Commit e84daed4 authored by Alexandre Julliard's avatar Alexandre Julliard

Avoid sizeof in traces.

parent 7645f321
...@@ -949,7 +949,7 @@ static void test_queryconfig2(void) ...@@ -949,7 +949,7 @@ static void test_queryconfig2(void)
pConfig->lpDescription = (LPSTR)0xdeadbeef; pConfig->lpDescription = (LPSTR)0xdeadbeef;
ret = pQueryServiceConfig2A(svc_handle, SERVICE_CONFIG_DESCRIPTION,buffer,sizeof(SERVICE_DESCRIPTIONA),&needed); ret = pQueryServiceConfig2A(svc_handle, SERVICE_CONFIG_DESCRIPTION,buffer,sizeof(SERVICE_DESCRIPTIONA),&needed);
ok(ret, "expected QueryServiceConfig2A to succeed\n"); ok(ret, "expected QueryServiceConfig2A to succeed\n");
ok(needed == sizeof(SERVICE_DESCRIPTIONA), "expected needed to be %d, got %d\n", sizeof(SERVICE_DESCRIPTIONA), needed); ok(needed == sizeof(SERVICE_DESCRIPTIONA), "got %d\n", needed);
ok(!pConfig->lpDescription, "expected lpDescription to be NULL, got %p\n", pConfig->lpDescription); ok(!pConfig->lpDescription, "expected lpDescription to be NULL, got %p\n", pConfig->lpDescription);
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
...@@ -957,7 +957,7 @@ static void test_queryconfig2(void) ...@@ -957,7 +957,7 @@ static void test_queryconfig2(void)
ret = pQueryServiceConfig2A(svc_handle, SERVICE_CONFIG_DESCRIPTION,NULL,0,&needed); ret = pQueryServiceConfig2A(svc_handle, SERVICE_CONFIG_DESCRIPTION,NULL,0,&needed);
ok(!ret, "expected QueryServiceConfig2A to fail\n"); ok(!ret, "expected QueryServiceConfig2A to fail\n");
ok(ERROR_INSUFFICIENT_BUFFER == GetLastError(), "expected error ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError()); ok(ERROR_INSUFFICIENT_BUFFER == GetLastError(), "expected error ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
ok(needed == sizeof(SERVICE_DESCRIPTIONA), "expected needed to be %d, got %d\n", sizeof(SERVICE_DESCRIPTIONA), needed); ok(needed == sizeof(SERVICE_DESCRIPTIONA), "got %d\n", needed);
if(!pChangeServiceConfig2A) if(!pChangeServiceConfig2A)
{ {
......
...@@ -284,7 +284,7 @@ static void test_ExpandEnvironmentStringsA(void) ...@@ -284,7 +284,7 @@ static void test_ExpandEnvironmentStringsA(void)
strcpy(buf, "Indirect-%IndirectVar%-Indirect"); strcpy(buf, "Indirect-%IndirectVar%-Indirect");
strcpy(buf2, "Indirect-Foo%EnvVar%Bar-Indirect"); strcpy(buf2, "Indirect-Foo%EnvVar%Bar-Indirect");
ret_size = ExpandEnvironmentStringsA(buf, buf1, sizeof(buf1)); ret_size = ExpandEnvironmentStringsA(buf, buf1, sizeof(buf1));
ok(ret_size == strlen(buf2)+1, "ExpandEnvironmentStrings returned %d instead of %d\n", ret_size, strlen(buf2)+1); ok(ret_size == strlen(buf2)+1, "ExpandEnvironmentStrings returned %d instead of %d\n", ret_size, lstrlen(buf2)+1);
ok(!strcmp(buf1, buf2), "ExpandEnvironmentStrings returned [%s]\n", buf1); ok(!strcmp(buf1, buf2), "ExpandEnvironmentStrings returned [%s]\n", buf1);
SetEnvironmentVariableA("IndirectVar", NULL); SetEnvironmentVariableA("IndirectVar", NULL);
......
...@@ -3185,9 +3185,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetSamplerState(IWineD3DDevice *iface, ...@@ -3185,9 +3185,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetSamplerState(IWineD3DDevice *iface,
} }
if (Sampler >= sizeof(This->stateBlock->samplerState)/sizeof(This->stateBlock->samplerState[0])) { if (Sampler >= sizeof(This->stateBlock->samplerState)/sizeof(This->stateBlock->samplerState[0])) {
ERR("Current Sampler overflows sampleState0 array (sampler %d vs size %d)\n", Sampler, ERR("Current Sampler overflows sampleState0 array (sampler %d)\n", Sampler);
sizeof(This->stateBlock->samplerState)/sizeof(This->stateBlock->samplerState[0])
);
return WINED3D_OK; /* Windows accepts overflowing this array ... we do not. */ return WINED3D_OK; /* Windows accepts overflowing this array ... we do not. */
} }
/** /**
...@@ -3236,9 +3234,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetSamplerState(IWineD3DDevice *iface, ...@@ -3236,9 +3234,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetSamplerState(IWineD3DDevice *iface,
} }
if (Sampler >= sizeof(This->stateBlock->samplerState)/sizeof(This->stateBlock->samplerState[0])) { if (Sampler >= sizeof(This->stateBlock->samplerState)/sizeof(This->stateBlock->samplerState[0])) {
ERR("Current Sampler overflows sampleState0 array (sampler %d vs size %d)\n", Sampler, ERR("Current Sampler overflows sampleState0 array (sampler %d)\n", Sampler);
sizeof(This->stateBlock->samplerState)/sizeof(This->stateBlock->samplerState[0])
);
return WINED3D_OK; /* Windows accepts overflowing this array ... we do not. */ return WINED3D_OK; /* Windows accepts overflowing this array ... we do not. */
} }
*Value = This->stateBlock->samplerState[Sampler][Type]; *Value = This->stateBlock->samplerState[Sampler][Type];
...@@ -4417,9 +4413,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetTexture(IWineD3DDevice *iface, DWORD ...@@ -4417,9 +4413,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetTexture(IWineD3DDevice *iface, DWORD
} }
if (Stage >= sizeof(This->stateBlock->textures)/sizeof(This->stateBlock->textures[0])) { if (Stage >= sizeof(This->stateBlock->textures)/sizeof(This->stateBlock->textures[0])) {
ERR("Current stage overflows textures array (stage %d vs size %d)\n", Stage, ERR("Current stage overflows textures array (stage %d)\n", Stage);
sizeof(This->stateBlock->textures)/sizeof(This->stateBlock->textures[0])
);
return WINED3D_OK; /* Windows accepts overflowing this array ... we do not. */ return WINED3D_OK; /* Windows accepts overflowing this array ... we do not. */
} }
...@@ -4516,9 +4510,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetTexture(IWineD3DDevice *iface, DWORD ...@@ -4516,9 +4510,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetTexture(IWineD3DDevice *iface, DWORD
} }
if (Stage >= sizeof(This->stateBlock->textures)/sizeof(This->stateBlock->textures[0])) { if (Stage >= sizeof(This->stateBlock->textures)/sizeof(This->stateBlock->textures[0])) {
ERR("Current stage overflows textures array (stage %d vs size %d)\n", Stage, ERR("Current stage overflows textures array (stage %d)\n", Stage);
sizeof(This->stateBlock->textures)/sizeof(This->stateBlock->textures[0])
);
return WINED3D_OK; /* Windows accepts overflowing this array ... we do not. */ return WINED3D_OK; /* Windows accepts overflowing this array ... we do not. */
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment