mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-27 09:58:45 +01:00
swprintf->_snwprintf to make newer cegcc happy
This commit is contained in:
parent
cf5a10084e
commit
d279664b00
1 changed files with 11 additions and 9 deletions
|
@ -49,22 +49,21 @@ ceFileExists( CEAppGlobals* globals, const wchar_t* name )
|
||||||
XP_U16 len;
|
XP_U16 len;
|
||||||
|
|
||||||
len = ceGetPath( globals, DEFAULT_DIR_PATH_L, buf, VSIZE(buf) );
|
len = ceGetPath( globals, DEFAULT_DIR_PATH_L, buf, VSIZE(buf) );
|
||||||
swprintf( &buf[len], L"%s.xwg", name );
|
_snwprintf( &buf[len], VSIZE(buf)-len, L"%s.xwg", name );
|
||||||
|
|
||||||
attributes = GetFileAttributes( buf );
|
attributes = GetFileAttributes( buf );
|
||||||
return attributes != 0xFFFFFFFF;
|
return attributes != 0xFFFFFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
makeUniqueName( CEAppGlobals* globals, wchar_t* buf,
|
makeUniqueName( CEAppGlobals* globals, wchar_t* buf, XP_U16 bufLen )
|
||||||
XP_U16 XP_UNUSED_DBG(bufLen) )
|
|
||||||
{
|
{
|
||||||
XP_U16 ii;
|
XP_U16 ii;
|
||||||
for ( ii = 1; ii < 100; ++ii ) {
|
for ( ii = 1; ii < 100; ++ii ) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
int len =
|
int len =
|
||||||
#endif
|
#endif
|
||||||
swprintf( buf, L"Untitled%d", ii );
|
_snwprintf( buf, bufLen, L"Untitled%d", ii );
|
||||||
XP_ASSERT( len < bufLen );
|
XP_ASSERT( len < bufLen );
|
||||||
if ( !ceFileExists( globals, buf ) ) {
|
if ( !ceFileExists( globals, buf ) ) {
|
||||||
break;
|
break;
|
||||||
|
@ -120,16 +119,18 @@ SaveNameDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
|
||||||
VSIZE(buf) );
|
VSIZE(buf) );
|
||||||
if ( ceFileExists( globals, buf ) ) {
|
if ( ceFileExists( globals, buf ) ) {
|
||||||
wchar_t widebuf[128];
|
wchar_t widebuf[128];
|
||||||
snwprintf( widebuf, VSIZE(widebuf),
|
_snwprintf( widebuf, VSIZE(widebuf),
|
||||||
L"File \"%s\" already exists.", buf );
|
L"File \"%s\" already exists.", buf );
|
||||||
result = MessageBox( hDlg, widebuf, L"Oops!",
|
result = MessageBox( hDlg, widebuf, L"Oops!",
|
||||||
MB_OK | MB_ICONHAND );
|
MB_OK | MB_ICONHAND );
|
||||||
(void)SetDlgItemText( hDlg, IDC_SVGN_EDIT, state->buf );
|
(void)SetDlgItemText( hDlg, IDC_SVGN_EDIT,
|
||||||
|
state->buf );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
len = ceGetPath( globals, DEFAULT_DIR_PATH_L,
|
len = ceGetPath( globals, DEFAULT_DIR_PATH_L,
|
||||||
state->buf, state->buflen );
|
state->buf, state->buflen );
|
||||||
swprintf( &state->buf[len], L"%s.xwg", buf );
|
_snwprintf( &state->buf[len], state->buflen - len,
|
||||||
|
L"%s.xwg", buf );
|
||||||
XP_LOGW( __func__, state->buf );
|
XP_LOGW( __func__, state->buf );
|
||||||
/* fallthru */
|
/* fallthru */
|
||||||
state->cancelled = XP_FALSE;
|
state->cancelled = XP_FALSE;
|
||||||
|
@ -315,7 +316,7 @@ renameSelected( CeSavedGamesState* state )
|
||||||
calling code handle it. If we're renaming any other game, we can
|
calling code handle it. If we're renaming any other game, we can
|
||||||
do it here. */
|
do it here. */
|
||||||
if ( state->openGameIndex == state->sel ) {
|
if ( state->openGameIndex == state->sel ) {
|
||||||
swprintf( state->buf, L"%s", newPath );
|
_snwprintf( state->buf, state->buflen, L"%s", newPath );
|
||||||
state->result = CE_SVGAME_RENAME;
|
state->result = CE_SVGAME_RENAME;
|
||||||
} else {
|
} else {
|
||||||
wchar_t curPath[MAX_PATH];
|
wchar_t curPath[MAX_PATH];
|
||||||
|
@ -447,7 +448,8 @@ SavedGamesDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
|
||||||
len = ceGetPath( state->dlgHdr.globals,
|
len = ceGetPath( state->dlgHdr.globals,
|
||||||
DEFAULT_DIR_PATH_L, state->buf,
|
DEFAULT_DIR_PATH_L, state->buf,
|
||||||
state->buflen );
|
state->buflen );
|
||||||
swprintf( &state->buf[len], L"%s.xwg", buf );
|
_snwprintf( &state->buf[len], state->buflen - len,
|
||||||
|
L"%s.xwg", buf );
|
||||||
XP_LOGW( "returning", state->buf );
|
XP_LOGW( "returning", state->buf );
|
||||||
state->result = CE_SVGAME_OPEN;
|
state->result = CE_SVGAME_OPEN;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue