'sizeof type' is best avoided as it won't always compile (e.g. 'int

main() {return sizeof int;}'). Use 'sizeof(type)' instead.
This commit is contained in:
Francois Gouget 2003-06-18 19:45:22 +00:00 committed by Alexandre Julliard
parent b14137c2c2
commit 9591836ffb
32 changed files with 131 additions and 131 deletions

View File

@ -797,7 +797,7 @@ DWORD WINAPI RegDeleteKeyW( HKEY hkey, LPCWSTR name )
{ {
WCHAR name[MAX_PATH]; WCHAR name[MAX_PATH];
while(!RegEnumKeyW(tmp, 0, name, sizeof name)) while(!RegEnumKeyW(tmp, 0, name, sizeof(name)))
{ {
if(RegDeleteKeyW(tmp, name)) /* recurse */ if(RegDeleteKeyW(tmp, name)) /* recurse */
break; break;
@ -831,7 +831,7 @@ DWORD WINAPI RegDeleteKeyA( HKEY hkey, LPCSTR name )
{ {
CHAR name[MAX_PATH]; CHAR name[MAX_PATH];
while(!RegEnumKeyA(tmp, 0, name, sizeof name)) while(!RegEnumKeyA(tmp, 0, name, sizeof(name)))
{ {
if(RegDeleteKeyA(tmp, name)) /* recurse */ if(RegDeleteKeyA(tmp, name)) /* recurse */
break; break;

View File

@ -624,11 +624,11 @@ StartServiceW( SC_HANDLE hService, DWORD dwNumServiceArgs,
TRACE("(%p,%ld,%p)\n",hService,dwNumServiceArgs, TRACE("(%p,%ld,%p)\n",hService,dwNumServiceArgs,
lpServiceArgVectors); lpServiceArgVectors);
size = sizeof str; size = sizeof(str);
r = RegQueryValueExW(hService, _ImagePathW, NULL, &type, (LPVOID)str, &size); r = RegQueryValueExW(hService, _ImagePathW, NULL, &type, (LPVOID)str, &size);
if (r!=ERROR_SUCCESS) if (r!=ERROR_SUCCESS)
return FALSE; return FALSE;
ExpandEnvironmentStringsW(str,path,sizeof path); ExpandEnvironmentStringsW(str,path,sizeof(path));
TRACE("Starting service %s\n", debugstr_w(path) ); TRACE("Starting service %s\n", debugstr_w(path) );
@ -718,7 +718,7 @@ QueryServiceStatus( SC_HANDLE hService, LPSERVICE_STATUS lpservicestatus )
FIXME("(%p,%p) partial\n",hService,lpservicestatus); FIXME("(%p,%p) partial\n",hService,lpservicestatus);
/* read the service type from the registry */ /* read the service type from the registry */
size = sizeof val; size = sizeof(val);
r = RegQueryValueExA(hService, "Type", NULL, &type, (LPBYTE)&val, &size); r = RegQueryValueExA(hService, "Type", NULL, &type, (LPBYTE)&val, &size);
if(type!=REG_DWORD) if(type!=REG_DWORD)
{ {

View File

@ -955,7 +955,7 @@ static LPENUMGUID COMCAT_CATID_IEnumGUID_Construct(
WCHAR prefix[6] = { 'C', 'L', 'S', 'I', 'D', '\\' }; WCHAR prefix[6] = { 'C', 'L', 'S', 'I', 'D', '\\' };
This->lpVtbl = &COMCAT_CATID_IEnumGUID_Vtbl; This->lpVtbl = &COMCAT_CATID_IEnumGUID_Vtbl;
memcpy(This->keyname, prefix, sizeof prefix); memcpy(This->keyname, prefix, sizeof(prefix));
StringFromGUID2(rclsid, This->keyname + 6, 39); StringFromGUID2(rclsid, This->keyname + 6, 39);
lstrcpyW(This->keyname + 44, postfix); lstrcpyW(This->keyname + 44, postfix);
RegOpenKeyExW(HKEY_CLASSES_ROOT, This->keyname, 0, KEY_READ, &This->key); RegOpenKeyExW(HKEY_CLASSES_ROOT, This->keyname, 0, KEY_READ, &This->key);

View File

@ -370,7 +370,7 @@ static LONG recursive_delete_key(HKEY key)
HKEY subkey; HKEY subkey;
for (;;) { for (;;) {
cName = sizeof subkey_name / sizeof(WCHAR); cName = sizeof(subkey_name) / sizeof(WCHAR);
res = RegEnumKeyExW(key, 0, subkey_name, &cName, res = RegEnumKeyExW(key, 0, subkey_name, &cName,
NULL, NULL, NULL, NULL); NULL, NULL, NULL, NULL);
if (res != ERROR_SUCCESS && res != ERROR_MORE_DATA) { if (res != ERROR_SUCCESS && res != ERROR_MORE_DATA) {

View File

@ -2081,7 +2081,7 @@ DPA_QuickSort (LPVOID *lpPtrs, INT l, INT r,
if(pfnCompare(lpPtrs[l],lpPtrs[m+1],lParam)>0) if(pfnCompare(lpPtrs[l],lpPtrs[m+1],lParam)>0)
{ {
t = lpPtrs[m+1]; t = lpPtrs[m+1];
memmove(&lpPtrs[l+1],&lpPtrs[l],(m-l+1)*sizeof lpPtrs[l]); memmove(&lpPtrs[l+1],&lpPtrs[l],(m-l+1)*sizeof(lpPtrs[l]));
lpPtrs[l] = t; lpPtrs[l] = t;
m++; m++;

View File

@ -503,7 +503,7 @@ BOOL PROPSHEET_CollectPageInfo(LPCPROPSHEETPAGEW lppsp,
if ( !HIWORD( lppsp->pszTitle ) ) if ( !HIWORD( lppsp->pszTitle ) )
{ {
if (!LoadStringW( lppsp->hInstance, (UINT)lppsp->pszTitle,szTitle,sizeof szTitle )) if (!LoadStringW( lppsp->hInstance, (UINT)lppsp->pszTitle,szTitle,sizeof(szTitle) ))
{ {
pTitle = pszNull; pTitle = pszNull;
FIXME("Could not load resource #%04x?\n",LOWORD(lppsp->pszTitle)); FIXME("Could not load resource #%04x?\n",LOWORD(lppsp->pszTitle));
@ -1995,7 +1995,7 @@ static void PROPSHEET_SetTitleA(HWND hwndDlg, DWORD dwStyle, LPCSTR lpszText)
{ {
WCHAR szTitle[256]; WCHAR szTitle[256];
MultiByteToWideChar(CP_ACP, 0, lpszText, -1, MultiByteToWideChar(CP_ACP, 0, lpszText, -1,
szTitle, sizeof szTitle); szTitle, sizeof(szTitle));
PROPSHEET_SetTitleW(hwndDlg, dwStyle, szTitle); PROPSHEET_SetTitleW(hwndDlg, dwStyle, szTitle);
} }
else else

View File

@ -2091,7 +2091,7 @@ TOOLTIPS_SetFont (HWND hwnd, WPARAM wParam, LPARAM lParam)
TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd); TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
LOGFONTW lf; LOGFONTW lf;
if(!GetObjectW((HFONT)wParam, sizeof lf, &lf)) if(!GetObjectW((HFONT)wParam, sizeof(lf), &lf))
return 0; return 0;
if(infoPtr->hFont) DeleteObject (infoPtr->hFont); if(infoPtr->hFont) DeleteObject (infoPtr->hFont);

View File

@ -329,8 +329,8 @@ EnumDisplayModesCallbackThunk(LPDDSURFACEDESC2 pDDSD2, LPVOID context)
DDSURFACEDESC DDSD; DDSURFACEDESC DDSD;
struct displaymodescallback_context *cbcontext = context; struct displaymodescallback_context *cbcontext = context;
memcpy(&DDSD,pDDSD2,sizeof DDSD); memcpy(&DDSD,pDDSD2,sizeof(DDSD));
DDSD.dwSize = sizeof DDSD; DDSD.dwSize = sizeof(DDSD);
return cbcontext->func(&DDSD, cbcontext->context); return cbcontext->func(&DDSD, cbcontext->context);
} }

View File

@ -848,7 +848,7 @@ BOOL WINAPI WaitNamedPipeW (LPCWSTR name, DWORD nTimeOut)
TRACE("%s 0x%08lx\n",debugstr_w(name),nTimeOut); TRACE("%s 0x%08lx\n",debugstr_w(name),nTimeOut);
memset(&ov,0,sizeof ov); memset(&ov,0,sizeof(ov));
ov.hEvent = CreateEventA( NULL, 0, 0, NULL ); ov.hEvent = CreateEventA( NULL, 0, 0, NULL );
if (!ov.hEvent) if (!ov.hEvent)
return FALSE; return FALSE;
@ -917,7 +917,7 @@ BOOL WINAPI ConnectNamedPipe(HANDLE hPipe, LPOVERLAPPED overlapped)
return FALSE; return FALSE;
} }
memset(&ov,0,sizeof ov); memset(&ov,0,sizeof(ov));
ov.hEvent = CreateEventA(NULL,0,0,NULL); ov.hEvent = CreateEventA(NULL,0,0,NULL);
if (!ov.hEvent) if (!ov.hEvent)
return FALSE; return FALSE;

View File

@ -43,176 +43,176 @@ void test_message_from_string(void)
/* the basics */ /* the basics */
r = FormatMessageA(FORMAT_MESSAGE_FROM_STRING, "test", 0, r = FormatMessageA(FORMAT_MESSAGE_FROM_STRING, "test", 0,
0, out, sizeof out/sizeof (CHAR),NULL); 0, out, sizeof(out)/sizeof(CHAR),NULL);
ok(!strcmp("test", out),"failed out=[%s]",out); ok(!strcmp("test", out),"failed out=[%s]",out);
ok(r==4,"failed: r=%ld",r); ok(r==4,"failed: r=%ld",r);
/* using the format feature */ /* using the format feature */
r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!s!", 0, r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!s!", 0,
0, out, sizeof out/sizeof (CHAR), "test"); 0, out, sizeof(out)/sizeof(CHAR), "test");
ok(!strcmp("test", out),"failed out=[%s]",out); ok(!strcmp("test", out),"failed out=[%s]",out);
ok(r==4,"failed: r=%ld",r); ok(r==4,"failed: r=%ld",r);
/* no format */ /* no format */
r = doit(FORMAT_MESSAGE_FROM_STRING, "%1", 0, r = doit(FORMAT_MESSAGE_FROM_STRING, "%1", 0,
0, out, sizeof out/sizeof (CHAR), "test"); 0, out, sizeof(out)/sizeof(CHAR), "test");
ok(!strcmp("test", out),"failed out=[%s]",out); ok(!strcmp("test", out),"failed out=[%s]",out);
ok(r==4,"failed: r=%ld",r); ok(r==4,"failed: r=%ld",r);
/* two pieces */ /* two pieces */
r = doit(FORMAT_MESSAGE_FROM_STRING, "%1%2", 0, r = doit(FORMAT_MESSAGE_FROM_STRING, "%1%2", 0,
0, out, sizeof out/sizeof (CHAR), "te","st"); 0, out, sizeof(out)/sizeof(CHAR), "te","st");
ok(!strcmp("test", out),"failed out=[%s]",out); ok(!strcmp("test", out),"failed out=[%s]",out);
ok(r==4,"failed: r=%ld",r); ok(r==4,"failed: r=%ld",r);
/* three pieces */ /* three pieces */
r = doit(FORMAT_MESSAGE_FROM_STRING, "%1%3%2%1", 0, r = doit(FORMAT_MESSAGE_FROM_STRING, "%1%3%2%1", 0,
0, out, sizeof out/sizeof (CHAR), "t","s","e"); 0, out, sizeof(out)/sizeof(CHAR), "t","s","e");
ok(!strcmp("test", out),"failed out=[%s]",out); ok(!strcmp("test", out),"failed out=[%s]",out);
ok(r==4,"failed: r=%ld",r); ok(r==4,"failed: r=%ld",r);
/* s doesn't seem to work in format strings */ /* s doesn't seem to work in format strings */
r = doit(FORMAT_MESSAGE_FROM_STRING, "%!s!", 0, r = doit(FORMAT_MESSAGE_FROM_STRING, "%!s!", 0,
0, out, sizeof out/sizeof (CHAR), "test"); 0, out, sizeof(out)/sizeof(CHAR), "test");
ok(!strcmp("!s!", out),"failed out=[%s]",out); ok(!strcmp("!s!", out),"failed out=[%s]",out);
ok(r==3,"failed: r=%ld",r); ok(r==3,"failed: r=%ld",r);
/* S is unicode */ /* S is unicode */
r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!S!", 0, r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!S!", 0,
0, out, sizeof out/sizeof (CHAR), szwTest); 0, out, sizeof(out)/sizeof(CHAR), szwTest);
ok(!strcmp("test", out),"failed out=[%s]",out); ok(!strcmp("test", out),"failed out=[%s]",out);
ok(r==4,"failed: r=%ld",r); ok(r==4,"failed: r=%ld",r);
/* as characters */ /* as characters */
r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!c!%2!c!%3!c!%1!c!", 0, r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!c!%2!c!%3!c!%1!c!", 0,
0, out, sizeof out/sizeof (CHAR), 't','e','s'); 0, out, sizeof(out)/sizeof(CHAR), 't','e','s');
ok(!strcmp("test", out),"failed out=[%s]",out); ok(!strcmp("test", out),"failed out=[%s]",out);
ok(r==4,"failed: r=%ld",r); ok(r==4,"failed: r=%ld",r);
/* some numbers */ /* some numbers */
r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!d!%2!d!%3!d!", 0, r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!d!%2!d!%3!d!", 0,
0, out, sizeof out/sizeof (CHAR), 1,2,3); 0, out, sizeof(out)/sizeof(CHAR), 1,2,3);
ok(!strcmp("123", out),"failed out=[%s]",out); ok(!strcmp("123", out),"failed out=[%s]",out);
ok(r==3,"failed: r=%ld",r); ok(r==3,"failed: r=%ld",r);
/* a single digit with some spacing */ /* a single digit with some spacing */
r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!4d!", 0, r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!4d!", 0,
0, out, sizeof out/sizeof (CHAR), 1); 0, out, sizeof(out)/sizeof(CHAR), 1);
ok(!strcmp(" 1", out),"failed out=[%s]",out); ok(!strcmp(" 1", out),"failed out=[%s]",out);
ok(r==4,"failed: r=%ld",r); ok(r==4,"failed: r=%ld",r);
/* a single digit, left justified */ /* a single digit, left justified */
r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!-4d!", 0, r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!-4d!", 0,
0, out, sizeof out/sizeof (CHAR), 1); 0, out, sizeof(out)/sizeof(CHAR), 1);
ok(!strcmp("1 ", out),"failed out=[%s]",out); ok(!strcmp("1 ", out),"failed out=[%s]",out);
ok(r==4,"failed: r=%ld",r); ok(r==4,"failed: r=%ld",r);
/* two digit decimal number */ /* two digit decimal number */
r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!4d!", 0, r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!4d!", 0,
0, out, sizeof out/sizeof (CHAR), 11); 0, out, sizeof(out)/sizeof(CHAR), 11);
ok(!strcmp(" 11", out),"failed out=[%s]",out); ok(!strcmp(" 11", out),"failed out=[%s]",out);
ok(r==4,"failed: r=%ld",r); ok(r==4,"failed: r=%ld",r);
/* a hex number */ /* a hex number */
r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!4x!", 0, r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!4x!", 0,
0, out, sizeof out/sizeof (CHAR), 11); 0, out, sizeof(out)/sizeof(CHAR), 11);
ok(!strcmp(" b", out),"failed out=[%s]",out); ok(!strcmp(" b", out),"failed out=[%s]",out);
ok(r==4,"failed: r=%ld",r); ok(r==4,"failed: r=%ld",r);
/* a hex number, upper case */ /* a hex number, upper case */
r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!4X!", 0, r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!4X!", 0,
0, out, sizeof out/sizeof (CHAR), 11); 0, out, sizeof(out)/sizeof(CHAR), 11);
ok(!strcmp(" B", out),"failed out=[%s]",out); ok(!strcmp(" B", out),"failed out=[%s]",out);
ok(r==4,"failed: r=%ld",r); ok(r==4,"failed: r=%ld",r);
/* a hex number, upper case, left justified */ /* a hex number, upper case, left justified */
r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!-4X!", 0, r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!-4X!", 0,
0, out, sizeof out/sizeof (CHAR), 11); 0, out, sizeof(out)/sizeof(CHAR), 11);
ok(!strcmp("B ", out),"failed out=[%s]",out); ok(!strcmp("B ", out),"failed out=[%s]",out);
ok(r==4,"failed: r=%ld",r); ok(r==4,"failed: r=%ld",r);
/* a long hex number, upper case */ /* a long hex number, upper case */
r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!4X!", 0, r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!4X!", 0,
0, out, sizeof out/sizeof (CHAR), 0x1ab); 0, out, sizeof(out)/sizeof(CHAR), 0x1ab);
ok(!strcmp(" 1AB", out),"failed out=[%s]",out); ok(!strcmp(" 1AB", out),"failed out=[%s]",out);
ok(r==4,"failed: r=%ld",r); ok(r==4,"failed: r=%ld",r);
/* two percent... */ /* two percent... */
r = doit(FORMAT_MESSAGE_FROM_STRING, " %%%% ", 0, r = doit(FORMAT_MESSAGE_FROM_STRING, " %%%% ", 0,
0, out, sizeof out/sizeof (CHAR)); 0, out, sizeof(out)/sizeof(CHAR));
ok(!strcmp(" %% ", out),"failed out=[%s]",out); ok(!strcmp(" %% ", out),"failed out=[%s]",out);
ok(r==4,"failed: r=%ld",r); ok(r==4,"failed: r=%ld",r);
/* periods are special cases */ /* periods are special cases */
r = doit(FORMAT_MESSAGE_FROM_STRING, " %.%. %1!d!", 0, r = doit(FORMAT_MESSAGE_FROM_STRING, " %.%. %1!d!", 0,
0, out, sizeof out/sizeof (CHAR), 0x1ab); 0, out, sizeof(out)/sizeof(CHAR), 0x1ab);
ok(!strcmp(" .. 427", out),"failed out=[%s]",out); ok(!strcmp(" .. 427", out),"failed out=[%s]",out);
ok(r==7,"failed: r=%ld",r); ok(r==7,"failed: r=%ld",r);
/* %0 ends the line */ /* %0 ends the line */
r = doit(FORMAT_MESSAGE_FROM_STRING, "test%0test", 0, r = doit(FORMAT_MESSAGE_FROM_STRING, "test%0test", 0,
0, out, sizeof out/sizeof (CHAR)); 0, out, sizeof(out)/sizeof(CHAR));
ok(!strcmp("test", out),"failed out=[%s]",out); ok(!strcmp("test", out),"failed out=[%s]",out);
ok(r==4,"failed: r=%ld",r); ok(r==4,"failed: r=%ld",r);
/* %! prints an exclaimation */ /* %! prints an exclaimation */
r = doit(FORMAT_MESSAGE_FROM_STRING, "yah%!%0 ", 0, r = doit(FORMAT_MESSAGE_FROM_STRING, "yah%!%0 ", 0,
0, out, sizeof out/sizeof (CHAR)); 0, out, sizeof(out)/sizeof(CHAR));
ok(!strcmp("yah!", out),"failed out=[%s]",out); ok(!strcmp("yah!", out),"failed out=[%s]",out);
ok(r==4,"failed: r=%ld",r); ok(r==4,"failed: r=%ld",r);
/* %space */ /* %space */
r = doit(FORMAT_MESSAGE_FROM_STRING, "% % ", 0, r = doit(FORMAT_MESSAGE_FROM_STRING, "% % ", 0,
0, out, sizeof out/sizeof (CHAR)); 0, out, sizeof(out)/sizeof(CHAR));
ok(!strcmp(" ", out),"failed out=[%s]",out); ok(!strcmp(" ", out),"failed out=[%s]",out);
ok(r==4,"failed: r=%ld",r); ok(r==4,"failed: r=%ld",r);
/* line feed */ /* line feed */
r = doit(FORMAT_MESSAGE_FROM_STRING, "hi\n", 0, r = doit(FORMAT_MESSAGE_FROM_STRING, "hi\n", 0,
0, out, sizeof out/sizeof (CHAR)); 0, out, sizeof(out)/sizeof(CHAR));
ok(!strcmp("hi\r\n", out),"failed out=[%s]",out); ok(!strcmp("hi\r\n", out),"failed out=[%s]",out);
ok(r==4,"failed: r=%ld",r); ok(r==4,"failed: r=%ld",r);
/* carriage return line feed */ /* carriage return line feed */
r = doit(FORMAT_MESSAGE_FROM_STRING, "hi\r\n", 0, r = doit(FORMAT_MESSAGE_FROM_STRING, "hi\r\n", 0,
0, out, sizeof out/sizeof (CHAR)); 0, out, sizeof(out)/sizeof(CHAR));
ok(!strcmp("hi\r\n", out),"failed out=[%s]",out); ok(!strcmp("hi\r\n", out),"failed out=[%s]",out);
ok(r==4,"failed: r=%ld",r); ok(r==4,"failed: r=%ld",r);
/* carriage return line feed */ /* carriage return line feed */
r = doit(FORMAT_MESSAGE_FROM_STRING, "\r", 0, r = doit(FORMAT_MESSAGE_FROM_STRING, "\r", 0,
0, out, sizeof out/sizeof (CHAR)); 0, out, sizeof(out)/sizeof(CHAR));
ok(!strcmp("\r\n", out),"failed out=[%s]",out); ok(!strcmp("\r\n", out),"failed out=[%s]",out);
ok(r==2,"failed: r=%ld",r); ok(r==2,"failed: r=%ld",r);
/* carriage return line feed */ /* carriage return line feed */
r = doit(FORMAT_MESSAGE_FROM_STRING, "\r\r\n", 0, r = doit(FORMAT_MESSAGE_FROM_STRING, "\r\r\n", 0,
0, out, sizeof out/sizeof (CHAR)); 0, out, sizeof(out)/sizeof(CHAR));
ok(!strcmp("\r\n\r\n", out),"failed out=[%s]",out); ok(!strcmp("\r\n\r\n", out),"failed out=[%s]",out);
ok(r==4,"failed: r=%ld",r); ok(r==4,"failed: r=%ld",r);
/* change of pace... test the low byte of dwflags */ /* change of pace... test the low byte of dwflags */
/* line feed */ /* line feed */
r = doit(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_MAX_WIDTH_MASK, "hi\n", 0, r = doit(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_MAX_WIDTH_MASK, "hi\n", 0,
0, out, sizeof out/sizeof (CHAR)); 0, out, sizeof(out)/sizeof(CHAR));
ok(!strcmp("hi ", out) || !strcmp("hi\r\n", out),"failed out=[%s]",out); ok(!strcmp("hi ", out) || !strcmp("hi\r\n", out),"failed out=[%s]",out);
ok(r==3 || r==4,"failed: r=%ld",r); ok(r==3 || r==4,"failed: r=%ld",r);
/* carriage return line feed */ /* carriage return line feed */
r = doit(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_MAX_WIDTH_MASK, "hi\r\n", 0, r = doit(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_MAX_WIDTH_MASK, "hi\r\n", 0,
0, out, sizeof out/sizeof (CHAR)); 0, out, sizeof(out)/sizeof(CHAR));
ok(!strcmp("hi ", out),"failed out=[%s]",out); ok(!strcmp("hi ", out),"failed out=[%s]",out);
ok(r==3,"failed: r=%ld",r); ok(r==3,"failed: r=%ld",r);
/* carriage return line feed */ /* carriage return line feed */
r = doit(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_MAX_WIDTH_MASK, "\r", 0, r = doit(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_MAX_WIDTH_MASK, "\r", 0,
0, out, sizeof out/sizeof (CHAR)); 0, out, sizeof(out)/sizeof(CHAR));
ok(!strcmp(" ", out),"failed out=[%s]",out); ok(!strcmp(" ", out),"failed out=[%s]",out);
ok(r==1,"failed: r=%ld",r); ok(r==1,"failed: r=%ld",r);
/* carriage return line feed */ /* carriage return line feed */
r = doit(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_MAX_WIDTH_MASK, "\r\r\n", 0, r = doit(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_MAX_WIDTH_MASK, "\r\r\n", 0,
0, out, sizeof out/sizeof (CHAR)); 0, out, sizeof(out)/sizeof(CHAR));
ok(!strcmp(" ", out),"failed out=[%s]",out); ok(!strcmp(" ", out),"failed out=[%s]",out);
ok(r==2,"failed: r=%ld",r); ok(r==2,"failed: r=%ld",r);
} }

View File

@ -217,8 +217,8 @@ NTSTATUS WINAPI NtReadFile (
FileHandle,EventHandle,ApcRoutine,ApcContext,IoStatusBlock,Buffer,Length,ByteOffset,Key); FileHandle,EventHandle,ApcRoutine,ApcContext,IoStatusBlock,Buffer,Length,ByteOffset,Key);
if (IsBadWritePtr( Buffer, Length ) || if (IsBadWritePtr( Buffer, Length ) ||
IsBadWritePtr( IoStatusBlock, sizeof *IoStatusBlock) || IsBadWritePtr( IoStatusBlock, sizeof(*IoStatusBlock)) ||
IsBadWritePtr( ByteOffset, sizeof *ByteOffset) ) IsBadWritePtr( ByteOffset, sizeof(*ByteOffset)) )
return STATUS_ACCESS_VIOLATION; return STATUS_ACCESS_VIOLATION;
IoStatusBlock->Information = 0; IoStatusBlock->Information = 0;

View File

@ -369,7 +369,7 @@ static LONG recursive_delete_key(HKEY key)
HKEY subkey; HKEY subkey;
for (;;) { for (;;) {
cName = sizeof subkey_name / sizeof(WCHAR); cName = sizeof(subkey_name) / sizeof(WCHAR);
res = RegEnumKeyExW(key, 0, subkey_name, &cName, res = RegEnumKeyExW(key, 0, subkey_name, &cName,
NULL, NULL, NULL, NULL); NULL, NULL, NULL, NULL);
if (res != ERROR_SUCCESS && res != ERROR_MORE_DATA) { if (res != ERROR_SUCCESS && res != ERROR_MORE_DATA) {

View File

@ -6553,7 +6553,7 @@ static HRESULT STREAM_WriteString( IStream *stm, LPCWSTR string )
if( string ) if( string )
len = WideCharToMultiByte( CP_ACP, 0, string, -1, NULL, 0, NULL, NULL); len = WideCharToMultiByte( CP_ACP, 0, string, -1, NULL, 0, NULL, NULL);
r = IStream_Write( stm, &len, sizeof len, NULL); r = IStream_Write( stm, &len, sizeof(len), NULL);
if( FAILED( r ) ) if( FAILED( r ) )
return r; return r;
if(len == 0) if(len == 0)
@ -6573,10 +6573,10 @@ static HRESULT STREAM_ReadString( IStream *stm, LPWSTR *string )
LPSTR str; LPSTR str;
LPWSTR wstr; LPWSTR wstr;
r = IStream_Read( stm, &len, sizeof len, &count ); r = IStream_Read( stm, &len, sizeof(len), &count );
if( FAILED( r ) ) if( FAILED( r ) )
return r; return r;
if( count != sizeof len ) if( count != sizeof(len) )
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
TRACE("%ld bytes\n",len); TRACE("%ld bytes\n",len);
@ -6633,7 +6633,7 @@ static HRESULT STORAGE_WriteCompObj( LPSTORAGE pstg, CLSID *clsid,
return r; return r;
/* Write CompObj Structure to stream */ /* Write CompObj Structure to stream */
r = IStream_Write(pstm, unknown1, sizeof unknown1, NULL); r = IStream_Write(pstm, unknown1, sizeof(unknown1), NULL);
if( SUCCEEDED( r ) ) if( SUCCEEDED( r ) )
r = WriteClassStm( pstm, clsid ); r = WriteClassStm( pstm, clsid );
@ -6645,7 +6645,7 @@ static HRESULT STORAGE_WriteCompObj( LPSTORAGE pstg, CLSID *clsid,
if( SUCCEEDED( r ) ) if( SUCCEEDED( r ) )
r = STREAM_WriteString( pstm, szProgIDName ); r = STREAM_WriteString( pstm, szProgIDName );
if( SUCCEEDED( r ) ) if( SUCCEEDED( r ) )
r = IStream_Write(pstm, unknown2, sizeof unknown2, NULL); r = IStream_Write(pstm, unknown2, sizeof(unknown2), NULL);
IStream_Release( pstm ); IStream_Release( pstm );
@ -6675,7 +6675,7 @@ static HRESULT CLSIDFromUserType(LPCWSTR lpszUserType, CLSID *clsid)
for(i=0; !found; i++ ) for(i=0; !found; i++ )
{ {
r = RegEnumKeyW( hkeyclsid, i, szKey, sizeof szKey/sizeof(WCHAR)); r = RegEnumKeyW( hkeyclsid, i, szKey, sizeof(szKey)/sizeof(WCHAR));
if( r != ERROR_SUCCESS ) if( r != ERROR_SUCCESS )
break; break;
hkey = 0; hkey = 0;
@ -6727,7 +6727,7 @@ HRESULT WINAPI WriteFmtUserTypeStg(
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
/* get the clipboard format name */ /* get the clipboard format name */
n = GetClipboardFormatNameW( cf, szwClipName, sizeof szwClipName ); n = GetClipboardFormatNameW( cf, szwClipName, sizeof(szwClipName) );
szwClipName[n]=0; szwClipName[n]=0;
TRACE("Clipboard name is %s\n", debugstr_w(szwClipName)); TRACE("Clipboard name is %s\n", debugstr_w(szwClipName));
@ -6785,8 +6785,8 @@ HRESULT WINAPI ReadFmtUserTypeStg (LPSTORAGE pstg, CLIPFORMAT* pcf, LPOLESTR* lp
} }
/* read the various parts of the structure */ /* read the various parts of the structure */
r = IStream_Read( stm, unknown1, sizeof unknown1, &count ); r = IStream_Read( stm, unknown1, sizeof(unknown1), &count );
if( FAILED( r ) || ( count != sizeof unknown1 ) ) if( FAILED( r ) || ( count != sizeof(unknown1) ) )
goto end; goto end;
r = ReadClassStm( stm, &clsid ); r = ReadClassStm( stm, &clsid );
if( FAILED( r ) ) if( FAILED( r ) )
@ -6804,8 +6804,8 @@ HRESULT WINAPI ReadFmtUserTypeStg (LPSTORAGE pstg, CLIPFORMAT* pcf, LPOLESTR* lp
if( FAILED( r ) ) if( FAILED( r ) )
goto end; goto end;
r = IStream_Read( stm, unknown2, sizeof unknown2, &count ); r = IStream_Read( stm, unknown2, sizeof(unknown2), &count );
if( FAILED( r ) || ( count != sizeof unknown2 ) ) if( FAILED( r ) || ( count != sizeof(unknown2) ) )
goto end; goto end;
/* ok, success... now we just need to store what we found */ /* ok, success... now we just need to store what we found */

View File

@ -260,7 +260,7 @@ static datetkn datetktbl[] = {
{ZULU, RESERV, DTK_ZULU}, /* 00:00:00 */ {ZULU, RESERV, DTK_ZULU}, /* 00:00:00 */
}; };
static unsigned int szdatetktbl = sizeof datetktbl / sizeof datetktbl[0]; static unsigned int szdatetktbl = sizeof(datetktbl) / sizeof(datetktbl[0]);

View File

@ -176,7 +176,7 @@ static BOOL SERIALUI_GetConfItems(HWND hDlg, DWORD id, LPCPARAM2STR table, LPDWO
return FALSE; return FALSE;
} }
if(!GetWindowTextA(hControl, &lpEntry[0], sizeof lpEntry)) if(!GetWindowTextA(hControl, &lpEntry[0], sizeof(lpEntry)))
{ {
TRACE("Couldn't get window text for item %lx\n",id); TRACE("Couldn't get window text for item %lx\n",id);
return FALSE; return FALSE;
@ -349,7 +349,7 @@ INT_PTR CALLBACK SERIALUI_ConfigDialogProc(HWND hWnd, UINT uMsg, WPARAM wParam,
if(!info) if(!info)
return FALSE; return FALSE;
SetWindowLongA(hWnd, DWL_USER, lParam); SetWindowLongA(hWnd, DWL_USER, lParam);
snprintf(szTitle, sizeof szTitle, "Settings for %s", info->lpszDevice); snprintf(szTitle, sizeof(szTitle), "Settings for %s", info->lpszDevice);
SetWindowTextA(hWnd, szTitle); SetWindowTextA(hWnd, szTitle);
SERIALUI_DCBToDialogInfo(hWnd, info); SERIALUI_DCBToDialogInfo(hWnd, info);
return TRUE; return TRUE;
@ -457,7 +457,7 @@ BOOL WINAPI SERIALUI_SetDefaultCommConfig(
if(r != ERROR_SUCCESS) if(r != ERROR_SUCCESS)
return FALSE; return FALSE;
snprintf(szKeyName, sizeof szKeyName, "%s\\%s", lpszCommKey ,lpszDevice); snprintf(szKeyName, sizeof(szKeyName), "%s\\%s", lpszCommKey ,lpszDevice);
r = RegCreateKeyA(hKeyReg, szKeyName, &hKeyPort); r = RegCreateKeyA(hKeyReg, szKeyName, &hKeyPort);
if(r == ERROR_SUCCESS) if(r == ERROR_SUCCESS)
{ {
@ -509,7 +509,7 @@ BOOL WINAPI SERIALUI_GetDefaultCommConfig(
if(r != ERROR_SUCCESS) if(r != ERROR_SUCCESS)
return FALSE; return FALSE;
snprintf(szKeyName, sizeof szKeyName, "%s\\%s", lpszCommKey ,lpszDevice); snprintf(szKeyName, sizeof(szKeyName), "%s\\%s", lpszCommKey ,lpszDevice);
r = RegOpenKeyA(hKeyReg, szKeyName, &hKeyPort); r = RegOpenKeyA(hKeyReg, szKeyName, &hKeyPort);
if(r == ERROR_SUCCESS) if(r == ERROR_SUCCESS)
{ {

View File

@ -108,7 +108,7 @@ BOOL WINAPI SetupDiEnumDeviceInfo(
if(info==NULL) if(info==NULL)
return FALSE; return FALSE;
if(info->cbSize < sizeof *info) if(info->cbSize < sizeof(*info))
return FALSE; return FALSE;
return FALSE; return FALSE;

View File

@ -247,8 +247,8 @@ static BOOL StartLinkProcessor( LPCOLESTR szLink )
TRACE("starting %s\n",debugstr_w(buffer)); TRACE("starting %s\n",debugstr_w(buffer));
memset(&si, 0, sizeof si); memset(&si, 0, sizeof(si));
si.cb = sizeof si; si.cb = sizeof(si);
if (!CreateProcessW( NULL, buffer, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) return FALSE; if (!CreateProcessW( NULL, buffer, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) return FALSE;
/* wait for a while to throttle the creation of linker processes */ /* wait for a while to throttle the creation of linker processes */
@ -404,8 +404,8 @@ static HRESULT Stream_LoadString( IStream* stm, BOOL unicode, LPWSTR *pstr )
TRACE("%p\n", stm); TRACE("%p\n", stm);
count = 0; count = 0;
r = IStream_Read(stm, &len, sizeof len, &count); r = IStream_Read(stm, &len, sizeof(len), &count);
if ( FAILED (r) || ( count != sizeof len ) ) if ( FAILED (r) || ( count != sizeof(len) ) )
return E_FAIL; return E_FAIL;
if( unicode ) if( unicode )
@ -455,20 +455,20 @@ static HRESULT Stream_LoadLocation( IStream* stm )
TRACE("%p\n",stm); TRACE("%p\n",stm);
r = IStream_Read( stm, &size, sizeof size, &count ); r = IStream_Read( stm, &size, sizeof(size), &count );
if( FAILED( r ) ) if( FAILED( r ) )
return r; return r;
if( count != sizeof loc->dwTotalSize ) if( count != sizeof(loc->dwTotalSize) )
return E_FAIL; return E_FAIL;
loc = HeapAlloc( GetProcessHeap(), 0, size ); loc = HeapAlloc( GetProcessHeap(), 0, size );
if( ! loc ) if( ! loc )
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
r = IStream_Read( stm, &loc->dwHeaderSize, size-sizeof size, &count ); r = IStream_Read( stm, &loc->dwHeaderSize, size-sizeof(size), &count );
if( FAILED( r ) ) if( FAILED( r ) )
goto end; goto end;
if( count != (size - sizeof size) ) if( count != (size - sizeof(size)) )
{ {
r = E_FAIL; r = E_FAIL;
goto end; goto end;
@ -507,13 +507,13 @@ static HRESULT WINAPI IPersistStream_fnLoad(
return STG_E_INVALIDPOINTER; return STG_E_INVALIDPOINTER;
dwBytesRead = 0; dwBytesRead = 0;
r = IStream_Read(stm, &hdr, sizeof hdr, &dwBytesRead); r = IStream_Read(stm, &hdr, sizeof(hdr), &dwBytesRead);
if( FAILED( r ) ) if( FAILED( r ) )
return r; return r;
if( dwBytesRead != sizeof hdr) if( dwBytesRead != sizeof(hdr))
return E_FAIL; return E_FAIL;
if( hdr.dwSize != sizeof hdr) if( hdr.dwSize != sizeof(hdr))
return E_FAIL; return E_FAIL;
if( !IsEqualIID(&hdr.MagicGuid, &CLSID_ShellLink) ) if( !IsEqualIID(&hdr.MagicGuid, &CLSID_ShellLink) )
return E_FAIL; return E_FAIL;
@ -604,7 +604,7 @@ static HRESULT Stream_WriteString( IStream* stm, LPCWSTR str )
DWORD count; DWORD count;
HRESULT r; HRESULT r;
r = IStream_Write( stm, &len, sizeof len, &count ); r = IStream_Write( stm, &len, sizeof(len), &count );
if( FAILED( r ) ) if( FAILED( r ) )
return r; return r;
@ -624,8 +624,8 @@ static HRESULT Stream_WriteLocationInfo( IStream* stm, LPCWSTR filename )
FIXME("writing empty location info\n"); FIXME("writing empty location info\n");
memset( &loc, 0, sizeof loc ); memset( &loc, 0, sizeof(loc) );
loc.dwTotalSize = sizeof loc - sizeof loc.dwTotalSize; loc.dwTotalSize = sizeof(loc) - sizeof(loc.dwTotalSize);
/* FIXME: fill this in */ /* FIXME: fill this in */
@ -658,9 +658,9 @@ static HRESULT WINAPI IPersistStream_fnSave(
This->pPidl = ILCreateFromPathW( This->sPath ); This->pPidl = ILCreateFromPathW( This->sPath );
} }
memset(&header, 0, sizeof header); memset(&header, 0, sizeof(header));
header.dwSize = sizeof header; header.dwSize = sizeof(header);
memcpy(&header.MagicGuid, &CLSID_ShellLink, sizeof header.MagicGuid ); memcpy(&header.MagicGuid, &CLSID_ShellLink, sizeof(header.MagicGuid) );
header.wHotKey = This->wHotKey; header.wHotKey = This->wHotKey;
header.nIcon = This->iIcoNdx; header.nIcon = This->iIcoNdx;
@ -682,7 +682,7 @@ static HRESULT WINAPI IPersistStream_fnSave(
SystemTimeToFileTime ( &This->time3, &header.Time3 ); SystemTimeToFileTime ( &This->time3, &header.Time3 );
/* write the Shortcut header */ /* write the Shortcut header */
r = IStream_Write( stm, &header, sizeof header, &count ); r = IStream_Write( stm, &header, sizeof(header), &count );
if( FAILED( r ) ) if( FAILED( r ) )
{ {
ERR("Write failed at %d\n",__LINE__); ERR("Write failed at %d\n",__LINE__);

View File

@ -1105,7 +1105,7 @@ BOOL WINAPI ReadCabinetState(CABINETSTATE *cs, int length)
TRACE("%p %d \n",cs,length); TRACE("%p %d \n",cs,length);
if( (cs == NULL) || (length < sizeof *cs) ) if( (cs == NULL) || (length < sizeof(*cs)) )
return FALSE; return FALSE;
r = RegOpenKeyW( HKEY_CURRENT_USER, szwCabLocation, &hkey ); r = RegOpenKeyW( HKEY_CURRENT_USER, szwCabLocation, &hkey );
@ -1119,12 +1119,12 @@ BOOL WINAPI ReadCabinetState(CABINETSTATE *cs, int length)
} }
/* if we can't read from the registry, create default values */ /* if we can't read from the registry, create default values */
if ( (r != ERROR_SUCCESS) || (cs->cLength < sizeof *cs) || if ( (r != ERROR_SUCCESS) || (cs->cLength < sizeof(*cs)) ||
(cs->cLength != length) ) (cs->cLength != length) )
{ {
ERR("Initializing shell cabinet settings\n"); ERR("Initializing shell cabinet settings\n");
memset(cs, 0, sizeof *cs); memset(cs, 0, sizeof(*cs));
cs->cLength = sizeof *cs; cs->cLength = sizeof(*cs);
cs->nVersion = 2; cs->nVersion = 2;
cs->fFullPathTitle = FALSE; cs->fFullPathTitle = FALSE;
cs->fSaveLocalView = TRUE; cs->fSaveLocalView = TRUE;

View File

@ -332,7 +332,7 @@ static INT COMM16_WriteFile(HANDLE hComm, LPCVOID buffer, DWORD len)
OVERLAPPED ov; OVERLAPPED ov;
DWORD count= -1; DWORD count= -1;
ZeroMemory(&ov,sizeof ov); ZeroMemory(&ov,sizeof(ov));
ov.hEvent = CreateEventA(NULL,0,0,NULL); ov.hEvent = CreateEventA(NULL,0,0,NULL);
if(ov.hEvent==INVALID_HANDLE_VALUE) if(ov.hEvent==INVALID_HANDLE_VALUE)
return -1; return -1;
@ -577,7 +577,7 @@ INT16 WINAPI OpenComm16(LPCSTR device,UINT16 cbInQueue,UINT16 cbOutQueue)
/* set default parameters */ /* set default parameters */
if(COM[port].baudrate>-1){ if(COM[port].baudrate>-1){
DCB16 dcb; DCB16 dcb;
memcpy(&dcb,&COM[port].dcb,sizeof dcb); memcpy(&dcb,&COM[port].dcb,sizeof(dcb));
dcb.BaudRate=COM[port].baudrate; dcb.BaudRate=COM[port].baudrate;
/* more defaults: /* more defaults:
* databits, parity, stopbits * databits, parity, stopbits
@ -923,8 +923,8 @@ INT16 WINAPI SetCommState16(LPDCB16 lpdcb)
return -1; return -1;
} }
memset(&dcb,0,sizeof dcb); memset(&dcb,0,sizeof(dcb));
dcb.DCBlength = sizeof dcb; dcb.DCBlength = sizeof(dcb);
/* /*
* according to MSDN, we should first interpret lpdcb->BaudRate as follows: * according to MSDN, we should first interpret lpdcb->BaudRate as follows:

View File

@ -127,7 +127,7 @@ void ClassTest(HINSTANCE hInstance, BOOL global)
} }
/* check GetClassName */ /* check GetClassName */
i = GetClassNameW(hTestWnd, str, sizeof str); i = GetClassNameW(hTestWnd, str, sizeof(str));
ok(i == lstrlenW(className), ok(i == lstrlenW(className),
"GetClassName returned incorrect length"); "GetClassName returned incorrect length");
ok(!lstrcmpW(className,str), ok(!lstrcmpW(className,str),

View File

@ -1569,7 +1569,7 @@ BOOL WINAPI InternetSetOptionA(HINTERNET hInternet, DWORD dwOption,
proxlen = MultiByteToWideChar( CP_ACP, 0, pi->lpszProxy, -1, NULL, 0); proxlen = MultiByteToWideChar( CP_ACP, 0, pi->lpszProxy, -1, NULL, 0);
prbylen= MultiByteToWideChar( CP_ACP, 0, pi->lpszProxyBypass, -1, NULL, 0); prbylen= MultiByteToWideChar( CP_ACP, 0, pi->lpszProxyBypass, -1, NULL, 0);
wlen = sizeof *piw + proxlen + prbylen; wlen = sizeof(*piw) + proxlen + prbylen;
wbuffer = HeapAlloc( GetProcessHeap(), 0, wlen ); wbuffer = HeapAlloc( GetProcessHeap(), 0, wlen );
piw = (LPINTERNET_PROXY_INFOW) wbuffer; piw = (LPINTERNET_PROXY_INFOW) wbuffer;
piw->dwAccessType = pi->dwAccessType; piw->dwAccessType = pi->dwAccessType;

View File

@ -478,7 +478,7 @@ UINT MMDRV_PhysicalFeatures(LPWINE_MLD mld, UINT uMsg, DWORD dwParam1,
case DRV_QUERYDRIVERIDS: case DRV_QUERYDRIVERIDS:
WARN("NIY call VxD\n"); WARN("NIY call VxD\n");
/* should call VxD MMDEVLDR with (DevNode, dwParam1 and dwParam2) as pmts /* should call VxD MMDEVLDR with (DevNode, dwParam1 and dwParam2) as pmts
* dwParam1 is buffer and dwParam2 is sizeof buffer * dwParam1 is buffer and dwParam2 is sizeof(buffer)
* I don't know where the result is stored though * I don't know where the result is stored though
*/ */
break; break;

View File

@ -910,7 +910,7 @@ static const struct sockaddr* ws_sockaddr_ws2u(const struct WS_sockaddr* wsaddr,
#ifdef IPX_FRAME_NONE #ifdef IPX_FRAME_NONE
uipx->sipx_type=IPX_FRAME_NONE; uipx->sipx_type=IPX_FRAME_NONE;
#endif #endif
memset(&uipx->sipx_zero,0,sizeof uipx->sipx_zero); memset(&uipx->sipx_zero,0,sizeof(uipx->sipx_zero));
return (const struct sockaddr*)uipx; return (const struct sockaddr*)uipx;
} }
#endif #endif

View File

@ -2933,7 +2933,7 @@ BOOL WINAPI EnumPortsA(LPSTR name,DWORD level,LPBYTE buffer,DWORD bufsize,
ofs = info_size*count; ofs = info_size*count;
for ( i=0; i<count; i++) for ( i=0; i<count; i++)
{ {
DWORD vallen = sizeof portname - 1; DWORD vallen = sizeof(portname) - 1;
/* get the serial port values, then the printer values */ /* get the serial port values, then the printer values */
if ( i < serial_count ) if ( i < serial_count )

View File

@ -216,7 +216,7 @@ static BOOL NB_Lookup(LPCSTR host, struct sockaddr_in *addr)
if(fd<0) if(fd<0)
return FALSE; return FALSE;
r = setsockopt(fd, SOL_SOCKET, SO_BROADCAST, &on, sizeof on); r = setsockopt(fd, SOL_SOCKET, SO_BROADCAST, &on, sizeof(on));
if(r<0) if(r<0)
goto err; goto err;
@ -228,11 +228,11 @@ static BOOL NB_Lookup(LPCSTR host, struct sockaddr_in *addr)
sin.sin_family = AF_INET; sin.sin_family = AF_INET;
sin.sin_port = htons(137); sin.sin_port = htons(137);
len = NB_NameReq(host,buffer,sizeof buffer); len = NB_NameReq(host,buffer,sizeof(buffer));
if(len<=0) if(len<=0)
goto err; goto err;
r = sendto(fd, buffer, len, 0, (struct sockaddr*)&sin, sizeof sin); r = sendto(fd, buffer, len, 0, (struct sockaddr*)&sin, sizeof(sin));
if(r<0) if(r<0)
{ {
FIXME("Error sending packet\n"); FIXME("Error sending packet\n");
@ -253,7 +253,7 @@ static BOOL NB_Lookup(LPCSTR host, struct sockaddr_in *addr)
TRACE("Got response!\n"); TRACE("Got response!\n");
fromsize = sizeof (fromaddr); fromsize = sizeof (fromaddr);
r = recvfrom(fd, buffer, sizeof buffer, 0, (struct sockaddr*)&fromaddr, &fromsize); r = recvfrom(fd, buffer, sizeof(buffer), 0, (struct sockaddr*)&fromaddr, &fromsize);
if(r<0) if(r<0)
goto err; goto err;
@ -271,7 +271,7 @@ static BOOL NB_Lookup(LPCSTR host, struct sockaddr_in *addr)
TRACE("packet is OK\n"); TRACE("packet is OK\n");
memcpy(&addr->sin_addr, &buffer[58], sizeof addr->sin_addr); memcpy(&addr->sin_addr, &buffer[58], sizeof(addr->sin_addr));
close(fd); close(fd);
return TRUE; return TRUE;
@ -525,7 +525,7 @@ static BOOL SMB_NegotiateProtocol(int fd, USHORT *dialect)
TRACE("\n"); TRACE("\n");
memset(buf,0,sizeof buf); memset(buf,0,sizeof(buf));
tx.buffer = buf; tx.buffer = buf;
tx.len = SMB_Header(tx.buffer, SMB_COM_NEGOTIATE, 0, 0); tx.len = SMB_Header(tx.buffer, SMB_COM_NEGOTIATE, 0, 0);
@ -578,7 +578,7 @@ static BOOL SMB_SessionSetup(int fd, USHORT *userid)
int pcount,bcount; int pcount,bcount;
struct NB_Buffer rx, tx; struct NB_Buffer rx, tx;
memset(buf,0,sizeof buf); memset(buf,0,sizeof(buf));
tx.buffer = buf; tx.buffer = buf;
tx.len = SMB_Header(tx.buffer, SMB_COM_SESSION_SETUP_ANDX, 0, 0); tx.len = SMB_Header(tx.buffer, SMB_COM_SESSION_SETUP_ANDX, 0, 0);
@ -675,7 +675,7 @@ static BOOL SMB_TreeConnect(int fd, USHORT user_id, LPCSTR share_name, USHORT *t
TRACE("%s\n",share_name); TRACE("%s\n",share_name);
memset(buf,0,sizeof buf); memset(buf,0,sizeof(buf));
tx.buffer = buf; tx.buffer = buf;
tx.len = SMB_Header(tx.buffer, SMB_COM_TREE_CONNECT, 0, user_id); tx.len = SMB_Header(tx.buffer, SMB_COM_TREE_CONNECT, 0, user_id);
@ -697,7 +697,7 @@ static BOOL SMB_TreeConnect(int fd, USHORT user_id, LPCSTR share_name, USHORT *t
tx.buffer[tx.len++] = 0; /* null terminated password */ tx.buffer[tx.len++] = 0; /* null terminated password */
slen = strlen(share_name); slen = strlen(share_name);
if(slen<(sizeof buf-tx.len)) if(slen<(sizeof(buf)-tx.len))
strcpy(&tx.buffer[tx.len], share_name); strcpy(&tx.buffer[tx.len], share_name);
else else
return FALSE; return FALSE;
@ -739,7 +739,7 @@ static BOOL SMB_NtCreateOpen(int fd, USHORT tree_id, USHORT user_id, USHORT dial
TRACE("%s\n",filename); TRACE("%s\n",filename);
memset(buffer,0,sizeof buffer); memset(buffer,0,sizeof(buffer));
len = SMB_Header(buffer, SMB_COM_NT_CREATE_ANDX, tree_id, user_id); len = SMB_Header(buffer, SMB_COM_NT_CREATE_ANDX, tree_id, user_id);
@ -789,7 +789,7 @@ static BOOL SMB_NtCreateOpen(int fd, USHORT tree_id, USHORT user_id, USHORT dial
/* 0x39 */ /* 0x39 */
SMB_ADDWORD(&buffer[len],slen); len += 2; /* size of buffer */ SMB_ADDWORD(&buffer[len],slen); len += 2; /* size of buffer */
if(slen<(sizeof buffer-len)) if(slen<(sizeof(buffer)-len))
strcpy(&buffer[len], filename); strcpy(&buffer[len], filename);
else else
return FALSE; return FALSE;
@ -865,7 +865,7 @@ static BOOL SMB_OpenAndX(int fd, USHORT tree_id, USHORT user_id, USHORT dialect,
mode = SMB_GetMode(access,sharing); mode = SMB_GetMode(access,sharing);
memset(buffer,0,sizeof buffer); memset(buffer,0,sizeof(buffer));
len = SMB_Header(buffer, SMB_COM_OPEN_ANDX, tree_id, user_id); len = SMB_Header(buffer, SMB_COM_OPEN_ANDX, tree_id, user_id);
@ -896,7 +896,7 @@ static BOOL SMB_Open(int fd, USHORT tree_id, USHORT user_id, USHORT dialect,
TRACE("%s\n",filename); TRACE("%s\n",filename);
memset(buf,0,sizeof buf); memset(buf,0,sizeof(buf));
tx.buffer = buf; tx.buffer = buf;
tx.len = SMB_Header(tx.buffer, SMB_COM_OPEN, tree_id, user_id); tx.len = SMB_Header(tx.buffer, SMB_COM_OPEN, tree_id, user_id);
@ -1167,7 +1167,7 @@ static BOOL SMB_SetupFindFirst(struct SMB_Trans2Info *send, LPSTR filename)
int storagetype = 0; int storagetype = 0;
int len, buf_size; int len, buf_size;
memset(send,0,sizeof send); memset(send,0,sizeof(send));
send->setup_count = 1; send->setup_count = 1;
send->setup = HeapAlloc(GetProcessHeap(),0,send->setup_count*2); send->setup = HeapAlloc(GetProcessHeap(),0,send->setup_count*2);
@ -1216,7 +1216,7 @@ static SMB_DIR *SMB_Trans2FindFirst(int fd, USHORT tree_id,
if(!SMB_SetupFindFirst(&send, filename)) if(!SMB_SetupFindFirst(&send, filename))
return FALSE; return FALSE;
memset(&recv,0,sizeof recv); memset(&recv,0,sizeof(recv));
ret = SMB_Transaction2(fd, tree_id, user_id, &send, &recv); ret = SMB_Transaction2(fd, tree_id, user_id, &send, &recv);
HeapFree(GetProcessHeap(),0,send.params); HeapFree(GetProcessHeap(),0,send.params);
@ -1323,7 +1323,7 @@ connect:
unsigned char *x = (unsigned char *)&sin.sin_addr; unsigned char *x = (unsigned char *)&sin.sin_addr;
TRACE("Connecting to %d.%d.%d.%d ...\n", x[0],x[1],x[2],x[3]); TRACE("Connecting to %d.%d.%d.%d ...\n", x[0],x[1],x[2],x[3]);
} }
r = connect(fd, (struct sockaddr*)&sin, sizeof sin); r = connect(fd, (struct sockaddr*)&sin, sizeof(sin));
if(!NB_SessionReq(fd, "*SMBSERVER", "WINE")) if(!NB_SessionReq(fd, "*SMBSERVER", "WINE"))
{ {
@ -1596,7 +1596,7 @@ BOOL WINAPI SMB_FindNext(SMB_DIR *dir, WIN32_FIND_DATAW *data )
if(dir->current >= dir->num_entries) if(dir->current >= dir->num_entries)
return FALSE; return FALSE;
memset(data, 0, sizeof *data); memset(data, 0, sizeof(*data));
ent = dir->entries[dir->current]; ent = dir->entries[dir->current];
len = SMB_GETDWORD(&ent[0]); len = SMB_GETDWORD(&ent[0]);
@ -1612,13 +1612,13 @@ BOOL WINAPI SMB_FindNext(SMB_DIR *dir, WIN32_FIND_DATAW *data )
/* copy the long filename */ /* copy the long filename */
fnlen = SMB_GETDWORD(&ent[0x3c]); fnlen = SMB_GETDWORD(&ent[0x3c]);
if ( fnlen > (sizeof data->cFileName/sizeof(WCHAR)) ) if ( fnlen > (sizeof(data->cFileName)/sizeof(WCHAR)) )
return FALSE; return FALSE;
MultiByteToWideChar( CP_ACP, 0, &ent[0x5e], fnlen, data->cFileName, MultiByteToWideChar( CP_ACP, 0, &ent[0x5e], fnlen, data->cFileName,
sizeof(data->cFileName)/sizeof(WCHAR) ); sizeof(data->cFileName)/sizeof(WCHAR) );
/* copy the short filename */ /* copy the short filename */
if ( ent[0x44] > (sizeof data->cAlternateFileName/sizeof(WCHAR)) ) if ( ent[0x44] > (sizeof(data->cAlternateFileName)/sizeof(WCHAR)) )
return FALSE; return FALSE;
MultiByteToWideChar( CP_ACP, 0, &ent[0x5e + len], ent[0x44], data->cAlternateFileName, MultiByteToWideChar( CP_ACP, 0, &ent[0x5e + len], ent[0x44], data->cAlternateFileName,
sizeof(data->cAlternateFileName)/sizeof(WCHAR) ); sizeof(data->cAlternateFileName)/sizeof(WCHAR) );
@ -1632,7 +1632,7 @@ BOOL WINAPI SMB_CloseDir(SMB_DIR *dir)
{ {
HeapFree(GetProcessHeap(),0,dir->buffer); HeapFree(GetProcessHeap(),0,dir->buffer);
HeapFree(GetProcessHeap(),0,dir->entries); HeapFree(GetProcessHeap(),0,dir->entries);
memset(dir,0,sizeof *dir); memset(dir,0,sizeof(*dir));
HeapFree(GetProcessHeap(),0,dir); HeapFree(GetProcessHeap(),0,dir);
return TRUE; return TRUE;
} }

View File

@ -1704,7 +1704,7 @@ static void XFONT_LoadAliases(void)
{ {
BOOL bSubst; BOOL bSubst;
char subsection[32]; char subsection[32];
snprintf( subsection, sizeof subsection, "%s%i", INIAliasSection, i++ ); snprintf( subsection, sizeof(subsection), "%s%i", INIAliasSection, i++ );
buffer[0] = 0; buffer[0] = 0;
if(!RegOpenKeyA(HKEY_LOCAL_MACHINE, INIFontSection, &hkey)) if(!RegOpenKeyA(HKEY_LOCAL_MACHINE, INIFontSection, &hkey))
@ -2109,7 +2109,7 @@ static int XFONT_BuildMetrics(char** x_pattern, int res, unsigned x_checksum, in
lfd1.resolution_x = res_string; lfd1.resolution_x = res_string;
lfd1.resolution_y = res_string; lfd1.resolution_y = res_string;
LFD_UnParse(buffer, sizeof buffer, &lfd1); LFD_UnParse(buffer, sizeof(buffer), &lfd1);
lpstr = buffer; lpstr = buffer;
} }
@ -2330,7 +2330,7 @@ static BOOL XFONT_WriteCachedMetrics( int fd, unsigned x_checksum, int x_count,
for( j = i = 0, pfr = fontList; pfr; pfr = pfr->next ) for( j = i = 0, pfr = fontList; pfr; pfr = pfr->next )
{ {
LFD_UnParse(buffer, sizeof buffer, pfr->resource); LFD_UnParse(buffer, sizeof(buffer), pfr->resource);
i += strlen( buffer) + 1; i += strlen( buffer) + 1;
j += pfr->fi_count; j += pfr->fi_count;
} }
@ -2368,7 +2368,7 @@ static BOOL XFONT_WriteCachedMetrics( int fd, unsigned x_checksum, int x_count,
write( fd, &i, sizeof(int) ); write( fd, &i, sizeof(int) );
for( pfr = fontList; pfr && i == j; pfr = pfr->next ) for( pfr = fontList; pfr && i == j; pfr = pfr->next )
{ {
LFD_UnParse(buffer, sizeof buffer, pfr->resource); LFD_UnParse(buffer, sizeof(buffer), pfr->resource);
i = strlen( buffer ) + 1; i = strlen( buffer ) + 1;
j = write( fd, buffer, i ); j = write( fd, buffer, i );
} }

View File

@ -80,7 +80,7 @@ struct {
{ BS_PUSHBUTTON, "Exit", 0 } { BS_PUSHBUTTON, "Exit", 0 }
}; };
#define NUM (sizeof button/sizeof button[0]) #define NUM (sizeof(button)/sizeof(button[0]))
int FetchUninstallInformation(void); int FetchUninstallInformation(void);
void UninstallProgram(void); void UninstallProgram(void);

View File

@ -683,7 +683,7 @@ static BOOL GetLinkLocation( LPCWSTR linkfile, DWORD *ofs, DWORD *loc )
if( !GetFullPathNameW( linkfile, MAX_PATH, filename, NULL )) if( !GetFullPathNameW( linkfile, MAX_PATH, filename, NULL ))
return FALSE; return FALSE;
for( i=0; i<sizeof locations/sizeof locations[0]; i++ ) for( i=0; i<sizeof(locations)/sizeof(locations[0]); i++ )
{ {
if (!SHGetSpecialFolderPathW( 0, buffer, locations[i], FALSE )) if (!SHGetSpecialFolderPathW( 0, buffer, locations[i], FALSE ))
continue; continue;
@ -743,24 +743,24 @@ static BOOL InvokeShellLinker( IShellLinkA *sl, LPCWSTR link )
} }
szWorkDir[0]=0; szWorkDir[0]=0;
IShellLinkA_GetWorkingDirectory( sl, szWorkDir, sizeof szWorkDir); IShellLinkA_GetWorkingDirectory( sl, szWorkDir, sizeof(szWorkDir));
WINE_TRACE("workdir : %s\n", szWorkDir); WINE_TRACE("workdir : %s\n", szWorkDir);
szDescription[0] = 0; szDescription[0] = 0;
IShellLinkA_GetDescription( sl, szDescription, sizeof szDescription); IShellLinkA_GetDescription( sl, szDescription, sizeof(szDescription));
WINE_TRACE("description: %s\n", szDescription); WINE_TRACE("description: %s\n", szDescription);
szPath[0] = 0; szPath[0] = 0;
IShellLinkA_GetPath( sl, szPath, sizeof szPath, NULL, SLGP_RAWPATH ); IShellLinkA_GetPath( sl, szPath, sizeof(szPath), NULL, SLGP_RAWPATH );
WINE_TRACE("path : %s\n", szPath); WINE_TRACE("path : %s\n", szPath);
szArgs[0] = 0; szArgs[0] = 0;
IShellLinkA_GetArguments( sl, szArgs, sizeof szArgs ); IShellLinkA_GetArguments( sl, szArgs, sizeof(szArgs) );
WINE_TRACE("args : %s\n", szArgs); WINE_TRACE("args : %s\n", szArgs);
szIconPath[0] = 0; szIconPath[0] = 0;
IShellLinkA_GetIconLocation( sl, szIconPath, IShellLinkA_GetIconLocation( sl, szIconPath,
sizeof szIconPath, &iIconId ); sizeof(szIconPath), &iIconId );
WINE_TRACE("icon file : %s\n", szIconPath ); WINE_TRACE("icon file : %s\n", szIconPath );
if( !szPath[0] ) if( !szPath[0] )
@ -963,7 +963,7 @@ int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show
{ {
WCHAR link[MAX_PATH]; WCHAR link[MAX_PATH];
MultiByteToWideChar( CP_ACP, 0, token, -1, link, sizeof link ); MultiByteToWideChar( CP_ACP, 0, token, -1, link, sizeof(link) );
if( !Process_Link( link, bAgain ) ) if( !Process_Link( link, bAgain ) )
{ {
WINE_ERR( "failed to build menu item for %s\n",token); WINE_ERR( "failed to build menu item for %s\n",token);

View File

@ -68,7 +68,7 @@
/* data structure used to pass an fd with sendmsg/recvmsg */ /* data structure used to pass an fd with sendmsg/recvmsg */
struct cmsg_fd struct cmsg_fd
{ {
int len; /* sizeof structure */ int len; /* size of structure */
int level; /* SOL_SOCKET */ int level; /* SOL_SOCKET */
int type; /* SCM_RIGHTS */ int type; /* SCM_RIGHTS */
int fd; /* fd to pass */ int fd; /* fd to pass */

View File

@ -248,7 +248,7 @@ static void queue_connect_waiter( struct named_pipe *pipe,
{ {
struct connect_wait *waiter; struct connect_wait *waiter;
waiter = mem_alloc( sizeof *waiter ); waiter = mem_alloc( sizeof(*waiter) );
if( waiter ) if( waiter )
{ {
set_waiter( &waiter->wait, func, overlapped ); set_waiter( &waiter->wait, func, overlapped );

View File

@ -1924,7 +1924,7 @@ DECL_HANDLER(set_registry_notification)
} }
else else
{ {
notify = (struct notify *) malloc (sizeof *notify); notify = (struct notify *) malloc (sizeof(*notify));
if( notify ) if( notify )
{ {
grab_object( event ); grab_object( event );

View File

@ -116,7 +116,7 @@ static struct msghdr msghdr;
#ifndef HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS #ifndef HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS
struct cmsg_fd struct cmsg_fd
{ {
int len; /* sizeof structure */ int len; /* size of structure */
int level; /* SOL_SOCKET */ int level; /* SOL_SOCKET */
int type; /* SCM_RIGHTS */ int type; /* SCM_RIGHTS */
int fd; /* fd to pass */ int fd; /* fd to pass */