krnl386.exe16: Use the ARRAY_SIZE() macro.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
fdc9f3dce9
commit
b45f948826
|
@ -814,8 +814,8 @@ static HANDLE INT21_CreateMagicDeviceHandle( LPCWSTR name )
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
memcpy( nameW.Buffer, prefixW, sizeof(prefixW) );
|
memcpy( nameW.Buffer, prefixW, sizeof(prefixW) );
|
||||||
MultiByteToWideChar( CP_UNIXCP, 0, dir, -1, nameW.Buffer + sizeof(prefixW)/sizeof(WCHAR), len );
|
MultiByteToWideChar( CP_UNIXCP, 0, dir, -1, nameW.Buffer + ARRAY_SIZE(prefixW), len );
|
||||||
len += sizeof(prefixW) / sizeof(WCHAR);
|
len += ARRAY_SIZE(prefixW);
|
||||||
nameW.Buffer[len-1] = '/';
|
nameW.Buffer[len-1] = '/';
|
||||||
strcpyW( nameW.Buffer + len, name );
|
strcpyW( nameW.Buffer + len, name );
|
||||||
|
|
||||||
|
@ -3264,7 +3264,7 @@ static BOOL INT21_NetworkFunc (CONTEXT *context)
|
||||||
case 0x00: /* Get machine name. */
|
case 0x00: /* Get machine name. */
|
||||||
{
|
{
|
||||||
WCHAR dstW[MAX_COMPUTERNAME_LENGTH + 1];
|
WCHAR dstW[MAX_COMPUTERNAME_LENGTH + 1];
|
||||||
DWORD s = sizeof(dstW) / sizeof(WCHAR);
|
DWORD s = ARRAY_SIZE(dstW);
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
char *dst = CTX_SEG_OFF_TO_LIN (context,context->SegDs,context->Edx);
|
char *dst = CTX_SEG_OFF_TO_LIN (context,context->SegDs,context->Edx);
|
||||||
|
|
|
@ -103,7 +103,7 @@ static void WINAPI DOSVM_DefaultHandler( CONTEXT *context )
|
||||||
*/
|
*/
|
||||||
static INTPROC DOSVM_GetBuiltinHandler( BYTE intnum )
|
static INTPROC DOSVM_GetBuiltinHandler( BYTE intnum )
|
||||||
{
|
{
|
||||||
if (intnum < sizeof(DOSVM_VectorsBuiltin)/sizeof(INTPROC)) {
|
if (intnum < ARRAY_SIZE(DOSVM_VectorsBuiltin)) {
|
||||||
INTPROC proc = DOSVM_VectorsBuiltin[intnum];
|
INTPROC proc = DOSVM_VectorsBuiltin[intnum];
|
||||||
if (proc)
|
if (proc)
|
||||||
return proc;
|
return proc;
|
||||||
|
@ -274,7 +274,7 @@ BOOL DOSVM_EmulateInterruptPM( CONTEXT *context, BYTE intnum )
|
||||||
else if (wine_ldt_is_system(context->SegCs))
|
else if (wine_ldt_is_system(context->SegCs))
|
||||||
{
|
{
|
||||||
INTPROC proc;
|
INTPROC proc;
|
||||||
if (intnum >= sizeof(DOSVM_VectorsBuiltin)/sizeof(INTPROC)) return FALSE;
|
if (intnum >= ARRAY_SIZE(DOSVM_VectorsBuiltin)) return FALSE;
|
||||||
if (!(proc = DOSVM_VectorsBuiltin[intnum])) return FALSE;
|
if (!(proc = DOSVM_VectorsBuiltin[intnum])) return FALSE;
|
||||||
proc( context );
|
proc( context );
|
||||||
}
|
}
|
||||||
|
|
|
@ -345,7 +345,7 @@ static int relay_call_from_16_no_debug( void *entry_point, unsigned char *args16
|
||||||
int args32[20];
|
int args32[20];
|
||||||
|
|
||||||
/* look for the ret instruction */
|
/* look for the ret instruction */
|
||||||
for (j = 0; j < sizeof(call->ret)/sizeof(call->ret[0]); j++)
|
for (j = 0; j < ARRAY_SIZE(call->ret); j++)
|
||||||
if (call->ret[j] == 0xca66 || call->ret[j] == 0xcb66) break;
|
if (call->ret[j] == 0xca66 || call->ret[j] == 0xcb66) break;
|
||||||
|
|
||||||
if (call->ret[j] == 0xcb66) /* cdecl */
|
if (call->ret[j] == 0xcb66) /* cdecl */
|
||||||
|
@ -449,7 +449,7 @@ int relay_call_from_16( void *entry_point, unsigned char *args16, CONTEXT *conte
|
||||||
TRACE( "\1Call %s.%d: %s(", module, ordinal, func );
|
TRACE( "\1Call %s.%d: %s(", module, ordinal, func );
|
||||||
|
|
||||||
/* look for the ret instruction */
|
/* look for the ret instruction */
|
||||||
for (j = 0; j < sizeof(call->ret)/sizeof(call->ret[0]); j++)
|
for (j = 0; j < ARRAY_SIZE(call->ret); j++)
|
||||||
if (call->ret[j] == 0xca66 || call->ret[j] == 0xcb66) break;
|
if (call->ret[j] == 0xca66 || call->ret[j] == 0xcb66) break;
|
||||||
|
|
||||||
if (call->ret[j] == 0xcb66) /* cdecl */
|
if (call->ret[j] == 0xcb66) /* cdecl */
|
||||||
|
|
|
@ -262,10 +262,10 @@ static void WINAPI SNOOP16_Entry(FARPROC proc, LPBYTE args, CONTEXT *context) {
|
||||||
return; /* oops */
|
return; /* oops */
|
||||||
}
|
}
|
||||||
while (*rets) {
|
while (*rets) {
|
||||||
for (i=0;i<sizeof((*rets)->entry)/sizeof((*rets)->entry[0]);i++)
|
for (i=0;i<ARRAY_SIZE((*rets)->entry);i++)
|
||||||
if (!(*rets)->entry[i].origreturn)
|
if (!(*rets)->entry[i].origreturn)
|
||||||
break;
|
break;
|
||||||
if (i!=sizeof((*rets)->entry)/sizeof((*rets)->entry[0]))
|
if (i!=ARRAY_SIZE((*rets)->entry))
|
||||||
break;
|
break;
|
||||||
rets = &((*rets)->next);
|
rets = &((*rets)->next);
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,8 +129,8 @@ static HANDLE open_vxd_handle( LPCWSTR name )
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
memcpy( nameW.Buffer, prefixW, sizeof(prefixW) );
|
memcpy( nameW.Buffer, prefixW, sizeof(prefixW) );
|
||||||
MultiByteToWideChar( CP_UNIXCP, 0, dir, -1, nameW.Buffer + sizeof(prefixW)/sizeof(WCHAR), len );
|
MultiByteToWideChar( CP_UNIXCP, 0, dir, -1, nameW.Buffer + ARRAY_SIZE(prefixW), len );
|
||||||
len += sizeof(prefixW) / sizeof(WCHAR);
|
len += ARRAY_SIZE(prefixW);
|
||||||
nameW.Buffer[len-1] = '/';
|
nameW.Buffer[len-1] = '/';
|
||||||
strcpyW( nameW.Buffer + len, name );
|
strcpyW( nameW.Buffer + len, name );
|
||||||
|
|
||||||
|
@ -201,7 +201,7 @@ HANDLE __wine_vxd_open( LPCWSTR filenameW, DWORD access, SECURITY_ATTRIBUTES *sa
|
||||||
|
|
||||||
/* normalize the filename */
|
/* normalize the filename */
|
||||||
|
|
||||||
if (strlenW( filenameW ) >= sizeof(name)/sizeof(WCHAR) - 4 ||
|
if (strlenW( filenameW ) >= ARRAY_SIZE(name) - 4 ||
|
||||||
strchrW( filenameW, '/' ) || strchrW( filenameW, '\\' ))
|
strchrW( filenameW, '/' ) || strchrW( filenameW, '\\' ))
|
||||||
{
|
{
|
||||||
SetLastError( ERROR_FILE_NOT_FOUND );
|
SetLastError( ERROR_FILE_NOT_FOUND );
|
||||||
|
|
Loading…
Reference in New Issue