os2: several warning fixes. mostly those "W007: '&array' may not produce intended result" warnings from Watcom, visible only in C++ mode. one or two others here & there.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384
diff --git a/src/audio/os2/SDL_os2audio.c b/src/audio/os2/SDL_os2audio.c
index 786deb1..9da0add 100644
--- a/src/audio/os2/SDL_os2audio.c
+++ b/src/audio/os2/SDL_os2audio.c
@@ -61,8 +61,8 @@ static int _MCIError(PSZ pszFunc, ULONG ulResult)
{
CHAR acBuf[128];
- mciGetErrorString( ulResult, (PCHAR)&acBuf, sizeof(acBuf) );
- return SDL_SetError( "[%s] %s", pszFunc, &acBuf );
+ mciGetErrorString( ulResult, acBuf, sizeof(acBuf) );
+ return SDL_SetError( "[%s] %s", pszFunc, acBuf );
}
static void _mixIOError(PSZ pszFunction, ULONG ulRC)
@@ -128,7 +128,7 @@ static void OS2_DetectDevices(void)
ULONG ulHandle = 0;
acBuf[0] = '\0';
- stMCISysInfo.pszReturn = &acBuf;
+ stMCISysInfo.pszReturn = acBuf;
stMCISysInfo.ulRetSize = sizeof(acBuf);
stMCISysInfo.usDeviceType = MCI_DEVTYPE_AUDIO_AMPMIX;
ulRC = mciSendCommand( 0, MCI_SYSINFO, MCI_WAIT | MCI_SYSINFO_QUANTITY,
@@ -145,7 +145,7 @@ static void OS2_DetectDevices(void)
stSysInfoParams.ulNumber++ )
{
// Get device install name.
- stSysInfoParams.pszReturn = &acBuf;
+ stSysInfoParams.pszReturn = acBuf;
stSysInfoParams.ulRetSize = sizeof( acBuf );
stSysInfoParams.usDeviceType = MCI_DEVTYPE_AUDIO_AMPMIX;
ulRC = mciSendCommand( 0, MCI_SYSINFO, MCI_WAIT | MCI_SYSINFO_INSTALLNAME,
@@ -159,7 +159,7 @@ static void OS2_DetectDevices(void)
// Get textual product description.
stSysInfoParams.ulItem = MCI_SYSINFO_QUERY_DRIVER;
stSysInfoParams.pSysInfoParm = &stLogDevice;
- strcpy( &stLogDevice.szInstallName, stSysInfoParams.pszReturn );
+ strcpy( stLogDevice.szInstallName, stSysInfoParams.pszReturn );
ulRC = mciSendCommand( 0, MCI_SYSINFO, MCI_WAIT | MCI_SYSINFO_ITEM,
&stSysInfoParams, 0 );
if ( ulRC != NO_ERROR )
@@ -169,9 +169,9 @@ static void OS2_DetectDevices(void)
}
ulHandle++;
- SDL_AddAudioDevice( 0, &stLogDevice.szProductInfo, (void *)(ulHandle) );
+ SDL_AddAudioDevice( 0, stLogDevice.szProductInfo, (void *)(ulHandle) );
ulHandle++;
- SDL_AddAudioDevice( 1, &stLogDevice.szProductInfo, (void *)(ulHandle) );
+ SDL_AddAudioDevice( 1, stLogDevice.szProductInfo, (void *)(ulHandle) );
}
}
@@ -226,11 +226,9 @@ static void OS2_CloseDevice(_THIS)
return;
/* Close up audio */
-
if ( pAData->usDeviceId != (USHORT)~0 )
{
// Device is open.
-
if ( pAData->stMCIMixSetup.ulBitsPerSample != 0 )
{
// Mixer was initialized.
diff --git a/src/core/os2/geniconv/geniconv.c b/src/core/os2/geniconv/geniconv.c
index 8ce7046..a86e3de 100644
--- a/src/core/os2/geniconv/geniconv.c
+++ b/src/core/os2/geniconv/geniconv.c
@@ -47,7 +47,7 @@ static BOOL _loadDLL(PSZ pszName, PSZ pszIconvOpen, PSZ pszIconv,
ULONG ulRC;
CHAR acError[256];
- ulRC = DosLoadModule( &acError, sizeof(acError), pszName, &hmIconv );
+ ulRC = DosLoadModule( acError, sizeof(acError), pszName, &hmIconv );
if ( ulRC != NO_ERROR )
{
debug( "DLL not loaded: %s", &acError );
diff --git a/src/core/os2/geniconv/os2cp.c b/src/core/os2/geniconv/os2cp.c
index 2e356a2..dfddf80 100644
--- a/src/core/os2/geniconv/os2cp.c
+++ b/src/core/os2/geniconv/os2cp.c
@@ -288,7 +288,7 @@ char * os2cpToName(unsigned long cp)
ULONG aulCP[3];
ULONG cCP;
- if ( DosQueryCp( sizeof(aulCP), &aulCP, &cCP ) != NO_ERROR )
+ if ( DosQueryCp( sizeof(aulCP), aulCP, &cCP ) != NO_ERROR )
return NULL;
cp = aulCP[0];
@@ -336,7 +336,7 @@ unsigned long os2cpFromName(char *cp)
ULONG aulCP[3];
ULONG cCP;
- return DosQueryCp( sizeof(aulCP), &aulCP, &cCP ) != NO_ERROR ? 0 : aulCP[0];
+ return DosQueryCp( sizeof(aulCP), aulCP, &cCP ) != NO_ERROR ? 0 : aulCP[0];
}
while( isspace( *cp ) ) cp++;
@@ -348,17 +348,17 @@ unsigned long os2cpFromName(char *cp)
if ( ulNext >= sizeof(acBuf) )
return 0;
- memcpy( &acBuf, cp, ulNext );
+ memcpy( acBuf, cp, ulNext );
acBuf[ulNext] = '\0';
- strupr( &acBuf );
+ strupr( acBuf );
- lCmp = strcmp( aName2CP[0].pszName, &acBuf );
+ lCmp = strcmp( aName2CP[0].pszName, acBuf );
if ( lCmp > 0 )
return 0;
else if ( lCmp == 0 )
return aName2CP[0].ulCode;
- lCmp = strcmp( aName2CP[ulHi].pszName, &acBuf );
+ lCmp = strcmp( aName2CP[ulHi].pszName, acBuf );
if ( lCmp < 0 )
return 0;
else if ( lCmp == 0 )
@@ -368,7 +368,7 @@ unsigned long os2cpFromName(char *cp)
{
ulNext = ( ulLo + ulHi ) / 2;
- lCmp = strcmp( aName2CP[ulNext].pszName, &acBuf );
+ lCmp = strcmp( aName2CP[ulNext].pszName, acBuf );
if ( lCmp < 0 )
ulLo = ulNext;
else if ( lCmp > 0 )
diff --git a/src/core/os2/geniconv/os2iconv.c b/src/core/os2/geniconv/os2iconv.c
index 9e54f66..d550bd4 100644
--- a/src/core/os2/geniconv/os2iconv.c
+++ b/src/core/os2/geniconv/os2iconv.c
@@ -49,7 +49,7 @@ static int _createUconvObj(const char *code, UconvObject *uobj)
}
}
- return UniCreateUconvObject( &uc_code, uobj );
+ return UniCreateUconvObject( uc_code, uobj );
}
static int uconv_open(const char *code, UconvObject *uobj)
@@ -68,8 +68,8 @@ static int uconv_open(const char *code, UconvObject *uobj)
unsigned long cp = os2cpFromName( (char *)code );
char cp_name[16];
- if ( cp != 0 && _snprintf( &cp_name, sizeof(cp_name), "IBM-%u", cp ) > 0 )
- rc = _createUconvObj( &cp_name, uobj );
+ if ( cp != 0 && _snprintf( cp_name, sizeof(cp_name), "IBM-%u", cp ) > 0 )
+ rc = _createUconvObj( cp_name, uobj );
}
return rc;
diff --git a/src/filesystem/os2/SDL_sysfilesystem.c b/src/filesystem/os2/SDL_sysfilesystem.c
index 2420ae2..7fd09c0 100644
--- a/src/filesystem/os2/SDL_sysfilesystem.c
+++ b/src/filesystem/os2/SDL_sysfilesystem.c
@@ -64,7 +64,7 @@ SDL_GetBasePath(void)
}
cbResult = pcEnd - pib->pib_pchcmd;
- SDL_memcpy( &acBuf, pib->pib_pchcmd, cbResult );
+ SDL_memcpy( acBuf, pib->pib_pchcmd, cbResult );
acBuf[cbResult] = '\0';
return OS2_SysToUTF8( acBuf );
@@ -91,12 +91,12 @@ SDL_GetPrefPath(const char *org, const char *app)
return NULL;
}
- lPosApp = SDL_snprintf( &acBuf, sizeof(acBuf) - 1, "%s\\%s", pszPath, pszOrg );
+ lPosApp = SDL_snprintf( acBuf, sizeof(acBuf) - 1, "%s\\%s", pszPath, pszOrg );
SDL_free( pszOrg );
if ( lPosApp == -1 )
return NULL;
- mkdir( &acBuf );
+ mkdir( acBuf );
pszApp = OS2_UTF8ToSys( app );
if ( pszApp == NULL )
@@ -110,11 +110,11 @@ SDL_GetPrefPath(const char *org, const char *app)
SDL_free( pszApp );
if ( lPosOrg == -1 )
return NULL;
-
- mkdir( &acBuf );
+
+ mkdir( acBuf );
*((PUSHORT)&acBuf[lPosApp + lPosOrg]) = (USHORT)'\0\\';
- return OS2_SysToUTF8( &acBuf );
+ return OS2_SysToUTF8( acBuf );
}
#endif /* SDL_FILESYSTEM_OS2 */
diff --git a/src/loadso/os2/SDL_sysloadso.c b/src/loadso/os2/SDL_sysloadso.c
index 2667712..85987df 100644
--- a/src/loadso/os2/SDL_sysloadso.c
+++ b/src/loadso/os2/SDL_sysloadso.c
@@ -40,10 +40,9 @@ SDL_LoadObject(const char *sofile)
PSZ pszModName = OS2_UTF8ToSys( sofile );
CHAR acError[256];
- ulRC = DosLoadModule( &acError, sizeof(acError), pszModName, &hModule );
- SDL_free( pszModName );
- if ( ulRC != NO_ERROR )
- {
+ ulRC = DosLoadModule(acError, sizeof(acError), pszModName, &hModule);
+ SDL_free(pszModName);
+ if (ulRC != NO_ERROR) {
SDL_SetError( "Failed loading %s (E%u)", acError, ulRC );
return NULL;
}
@@ -57,9 +56,8 @@ SDL_LoadFunction(void *handle, const char *name)
ULONG ulRC;
PFN pFN;
- ulRC = DosQueryProcAddr( (HMODULE)handle, 0, name, &pFN );
- if ( ulRC != NO_ERROR )
- {
+ ulRC = DosQueryProcAddr((HMODULE)handle, 0, name, &pFN);
+ if (ulRC != NO_ERROR) {
SDL_SetError( "Failed loading procedure %s (E%u)", name, ulRC );
return NULL;
}
@@ -70,7 +68,7 @@ SDL_LoadFunction(void *handle, const char *name)
void
SDL_UnloadObject(void *handle)
{
- if ( handle != NULL )
+ if (handle != NULL)
DosFreeModule( (HMODULE)handle );
}
diff --git a/src/video/os2/SDL_os2dive.c b/src/video/os2/SDL_os2dive.c
index d4f4982..a52f94e 100644
--- a/src/video/os2/SDL_os2dive.c
+++ b/src/video/os2/SDL_os2dive.c
@@ -72,7 +72,7 @@ static BOOL voQueryInfo(PVIDEOOUTPUTINFO pInfo)
// Query information about display hardware from DIVE.
- sDiveCaps.pFormatData = &fccFormats;
+ sDiveCaps.pFormatData = fccFormats;
sDiveCaps.ulFormatLength = 100;
sDiveCaps.ulStructLen = sizeof(DIVE_CAPS);
diff --git a/src/video/os2/SDL_os2messagebox.c b/src/video/os2/SDL_os2messagebox.c
index 9361199..3882a6c 100644
--- a/src/video/os2/SDL_os2messagebox.c
+++ b/src/video/os2/SDL_os2messagebox.c
@@ -68,10 +68,10 @@ static VOID _wmInitDlg(HWND hwnd, PMSGBOXDLGDATA pDlgData)
while( ( hWndNext = WinGetNextWindow( hEnum ) ) != NULLHANDLE )
{
- if ( WinQueryClassName( hWndNext, sizeof(acBuf), &acBuf ) == 0 )
+ if ( WinQueryClassName( hWndNext, sizeof(acBuf), acBuf ) == 0 )
continue;
- if ( strcmp( &acBuf, "#3" ) == 0 ) // Class name of button.
+ if ( strcmp( acBuf, "#3" ) == 0 ) // Class name of button.
{
if ( cButtons < sizeof(aButtons) / sizeof(struct _BUTTON) )
{
@@ -91,8 +91,8 @@ static VOID _wmInitDlg(HWND hwnd, PMSGBOXDLGDATA pDlgData)
for( ulIdx = 0; ulIdx < cButtons; ulIdx++ )
{
// Query size of text in window coordinates.
- cbBuf = WinQueryWindowText( aButtons[ulIdx].hwnd, sizeof(acBuf), &acBuf );
- GpiQueryTextBox( hps, cbBuf, acBuf, TXTBOX_COUNT, &aptText );
+ cbBuf = WinQueryWindowText( aButtons[ulIdx].hwnd, sizeof(acBuf), acBuf );
+ GpiQueryTextBox( hps, cbBuf, acBuf, TXTBOX_COUNT, aptText );
aptText[TXTBOX_TOPRIGHT].x -= aptText[TXTBOX_BOTTOMLEFT].x;
aptText[TXTBOX_TOPRIGHT].y -= aptText[TXTBOX_BOTTOMLEFT].y;
// Convert text size to dialog coordinates.
@@ -154,7 +154,7 @@ static VOID _wmInitDlg(HWND hwnd, PMSGBOXDLGDATA pDlgData)
aptText[1].x = aButtons[ulIdx].ulCX;
aptText[1].y = ulButtonsCY;
// Convert to window coordinates.
- WinMapDlgPoints( hwnd, &aptText, 2, TRUE );
+ WinMapDlgPoints( hwnd, aptText, 2, TRUE );
WinSetWindowPos( aButtons[ulIdx].hwnd, HWND_TOP,
aptText[0].x, aptText[0].y, aptText[1].x, aptText[1].y,
@@ -229,10 +229,8 @@ static HWND _makeDlg(const SDL_MessageBoxData *messageboxdata)
PSZ pszBtnText;
ULONG cbBtnText;
HWND hwnd;
- SDL_MessageBoxColor *pSDLColors = messageboxdata->colorScheme == NULL
- ? NULL
- : (SDL_MessageBoxColor *)&messageboxdata->colorScheme->colors;
- SDL_MessageBoxColor *pSDLColor;
+ const SDL_MessageBoxColor *pSDLColors = (messageboxdata->colorScheme == NULL)? NULL : messageboxdata->colorScheme->colors;
+ const SDL_MessageBoxColor *pSDLColor;
MSGBOXDLGDATA stDlgData;
/* Build a dialog tamplate in memory */
@@ -256,7 +254,7 @@ static HWND _makeDlg(const SDL_MessageBoxData *messageboxdata)
( 48 * cSDLBtnData ); /* PP for buttons. */
// Allocate memory for the dialog template.
- pTemplate = SDL_malloc( cbTemplate );
+ pTemplate = (PDLGTEMPLATE) SDL_malloc( cbTemplate );
// Pointer on data for dialog items in allocated memory.
pcDlgData = &((PCHAR)pTemplate)[ sizeof(DLGTEMPLATE) +
( (2 + cSDLBtnData) * sizeof(DLGTITEM) ) ];
@@ -276,7 +274,7 @@ static HWND _makeDlg(const SDL_MessageBoxData *messageboxdata)
/* First item info - frame */
- pDlgItem = &pTemplate->adlgti;
+ pDlgItem = pTemplate->adlgti;
pDlgItem->fsItemStatus = 0; /* Reserved? */
/* Number of dialog item child windows owned by this item. */
pDlgItem->cChildren = 2 + cSDLBtnData; // Ststic text + buttons.
diff --git a/src/video/os2/SDL_os2video.c b/src/video/os2/SDL_os2video.c
index c6f5b7a..902f792 100644
--- a/src/video/os2/SDL_os2video.c
+++ b/src/video/os2/SDL_os2video.c
@@ -330,9 +330,9 @@ static VOID _wmChar(PWINDATA pWinData, MPARAM mp1, MPARAM mp2)
if ( (ulFlags & KC_CHAR) != 0 )
{
CHAR acUTF8[4];
- LONG lRC = StrUTF8( 1, &acUTF8, sizeof(acUTF8), (PSZ)&ulCharCode, 1 );
+ LONG lRC = StrUTF8( 1, acUTF8, sizeof(acUTF8), (PSZ)&ulCharCode, 1 );
- SDL_SendKeyboardText( lRC > 0 ? &acUTF8 : (PSZ)&ulCharCode );
+ SDL_SendKeyboardText( lRC > 0 ? acUTF8 : (PSZ)&ulCharCode );
}
}
@@ -421,13 +421,13 @@ static MRESULT _wmDrop(PWINDATA pWinData, PDRAGINFO pDragInfo)
{
// Get file name from the item.
DrgQueryStrName( pDragItem->hstrContainerName,
- sizeof(acFName), &acFName );
- pcFName = strchr( &acFName, '\0' );
+ sizeof(acFName), acFName );
+ pcFName = strchr( acFName, '\0' );
DrgQueryStrName( pDragItem->hstrSourceName,
- sizeof(acFName) - (pcFName - &acFName), pcFName );
+ sizeof(acFName) - (pcFName - acFName), pcFName );
// Send to SDL full file name converted to UTF-8.
- pcFName = OS2_SysToUTF8( &acFName );
+ pcFName = OS2_SysToUTF8( acFName );
SDL_SendDropFile( pcFName );
SDL_free( pcFName );
@@ -852,7 +852,7 @@ static int OS2_CreateWindowFrom(_THIS, SDL_Window *window, const void *data)
// Get client and frame window handles.
WinQueryClassName( hwndUser, sizeof(acBuf), acBuf );
- if ( !WinQueryClassInfo( pVData->hab, &acBuf, &stCI ) )
+ if ( !WinQueryClassInfo( pVData->hab, acBuf, &stCI ) )
return SDL_SetError( "Cannot get user window class information" );
if ( (stCI.flClassStyle & CS_FRAME) == 0 )
@@ -879,7 +879,7 @@ static int OS2_CreateWindowFrom(_THIS, SDL_Window *window, const void *data)
hwndFrame = hwndUser;
WinQueryClassName( hwnd, sizeof(acBuf), acBuf );
- if ( !WinQueryClassInfo( pVData->hab, &acBuf, &stCI ) )
+ if ( !WinQueryClassInfo( pVData->hab, acBuf, &stCI ) )
return SDL_SetError( "Cannot get client window class information" );
}
diff --git a/src/video/os2/SDL_os2vman.c b/src/video/os2/SDL_os2vman.c
index fe1952d..5ad8bb1 100644
--- a/src/video/os2/SDL_os2vman.c
+++ b/src/video/os2/SDL_os2vman.c
@@ -103,7 +103,7 @@ static BOOL _vmanInit()
return TRUE;
// Load vman.dll
- ulRC = DosLoadModule( &acBuf, sizeof(acBuf), "VMAN", &hmodVMan );
+ ulRC = DosLoadModule( acBuf, sizeof(acBuf), "VMAN", &hmodVMan );
if ( ulRC != NO_ERROR )
{
debug( "Could not load VMAN.DLL, rc = %u : %s", ulRC, &acBuf );