Wine-devel
Threads by month
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
March 2020
- 72 participants
- 969 discussions
17 Mar '20
Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com>
---
dlls/d3d8/tests/device.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c
index 1fe9864c52..ee72ca5e4c 100644
--- a/dlls/d3d8/tests/device.c
+++ b/dlls/d3d8/tests/device.c
@@ -6624,7 +6624,8 @@ static void test_update_volumetexture(void)
hr = IDirect3DDevice8_UpdateTexture(device, (IDirect3DBaseTexture8 *)src, (IDirect3DBaseTexture8 *)dst);
todo_wine_if (FAILED(hr))
- ok(SUCCEEDED(hr), "Failed to update texture, hr %#x, case %u.\n", hr, i);
+ ok(SUCCEEDED(hr) || broken(hr == E_FAIL && (i == 6 || i == 7)), /* Win10 1809 TestBots */
+ "Failed to update texture, hr %#x, case %u.\n", hr, i);
IDirect3DVolumeTexture8_Release(src);
IDirect3DVolumeTexture8_Release(dst);
--
2.20.1
3
2
Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com>
---
dlls/d3d8/tests/device.c | 233 +++++++++++++++++++++++----------------
1 file changed, 135 insertions(+), 98 deletions(-)
diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c
index 76e5c7389c..1fe9864c52 100644
--- a/dlls/d3d8/tests/device.c
+++ b/dlls/d3d8/tests/device.c
@@ -8845,6 +8845,8 @@ static void test_swapchain_multisample_reset(void)
static void test_device_caps(void)
{
+ unsigned int adapter_idx, adapter_count;
+ struct device_desc device_desc;
IDirect3DDevice8 *device;
IDirect3D8 *d3d;
ULONG refcount;
@@ -8855,106 +8857,141 @@ static void test_device_caps(void)
window = create_window();
d3d = Direct3DCreate8(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
- if (!(device = create_device(d3d, window, NULL)))
+
+ device_desc.device_window = window;
+ device_desc.width = 640;
+ device_desc.height = 480;
+ device_desc.flags = 0;
+
+ adapter_count = IDirect3D8_GetAdapterCount(d3d);
+ for (adapter_idx = 0; adapter_idx < adapter_count; ++adapter_idx)
{
- skip("Failed to create a D3D device.\n");
- IDirect3D8_Release(d3d);
- DestroyWindow(window);
- return;
+ /* Test IDirect3D8_GetDeviceCaps */
+ hr = IDirect3D8_GetDeviceCaps(d3d, adapter_idx, D3DDEVTYPE_HAL, &caps);
+ ok(hr == D3D_OK || hr == D3DERR_NOTAVAILABLE, "Adapter %u: GetDeviceCaps failed, hr %#x.\n",
+ adapter_idx, hr);
+ if (hr == D3DERR_NOTAVAILABLE)
+ {
+ skip("Adapter %u: No Direct3D support, skipping test.\n", adapter_idx);
+ break;
+ }
+ ok(caps.AdapterOrdinal == adapter_idx, "Adapter %u: Got unexpected adapter ordinal %u.\n",
+ adapter_idx, caps.AdapterOrdinal);
+
+ /* Test IDirect3DDevice8_GetDeviceCaps */
+ device_desc.adapter_ordinal = adapter_idx;
+ device = create_device(d3d, window, &device_desc);
+ ok(!!device, "Adapter %u: Failed to create a D3D device.\n", adapter_idx);
+ hr = IDirect3DDevice8_GetDeviceCaps(device, &caps);
+ ok(SUCCEEDED(hr), "Adapter %u: Failed to get caps, hr %#x.\n", adapter_idx, hr);
+
+ ok(caps.AdapterOrdinal == adapter_idx, "Adapter %u: Got unexpected adapter ordinal %u.\n",
+ adapter_idx, caps.AdapterOrdinal);
+ ok(!(caps.Caps & ~D3DCAPS_READ_SCANLINE),
+ "Adapter %u: Caps field has unexpected flags %#x.\n", adapter_idx, caps.Caps);
+ ok(!(caps.Caps2 & ~(D3DCAPS2_CANCALIBRATEGAMMA | D3DCAPS2_CANRENDERWINDOWED
+ | D3DCAPS2_CANMANAGERESOURCE | D3DCAPS2_DYNAMICTEXTURES | D3DCAPS2_FULLSCREENGAMMA
+ | D3DCAPS2_NO2DDURING3DSCENE | D3DCAPS2_RESERVED)),
+ "Adapter %u: Caps2 field has unexpected flags %#x.\n", adapter_idx, caps.Caps2);
+ /* Nvidia returns that 0x400 flag, which is probably Vista+
+ * D3DCAPS3_DXVAHD from d3d9caps.h */
+ /* AMD doesn't filter all the ddraw / d3d9 caps. Consider that behavior
+ * broken. */
+ ok(!(caps.Caps3 & ~(D3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD | D3DCAPS3_RESERVED | 0x400))
+ || broken(!(caps.Caps3 & ~(D3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD | 0x80))),
+ "Adapter %u: Caps3 field has unexpected flags %#x.\n", adapter_idx, caps.Caps3);
+ ok(!(caps.PrimitiveMiscCaps & ~(D3DPMISCCAPS_MASKZ | D3DPMISCCAPS_LINEPATTERNREP
+ | D3DPMISCCAPS_CULLNONE | D3DPMISCCAPS_CULLCW | D3DPMISCCAPS_CULLCCW
+ | D3DPMISCCAPS_COLORWRITEENABLE | D3DPMISCCAPS_CLIPPLANESCALEDPOINTS
+ | D3DPMISCCAPS_CLIPTLVERTS | D3DPMISCCAPS_TSSARGTEMP | D3DPMISCCAPS_BLENDOP
+ | D3DPMISCCAPS_NULLREFERENCE))
+ || broken(!(caps.PrimitiveMiscCaps & ~0x003fdff6)),
+ "Adapter %u: PrimitiveMiscCaps field has unexpected flags %#x.\n", adapter_idx,
+ caps.PrimitiveMiscCaps);
+ /* AMD includes an unknown 0x2 flag. */
+ ok(!(caps.RasterCaps & ~(D3DPRASTERCAPS_DITHER | D3DPRASTERCAPS_PAT | D3DPRASTERCAPS_ZTEST
+ | D3DPRASTERCAPS_FOGVERTEX | D3DPRASTERCAPS_FOGTABLE | D3DPRASTERCAPS_ANTIALIASEDGES
+ | D3DPRASTERCAPS_MIPMAPLODBIAS | D3DPRASTERCAPS_ZBIAS | D3DPRASTERCAPS_ZBUFFERLESSHSR
+ | D3DPRASTERCAPS_FOGRANGE | D3DPRASTERCAPS_ANISOTROPY | D3DPRASTERCAPS_WBUFFER
+ | D3DPRASTERCAPS_WFOG | D3DPRASTERCAPS_ZFOG | D3DPRASTERCAPS_COLORPERSPECTIVE
+ | D3DPRASTERCAPS_STRETCHBLTMULTISAMPLE))
+ || broken(!(caps.RasterCaps & ~0x0ff7f19b)),
+ "Adapter %u: RasterCaps field has unexpected flags %#x.\n", adapter_idx,
+ caps.RasterCaps);
+ ok(!(caps.SrcBlendCaps & ~(D3DPBLENDCAPS_ZERO | D3DPBLENDCAPS_ONE | D3DPBLENDCAPS_SRCCOLOR
+ | D3DPBLENDCAPS_INVSRCCOLOR | D3DPBLENDCAPS_SRCALPHA | D3DPBLENDCAPS_INVSRCALPHA
+ | D3DPBLENDCAPS_DESTALPHA | D3DPBLENDCAPS_INVDESTALPHA | D3DPBLENDCAPS_DESTCOLOR
+ | D3DPBLENDCAPS_INVDESTCOLOR | D3DPBLENDCAPS_SRCALPHASAT | D3DPBLENDCAPS_BOTHSRCALPHA
+ | D3DPBLENDCAPS_BOTHINVSRCALPHA)),
+ "Adapter %u: SrcBlendCaps field has unexpected flags %#x.\n", adapter_idx,
+ caps.SrcBlendCaps);
+ ok(!(caps.DestBlendCaps & ~(D3DPBLENDCAPS_ZERO | D3DPBLENDCAPS_ONE | D3DPBLENDCAPS_SRCCOLOR
+ | D3DPBLENDCAPS_INVSRCCOLOR | D3DPBLENDCAPS_SRCALPHA | D3DPBLENDCAPS_INVSRCALPHA
+ | D3DPBLENDCAPS_DESTALPHA | D3DPBLENDCAPS_INVDESTALPHA | D3DPBLENDCAPS_DESTCOLOR
+ | D3DPBLENDCAPS_INVDESTCOLOR | D3DPBLENDCAPS_SRCALPHASAT | D3DPBLENDCAPS_BOTHSRCALPHA
+ | D3DPBLENDCAPS_BOTHINVSRCALPHA)),
+ "Adapter %u: DestBlendCaps field has unexpected flags %#x.\n", adapter_idx,
+ caps.DestBlendCaps);
+ ok(!(caps.TextureCaps & ~(D3DPTEXTURECAPS_PERSPECTIVE | D3DPTEXTURECAPS_POW2
+ | D3DPTEXTURECAPS_ALPHA | D3DPTEXTURECAPS_SQUAREONLY
+ | D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE | D3DPTEXTURECAPS_ALPHAPALETTE
+ | D3DPTEXTURECAPS_NONPOW2CONDITIONAL | D3DPTEXTURECAPS_PROJECTED
+ | D3DPTEXTURECAPS_CUBEMAP | D3DPTEXTURECAPS_VOLUMEMAP | D3DPTEXTURECAPS_MIPMAP
+ | D3DPTEXTURECAPS_MIPVOLUMEMAP | D3DPTEXTURECAPS_MIPCUBEMAP
+ | D3DPTEXTURECAPS_CUBEMAP_POW2 | D3DPTEXTURECAPS_VOLUMEMAP_POW2)),
+ "Adapter %u: TextureCaps field has unexpected flags %#x.\n", adapter_idx,
+ caps.TextureCaps);
+ ok(!(caps.TextureFilterCaps & ~(D3DPTFILTERCAPS_MINFPOINT | D3DPTFILTERCAPS_MINFLINEAR
+ | D3DPTFILTERCAPS_MINFANISOTROPIC | D3DPTFILTERCAPS_MIPFPOINT
+ | D3DPTFILTERCAPS_MIPFLINEAR | D3DPTFILTERCAPS_MAGFPOINT | D3DPTFILTERCAPS_MAGFLINEAR
+ | D3DPTFILTERCAPS_MAGFANISOTROPIC | D3DPTFILTERCAPS_MAGFAFLATCUBIC
+ | D3DPTFILTERCAPS_MAGFGAUSSIANCUBIC))
+ || broken(!(caps.TextureFilterCaps & ~0x0703073f)),
+ "Adapter %u: TextureFilterCaps field has unexpected flags %#x.\n", adapter_idx,
+ caps.TextureFilterCaps);
+ ok(!(caps.CubeTextureFilterCaps & ~(D3DPTFILTERCAPS_MINFPOINT | D3DPTFILTERCAPS_MINFLINEAR
+ | D3DPTFILTERCAPS_MINFANISOTROPIC | D3DPTFILTERCAPS_MIPFPOINT
+ | D3DPTFILTERCAPS_MIPFLINEAR | D3DPTFILTERCAPS_MAGFPOINT | D3DPTFILTERCAPS_MAGFLINEAR
+ | D3DPTFILTERCAPS_MAGFANISOTROPIC | D3DPTFILTERCAPS_MAGFAFLATCUBIC
+ | D3DPTFILTERCAPS_MAGFGAUSSIANCUBIC)),
+ "Adapter %u: CubeTextureFilterCaps field has unexpected flags %#x.\n", adapter_idx,
+ caps.CubeTextureFilterCaps);
+ ok(!(caps.VolumeTextureFilterCaps & ~(D3DPTFILTERCAPS_MINFPOINT | D3DPTFILTERCAPS_MINFLINEAR
+ | D3DPTFILTERCAPS_MINFANISOTROPIC | D3DPTFILTERCAPS_MIPFPOINT
+ | D3DPTFILTERCAPS_MIPFLINEAR | D3DPTFILTERCAPS_MAGFPOINT | D3DPTFILTERCAPS_MAGFLINEAR
+ | D3DPTFILTERCAPS_MAGFANISOTROPIC | D3DPTFILTERCAPS_MAGFAFLATCUBIC
+ | D3DPTFILTERCAPS_MAGFGAUSSIANCUBIC)),
+ "Adapter %u: VolumeTextureFilterCaps field has unexpected flags %#x.\n",
+ adapter_idx, caps.VolumeTextureFilterCaps);
+ ok(!(caps.LineCaps & ~(D3DLINECAPS_TEXTURE | D3DLINECAPS_ZTEST | D3DLINECAPS_BLEND
+ | D3DLINECAPS_ALPHACMP | D3DLINECAPS_FOG)),
+ "Adapter %u: LineCaps field has unexpected flags %#x.\n", adapter_idx,
+ caps.LineCaps);
+ ok(!(caps.StencilCaps & ~(D3DSTENCILCAPS_KEEP | D3DSTENCILCAPS_ZERO | D3DSTENCILCAPS_REPLACE
+ | D3DSTENCILCAPS_INCRSAT | D3DSTENCILCAPS_DECRSAT | D3DSTENCILCAPS_INVERT
+ | D3DSTENCILCAPS_INCR | D3DSTENCILCAPS_DECR)),
+ "Adapter %u: StencilCaps field has unexpected flags %#x.\n", adapter_idx,
+ caps.StencilCaps);
+ ok(!(caps.VertexProcessingCaps & ~(D3DVTXPCAPS_TEXGEN | D3DVTXPCAPS_MATERIALSOURCE7
+ | D3DVTXPCAPS_DIRECTIONALLIGHTS | D3DVTXPCAPS_POSITIONALLIGHTS | D3DVTXPCAPS_LOCALVIEWER
+ | D3DVTXPCAPS_TWEENING | D3DVTXPCAPS_NO_VSDT_UBYTE4)),
+ "Adapter %u: VertexProcessingCaps field has unexpected flags %#x.\n", adapter_idx,
+ caps.VertexProcessingCaps);
+ /* Both Nvidia and AMD give 10 here. */
+ ok(caps.MaxActiveLights <= 10,
+ "Adapter %u: MaxActiveLights field has unexpected value %u.\n", adapter_idx,
+ caps.MaxActiveLights);
+ /* AMD gives 6, Nvidia returns 8. */
+ ok(caps.MaxUserClipPlanes <= 8,
+ "Adapter %u: MaxUserClipPlanes field has unexpected value %u.\n", adapter_idx,
+ caps.MaxUserClipPlanes);
+ ok(caps.MaxVertexW == 0.0f || caps.MaxVertexW >= 1e10f,
+ "Adapter %u: MaxVertexW field has unexpected value %.8e.\n", adapter_idx,
+ caps.MaxVertexW);
+
+ refcount = IDirect3DDevice8_Release(device);
+ ok(!refcount, "Adapter %u: Device has %u references left.\n", adapter_idx, refcount);
}
-
- hr = IDirect3DDevice8_GetDeviceCaps(device, &caps);
- ok(SUCCEEDED(hr), "Failed to get caps, hr %#x.\n", hr);
-
- ok(!(caps.Caps & ~D3DCAPS_READ_SCANLINE), "Caps field has unexpected flags %#x.\n", caps.Caps);
- ok(!(caps.Caps2 & ~(D3DCAPS2_CANCALIBRATEGAMMA | D3DCAPS2_CANRENDERWINDOWED
- | D3DCAPS2_CANMANAGERESOURCE | D3DCAPS2_DYNAMICTEXTURES | D3DCAPS2_FULLSCREENGAMMA
- | D3DCAPS2_NO2DDURING3DSCENE | D3DCAPS2_RESERVED)),
- "Caps2 field has unexpected flags %#x.\n", caps.Caps2);
- /* Nvidia returns that 0x400 flag, which is probably Vista+
- * D3DCAPS3_DXVAHD from d3d9caps.h */
- /* AMD doesn't filter all the ddraw / d3d9 caps. Consider that behavior
- * broken. */
- ok(!(caps.Caps3 & ~(D3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD | D3DCAPS3_RESERVED | 0x400))
- || broken(!(caps.Caps3 & ~(D3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD | 0x80))),
- "Caps3 field has unexpected flags %#x.\n", caps.Caps3);
- ok(!(caps.PrimitiveMiscCaps & ~(D3DPMISCCAPS_MASKZ | D3DPMISCCAPS_LINEPATTERNREP
- | D3DPMISCCAPS_CULLNONE | D3DPMISCCAPS_CULLCW | D3DPMISCCAPS_CULLCCW
- | D3DPMISCCAPS_COLORWRITEENABLE | D3DPMISCCAPS_CLIPPLANESCALEDPOINTS
- | D3DPMISCCAPS_CLIPTLVERTS | D3DPMISCCAPS_TSSARGTEMP | D3DPMISCCAPS_BLENDOP
- | D3DPMISCCAPS_NULLREFERENCE))
- || broken(!(caps.PrimitiveMiscCaps & ~0x003fdff6)),
- "PrimitiveMiscCaps field has unexpected flags %#x.\n", caps.PrimitiveMiscCaps);
- /* AMD includes an unknown 0x2 flag. */
- ok(!(caps.RasterCaps & ~(D3DPRASTERCAPS_DITHER | D3DPRASTERCAPS_PAT | D3DPRASTERCAPS_ZTEST
- | D3DPRASTERCAPS_FOGVERTEX | D3DPRASTERCAPS_FOGTABLE | D3DPRASTERCAPS_ANTIALIASEDGES
- | D3DPRASTERCAPS_MIPMAPLODBIAS | D3DPRASTERCAPS_ZBIAS | D3DPRASTERCAPS_ZBUFFERLESSHSR
- | D3DPRASTERCAPS_FOGRANGE | D3DPRASTERCAPS_ANISOTROPY | D3DPRASTERCAPS_WBUFFER
- | D3DPRASTERCAPS_WFOG | D3DPRASTERCAPS_ZFOG | D3DPRASTERCAPS_COLORPERSPECTIVE
- | D3DPRASTERCAPS_STRETCHBLTMULTISAMPLE))
- || broken(!(caps.RasterCaps & ~0x0ff7f19b)),
- "RasterCaps field has unexpected flags %#x.\n", caps.RasterCaps);
- ok(!(caps.SrcBlendCaps & ~(D3DPBLENDCAPS_ZERO | D3DPBLENDCAPS_ONE | D3DPBLENDCAPS_SRCCOLOR
- | D3DPBLENDCAPS_INVSRCCOLOR | D3DPBLENDCAPS_SRCALPHA | D3DPBLENDCAPS_INVSRCALPHA
- | D3DPBLENDCAPS_DESTALPHA | D3DPBLENDCAPS_INVDESTALPHA | D3DPBLENDCAPS_DESTCOLOR
- | D3DPBLENDCAPS_INVDESTCOLOR | D3DPBLENDCAPS_SRCALPHASAT | D3DPBLENDCAPS_BOTHSRCALPHA
- | D3DPBLENDCAPS_BOTHINVSRCALPHA)),
- "SrcBlendCaps field has unexpected flags %#x.\n", caps.SrcBlendCaps);
- ok(!(caps.DestBlendCaps & ~(D3DPBLENDCAPS_ZERO | D3DPBLENDCAPS_ONE | D3DPBLENDCAPS_SRCCOLOR
- | D3DPBLENDCAPS_INVSRCCOLOR | D3DPBLENDCAPS_SRCALPHA | D3DPBLENDCAPS_INVSRCALPHA
- | D3DPBLENDCAPS_DESTALPHA | D3DPBLENDCAPS_INVDESTALPHA | D3DPBLENDCAPS_DESTCOLOR
- | D3DPBLENDCAPS_INVDESTCOLOR | D3DPBLENDCAPS_SRCALPHASAT | D3DPBLENDCAPS_BOTHSRCALPHA
- | D3DPBLENDCAPS_BOTHINVSRCALPHA)),
- "DestBlendCaps field has unexpected flags %#x.\n", caps.DestBlendCaps);
- ok(!(caps.TextureCaps & ~(D3DPTEXTURECAPS_PERSPECTIVE | D3DPTEXTURECAPS_POW2
- | D3DPTEXTURECAPS_ALPHA | D3DPTEXTURECAPS_SQUAREONLY
- | D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE | D3DPTEXTURECAPS_ALPHAPALETTE
- | D3DPTEXTURECAPS_NONPOW2CONDITIONAL | D3DPTEXTURECAPS_PROJECTED
- | D3DPTEXTURECAPS_CUBEMAP | D3DPTEXTURECAPS_VOLUMEMAP | D3DPTEXTURECAPS_MIPMAP
- | D3DPTEXTURECAPS_MIPVOLUMEMAP | D3DPTEXTURECAPS_MIPCUBEMAP
- | D3DPTEXTURECAPS_CUBEMAP_POW2 | D3DPTEXTURECAPS_VOLUMEMAP_POW2)),
- "TextureCaps field has unexpected flags %#x.\n", caps.TextureCaps);
- ok(!(caps.TextureFilterCaps & ~(D3DPTFILTERCAPS_MINFPOINT | D3DPTFILTERCAPS_MINFLINEAR
- | D3DPTFILTERCAPS_MINFANISOTROPIC | D3DPTFILTERCAPS_MIPFPOINT
- | D3DPTFILTERCAPS_MIPFLINEAR | D3DPTFILTERCAPS_MAGFPOINT | D3DPTFILTERCAPS_MAGFLINEAR
- | D3DPTFILTERCAPS_MAGFANISOTROPIC | D3DPTFILTERCAPS_MAGFAFLATCUBIC
- | D3DPTFILTERCAPS_MAGFGAUSSIANCUBIC))
- || broken(!(caps.TextureFilterCaps & ~0x0703073f)),
- "TextureFilterCaps field has unexpected flags %#x.\n", caps.TextureFilterCaps);
- ok(!(caps.CubeTextureFilterCaps & ~(D3DPTFILTERCAPS_MINFPOINT | D3DPTFILTERCAPS_MINFLINEAR
- | D3DPTFILTERCAPS_MINFANISOTROPIC | D3DPTFILTERCAPS_MIPFPOINT
- | D3DPTFILTERCAPS_MIPFLINEAR | D3DPTFILTERCAPS_MAGFPOINT | D3DPTFILTERCAPS_MAGFLINEAR
- | D3DPTFILTERCAPS_MAGFANISOTROPIC | D3DPTFILTERCAPS_MAGFAFLATCUBIC
- | D3DPTFILTERCAPS_MAGFGAUSSIANCUBIC)),
- "CubeTextureFilterCaps field has unexpected flags %#x.\n", caps.CubeTextureFilterCaps);
- ok(!(caps.VolumeTextureFilterCaps & ~(D3DPTFILTERCAPS_MINFPOINT | D3DPTFILTERCAPS_MINFLINEAR
- | D3DPTFILTERCAPS_MINFANISOTROPIC | D3DPTFILTERCAPS_MIPFPOINT
- | D3DPTFILTERCAPS_MIPFLINEAR | D3DPTFILTERCAPS_MAGFPOINT | D3DPTFILTERCAPS_MAGFLINEAR
- | D3DPTFILTERCAPS_MAGFANISOTROPIC | D3DPTFILTERCAPS_MAGFAFLATCUBIC
- | D3DPTFILTERCAPS_MAGFGAUSSIANCUBIC)),
- "VolumeTextureFilterCaps field has unexpected flags %#x.\n", caps.VolumeTextureFilterCaps);
- ok(!(caps.LineCaps & ~(D3DLINECAPS_TEXTURE | D3DLINECAPS_ZTEST | D3DLINECAPS_BLEND
- | D3DLINECAPS_ALPHACMP | D3DLINECAPS_FOG)),
- "LineCaps field has unexpected flags %#x.\n", caps.LineCaps);
- ok(!(caps.StencilCaps & ~(D3DSTENCILCAPS_KEEP | D3DSTENCILCAPS_ZERO | D3DSTENCILCAPS_REPLACE
- | D3DSTENCILCAPS_INCRSAT | D3DSTENCILCAPS_DECRSAT | D3DSTENCILCAPS_INVERT
- | D3DSTENCILCAPS_INCR | D3DSTENCILCAPS_DECR)),
- "StencilCaps field has unexpected flags %#x.\n", caps.StencilCaps);
- ok(!(caps.VertexProcessingCaps & ~(D3DVTXPCAPS_TEXGEN | D3DVTXPCAPS_MATERIALSOURCE7
- | D3DVTXPCAPS_DIRECTIONALLIGHTS | D3DVTXPCAPS_POSITIONALLIGHTS | D3DVTXPCAPS_LOCALVIEWER
- | D3DVTXPCAPS_TWEENING | D3DVTXPCAPS_NO_VSDT_UBYTE4)),
- "VertexProcessingCaps field has unexpected flags %#x.\n", caps.VertexProcessingCaps);
- /* Both Nvidia and AMD give 10 here. */
- ok(caps.MaxActiveLights <= 10,
- "MaxActiveLights field has unexpected value %u.\n", caps.MaxActiveLights);
- /* AMD gives 6, Nvidia returns 8. */
- ok(caps.MaxUserClipPlanes <= 8,
- "MaxUserClipPlanes field has unexpected value %u.\n", caps.MaxUserClipPlanes);
- ok(caps.MaxVertexW == 0.0f || caps.MaxVertexW >= 1e10f,
- "MaxVertexW field has unexpected value %.8e.\n", caps.MaxVertexW);
-
- refcount = IDirect3DDevice8_Release(device);
- ok(!refcount, "Device has %u references left.\n", refcount);
IDirect3D8_Release(d3d);
DestroyWindow(window);
}
--
2.20.1
3
2
[PATCH 2/6] d3d9/tests: Support creating a device with the specified adapter.
by Zhiyi Zhang 17 Mar '20
by Zhiyi Zhang 17 Mar '20
17 Mar '20
Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com>
---
dlls/d3d9/tests/device.c | 29 ++++++++++++++++++++++++++---
1 file changed, 26 insertions(+), 3 deletions(-)
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index d00a26b942..49280ef869 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -42,6 +42,7 @@ struct vec3
struct device_desc
{
+ unsigned int adapter_ordinal;
HWND device_window;
unsigned int width;
unsigned int height;
@@ -153,9 +154,11 @@ static BOOL adapter_is_warp(const D3DADAPTER_IDENTIFIER9 *identifier)
static IDirect3DDevice9 *create_device(IDirect3D9 *d3d9, HWND focus_window, const struct device_desc *desc)
{
D3DPRESENT_PARAMETERS present_parameters = {0};
+ unsigned int adapter_ordinal;
IDirect3DDevice9 *device;
DWORD behavior_flags = D3DCREATE_HARDWARE_VERTEXPROCESSING;
+ adapter_ordinal = D3DADAPTER_DEFAULT;
present_parameters.BackBufferWidth = 640;
present_parameters.BackBufferHeight = 480;
present_parameters.BackBufferFormat = D3DFMT_A8R8G8B8;
@@ -167,6 +170,7 @@ static IDirect3DDevice9 *create_device(IDirect3D9 *d3d9, HWND focus_window, cons
if (desc)
{
+ adapter_ordinal = desc->adapter_ordinal;
present_parameters.BackBufferWidth = desc->width;
present_parameters.BackBufferHeight = desc->height;
if (desc->flags & CREATE_DEVICE_UNKNOWN_BACKBUFFER_FORMAT)
@@ -185,12 +189,12 @@ static IDirect3DDevice9 *create_device(IDirect3D9 *d3d9, HWND focus_window, cons
behavior_flags |= D3DCREATE_FPU_PRESERVE;
}
- if (SUCCEEDED(IDirect3D9_CreateDevice(d3d9, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, focus_window,
+ if (SUCCEEDED(IDirect3D9_CreateDevice(d3d9, adapter_ordinal, D3DDEVTYPE_HAL, focus_window,
behavior_flags, &present_parameters, &device)))
return device;
present_parameters.AutoDepthStencilFormat = D3DFMT_D16;
- if (SUCCEEDED(IDirect3D9_CreateDevice(d3d9, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, focus_window,
+ if (SUCCEEDED(IDirect3D9_CreateDevice(d3d9, adapter_ordinal, D3DDEVTYPE_HAL, focus_window,
behavior_flags, &present_parameters, &device)))
return device;
@@ -200,7 +204,7 @@ static IDirect3DDevice9 *create_device(IDirect3D9 *d3d9, HWND focus_window, cons
& ~(D3DCREATE_MIXED_VERTEXPROCESSING | D3DCREATE_SOFTWARE_VERTEXPROCESSING))
| D3DCREATE_HARDWARE_VERTEXPROCESSING;
- if (SUCCEEDED(IDirect3D9_CreateDevice(d3d9, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, focus_window,
+ if (SUCCEEDED(IDirect3D9_CreateDevice(d3d9, adapter_ordinal, D3DDEVTYPE_HAL, focus_window,
behavior_flags, &present_parameters, &device)))
return device;
@@ -1895,6 +1899,7 @@ static void test_reset(void)
i = 0;
if (modes[i].w == orig_width && modes[i].h == orig_height) ++i;
+ device_desc.adapter_ordinal = D3DADAPTER_DEFAULT;
device_desc.width = modes[i].w;
device_desc.height = modes[i].h;
device_desc.device_window = hwnd;
@@ -3429,6 +3434,7 @@ static void test_scissor_size(void)
scts[i].backy = registry_mode.dmPelsHeight;
}
+ device_desc.adapter_ordinal = D3DADAPTER_DEFAULT;
device_desc.device_window = hwnd;
device_desc.width = scts[i].backx;
device_desc.height = scts[i].backy;
@@ -3942,6 +3948,7 @@ static void test_wndproc(void)
expect_messages = create_messages;
+ device_desc.adapter_ordinal = D3DADAPTER_DEFAULT;
device_desc.device_window = device_window;
device_desc.width = d3d_width;
device_desc.height = d3d_height;
@@ -4382,6 +4389,7 @@ static void test_wndproc_windowed(void)
filter_messages = focus_window;
+ device_desc.adapter_ordinal = D3DADAPTER_DEFAULT;
device_desc.device_window = device_window;
device_desc.width = 640;
device_desc.height = 480;
@@ -4711,6 +4719,7 @@ static void test_fpu_setup(void)
d3d9 = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d9, "Failed to create a D3D object.\n");
+ device_desc.adapter_ordinal = D3DADAPTER_DEFAULT;
device_desc.device_window = window;
device_desc.width = 640;
device_desc.height = 480;
@@ -4845,6 +4854,7 @@ static void test_window_style(void)
GetWindowRect(focus_window, &focus_rect);
GetWindowRect(device_window, &device_rect);
+ device_desc.adapter_ordinal = D3DADAPTER_DEFAULT;
device_desc.device_window = device_window;
device_desc.width = registry_mode.dmPelsWidth;
device_desc.height = registry_mode.dmPelsHeight;
@@ -5155,6 +5165,7 @@ static void test_mode_change(void)
SetRect(&d3d_rect, 0, 0, d3d_width, d3d_height);
GetWindowRect(focus_window, &focus_rect);
+ device_desc.adapter_ordinal = D3DADAPTER_DEFAULT;
device_desc.device_window = device_window;
device_desc.width = d3d_width;
device_desc.height = d3d_height;
@@ -5210,6 +5221,7 @@ static void test_mode_change(void)
/* The mode restore also happens when the device was created at the original screen size. */
+ device_desc.adapter_ordinal = D3DADAPTER_DEFAULT;
device_desc.device_window = device_window;
device_desc.width = registry_mode.dmPelsWidth;
device_desc.height = registry_mode.dmPelsHeight;
@@ -5269,6 +5281,7 @@ static void test_device_window_reset(void)
ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n",
(LONG_PTR)test_proc, proc);
+ device_desc.adapter_ordinal = D3DADAPTER_DEFAULT;
device_desc.device_window = NULL;
device_desc.width = registry_mode.dmPelsWidth;
device_desc.height = registry_mode.dmPelsHeight;
@@ -5877,6 +5890,7 @@ static void test_occlusion_query(void)
window = create_window();
d3d9 = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d9, "Failed to create a D3D object.\n");
+ device_desc.adapter_ordinal = D3DADAPTER_DEFAULT;
device_desc.device_window = window;
device_desc.width = registry_mode.dmPelsWidth;
device_desc.height = registry_mode.dmPelsHeight;
@@ -6394,6 +6408,7 @@ static void test_vertex_shader_constant(void)
refcount = IDirect3DDevice9_Release(device);
ok(!refcount, "Device has %u references left.\n", refcount);
+ desc.adapter_ordinal = D3DADAPTER_DEFAULT;
desc.device_window = window;
desc.width = 640;
desc.height = 480;
@@ -6891,6 +6906,7 @@ float4 main(const float4 color : COLOR) : SV_TARGET
refcount = IDirect3DDevice9_Release(device);
ok(!refcount, "Device has %u references left.\n", refcount);
+ desc.adapter_ordinal = D3DADAPTER_DEFAULT;
desc.device_window = window;
desc.width = 640;
desc.height = 480;
@@ -8606,6 +8622,7 @@ static void test_getdc(void)
ok(!refcount, "Device has %u references left.\n", refcount);
/* Backbuffer created with D3DFMT_UNKNOWN format. */
+ device_desc.adapter_ordinal = D3DADAPTER_DEFAULT;
device_desc.width = 640;
device_desc.height = 480;
device_desc.device_window = window;
@@ -9321,6 +9338,7 @@ static void test_pinned_buffers(void)
for (test = 0; test < ARRAY_SIZE(tests); ++test)
{
+ device_desc.adapter_ordinal = D3DADAPTER_DEFAULT;
device_desc.device_window = window;
device_desc.width = 640;
device_desc.height = 480;
@@ -11276,6 +11294,7 @@ static void test_lost_device(void)
window = create_window();
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
+ device_desc.adapter_ordinal = D3DADAPTER_DEFAULT;
device_desc.device_window = window;
device_desc.width = registry_mode.dmPelsWidth;
device_desc.height = registry_mode.dmPelsHeight;
@@ -12218,6 +12237,7 @@ static void test_lockable_backbuffer(void)
refcount = IDirect3DDevice9_Release(device);
ok(!refcount, "Device has %u references left.\n", refcount);
+ device_desc.adapter_ordinal = D3DADAPTER_DEFAULT;
device_desc.width = 640;
device_desc.height = 480;
device_desc.device_window = window;
@@ -12261,6 +12281,7 @@ static void test_clip_planes_limits(void)
for (i = 0; i < ARRAY_SIZE(device_flags); ++i)
{
+ desc.adapter_ordinal = D3DADAPTER_DEFAULT;
desc.device_window = window;
desc.width = 640;
desc.height = 480;
@@ -12795,6 +12816,7 @@ static void test_resource_access(void)
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
+ device_desc.adapter_ordinal = D3DADAPTER_DEFAULT;
device_desc.device_window = window;
device_desc.width = 16;
device_desc.height = 16;
@@ -13370,6 +13392,7 @@ static void test_get_display_mode(void)
refcount = IDirect3DDevice9_Release(device);
ok(!refcount, "Device has %u references left.\n", refcount);
+ desc.adapter_ordinal = D3DADAPTER_DEFAULT;
desc.device_window = window;
desc.width = 640;
desc.height = 480;
--
2.20.1
3
2
[PATCH 1/6] d3d8/tests: Support creating a device with the specified adapter.
by Zhiyi Zhang 17 Mar '20
by Zhiyi Zhang 17 Mar '20
17 Mar '20
Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com>
---
dlls/d3d8/tests/device.c | 24 +++++++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)
diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c
index 008395df1a..76e5c7389c 100644
--- a/dlls/d3d8/tests/device.c
+++ b/dlls/d3d8/tests/device.c
@@ -41,6 +41,7 @@ struct vec3
struct device_desc
{
+ unsigned int adapter_ordinal;
HWND device_window;
unsigned int width;
unsigned int height;
@@ -109,9 +110,11 @@ static BOOL adapter_is_warp(const D3DADAPTER_IDENTIFIER8 *identifier)
static IDirect3DDevice8 *create_device(IDirect3D8 *d3d8, HWND focus_window, const struct device_desc *desc)
{
D3DPRESENT_PARAMETERS present_parameters = {0};
+ unsigned int adapter_ordinal;
IDirect3DDevice8 *device;
DWORD behavior_flags = D3DCREATE_HARDWARE_VERTEXPROCESSING;
+ adapter_ordinal = D3DADAPTER_DEFAULT;
present_parameters.BackBufferWidth = 640;
present_parameters.BackBufferHeight = 480;
present_parameters.BackBufferFormat = D3DFMT_A8R8G8B8;
@@ -123,6 +126,7 @@ static IDirect3DDevice8 *create_device(IDirect3D8 *d3d8, HWND focus_window, cons
if (desc)
{
+ adapter_ordinal = desc->adapter_ordinal;
present_parameters.BackBufferWidth = desc->width;
present_parameters.BackBufferHeight = desc->height;
present_parameters.hDeviceWindow = desc->device_window;
@@ -135,12 +139,12 @@ static IDirect3DDevice8 *create_device(IDirect3D8 *d3d8, HWND focus_window, cons
behavior_flags |= D3DCREATE_FPU_PRESERVE;
}
- if (SUCCEEDED(IDirect3D8_CreateDevice(d3d8, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, focus_window,
+ if (SUCCEEDED(IDirect3D8_CreateDevice(d3d8, adapter_ordinal, D3DDEVTYPE_HAL, focus_window,
behavior_flags, &present_parameters, &device)))
return device;
present_parameters.AutoDepthStencilFormat = D3DFMT_D16;
- if (SUCCEEDED(IDirect3D8_CreateDevice(d3d8, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, focus_window,
+ if (SUCCEEDED(IDirect3D8_CreateDevice(d3d8, adapter_ordinal, D3DDEVTYPE_HAL, focus_window,
behavior_flags, &present_parameters, &device)))
return device;
@@ -148,7 +152,7 @@ static IDirect3DDevice8 *create_device(IDirect3D8 *d3d8, HWND focus_window, cons
return NULL;
behavior_flags ^= (D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_SOFTWARE_VERTEXPROCESSING);
- if (SUCCEEDED(IDirect3D8_CreateDevice(d3d8, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, focus_window,
+ if (SUCCEEDED(IDirect3D8_CreateDevice(d3d8, adapter_ordinal, D3DDEVTYPE_HAL, focus_window,
behavior_flags, &present_parameters, &device)))
return device;
@@ -1390,6 +1394,7 @@ static void test_reset(void)
i = 0;
if (modes[i].w == orig_width && modes[i].h == orig_height) ++i;
+ device_desc.adapter_ordinal = D3DADAPTER_DEFAULT;
device_desc.width = modes[i].w;
device_desc.height = modes[i].h;
device_desc.device_window = window;
@@ -2905,6 +2910,7 @@ static void test_wndproc(void)
expect_messages = create_messages;
+ device_desc.adapter_ordinal = D3DADAPTER_DEFAULT;
device_desc.device_window = device_window;
device_desc.width = d3d_width;
device_desc.height = d3d_height;
@@ -3311,6 +3317,7 @@ static void test_wndproc_windowed(void)
filter_messages = focus_window;
+ device_desc.adapter_ordinal = D3DADAPTER_DEFAULT;
device_desc.device_window = device_window;
device_desc.width = registry_mode.dmPelsWidth;
device_desc.height = registry_mode.dmPelsHeight;
@@ -3543,6 +3550,7 @@ static void test_fpu_setup(void)
hr = IDirect3D8_GetAdapterDisplayMode(d3d8, D3DADAPTER_DEFAULT, &d3ddm);
ok(SUCCEEDED(hr), "GetAdapterDisplayMode failed, hr %#x.\n", hr);
+ device_desc.adapter_ordinal = D3DADAPTER_DEFAULT;
device_desc.device_window = window;
device_desc.width = 640;
device_desc.height = 480;
@@ -3772,6 +3780,7 @@ static void test_window_style(void)
SetRect(&fullscreen_rect, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight);
GetWindowRect(focus_window, &focus_rect);
+ device_desc.adapter_ordinal = D3DADAPTER_DEFAULT;
device_desc.device_window = device_window;
device_desc.width = registry_mode.dmPelsWidth;
device_desc.height = registry_mode.dmPelsHeight;
@@ -4074,6 +4083,7 @@ static void test_mode_change(void)
SetRect(&d3d_rect, 0, 0, d3d_width, d3d_height);
GetWindowRect(focus_window, &focus_rect);
+ device_desc.adapter_ordinal = D3DADAPTER_DEFAULT;
device_desc.device_window = device_window;
device_desc.width = d3d_width;
device_desc.height = d3d_height;
@@ -4129,6 +4139,7 @@ static void test_mode_change(void)
/* The mode restore also happens when the device was created at the original screen size. */
+ device_desc.adapter_ordinal = D3DADAPTER_DEFAULT;
device_desc.device_window = device_window;
device_desc.width = registry_mode.dmPelsWidth;
device_desc.height = registry_mode.dmPelsHeight;
@@ -4188,6 +4199,7 @@ static void test_device_window_reset(void)
ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n",
(LONG_PTR)test_proc, proc);
+ device_desc.adapter_ordinal = D3DADAPTER_DEFAULT;
device_desc.device_window = NULL;
device_desc.width = registry_mode.dmPelsWidth;
device_desc.height = registry_mode.dmPelsHeight;
@@ -6222,6 +6234,7 @@ static void test_pinned_buffers(void)
for (test = 0; test < ARRAY_SIZE(tests); ++test)
{
+ device_desc.adapter_ordinal = D3DADAPTER_DEFAULT;
device_desc.device_window = window;
device_desc.width = 640;
device_desc.height = 480;
@@ -7823,6 +7836,7 @@ static void test_lost_device(void)
ok(!!d3d, "Failed to create a D3D object.\n");
hr = IDirect3D8_GetAdapterIdentifier(d3d, D3DADAPTER_DEFAULT, 0, &identifier);
ok(SUCCEEDED(hr), "Failed to get adapter identifier, hr %#x.\n", hr);
+ device_desc.adapter_ordinal = D3DADAPTER_DEFAULT;
device_desc.device_window = window;
device_desc.width = registry_mode.dmPelsWidth;
device_desc.height = registry_mode.dmPelsHeight;
@@ -8666,6 +8680,7 @@ static void test_lockable_backbuffer(void)
refcount = IDirect3DDevice8_Release(device);
ok(!refcount, "Device has %u references left.\n", refcount);
+ device_desc.adapter_ordinal = D3DADAPTER_DEFAULT;
device_desc.width = 640;
device_desc.height = 480;
device_desc.device_window = window;
@@ -8709,6 +8724,7 @@ static void test_clip_planes_limits(void)
for (i = 0; i < ARRAY_SIZE(device_flags); ++i)
{
+ desc.adapter_ordinal = D3DADAPTER_DEFAULT;
desc.device_window = window;
desc.width = 640;
desc.height = 480;
@@ -9086,6 +9102,7 @@ static void test_resource_access(void)
ok(SUCCEEDED(hr), "Failed to get adapter identifier, hr %#x.\n", hr);
warp = adapter_is_warp(&identifier);
+ device_desc.adapter_ordinal = D3DADAPTER_DEFAULT;
device_desc.device_window = window;
device_desc.width = 16;
device_desc.height = 16;
@@ -9734,6 +9751,7 @@ static void test_get_display_mode(void)
refcount = IDirect3DDevice8_Release(device);
ok(!refcount, "Device has %u references left.\n", refcount);
+ desc.adapter_ordinal = D3DADAPTER_DEFAULT;
desc.device_window = window;
desc.width = 640;
desc.height = 480;
--
2.20.1
3
2
17 Mar '20
Signed-off-by: Connor McAdams <conmanx360(a)gmail.com>
---
dlls/d2d1/device.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/dlls/d2d1/device.c b/dlls/d2d1/device.c
index c3decf6fbd..146f7009da 100644
--- a/dlls/d2d1/device.c
+++ b/dlls/d2d1/device.c
@@ -1008,6 +1008,7 @@ static void d2d_device_context_fill_geometry(struct d2d_device_context *render_t
if (geometry->fill.arc_vertex_count)
{
buffer_desc.ByteWidth = geometry->fill.arc_vertex_count * sizeof(*geometry->fill.arc_vertices);
+ buffer_desc.BindFlags = D3D10_BIND_VERTEX_BUFFER;
buffer_data.pSysMem = geometry->fill.arc_vertices;
if (FAILED(hr = ID3D10Device_CreateBuffer(render_target->d3d_device, &buffer_desc, &buffer_data, &vb)))
--
2.20.1
2
1
17 Mar '20
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
---
dlls/webservices/tests/writer.c | 61 ++++++++++++++++++++++++++++++---
dlls/webservices/writer.c | 7 ++--
2 files changed, 61 insertions(+), 7 deletions(-)
diff --git a/dlls/webservices/tests/writer.c b/dlls/webservices/tests/writer.c
index 4fb9f44733..d66c2e4319 100644
--- a/dlls/webservices/tests/writer.c
+++ b/dlls/webservices/tests/writer.c
@@ -3050,12 +3050,12 @@ static void test_datetime(void)
static void test_repeating_element(void)
{
- WS_XML_STRING localname = {4, (BYTE *)"test"}, ns = {0, NULL};
- WS_XML_STRING val = {3, (BYTE *)"val"}, wrapper = {7, (BYTE *)"wrapper"};
+ WS_XML_STRING localname = {4, (BYTE *)"test"}, ns = {0, NULL}, data = {4, (BYTE *)"data"};
+ WS_XML_STRING val = {3, (BYTE *)"val"}, wrapper = {7, (BYTE *)"wrapper"}, structval = {9, (BYTE *)"structval"};
HRESULT hr;
WS_XML_WRITER *writer;
- WS_STRUCT_DESCRIPTION s;
- WS_FIELD_DESCRIPTION f, *fields[1];
+ WS_STRUCT_DESCRIPTION s, s2;
+ WS_FIELD_DESCRIPTION f, f2, *fields[1], *fields2[1];
WS_ITEM_RANGE range;
struct test
{
@@ -3067,6 +3067,15 @@ static void test_repeating_element(void)
INT32 *val;
ULONG count;
} *test2;
+ struct value
+ {
+ INT32 data;
+ } value;
+ struct test3
+ {
+ const struct value **val;
+ ULONG count;
+ } *test3;
hr = WsCreateWriter( NULL, 0, &writer, NULL );
ok( hr == S_OK, "got %08x\n", hr );
@@ -3153,6 +3162,50 @@ static void test_repeating_element(void)
check_output( writer, "<test><val>1</val><val>2</val></test>", __LINE__ );
HeapFree( GetProcessHeap(), 0, test2 );
+ /* nillable item */
+ hr = set_output( writer );
+ ok( hr == S_OK, "got %08x\n", hr );
+ hr = WsWriteStartElement( writer, NULL, &localname, &ns, NULL );
+ ok( hr == S_OK, "got %08x\n", hr );
+
+ memset( &f2, 0, sizeof(f2) );
+ f2.mapping = WS_ELEMENT_FIELD_MAPPING;
+ f2.localName = &data;
+ f2.ns = &ns;
+ f2.type = WS_INT32_TYPE;
+ fields2[0] = &f2;
+
+ memset( &s2, 0, sizeof(s2) );
+ s2.size = sizeof(struct test3);
+ s2.alignment = TYPE_ALIGNMENT(struct test3);
+ s2.typeLocalName = &structval;
+ s2.typeNs = &ns;
+ s2.fields = fields2;
+ s2.fieldCount = 1;
+
+ f.type = WS_STRUCT_TYPE;
+ f.typeDescription = &s2;
+ f.localName = &wrapper;
+ f.ns = &ns;
+ f.itemRange = NULL;
+ f.options = WS_FIELD_POINTER|WS_FIELD_OPTIONAL|WS_FIELD_NILLABLE|WS_FIELD_NILLABLE_ITEM;
+
+ value.data = -1;
+ test3 = HeapAlloc( GetProcessHeap(), 0, sizeof(*test3) + 2 * sizeof(const struct value *) );
+ test3->val = (const struct value **)(test3 + 1);
+ test3->val[0] = &value;
+ test3->val[1] = NULL;
+ test3->count = 2;
+
+ hr = WsWriteType( writer, WS_ELEMENT_TYPE_MAPPING, WS_STRUCT_TYPE, &s,
+ WS_WRITE_REQUIRED_POINTER, &test3, sizeof(test3), NULL );
+ ok( hr == S_OK, "got %08x\n", hr );
+ hr = WsWriteEndElement( writer, NULL );
+ ok( hr == S_OK, "got %08x\n", hr );
+ check_output( writer, "<test><wrapper><val><data>-1</data></val><val a:nil=\"true\" "
+ "xmlns:a=\"http://www.w3.org/2001/XMLSchema-instance\"/></wrapper></test>", __LINE__ );
+ HeapFree( GetProcessHeap(), 0, test3 );
+
WsFreeWriter( writer );
}
diff --git a/dlls/webservices/writer.c b/dlls/webservices/writer.c
index 021c961c94..53489786cd 100644
--- a/dlls/webservices/writer.c
+++ b/dlls/webservices/writer.c
@@ -3607,7 +3607,7 @@ static WS_WRITE_OPTION get_field_write_option( WS_TYPE type, ULONG options )
{
if (options & WS_FIELD_POINTER)
{
- if (options & (WS_FIELD_OPTIONAL|WS_FIELD_NILLABLE)) return WS_WRITE_NILLABLE_POINTER;
+ if (options & (WS_FIELD_OPTIONAL|WS_FIELD_NILLABLE|WS_FIELD_NILLABLE_ITEM)) return WS_WRITE_NILLABLE_POINTER;
return WS_WRITE_REQUIRED_POINTER;
}
@@ -3754,7 +3754,7 @@ static HRESULT write_type_field( struct writer *writer, const WS_FIELD_DESCRIPTI
ULONG count, size, field_options = desc->options;
const char *ptr = buf + offset;
- if (field_options & ~(WS_FIELD_POINTER|WS_FIELD_OPTIONAL|WS_FIELD_NILLABLE))
+ if (field_options & ~(WS_FIELD_POINTER|WS_FIELD_OPTIONAL|WS_FIELD_NILLABLE|WS_FIELD_NILLABLE_ITEM))
{
FIXME( "options 0x%x not supported\n", desc->options );
return E_NOTIMPL;
@@ -3771,7 +3771,7 @@ static HRESULT write_type_field( struct writer *writer, const WS_FIELD_DESCRIPTI
if (is_nil_value( ptr, size ))
{
if (field_options & WS_FIELD_OPTIONAL) return S_OK;
- if (field_options & WS_FIELD_NILLABLE)
+ if (field_options & (WS_FIELD_NILLABLE|WS_FIELD_NILLABLE_ITEM))
{
if (field_options & WS_FIELD_POINTER) option = WS_WRITE_NILLABLE_POINTER;
else option = WS_WRITE_NILLABLE_VALUE;
@@ -3867,6 +3867,7 @@ static HRESULT write_type_struct( struct writer *writer, WS_TYPE_MAPPING mapping
if (desc->structOptions) FIXME( "struct options 0x%x not supported\n", desc->structOptions );
if ((hr = get_value_ptr( option, value, size, desc->size, &ptr )) != S_OK) return hr;
+ if (option == WS_WRITE_NILLABLE_POINTER && !ptr) return write_add_nil_attribute( writer );
for (i = 0; i < desc->fieldCount; i++)
{
--
2.20.1
1
0
[PATCH 3/4] webservices: Handle WS_XML_TEXT_TYPE_INT32 in text_to_uint64.
by Hans Leidekker 17 Mar '20
by Hans Leidekker 17 Mar '20
17 Mar '20
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
---
dlls/webservices/reader.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/dlls/webservices/reader.c b/dlls/webservices/reader.c
index b328bb779e..bf29990923 100644
--- a/dlls/webservices/reader.c
+++ b/dlls/webservices/reader.c
@@ -5051,6 +5051,13 @@ static HRESULT text_to_uint64( const WS_XML_TEXT *text, UINT64 *val )
hr = str_to_uint64( text_utf8->value.bytes, text_utf8->value.length, MAX_UINT64, val );
break;
}
+ case WS_XML_TEXT_TYPE_INT32:
+ {
+ const WS_XML_INT32_TEXT *text_int32 = (const WS_XML_INT32_TEXT *)text;
+ *val = text_int32->value;
+ hr = S_OK;
+ break;
+ }
case WS_XML_TEXT_TYPE_INT64:
{
const WS_XML_INT64_TEXT *text_int64 = (const WS_XML_INT64_TEXT *)text;
--
2.20.1
1
0
17 Mar '20
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
---
dlls/webservices/tests/channel.c | 51 +++------
dlls/webservices/tests/msg.c | 34 +++---
dlls/webservices/tests/proxy.c | 28 ++---
dlls/webservices/tests/reader.c | 57 ++++------
dlls/webservices/tests/url.c | 178 +++++++++++++------------------
dlls/webservices/tests/writer.c | 77 ++++++-------
6 files changed, 172 insertions(+), 253 deletions(-)
diff --git a/dlls/webservices/tests/channel.c b/dlls/webservices/tests/channel.c
index 6a45671057..d80f1f64cd 100644
--- a/dlls/webservices/tests/channel.c
+++ b/dlls/webservices/tests/channel.c
@@ -115,7 +115,6 @@ static void test_WsCreateChannel(void)
static void test_WsOpenChannel(void)
{
- WCHAR url[] = {'h','t','t','p',':','/','/','l','o','c','a','l','h','o','s','t'};
HRESULT hr;
WS_CHANNEL *channel;
WS_ENDPOINT_ADDRESS addr;
@@ -134,8 +133,8 @@ static void test_WsOpenChannel(void)
ok( hr == E_INVALIDARG, "got %08x\n", hr );
memset( &addr, 0, sizeof(addr) );
- addr.url.length = ARRAY_SIZE( url );
- addr.url.chars = url;
+ addr.url.length = ARRAY_SIZE( L"http://localhost" ) - 1;
+ addr.url.chars = (WCHAR *)L"http://localhost";
hr = WsOpenChannel( NULL, &addr, NULL, NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr );
@@ -159,7 +158,6 @@ static void test_WsOpenChannel(void)
static void test_WsResetChannel(void)
{
- WCHAR url[] = {'h','t','t','p',':','/','/','l','o','c','a','l','h','o','s','t'};
HRESULT hr;
WS_CHANNEL *channel;
WS_CHANNEL_STATE state;
@@ -179,8 +177,8 @@ static void test_WsResetChannel(void)
ok( hr == S_OK, "got %08x\n", hr );
memset( &addr, 0, sizeof(addr) );
- addr.url.length = ARRAY_SIZE( url );
- addr.url.chars = url;
+ addr.url.length = ARRAY_SIZE( L"http://localhost" ) - 1;
+ addr.url.chars = (WCHAR *)L"http://localhost";
hr = WsOpenChannel( channel, &addr, NULL, NULL );
ok( hr == S_OK, "got %08x\n", hr );
@@ -274,12 +272,6 @@ static void test_WsCreateListener(void)
static void test_WsOpenListener(void)
{
- WCHAR str[] =
- {'n','e','t','.','t','c','p',':','/','/','+',':','2','0','1','7','/','p','a','t','h'};
- WCHAR str2[] =
- {'n','e','t','.','t','c','p',':','/','/','l','o','c','a','l','h','o','s','t',':','2','0','1','7'};
- WCHAR str3[] =
- {'n','e','t','.','t','c','p',':','/','/','1','2','7','.','0','.','0','.','1',':','2','0','1','7'};
WS_STRING url;
WS_LISTENER *listener;
HRESULT hr;
@@ -300,9 +292,8 @@ static void test_WsOpenListener(void)
hr = WsOpenListener( listener, NULL, NULL, NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr );
-
- url.length = ARRAY_SIZE( str );
- url.chars = str;
+ url.length = ARRAY_SIZE( L"net.tcp://+:2017/path" ) - 1;
+ url.chars = (WCHAR *)L"net.tcp://+:2017/path";
hr = WsOpenListener( NULL, &url, NULL, NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr );
@@ -320,8 +311,8 @@ static void test_WsOpenListener(void)
hr = WsCreateListener( WS_CHANNEL_TYPE_DUPLEX_SESSION, WS_TCP_CHANNEL_BINDING, NULL, 0, NULL, &listener, NULL );
ok( hr == S_OK, "got %08x\n", hr );
- url.length = ARRAY_SIZE( str2 );
- url.chars = str2;
+ url.length = ARRAY_SIZE( L"net.tcp://localhost:2017" ) - 1;
+ url.chars = (WCHAR *)L"net.tcp://localhost:2017";
hr = WsOpenListener( listener, &url, NULL, NULL );
ok( hr == S_OK, "got %08x\n", hr );
@@ -333,8 +324,8 @@ static void test_WsOpenListener(void)
hr = WsCreateListener( WS_CHANNEL_TYPE_DUPLEX_SESSION, WS_TCP_CHANNEL_BINDING, NULL, 0, NULL, &listener, NULL );
ok( hr == S_OK, "got %08x\n", hr );
- url.length = ARRAY_SIZE( str3 );
- url.chars = str3;
+ url.length = ARRAY_SIZE( L"net.tcp://127.0.0.1:2017" ) - 1;
+ url.chars = (WCHAR *)L"net.tcp://127.0.0.1:2017";
hr = WsOpenListener( listener, &url, NULL, NULL );
ok( hr == S_OK, "got %08x\n", hr );
@@ -385,9 +376,7 @@ static void test_WsCreateChannelForListener(void)
static void test_WsResetListener(void)
{
- WCHAR str[] =
- {'n','e','t','.','t','c','p',':','/','/','+',':','2','0','1','7','/','p','a','t','h'};
- WS_STRING url = { ARRAY_SIZE( str ), str };
+ WS_STRING url = { ARRAY_SIZE( L"net.tcp://+:2017/path" ) - 1, (WCHAR *)L"net.tcp://+:2017/path" };
WS_LISTENER *listener;
WS_LISTENER_STATE state;
WS_LISTENER_PROPERTY prop;
@@ -433,11 +422,6 @@ static void test_WsResetListener(void)
WsFreeListener( listener );
}
-static const WCHAR fmt_soap_udp[] =
- {'s','o','a','p','.','u','d','p',':','/','/','l','o','c','a','l','h','o','s','t',':','%','u',0};
-static const WCHAR fmt_net_tcp[] =
- {'n','e','t','.','t','c','p',':','/','/','l','o','c','a','l','h','o','s','t',':','%','u',0};
-
struct listener_info
{
int port;
@@ -494,7 +478,7 @@ static void client_message_read_write( const struct listener_info *info )
ok( hr == S_OK, "got %08x\n", hr );
memset( &addr, 0, sizeof(addr) );
- addr.url.length = wsprintfW( buf, fmt_soap_udp, info->port );
+ addr.url.length = wsprintfW( buf, L"soap.udp://localhost:%u", info->port );
addr.url.chars = buf;
hr = WsOpenChannel( channel, &addr, NULL, NULL );
ok( hr == S_OK, "got %08x\n", hr );
@@ -635,7 +619,7 @@ static void client_duplex_session( const struct listener_info *info )
ok( hr == WS_E_INVALID_OPERATION, "got %08x\n", hr );
memset( &addr, 0, sizeof(addr) );
- addr.url.length = wsprintfW( buf, fmt_net_tcp, info->port );
+ addr.url.length = wsprintfW( buf, L"net.tcp://localhost:%u", info->port );
addr.url.chars = buf;
hr = WsOpenChannel( channel, &addr, NULL, NULL );
ok( hr == S_OK, "got %08x\n", hr );
@@ -707,7 +691,7 @@ static void server_accept_channel( WS_CHANNEL *channel )
static void client_accept_channel( const struct listener_info *info )
{
- const WCHAR *fmt = (info->binding == WS_TCP_CHANNEL_BINDING) ? fmt_net_tcp : fmt_soap_udp;
+ const WCHAR *fmt = (info->binding == WS_TCP_CHANNEL_BINDING) ? L"net.tcp://localhost:%u" : L"soap.udp://localhost:%u";
WS_XML_STRING localname = {9, (BYTE *)"localname"}, ns = {2, (BYTE *)"ns"}, action = {6, (BYTE *)"action"};
WCHAR buf[64];
WS_LISTENER *listener;
@@ -827,7 +811,7 @@ static void client_request_reply( const struct listener_info *info )
ok( hr == S_OK, "got %08x\n", hr );
memset( &addr, 0, sizeof(addr) );
- addr.url.length = wsprintfW( buf, fmt_net_tcp, info->port );
+ addr.url.length = wsprintfW( buf, L"net.tcp://localhost:%u", info->port );
addr.url.chars = buf;
hr = WsOpenChannel( channel, &addr, NULL, NULL );
ok( hr == S_OK, "got %08x\n", hr );
@@ -867,7 +851,7 @@ static void client_request_reply( const struct listener_info *info )
static DWORD CALLBACK listener_proc( void *arg )
{
struct listener_info *info = arg;
- const WCHAR *fmt = (info->binding == WS_TCP_CHANNEL_BINDING) ? fmt_net_tcp : fmt_soap_udp;
+ const WCHAR *fmt = (info->binding == WS_TCP_CHANNEL_BINDING) ? L"net.tcp://localhost:%u" : L"soap.udp://localhost:%u";
WS_LISTENER *listener;
WS_CHANNEL *channel;
WCHAR buf[64];
@@ -973,7 +957,6 @@ done:
static HRESULT set_firewall( enum firewall_op op )
{
- static const WCHAR testW[] = {'w','e','b','s','e','r','v','i','c','e','s','_','t','e','s','t',0};
HRESULT hr, init;
INetFwMgr *mgr = NULL;
INetFwPolicy *policy = NULL;
@@ -1013,7 +996,7 @@ static HRESULT set_firewall( enum firewall_op op )
hr = INetFwAuthorizedApplication_put_ProcessImageFileName( app, image );
if (hr != S_OK) goto done;
- name = SysAllocString( testW );
+ name = SysAllocString( L"webservices_test" );
hr = INetFwAuthorizedApplication_put_Name( app, name );
SysFreeString( name );
ok( hr == S_OK, "got %08x\n", hr );
diff --git a/dlls/webservices/tests/msg.c b/dlls/webservices/tests/msg.c
index 766c2c5acf..ed399db636 100644
--- a/dlls/webservices/tests/msg.c
+++ b/dlls/webservices/tests/msg.c
@@ -257,7 +257,6 @@ static void test_WsInitializeMessage(void)
static void test_WsAddressMessage(void)
{
- static WCHAR localhost[] = {'h','t','t','p',':','/','/','l','o','c','a','l','h','o','s','t','/',0};
HRESULT hr;
WS_MESSAGE *msg;
WS_ENDPOINT_ADDRESS endpoint;
@@ -304,8 +303,8 @@ static void test_WsAddressMessage(void)
ok( hr == S_OK, "got %08x\n", hr );
memset( &endpoint, 0, sizeof(endpoint) );
- endpoint.url.chars = localhost;
- endpoint.url.length = ARRAY_SIZE( localhost );
+ endpoint.url.chars = (WCHAR *)L"http://localhost/";
+ endpoint.url.length = ARRAY_SIZE( L"http://localhost/" ) - 1;
hr = WsAddressMessage( msg, &endpoint, NULL );
ok( hr == S_OK, "got %08x\n", hr );
@@ -639,12 +638,11 @@ static void test_WsSetHeader(void)
"<a:MessageID>urn:uuid:00000000-0000-0000-0000-000000000000</a:MessageID>"
"<a:Action s:mustUnderstand=\"1\">action2</a:Action></s:Header>"
"<s:Body/></s:Envelope>";
- static const WCHAR action[] = {'a','c','t','i','o','n',0};
static const WS_XML_STRING action2 = {7, (BYTE *)"action2"};
HRESULT hr;
WS_MESSAGE *msg;
WS_XML_WRITER *writer;
- const WCHAR *ptr = action;
+ const WCHAR *ptr = L"action";
hr = WsSetHeader( NULL, 0, 0, 0, NULL, 0, NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr );
@@ -848,8 +846,6 @@ static void test_WsAddCustomHeader(void)
"<header2 xmlns=\"ns\">value2</header2></s:Header><s:Body/></s:Envelope>";
static WS_XML_STRING header = {6, (BYTE *)"header"}, ns = {2, (BYTE *)"ns"};
static WS_XML_STRING header2 = {7, (BYTE *)"header2"};
- static WCHAR valueW[] = {'v','a','l','u','e',0};
- static WCHAR value2W[] = {'v','a','l','u','e','2',0};
HRESULT hr;
WS_MESSAGE *msg;
WS_ELEMENT_DESCRIPTION desc;
@@ -891,12 +887,12 @@ static void test_WsAddCustomHeader(void)
ok( hr == S_OK, "got %08x\n", hr );
check_output_header( msg, expected2, -1, strstr(expected2, "urn:uuid:") - expected2, 46, __LINE__ );
- test.value = valueW;
+ test.value = L"value";
hr = WsAddCustomHeader( msg, &desc, WS_WRITE_REQUIRED_VALUE, &test, sizeof(test), 0, NULL );
ok( hr == S_OK, "got %08x\n", hr );
check_output_header( msg, expected, -1, strstr(expected, "urn:uuid:") - expected, 46, __LINE__ );
- test.value = value2W;
+ test.value = L"value2";
hr = WsAddCustomHeader( msg, &desc, WS_WRITE_REQUIRED_VALUE, &test, sizeof(test), 0, NULL );
ok( hr == S_OK, "got %08x\n", hr );
check_output_header( msg, expected3, -1, strstr(expected3, "urn:uuid:") - expected3, 46, __LINE__ );
@@ -1243,9 +1239,8 @@ static void test_WsGetHeader(void)
"<Action s:mustUnderstand=\"1\" "
"xmlns=\"http://schemas.microsoft.com/ws/2005/05/addressing/none\">action</Action>"
"</s:Header><s:Body/></s:Envelope>";
- static WCHAR action[] = {'a','c','t','i','o','n',0};
WS_MESSAGE *msg;
- WCHAR *ptr;
+ const WCHAR *ptr;
HRESULT hr;
hr = WsGetHeader( NULL, 0, 0, 0, NULL, NULL, 0, NULL );
@@ -1275,7 +1270,7 @@ static void test_WsGetHeader(void)
hr = WsGetHeader( msg, WS_ACTION_HEADER, WS_WSZ_TYPE, WS_READ_REQUIRED_POINTER, NULL, NULL, 0, NULL );
ok( hr == WS_E_INVALID_FORMAT, "got %08x\n", hr );
- ptr = action;
+ ptr = L"action";
hr = WsSetHeader( msg, WS_ACTION_HEADER, WS_WSZ_TYPE, WS_WRITE_REQUIRED_POINTER, &ptr, sizeof(ptr), NULL );
ok( hr == S_OK, "got %08x\n", hr );
check_output_header( msg, expected, -1, strstr(expected, "urn:uuid:") - expected, 46, __LINE__ );
@@ -1291,7 +1286,7 @@ static void test_WsGetHeader(void)
hr = WsGetHeader( msg, WS_ACTION_HEADER, WS_WSZ_TYPE, WS_READ_REQUIRED_POINTER, NULL, &ptr, sizeof(ptr), NULL );
ok( hr == S_OK, "got %08x\n", hr );
ok( ptr != NULL, "ptr not set\n" );
- ok( !memcmp( ptr, action, sizeof(action) ), "wrong data\n" );
+ ok( !memcmp( ptr, L"action", sizeof(L"action") ), "wrong data\n" );
WsFreeMessage( msg );
hr = WsCreateMessage( WS_ENVELOPE_VERSION_NONE, WS_ADDRESSING_VERSION_TRANSPORT, NULL, 0, &msg, NULL );
@@ -1300,7 +1295,7 @@ static void test_WsGetHeader(void)
hr = WsInitializeMessage( msg, WS_REQUEST_MESSAGE, NULL, NULL );
ok( hr == S_OK, "got %08x\n", hr );
- ptr = action;
+ ptr = L"action";
hr = WsSetHeader( msg, WS_ACTION_HEADER, WS_WSZ_TYPE, WS_WRITE_REQUIRED_POINTER, &ptr, sizeof(ptr), NULL );
ok( hr == S_OK, "got %08x\n", hr );
if (hr == S_OK) check_output_header( msg, expected2, -1, 0, 0, __LINE__ );
@@ -1309,7 +1304,7 @@ static void test_WsGetHeader(void)
hr = WsGetHeader( msg, WS_ACTION_HEADER, WS_WSZ_TYPE, WS_READ_REQUIRED_POINTER, NULL, &ptr, sizeof(ptr), NULL );
ok( hr == S_OK, "got %08x\n", hr );
ok( ptr != NULL, "ptr not set\n" );
- ok( !memcmp( ptr, action, sizeof(action) ), "wrong data\n" );
+ ok( !memcmp( ptr, L"action", sizeof(L"action") ), "wrong data\n" );
WsFreeMessage( msg );
hr = WsCreateMessage( WS_ENVELOPE_VERSION_SOAP_1_2, WS_ADDRESSING_VERSION_TRANSPORT, NULL, 0, &msg, NULL );
@@ -1318,7 +1313,7 @@ static void test_WsGetHeader(void)
hr = WsInitializeMessage( msg, WS_REQUEST_MESSAGE, NULL, NULL );
ok( hr == S_OK, "got %08x\n", hr );
- ptr = action;
+ ptr = L"action";
hr = WsSetHeader( msg, WS_ACTION_HEADER, WS_WSZ_TYPE, WS_WRITE_REQUIRED_POINTER, &ptr, sizeof(ptr), NULL );
ok( hr == S_OK, "got %08x\n", hr );
if (hr == S_OK) check_output_header( msg, expected3, -1, 0, 0, __LINE__ );
@@ -1327,7 +1322,7 @@ static void test_WsGetHeader(void)
hr = WsGetHeader( msg, WS_ACTION_HEADER, WS_WSZ_TYPE, WS_READ_REQUIRED_POINTER, NULL, &ptr, sizeof(ptr), NULL );
ok( hr == S_OK, "got %08x\n", hr );
ok( ptr != NULL, "ptr not set\n" );
- ok( !memcmp( ptr, action, sizeof(action) ), "wrong data\n" );
+ ok( !memcmp( ptr, L"action", sizeof(L"action") ), "wrong data\n" );
WsFreeMessage( msg );
}
@@ -1336,7 +1331,6 @@ static void test_WsGetCustomHeader(void)
static char expected[] =
"<Envelope><Header><Custom xmlns=\"ns\">value</Custom></Header><Body/></Envelope>";
static WS_XML_STRING custom = {6, (BYTE *)"Custom"}, ns = {2, (BYTE *)"ns"};
- static WCHAR valueW[] = {'v','a','l','u','e',0};
WS_ELEMENT_DESCRIPTION desc;
WS_STRUCT_DESCRIPTION s;
WS_FIELD_DESCRIPTION f, *fields[1];
@@ -1375,7 +1369,7 @@ static void test_WsGetCustomHeader(void)
desc.type = WS_STRUCT_TYPE;
desc.typeDescription = &s;
- test.value = valueW;
+ test.value = L"value";
hr = WsAddCustomHeader( msg, &desc, WS_WRITE_REQUIRED_VALUE, &test, sizeof(test), 0, NULL );
ok( hr == S_OK, "got %08x\n", hr );
check_output_header( msg, expected, -1, 0, 0, __LINE__ );
@@ -1394,7 +1388,7 @@ static void test_WsGetCustomHeader(void)
NULL, NULL );
ok( hr == S_OK, "got %08x\n", hr );
ok( test.value != NULL, "value not set\n" );
- ok( !memcmp( test.value, valueW, sizeof(valueW) ), "wrong value\n" );
+ ok( !memcmp( test.value, L"value", sizeof(L"value") ), "wrong value\n" );
WsFreeMessage( msg );
}
diff --git a/dlls/webservices/tests/proxy.c b/dlls/webservices/tests/proxy.c
index 07610ac70e..e2c6c87b83 100644
--- a/dlls/webservices/tests/proxy.c
+++ b/dlls/webservices/tests/proxy.c
@@ -146,7 +146,6 @@ static void test_WsCreateServiceProxyFromTemplate(void)
static void test_WsOpenServiceProxy(void)
{
- WCHAR url[] = {'h','t','t','p',':','/','/','l','o','c','a','l','h','o','s','t','/'};
HRESULT hr;
WS_SERVICE_PROXY *proxy;
WS_SERVICE_PROXY_STATE state;
@@ -164,8 +163,8 @@ static void test_WsOpenServiceProxy(void)
ok( state == WS_SERVICE_PROXY_STATE_CREATED, "got %u\n", state );
memset( &addr, 0, sizeof(addr) );
- addr.url.length = ARRAY_SIZE( url );
- addr.url.chars = url;
+ addr.url.length = ARRAY_SIZE( L"http://localhost/" ) - 1;
+ addr.url.chars = (WCHAR *)L"http://localhost/";
hr = WsOpenServiceProxy( proxy, &addr, NULL, NULL );
ok( hr == S_OK, "got %08x\n", hr );
@@ -187,7 +186,6 @@ static void test_WsOpenServiceProxy(void)
static void test_WsResetServiceProxy(void)
{
- WCHAR url[] = {'h','t','t','p',':','/','/','l','o','c','a','l','h','o','s','t','/'};
HRESULT hr;
WS_SERVICE_PROXY *proxy;
WS_ENDPOINT_ADDRESS addr;
@@ -206,8 +204,8 @@ static void test_WsResetServiceProxy(void)
ok( state == WS_SERVICE_PROXY_STATE_CREATED, "got %u\n", state );
memset( &addr, 0, sizeof(addr) );
- addr.url.length = ARRAY_SIZE( url );
- addr.url.chars = url;
+ addr.url.length = ARRAY_SIZE( L"http://localhost/" ) - 1;
+ addr.url.chars = (WCHAR *)L"http://localhost/";
hr = WsOpenServiceProxy( proxy, &addr, NULL, NULL );
ok( hr == S_OK, "got %08x\n", hr );
@@ -230,8 +228,6 @@ static void test_WsResetServiceProxy(void)
static HRESULT create_channel( int port, WS_CHANNEL **ret )
{
- static const WCHAR fmt[] =
- {'h','t','t','p',':','/','/','1','2','7','.','0','.','0','.','1',':','%','u',0};
WS_CHANNEL_PROPERTY prop[2];
WS_ENVELOPE_VERSION env_version = WS_ENVELOPE_VERSION_SOAP_1_1;
WS_ADDRESSING_VERSION addr_version = WS_ADDRESSING_VERSION_TRANSPORT;
@@ -253,7 +249,7 @@ static HRESULT create_channel( int port, WS_CHANNEL **ret )
if (hr != S_OK) return hr;
memset( &addr, 0, sizeof(addr) );
- addr.url.length = wsprintfW( buf, fmt, port );
+ addr.url.length = wsprintfW( buf, L"http://127.0.0.1:%u", port );
addr.url.chars = buf;
hr = WsOpenChannel( channel, &addr, NULL, NULL );
if (hr == S_OK) *ret = channel;
@@ -383,8 +379,6 @@ static WS_HTTP_HEADER_MAPPING *response_header_mappings[] =
static HRESULT create_proxy( int port, WS_SERVICE_PROXY **ret )
{
- static const WCHAR fmt[] =
- {'h','t','t','p',':','/','/','1','2','7','.','0','.','0','.','1',':','%','u','/',0};
WS_ENVELOPE_VERSION env_version;
WS_ADDRESSING_VERSION addr_version;
WS_HTTP_MESSAGE_MAPPING mapping;
@@ -421,7 +415,7 @@ static HRESULT create_proxy( int port, WS_SERVICE_PROXY **ret )
if (hr != S_OK) return hr;
memset( &addr, 0, sizeof(addr) );
- addr.url.length = wsprintfW( url, fmt, port );
+ addr.url.length = wsprintfW( url, L"http://127.0.0.1:%u", port );
addr.url.chars = url;
hr = WsOpenServiceProxy( proxy, &addr, NULL, NULL );
if (hr == S_OK) *ret = proxy;
@@ -485,7 +479,6 @@ static HRESULT CALLBACK send_callback( WS_MESSAGE *msg, WS_HEAP *heap, void *sta
static HRESULT CALLBACK recv_callback( WS_MESSAGE *msg, WS_HEAP *heap, void *state, WS_ERROR *error )
{
static const WS_XML_STRING header = {20, (BYTE *)"MappedResponseHeader"};
- static const WCHAR valueW[] = {'v','a','l','u','e',0};
WCHAR *str;
HRESULT hr;
@@ -493,13 +486,12 @@ static HRESULT CALLBACK recv_callback( WS_MESSAGE *msg, WS_HEAP *heap, void *sta
hr = WsGetMappedHeader( msg, &header, WS_SINGLETON_HEADER, 0, WS_WSZ_TYPE, WS_READ_OPTIONAL_POINTER, heap,
&str, sizeof(str), NULL );
ok( hr == S_OK, "got %08x\n", hr );
- ok( !lstrcmpW(str, valueW), "wrong value %s\n", wine_dbgstr_w(str) );
+ ok( !wcscmp(str, L"value"), "wrong value %s\n", wine_dbgstr_w(str) );
return S_OK;
}
static void test_WsCall( int port )
{
- static const WCHAR testW[] = {'t','e','s','t',0}, test2W[] = {'t','e','s','t','2',0};
WS_XML_STRING str = {3, (BYTE *)"str"};
WS_XML_STRING req = {3, (BYTE *)"req"};
WS_XML_STRING resp = {4, (BYTE *)"resp"};
@@ -584,8 +576,8 @@ static void test_WsCall( int port )
ok( hr == E_INVALIDARG, "got %08x\n", hr );
in.val = 1;
- str_array[0] = testW;
- str_array[1] = test2W;
+ str_array[0] = L"test";
+ str_array[1] = L"test2";
in.str = str_array;
in.count = 2;
@@ -620,7 +612,7 @@ static void test_WsCall( int port )
hr = WsCall( proxy, &op, args, heap, prop, ARRAY_SIZE(prop), NULL, NULL );
ok( hr == S_OK, "got %08x\n", hr );
- ok( !lstrcmpW( out.str, testW ), "wrong data\n" );
+ ok( !wcscmp( out.str, L"test" ), "wrong data\n" );
ok( out.count == 2, "got %u\n", out.count );
ok( out.val[0] == 1, "got %u\n", out.val[0] );
ok( out.val[1] == 2, "got %u\n", out.val[1] );
diff --git a/dlls/webservices/tests/reader.c b/dlls/webservices/tests/reader.c
index 96eee2cf77..5fb81b5dc8 100644
--- a/dlls/webservices/tests/reader.c
+++ b/dlls/webservices/tests/reader.c
@@ -1325,10 +1325,8 @@ static void prepare_type_test( WS_XML_READER *reader, const char *data, ULONG si
static void test_WsReadType(void)
{
- static const WCHAR testW[] = {'t','e','s','t',0}, test2W[] = {' ','t','e','s','t',' '};
static const GUID guid = {0,0,0,{0,0,0,0,0,0,0,0xa1}};
static const char utf8[] = {'<','t','>',0xe2,0x80,0x99,'<','/','t','>'};
- static const WCHAR utf8W[] = {0x2019,0};
HRESULT hr;
WS_XML_READER *reader;
WS_HEAP *heap;
@@ -1381,7 +1379,7 @@ static void test_WsReadType(void)
WS_READ_REQUIRED_POINTER, heap, &val_str, sizeof(val_str), NULL );
ok( hr == S_OK, "got %08x\n", hr );
ok( val_str != NULL, "pointer not set\n" );
- if (val_str) ok( !lstrcmpW( val_str, testW ), "wrong data\n" );
+ if (val_str) ok( !wcscmp( val_str, L"test" ), "wrong data\n" );
val_bool = -1;
prepare_type_test( reader, "<t>true</t>", sizeof("<t>true</t>") - 1 );
@@ -1748,7 +1746,7 @@ static void test_WsReadType(void)
WS_READ_REQUIRED_POINTER, heap, &val_str, sizeof(val_str), NULL );
ok( hr == S_OK, "got %08x\n", hr );
ok( val_str != NULL, "pointer not set\n" );
- ok( !lstrcmpW( val_str, utf8W ), "got %s\n", wine_dbgstr_w(val_str) );
+ ok( !lstrcmpW( val_str, L"\x2019" ), "got %s\n", wine_dbgstr_w(val_str) );
val_str = NULL;
prepare_type_test( reader, "<t></t>", sizeof("<t></t>") - 1 );
@@ -1787,7 +1785,7 @@ static void test_WsReadType(void)
WS_READ_REQUIRED_VALUE, heap, &val_string, sizeof(val_string), NULL );
ok( hr == S_OK, "got %08x\n", hr );
ok( val_string.length == 6, "got %u\n", val_string.length );
- ok( !memcmp( val_string.chars, test2W, sizeof(test2W) ), "wrong data\n" );
+ ok( !memcmp( val_string.chars, L" test ", 12 ), "wrong data\n" );
val_string.length = 0xdeadbeef;
val_string.chars = (WCHAR *)0xdeadbeef;
@@ -1811,7 +1809,7 @@ static void test_WsReadType(void)
WS_READ_REQUIRED_VALUE, heap, &val_id, sizeof(val_id), NULL );
ok( hr == S_OK, "got %08x\n", hr );
ok( val_id.uri.length == 6, "got %u\n", val_string.length );
- ok( !memcmp( val_id.uri.chars, test2W, sizeof(test2W) ), "wrong data\n" );
+ ok( !memcmp( val_id.uri.chars, L" test ", 12 ), "wrong data\n" );
ok( IsEqualGUID( &val_id.guid, &guid_null ), "wrong guid\n" );
memset( &val_id, 0, sizeof(val_id) );
@@ -1882,7 +1880,6 @@ static void test_WsReadType(void)
static void test_WsGetXmlAttribute(void)
{
- static const WCHAR valueW[] = {'v','a','l','u','e',0};
HRESULT hr;
WS_XML_READER *reader;
WS_XML_STRING xmlstr;
@@ -1919,7 +1916,7 @@ static void test_WsGetXmlAttribute(void)
todo_wine ok( str != NULL, "str not set\n" );
todo_wine ok( count == 5, "got %u\n", count );
/* string is not null-terminated */
- if (str) ok( !memcmp( str, valueW, count * sizeof(WCHAR) ), "wrong data\n" );
+ if (str) ok( !memcmp( str, L"value", count * sizeof(WCHAR) ), "wrong data\n" );
xmlstr.bytes = (BYTE *)"none";
xmlstr.length = sizeof("none") - 1;
@@ -2285,7 +2282,6 @@ static void prepare_struct_type_test( WS_XML_READER *reader, const char *data )
static void test_simple_struct_type(void)
{
- static const WCHAR testW[] = {'t','e','s','t',0};
HRESULT hr;
WS_XML_READER *reader;
WS_HEAP *heap;
@@ -2354,7 +2350,7 @@ static void test_simple_struct_type(void)
if (test)
{
ok( test->str != NULL, "str not set\n" );
- if (test->str) ok( !lstrcmpW( test->str, testW ), "wrong data\n" );
+ if (test->str) ok( !wcscmp( test->str, L"test" ), "wrong data\n" );
}
hr = WsGetReaderNode( reader, &node, NULL );
@@ -2370,7 +2366,7 @@ static void test_simple_struct_type(void)
if (test)
{
ok( test->str != NULL, "str not set\n" );
- if (test->str) ok( !lstrcmpW( test->str, testW ), "wrong data\n" );
+ if (test->str) ok( !wcscmp( test->str, L"test" ), "wrong data\n" );
}
hr = WsGetReaderNode( reader, &node, NULL );
@@ -2386,7 +2382,7 @@ static void test_simple_struct_type(void)
if (test)
{
ok( test->str != NULL, "str not set\n" );
- if (test->str) ok( !lstrcmpW( test->str, testW ), "wrong data\n" );
+ if (test->str) ok( !wcscmp( test->str, L"test" ), "wrong data\n" );
}
hr = WsGetReaderNode( reader, &node, NULL );
@@ -2412,7 +2408,7 @@ static void test_simple_struct_type(void)
if (test)
{
ok( test->str != NULL, "str not set\n" );
- if (test->str) ok( !lstrcmpW( test->str, testW ), "wrong data\n" );
+ if (test->str) ok( !wcscmp( test->str, L"test" ), "wrong data\n" );
}
hr = WsGetReaderNode( reader, &node, NULL );
@@ -2434,7 +2430,7 @@ static void test_simple_struct_type(void)
if (test)
{
ok( test->str != NULL, "str not set\n" );
- if (test->str) ok( !lstrcmpW( test->str, testW ), "wrong data test %p test->str %p\n", test, test->str );
+ if (test->str) ok( !wcscmp( test->str, L"test" ), "wrong data test %p test->str %p\n", test, test->str );
}
hr = WsGetReaderNode( reader, &node, NULL );
@@ -2903,7 +2899,6 @@ static void test_WsGetNamespaceFromPrefix(void)
static void test_text_field_mapping(void)
{
- static const WCHAR testW[] = {'t','e','s','t',0};
HRESULT hr;
WS_XML_READER *reader;
WS_HEAP *heap;
@@ -2939,7 +2934,7 @@ static void test_text_field_mapping(void)
ok( hr == S_OK, "got %08x\n", hr );
ok( test != NULL, "test not set\n" );
ok( test->str != NULL, "str not set\n" );
- ok( !lstrcmpW( test->str, testW ), "got %s\n", wine_dbgstr_w(test->str) );
+ ok( !wcscmp( test->str, L"test" ), "got %s\n", wine_dbgstr_w(test->str) );
WsFreeReader( reader );
WsFreeHeap( heap );
@@ -2958,8 +2953,6 @@ static void test_complex_struct_type(void)
"<o:services o:GenerationTime=\"2015-09-03T18:47:54\"></o:services>"
"<trailing>content</trailing>"
"</o:OfficeConfig>";
- static const WCHAR timestampW[] =
- {'2','0','1','5','-','0','9','-','0','3','T','1','8',':','4','7',':','5','4',0};
HRESULT hr;
WS_ERROR *error;
WS_ERROR_PROPERTY prop;
@@ -3056,7 +3049,7 @@ static void test_complex_struct_type(void)
WS_READ_REQUIRED_POINTER, heap, &test, sizeof(test), error );
ok( hr == S_OK, "got %08x\n", hr );
ok( test != NULL, "test not set\n" );
- ok( !lstrcmpW( test->services->generationtime, timestampW ), "wrong data\n" );
+ ok( !wcscmp( test->services->generationtime, L"2015-09-03T18:47:54" ), "wrong data\n" );
hr = WsGetReaderNode( reader, &node, NULL );
ok( hr == S_OK, "got %08x\n", hr );
@@ -3090,7 +3083,7 @@ static void test_complex_struct_type(void)
WS_READ_REQUIRED_POINTER, heap, &test, sizeof(test), error );
ok( hr == S_OK, "got %08x\n", hr );
ok( test != NULL, "test not set\n" );
- if (test) ok( !lstrcmpW( test->services->generationtime, timestampW ), "wrong data\n" );
+ if (test) ok( !wcscmp( test->services->generationtime, L"2015-09-03T18:47:54" ), "wrong data\n" );
hr = WsGetReaderNode( reader, &node, NULL );
ok( hr == S_OK, "got %08x\n", hr );
@@ -3158,7 +3151,6 @@ static void test_repeating_element(void)
"<services>"
"<service><name></name></service>"
"</services>";
- static const WCHAR oneW[] = {'1',0}, twoW[] = {'2',0};
WS_XML_STRING str_name = {4, (BYTE *)"name"};
WS_XML_STRING str_services = {8, (BYTE *)"services"};
WS_XML_STRING str_service = {7, (BYTE *)"service"};
@@ -3308,8 +3300,8 @@ static void test_repeating_element(void)
ok( test2 != NULL, "test2 not set\n" );
ok( test2->service != NULL, "service not set\n" );
ok( test2->service_count == 2, "got %u\n", test2->service_count );
- ok( !lstrcmpW( test2->service[0].id, oneW ), "wrong data\n" );
- ok( !lstrcmpW( test2->service[1].id, twoW ), "wrong data\n" );
+ ok( !wcscmp( test2->service[0].id, L"1" ), "wrong data\n" );
+ ok( !wcscmp( test2->service[1].id, L"2" ), "wrong data\n" );
/* repeating attribute field + text field mapping */
prepare_struct_type_test( reader, data5 );
@@ -3331,10 +3323,10 @@ static void test_repeating_element(void)
ok( test3 != NULL, "test3 not set\n" );
ok( test3->service != NULL, "service not set\n" );
ok( test3->service_count == 2, "got %u\n", test3->service_count );
- ok( !lstrcmpW( test3->service[0].name, oneW ), "wrong data\n" );
- ok( !lstrcmpW( test3->service[0].id, oneW ), "wrong data\n" );
- ok( !lstrcmpW( test3->service[1].name, twoW ), "wrong data\n" );
- ok( !lstrcmpW( test3->service[1].id, twoW ), "wrong data\n" );
+ ok( !wcscmp( test3->service[0].name, L"1" ), "wrong data\n" );
+ ok( !wcscmp( test3->service[0].id, L"1" ), "wrong data\n" );
+ ok( !wcscmp( test3->service[1].name, L"2" ), "wrong data\n" );
+ ok( !wcscmp( test3->service[1].id, L"2" ), "wrong data\n" );
/* empty text, item range */
prepare_struct_type_test( reader, data6 );
@@ -4330,7 +4322,6 @@ static void test_WsReadBytes(void)
static void test_WsReadChars(void)
{
- static const WCHAR textW[] = {'t','e','x','t'};
HRESULT hr;
WS_XML_READER *reader;
const WS_XML_NODE *node;
@@ -4411,7 +4402,7 @@ static void test_WsReadChars(void)
hr = WsReadChars( reader, bufW, 2, &count, NULL );
ok( hr == S_OK, "got %08x\n", hr );
ok( count == 2, "got %u\n", count );
- ok( !memcmp( bufW, textW, 2 * sizeof(WCHAR) ), "wrong data\n" );
+ ok( !memcmp( bufW, L"te", 2 * sizeof(WCHAR) ), "wrong data\n" );
hr = WsGetReaderNode( reader, &node, NULL );
ok( hr == S_OK, "got %08x\n", hr );
@@ -6168,7 +6159,6 @@ static void test_WsReadXmlBuffer(void)
static void test_union_type(void)
{
- static const WCHAR testW[] = {'t','e','s','t',0};
static WS_XML_STRING str_ns = {0, NULL}, str_a = {1, (BYTE *)"a"}, str_b = {1, (BYTE *)"b"};
static WS_XML_STRING str_s = {1, (BYTE *)"s"};
HRESULT hr;
@@ -6243,7 +6233,7 @@ static void test_union_type(void)
ok( hr == S_OK, "got %08x\n", hr );
ok( test != NULL, "test not set\n" );
ok( test->choice == CHOICE_A, "got %d\n", test->choice );
- ok( !lstrcmpW(test->value.a, testW), "got %s\n", wine_dbgstr_w(test->value.a) );
+ ok( !wcscmp(test->value.a, L"test"), "got %s\n", wine_dbgstr_w(test->value.a) );
hr = WsGetReaderNode( reader, &node, NULL );
ok( hr == S_OK, "got %08x\n", hr );
ok( node->nodeType == WS_XML_NODE_TYPE_EOF, "got %u\n", node->nodeType );
@@ -6386,7 +6376,6 @@ static void test_float(void)
static void test_repeating_element_choice(void)
{
- static const WCHAR testW[] = {'t','e','s','t',0};
static WS_XML_STRING str_ns = {0, NULL}, str_a = {1, (BYTE *)"a"}, str_b = {1, (BYTE *)"b"};
static WS_XML_STRING str_s = {1, (BYTE *)"s"}, str_t = {1, (BYTE *)"t"};
HRESULT hr;
@@ -6470,7 +6459,7 @@ static void test_repeating_element_choice(void)
ok( test != NULL, "test not set\n" );
ok( test->count == 1, "got %u\n", test->count );
ok( test->items[0].choice == CHOICE_A, "got %d\n", test->items[0].choice );
- ok( !lstrcmpW(test->items[0].value.a, testW), "got %s\n", wine_dbgstr_w(test->items[0].value.a) );
+ ok( !wcscmp(test->items[0].value.a, L"test"), "got %s\n", wine_dbgstr_w(test->items[0].value.a) );
test = NULL;
prepare_struct_type_test( reader, "<t><b>123</b></t>" );
@@ -6490,7 +6479,7 @@ static void test_repeating_element_choice(void)
ok( test != NULL, "test not set\n" );
ok( test->count == 2, "got %u\n", test->count );
ok( test->items[0].choice == CHOICE_A, "got %d\n", test->items[0].choice );
- ok( !lstrcmpW(test->items[0].value.a, testW), "got %s\n", wine_dbgstr_w(test->items[0].value.a) );
+ ok( !wcscmp(test->items[0].value.a, L"test"), "got %s\n", wine_dbgstr_w(test->items[0].value.a) );
ok( test->items[1].choice == CHOICE_B, "got %d\n", test->items[1].choice );
ok( test->items[1].value.b == 123, "got %u\n", test->items[1].value.b );
diff --git a/dlls/webservices/tests/url.c b/dlls/webservices/tests/url.c
index 2b8dda482e..718f072f19 100644
--- a/dlls/webservices/tests/url.c
+++ b/dlls/webservices/tests/url.c
@@ -23,58 +23,48 @@
static void test_WsDecodeUrl(void)
{
- static WCHAR url1[] = {'h','t','t','p',':','/','/','h','o','s','t',0};
- static WCHAR url2[] = {'h','t','t','p','s',':','/','/','h','o','s','t',0};
- static WCHAR url3[] = {'h','t','t','p',':','/','/','h','o','s','t',':','8','0',0};
- static WCHAR url4[] = {'h','t','t','p','s',':','/','/','h','o','s','t',':','8','0',0};
- static WCHAR url5[] = {'h','t','t','p',':','/','/','h','o','s','t','/','p','a','t','h',0};
- static WCHAR url6[] = {'h','t','t','p',':','/','/','h','o','s','t','/','p','a','t','h','?',
- 'q','u','e','r','y',0};
- static WCHAR url7[] = {'h','t','t','p',':','/','/','h','o','s','t','/','p','a','t','h','?',
- 'q','u','e','r','y','#','f','r','a','g',0};
- static WCHAR url8[] = {'H','T','T','P',':','/','/','h','o','s','t',0};
- static WCHAR url9[] = {'h','t','t','q',':','/','/','h','o','s','t',0};
- static WCHAR url10[] = {'h','t','t','p',':',0};
- static WCHAR url11[] = {'h','t','t','p',0};
- static WCHAR url12[] = {'n','e','t','.','t','c','p',':','/','/','h','o','s','t',0};
- static WCHAR url13[] = {'s','o','a','p','.','u','d','p',':','/','/','h','o','s','t',0};
- static WCHAR url14[] = {'n','e','t','.','p','i','p','e',':','/','/','h','o','s','t',0};
- static WCHAR url15[] = {'h','t','t','p',':','/','h','o','s','t',0};
- static WCHAR url16[] = {'h','t','t','p',':','h','o','s','t',0};
- static WCHAR url17[] = {'h','t','t','p',':','/','/','/','h','o','s','t',0};
- static WCHAR url18[] = {'h','t','t','p',':','/','/','h','o','s','t','/',0};
- static WCHAR url19[] = {'h','t','t','p',':','/','/','h','o','s','t',':','/',0};
- static WCHAR url20[] = {'h','t','t','p',':','/','/','h','o','s','t',':','6','5','5','3','6',0};
- static WCHAR url21[] = {'h','t','t','p',':','/','/','h','o','s','t','?','q','u','e','r','y',0};
- static WCHAR url22[] = {'h','t','t','p',':','/','/','h','o','s','t','#','f','r','a','g',0};
- static WCHAR url23[] = {'h','t','t','p',':','/','/','h','o','s','t','%','2','0','2',0};
- static WCHAR url24[] = {'h','t','t','p',':','/','/','h','o','s','t','/','p','a','t','h',
- '%','2','0','2',0};
- static WCHAR url25[] = {'h','t','t','p',':','/','/','h','o','s','t','?','q','u','e','r','y',
- '%','2','0','2',0};
- static WCHAR url26[] = {'h','t','t','p',':','/','/','h','o','s','t','#','f','r','a','g',
- '%','2','0','2',0};
- static WCHAR url27[] = {'h','t','t','p',':','/','/','h','o','s','t','/','%','c','3','%','a','b','/',0};
- static WCHAR host2[] = {'h','o','s','t',' ','2'};
- static WCHAR path2[] = {'/','p','a','t','h',' ','2'};
- static WCHAR path3[] = {'/',0xeb,'/'};
- static WCHAR query2[] = {'q','u','e','r','y',' ','2'};
- static WCHAR frag2[] = {'f','r','a','g',' ','2'};
+ static const WCHAR url1[] = L"http://host";
+ static const WCHAR url2[] = L"https://host";
+ static const WCHAR url3[] = L"http://host:80";
+ static const WCHAR url4[] = L"https://host:80";
+ static const WCHAR url5[] = L"http://host/path";
+ static const WCHAR url6[] = L"http://host/path?query";
+ static const WCHAR url7[] = L"http://host/path?query#frag";
+ static const WCHAR url8[] = L"HTTP://host";
+ static const WCHAR url9[] = L"httq://host";
+ static const WCHAR url10[] = L"http:";
+ static const WCHAR url11[] = L"http";
+ static const WCHAR url12[] = L"net.tcp://host";
+ static const WCHAR url13[] = L"soap.udp://host";
+ static const WCHAR url14[] = L"net.pipe://host";
+ static const WCHAR url15[] = L"http:/host";
+ static const WCHAR url16[] = L"http:host";
+ static const WCHAR url17[] = L"http:///host";
+ static const WCHAR url18[] = L"http://host/";
+ static const WCHAR url19[] = L"http://host:/";
+ static const WCHAR url20[] = L"http://host:65536";
+ static const WCHAR url21[] = L"http://host?query";
+ static const WCHAR url22[] = L"http://host#frag";
+ static const WCHAR url23[] = L"http://host%202";
+ static const WCHAR url24[] = L"http://host/path%202";
+ static const WCHAR url25[] = L"http://host?query%202";
+ static const WCHAR url26[] = L"http://host#frag%202";
+ static const WCHAR url27[] = L"http://host/%c3%ab/";
static const struct
{
- WCHAR *str;
+ const WCHAR *str;
HRESULT hr;
WS_URL_SCHEME_TYPE scheme;
- WCHAR *host;
+ const WCHAR *host;
ULONG host_len;
USHORT port;
- WCHAR *port_str;
+ const WCHAR *port_str;
ULONG port_len;
- WCHAR *path;
+ const WCHAR *path;
ULONG path_len;
- WCHAR *query;
+ const WCHAR *query;
ULONG query_len;
- WCHAR *fragment;
+ const WCHAR *fragment;
ULONG fragment_len;
}
tests[] =
@@ -85,8 +75,7 @@ static void test_WsDecodeUrl(void)
{ url4, S_OK, WS_URL_HTTPS_SCHEME_TYPE, url4 + 8, 4, 80, url4 + 13, 2 },
{ url5, S_OK, WS_URL_HTTP_SCHEME_TYPE, url5 + 7, 4, 80, NULL, 0, url5 + 11, 5 },
{ url6, S_OK, WS_URL_HTTP_SCHEME_TYPE, url5 + 7, 4, 80, NULL, 0, url6 + 11, 5, url6 + 17, 5 },
- { url7, S_OK, WS_URL_HTTP_SCHEME_TYPE, url5 + 7, 4, 80, NULL, 0, url7 + 11, 5, url7 + 17, 5,
- url7 + 23, 4 },
+ { url7, S_OK, WS_URL_HTTP_SCHEME_TYPE, url5 + 7, 4, 80, NULL, 0, url7 + 11, 5, url7 + 17, 5, url7 + 23, 4 },
{ url8, S_OK, WS_URL_HTTP_SCHEME_TYPE, url1 + 7, 4, 80 },
{ url9, WS_E_INVALID_FORMAT },
{ url10, WS_E_INVALID_FORMAT },
@@ -103,11 +92,11 @@ static void test_WsDecodeUrl(void)
{ url21, S_OK, WS_URL_HTTP_SCHEME_TYPE, url21 + 7, 4, 80, NULL, 0, NULL, 0, url21 + 12, 5 },
{ url22, S_OK, WS_URL_HTTP_SCHEME_TYPE, url22 + 7, 4, 80, NULL, 0, NULL, 0, NULL, 0,
url22 + 12, 4 },
- { url23, S_OK, WS_URL_HTTP_SCHEME_TYPE, host2, 6, 80 },
- { url24, S_OK, WS_URL_HTTP_SCHEME_TYPE, url24 + 7, 4, 80, NULL, 0, path2, 7 },
- { url25, S_OK, WS_URL_HTTP_SCHEME_TYPE, url25 + 7, 4, 80, NULL, 0, NULL, 0, query2, 7 },
- { url26, S_OK, WS_URL_HTTP_SCHEME_TYPE, url26 + 7, 4, 80, NULL, 0, NULL, 0, NULL, 0, frag2, 6 },
- { url27, S_OK, WS_URL_HTTP_SCHEME_TYPE, url27 + 7, 4, 80, NULL, 0, path3, 3 },
+ { url23, S_OK, WS_URL_HTTP_SCHEME_TYPE, L"host 2", 6, 80 },
+ { url24, S_OK, WS_URL_HTTP_SCHEME_TYPE, url24 + 7, 4, 80, NULL, 0, L"/path 2", 7 },
+ { url25, S_OK, WS_URL_HTTP_SCHEME_TYPE, url25 + 7, 4, 80, NULL, 0, NULL, 0, L"query 2", 7 },
+ { url26, S_OK, WS_URL_HTTP_SCHEME_TYPE, url26 + 7, 4, 80, NULL, 0, NULL, 0, NULL, 0, L"frag 2", 6 },
+ { url27, S_OK, WS_URL_HTTP_SCHEME_TYPE, url27 + 7, 4, 80, NULL, 0, L"/\x00eb/", 3 },
};
WS_HEAP *heap;
WS_STRING str;
@@ -126,21 +115,19 @@ static void test_WsDecodeUrl(void)
hr = WsDecodeUrl( &str, 0, heap, (WS_URL **)&url, NULL );
ok( hr == WS_E_INVALID_FORMAT, "got %08x\n", hr );
- str.chars = url1;
+ str.chars = (WCHAR *)url1;
str.length = lstrlenW( url1 );
hr = WsDecodeUrl( &str, 0, NULL, (WS_URL **)&url, NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr );
for (i = 0; i < ARRAY_SIZE( tests ); i++)
{
- static const WCHAR netpipe[] = {'n','e','t','.','p','i','p','e'};
-
str.length = lstrlenW( tests[i].str );
- str.chars = tests[i].str;
+ str.chars = (WCHAR *)tests[i].str;
url = NULL;
hr = WsDecodeUrl( &str, 0, heap, (WS_URL **)&url, NULL );
ok( hr == tests[i].hr ||
- broken(hr == WS_E_INVALID_FORMAT && str.length >= 8 && !memcmp(netpipe, str.chars, 8)),
+ broken(hr == WS_E_INVALID_FORMAT && str.length >= 8 && !memcmp(L"net.pipe", str.chars, 8)),
"%u: got %08x\n", i, hr );
if (hr != S_OK) continue;
@@ -193,42 +180,31 @@ static void test_WsDecodeUrl(void)
static void test_WsEncodeUrl(void)
{
- static WCHAR host[] = {'h','o','s','t'};
- static WCHAR host2[] = {'h','o','s','t',' ','2'};
- static WCHAR path[] = {'/','p','a','t','h'};
- static WCHAR path2[] = {'/','p','a','t','h',' ','2'};
- static WCHAR query[] = {'q','u','e','r','y'};
- static WCHAR query2[] = {'q','u','e','r','y',' ','2'};
- static WCHAR frag[] = {'f','r','a','g'};
- static WCHAR frag2[] = {'f','r','a','g',' ','2'};
- static WCHAR port[] = {'8','0','8','0'};
- static WCHAR port2[] = {'6','5','5','3','6'};
- static const WCHAR url1[] = {'h','t','t','p',':','/','/','h','o','s','t'};
- static const WCHAR url2[] = {'h','t','t','p',':','/','/'};
- static const WCHAR url3[] = {'h','t','t','p',':','/','/','/','p','a','t','h'};
- static const WCHAR url4[] = {'h','t','t','p',':','/','/','?','q','u','e','r','y'};
- static const WCHAR url5[] = {'h','t','t','p',':','/','/','#','f','r','a','g'};
- static const WCHAR url6[] = {'h','t','t','p',':','/','/','h','o','s','t',':','8','0','8','0',
- '/','p','a','t','h','?','q','u','e','r','y','#','f','r','a','g'};
- static const WCHAR url7[] = {'h','t','t','p',':','/','/',':','8','0','8','0'};
- static const WCHAR url8[] = {'h','t','t','p',':','/','/'};
- static const WCHAR url9[] = {'h','t','t','p',':','/','/','/','p','a','t','h','%','2','0','2'};
- static const WCHAR url10[] = {'h','t','t','p',':','/','/','?','q','u','e','r','y','%','2','0','2'};
- static const WCHAR url11[] = {'h','t','t','p',':','/','/','#','f','r','a','g','%','2','0','2'};
- static const WCHAR url12[] = {'h','t','t','p',':','/','/','h','o','s','t','%','2','0','2'};
+ static const WCHAR url1[] = L"http://host";
+ static const WCHAR url2[] = L"http://";
+ static const WCHAR url3[] = L"http:///path";
+ static const WCHAR url4[] = L"http://?query";
+ static const WCHAR url5[] = L"http://#frag";
+ static const WCHAR url6[] = L"http://host:8080/path?query#frag";
+ static const WCHAR url7[] = L"http://:8080";
+ static const WCHAR url8[] = L"http://";
+ static const WCHAR url9[] = L"http:///path%202";
+ static const WCHAR url10[] = L"http://?query%202";
+ static const WCHAR url11[] = L"http://#frag%202";
+ static const WCHAR url12[] = L"http://host%202";
static const struct
{
WS_URL_SCHEME_TYPE scheme;
- WCHAR *host;
+ const WCHAR *host;
ULONG host_len;
USHORT port;
- WCHAR *port_str;
+ const WCHAR *port_str;
ULONG port_len;
- WCHAR *path;
+ const WCHAR *path;
ULONG path_len;
- WCHAR *query;
+ const WCHAR *query;
ULONG query_len;
- WCHAR *fragment;
+ const WCHAR *fragment;
ULONG fragment_len;
HRESULT hr;
ULONG len;
@@ -236,22 +212,22 @@ static void test_WsEncodeUrl(void)
}
tests[] =
{
- { WS_URL_HTTP_SCHEME_TYPE, host, 4, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 0, S_OK, 11, url1 },
+ { WS_URL_HTTP_SCHEME_TYPE, L"host", 4, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 0, S_OK, 11, url1 },
{ WS_URL_HTTP_SCHEME_TYPE, NULL, 0, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 0, S_OK, 7, url2 },
- { WS_URL_HTTP_SCHEME_TYPE, NULL, 0, 0, NULL, 0, path, 5, NULL, 0, NULL, 0, S_OK, 12, url3 },
- { WS_URL_HTTP_SCHEME_TYPE, NULL, 0, 0, NULL, 0, NULL, 0, query, 5, NULL, 0, S_OK, 13, url4 },
- { WS_URL_HTTP_SCHEME_TYPE, NULL, 0, 0, NULL, 0, NULL, 0, NULL, 0, frag, 4, S_OK, 12, url5 },
- { WS_URL_HTTP_SCHEME_TYPE, host, 4, 0, port, 4, path, 5, query, 5, frag, 4, S_OK, 32, url6 },
+ { WS_URL_HTTP_SCHEME_TYPE, NULL, 0, 0, NULL, 0, L"/path", 5, NULL, 0, NULL, 0, S_OK, 12, url3 },
+ { WS_URL_HTTP_SCHEME_TYPE, NULL, 0, 0, NULL, 0, NULL, 0, L"query", 5, NULL, 0, S_OK, 13, url4 },
+ { WS_URL_HTTP_SCHEME_TYPE, NULL, 0, 0, NULL, 0, NULL, 0, NULL, 0, L"frag", 4, S_OK, 12, url5 },
+ { WS_URL_HTTP_SCHEME_TYPE, L"host", 4, 0, L"8080", 4, L"/path", 5, L"query", 5, L"frag", 4, S_OK, 32, url6 },
{ WS_URL_HTTP_SCHEME_TYPE, NULL, 0, 8080, NULL, 0, NULL, 0, NULL, 0, NULL, 0, S_OK, 12, url7 },
- { WS_URL_HTTP_SCHEME_TYPE, NULL, 0, 0, port, 4, NULL, 0, NULL, 0, NULL, 0, S_OK, 12, url7 },
- { WS_URL_HTTP_SCHEME_TYPE, NULL, 0, 8080, port, 4, NULL, 0, NULL, 0, NULL, 0, S_OK, 12, url7 },
- { WS_URL_HTTP_SCHEME_TYPE, NULL, 0, 8181, port, 4, NULL, 0, NULL, 0, NULL, 0, E_INVALIDARG, 0, NULL },
- { WS_URL_HTTP_SCHEME_TYPE, NULL, 0, 0, port2, 5, NULL, 0, NULL, 0, NULL, 0, WS_E_INVALID_FORMAT, 0, NULL },
+ { WS_URL_HTTP_SCHEME_TYPE, NULL, 0, 0, L"8080", 4, NULL, 0, NULL, 0, NULL, 0, S_OK, 12, url7 },
+ { WS_URL_HTTP_SCHEME_TYPE, NULL, 0, 8080, L"8080", 4, NULL, 0, NULL, 0, NULL, 0, S_OK, 12, url7 },
+ { WS_URL_HTTP_SCHEME_TYPE, NULL, 0, 8181, L"8080", 4, NULL, 0, NULL, 0, NULL, 0, E_INVALIDARG, 0, NULL },
+ { WS_URL_HTTP_SCHEME_TYPE, NULL, 0, 0, L"65536", 5, NULL, 0, NULL, 0, NULL, 0, WS_E_INVALID_FORMAT, 0, NULL },
{ WS_URL_HTTP_SCHEME_TYPE, NULL, 0, 80, NULL, 0, NULL, 0, NULL, 0, NULL, 0, S_OK, 7, url8 },
- { WS_URL_HTTP_SCHEME_TYPE, NULL, 0, 0, NULL, 0, path2, 7, NULL, 0, NULL, 0, S_OK, 16, url9 },
- { WS_URL_HTTP_SCHEME_TYPE, NULL, 0, 0, NULL, 0, NULL, 0, query2, 7, NULL, 0, S_OK, 17, url10 },
- { WS_URL_HTTP_SCHEME_TYPE, NULL, 0, 0, NULL, 0, NULL, 0, NULL, 0, frag2, 6, S_OK, 16, url11 },
- { WS_URL_HTTP_SCHEME_TYPE, host2, 6, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 0, S_OK, 15, url12 },
+ { WS_URL_HTTP_SCHEME_TYPE, NULL, 0, 0, NULL, 0, L"/path 2", 7, NULL, 0, NULL, 0, S_OK, 16, url9 },
+ { WS_URL_HTTP_SCHEME_TYPE, NULL, 0, 0, NULL, 0, NULL, 0, L"query 2", 7, NULL, 0, S_OK, 17, url10 },
+ { WS_URL_HTTP_SCHEME_TYPE, NULL, 0, 0, NULL, 0, NULL, 0, NULL, 0, L"frag 2", 6, S_OK, 16, url11 },
+ { WS_URL_HTTP_SCHEME_TYPE, L"host 2", 6, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 0, S_OK, 15, url12 },
};
WS_HEAP *heap;
WS_STRING str;
@@ -275,16 +251,16 @@ static void test_WsEncodeUrl(void)
{
memset( &url, 0, sizeof(url) );
url.url.scheme = tests[i].scheme;
- url.host.chars = tests[i].host;
+ url.host.chars = (WCHAR *)tests[i].host;
url.host.length = tests[i].host_len;
url.port = tests[i].port;
- url.portAsString.chars = tests[i].port_str;
+ url.portAsString.chars = (WCHAR *)tests[i].port_str;
url.portAsString.length = tests[i].port_len;
- url.path.chars = tests[i].path;
+ url.path.chars = (WCHAR *)tests[i].path;
url.path.length = tests[i].path_len;
- url.query.chars = tests[i].query;
+ url.query.chars = (WCHAR *)tests[i].query;
url.query.length = tests[i].query_len;
- url.fragment.chars = tests[i].fragment;
+ url.fragment.chars = (WCHAR *)tests[i].fragment;
url.fragment.length = tests[i].fragment_len;
memset( &str, 0, sizeof(str) );
diff --git a/dlls/webservices/tests/writer.c b/dlls/webservices/tests/writer.c
index 65e672a424..4fb9f44733 100644
--- a/dlls/webservices/tests/writer.c
+++ b/dlls/webservices/tests/writer.c
@@ -549,7 +549,6 @@ static void test_WsWriteStartAttribute(void)
static void test_WsWriteType(void)
{
- static const WCHAR testW[] = {'t','e','s','t',0};
HRESULT hr;
WS_XML_WRITER *writer;
WS_XML_STRING prefix = {1, (BYTE*)"p"}, localname = {3, (BYTE *)"str"}, ns = {2, (BYTE *)"ns"};
@@ -566,7 +565,7 @@ static void test_WsWriteType(void)
hr = set_output( writer );
ok( hr == S_OK, "got %08x\n", hr );
- val_str = testW;
+ val_str = L"test";
hr = WsWriteType( writer, WS_ELEMENT_TYPE_MAPPING, WS_WSZ_TYPE, NULL,
WS_WRITE_REQUIRED_POINTER, &val_str, sizeof(val_str), NULL );
ok( hr == WS_E_INVALID_FORMAT, "got %08x\n", hr );
@@ -579,11 +578,11 @@ static void test_WsWriteType(void)
/* required value */
hr = WsWriteType( writer, WS_ELEMENT_TYPE_MAPPING, WS_WSZ_TYPE, NULL,
- WS_WRITE_REQUIRED_VALUE, NULL, sizeof(testW), NULL );
+ WS_WRITE_REQUIRED_VALUE, NULL, sizeof(L"test"), NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr );
hr = WsWriteType( writer, WS_ELEMENT_TYPE_MAPPING, WS_WSZ_TYPE, NULL,
- WS_WRITE_REQUIRED_VALUE, testW, sizeof(testW), NULL );
+ WS_WRITE_REQUIRED_VALUE, L"test", sizeof(L"test"), NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr );
/* required pointer */
@@ -592,7 +591,7 @@ static void test_WsWriteType(void)
ok( hr == E_INVALIDARG, "got %08x\n", hr );
hr = WsWriteType( writer, WS_ELEMENT_TYPE_MAPPING, WS_WSZ_TYPE, NULL,
- WS_WRITE_REQUIRED_VALUE, testW, sizeof(testW), NULL );
+ WS_WRITE_REQUIRED_VALUE, L"test", sizeof(L"test"), NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr );
hr = WsWriteType( writer, WS_ELEMENT_TYPE_MAPPING, WS_WSZ_TYPE, NULL,
@@ -613,7 +612,7 @@ static void test_WsWriteType(void)
hr = WsWriteStartAttribute( writer, NULL, &localname, &ns, FALSE, NULL );
ok( hr == S_OK, "got %08x\n", hr );
- val_str = testW;
+ val_str = L"test";
hr = WsWriteType( writer, WS_ATTRIBUTE_TYPE_MAPPING, WS_WSZ_TYPE, NULL,
WS_WRITE_REQUIRED_POINTER, &val_str, sizeof(val_str), NULL );
ok( hr == S_OK, "got %08x\n", hr );
@@ -633,7 +632,7 @@ static void test_WsWriteType(void)
hr = WsWriteStartElement( writer, &prefix, &localname, &ns, NULL );
ok( hr == S_OK, "got %08x\n", hr );
- val_str = testW;
+ val_str = L"test";
hr = WsWriteType( writer, WS_ELEMENT_CONTENT_TYPE_MAPPING, WS_WSZ_TYPE, NULL,
WS_WRITE_REQUIRED_POINTER, &val_str, sizeof(val_str), NULL );
ok( hr == S_OK, "got %08x\n", hr );
@@ -689,12 +688,11 @@ static void prepare_basic_type_test( WS_XML_WRITER *writer )
static void test_basic_type(void)
{
- static WCHAR testW[] = {'t','e','s','t',0};
HRESULT hr;
WS_XML_WRITER *writer;
WS_XML_STRING localname = {1, (BYTE *)"t"}, ns = {0, NULL}, xmlstr;
GUID guid;
- WCHAR *str;
+ const WCHAR *str;
WS_STRING string;
WS_BYTES bytes;
WS_UNIQUE_ID id;
@@ -784,7 +782,7 @@ static void test_basic_type(void)
check_output( writer, "<t>00000000-0000-0000-0000-000000000000</t>", __LINE__ );
prepare_basic_type_test( writer );
- string.chars = testW;
+ string.chars = (WCHAR *)L"test";
string.length = 4;
hr = WsWriteType( writer, WS_ELEMENT_TYPE_MAPPING, WS_STRING_TYPE, NULL, WS_WRITE_REQUIRED_VALUE,
&string, sizeof(string), NULL );
@@ -794,7 +792,7 @@ static void test_basic_type(void)
check_output( writer, "<t>test</t>", __LINE__ );
prepare_basic_type_test( writer );
- str = testW;
+ str = L"test";
hr = WsWriteType( writer, WS_ELEMENT_TYPE_MAPPING, WS_WSZ_TYPE, NULL, WS_WRITE_REQUIRED_POINTER,
&str, sizeof(str), NULL );
ok( hr == S_OK, "got %08x\n", hr );
@@ -860,7 +858,7 @@ static void test_basic_type(void)
prepare_basic_type_test( writer );
id.uri.length = 4;
- id.uri.chars = testW;
+ id.uri.chars = (WCHAR *)L"test";
hr = WsWriteType( writer, WS_ELEMENT_TYPE_MAPPING, WS_UNIQUE_ID_TYPE, NULL, WS_WRITE_REQUIRED_VALUE,
&id, sizeof(id), NULL );
ok( hr == S_OK, "got %08x\n", hr );
@@ -873,7 +871,6 @@ static void test_basic_type(void)
static void test_simple_struct_type(void)
{
- static const WCHAR valueW[] = {'v','a','l','u','e',0};
HRESULT hr;
WS_XML_WRITER *writer;
WS_STRUCT_DESCRIPTION s;
@@ -905,7 +902,7 @@ static void test_simple_struct_type(void)
s.fieldCount = 1;
test = HeapAlloc( GetProcessHeap(), 0, sizeof(*test) );
- test->field = valueW;
+ test->field = L"value";
hr = WsWriteType( writer, WS_ELEMENT_CONTENT_TYPE_MAPPING, WS_STRUCT_TYPE, NULL,
WS_WRITE_REQUIRED_POINTER, &test, sizeof(test), NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr );
@@ -977,7 +974,6 @@ static void test_simple_struct_type(void)
static void test_WsWriteElement(void)
{
- static const WCHAR testW[] = {'t','e','s','t',0};
HRESULT hr;
WS_XML_WRITER *writer;
WS_STRUCT_DESCRIPTION s;
@@ -1010,7 +1006,7 @@ static void test_WsWriteElement(void)
desc.typeDescription = &s;
test = HeapAlloc( GetProcessHeap(), 0, sizeof(*test) );
- test->str = testW;
+ test->str = L"test";
hr = WsWriteElement( NULL, &desc, WS_WRITE_REQUIRED_POINTER, &test, sizeof(test), NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr );
@@ -1165,7 +1161,6 @@ static void test_WsWriteValue(void)
static void test_WsWriteAttribute(void)
{
- static const WCHAR testW[] = {'t','e','s','t',0};
HRESULT hr;
WS_XML_WRITER *writer;
WS_STRUCT_DESCRIPTION s;
@@ -1198,7 +1193,7 @@ static void test_WsWriteAttribute(void)
desc.typeDescription = &s;
test = HeapAlloc( GetProcessHeap(), 0, sizeof(*test) );
- test->str = testW;
+ test->str = L"test";
hr = WsWriteAttribute( NULL, &desc, WS_WRITE_REQUIRED_POINTER, &test, sizeof(test), NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr );
@@ -1580,8 +1575,6 @@ static void test_complex_struct_type(void)
"<o:OfficeConfig xmlns:o=\"urn:schemas-microsoft-com:office:office\">"
"<o:services o:GenerationTime=\"2015-09-03T18:47:54\"/>"
"</o:OfficeConfig>";
- static const WCHAR timestampW[] =
- {'2','0','1','5','-','0','9','-','0','3','T','1','8',':','4','7',':','5','4',0};
WS_XML_STRING str_officeconfig = {12, (BYTE *)"OfficeConfig"};
WS_XML_STRING str_services = {8, (BYTE *)"services"};
WS_XML_STRING str_generationtime = {14, (BYTE *)"GenerationTime"};
@@ -1654,7 +1647,7 @@ static void test_complex_struct_type(void)
size = sizeof(struct officeconfig) + sizeof(struct services);
test = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, size );
test->services = (struct services *)(test + 1);
- test->services->generationtime = timestampW;
+ test->services->generationtime = L"2015-09-03T18:47:54";
hr = WsWriteType( writer, WS_ELEMENT_CONTENT_TYPE_MAPPING, WS_STRUCT_TYPE, &s,
WS_WRITE_REQUIRED_POINTER, &test, sizeof(test), NULL );
ok( hr == S_OK, "got %08x\n", hr );
@@ -2141,7 +2134,6 @@ static void test_WsCopyNode(void)
static void test_text_types(void)
{
- static const WCHAR utf16W[] = {'u','t','f','1','6'};
WS_XML_STRING prefix = {1, (BYTE *)"p"}, localname = {1, (BYTE *)"t"}, localname2 = {1, (BYTE *)"u"};
WS_XML_STRING ns = {0, NULL}, ns2 = {2, (BYTE *)"ns"};
WS_XML_WRITER *writer;
@@ -2180,8 +2172,8 @@ static void test_text_types(void)
HRESULT hr;
ULONG i;
- val_utf16.bytes = (BYTE *)utf16W;
- val_utf16.byteCount = sizeof(utf16W);
+ val_utf16.bytes = (BYTE *)L"utf16";
+ val_utf16.byteCount = 10;
val_qname.localName = &localname2;
val_qname.ns = &ns;
@@ -2432,7 +2424,6 @@ static void test_field_options(void)
static void test_WsWriteText(void)
{
- static const WCHAR testW[] = {'t','e','s','t'};
WS_XML_STRING localname = {1, (BYTE *)"t"}, localname2 = {1, (BYTE *)"a"}, ns = {0, NULL};
HRESULT hr;
WS_XML_WRITER *writer;
@@ -2504,8 +2495,8 @@ static void test_WsWriteText(void)
hr = WsWriteStartElement( writer, NULL, &localname, &ns, NULL );
ok( hr == S_OK, "got %08x\n", hr );
- utf16.bytes = (BYTE *)testW;
- utf16.byteCount = sizeof(testW);
+ utf16.bytes = (BYTE *)L"test";
+ utf16.byteCount = 8;
hr = WsWriteText( writer, &utf16.text, NULL );
ok( hr == S_OK, "got %08x\n", hr );
check_output( writer, "<t>test", __LINE__ );
@@ -2852,11 +2843,10 @@ static void test_escapes(void)
static void test_write_option(void)
{
- static const WCHAR sW[] = {'s',0};
static const WS_XML_STRING localname = {1, (BYTE *)"t"}, ns = {0, NULL};
WS_XML_WRITER *writer;
int val_int = -1, val_int_zero = 0, *ptr_int = &val_int, *ptr_int_null = NULL;
- const WCHAR *ptr_wsz = sW, *ptr_wsz_null = NULL;
+ const WCHAR *ptr_wsz = L"s", *ptr_wsz_null = NULL;
static const WS_XML_STRING val_xmlstr = {1, (BYTE *)"x"}, val_xmlstr_zero = {0, NULL};
const WS_XML_STRING *ptr_xmlstr = &val_xmlstr, *ptr_xmlstr_null = NULL;
struct
@@ -3060,7 +3050,6 @@ static void test_datetime(void)
static void test_repeating_element(void)
{
- static const WCHAR oneW[] = {'1',0}, twoW[] = {'2',0};
WS_XML_STRING localname = {4, (BYTE *)"test"}, ns = {0, NULL};
WS_XML_STRING val = {3, (BYTE *)"val"}, wrapper = {7, (BYTE *)"wrapper"};
HRESULT hr;
@@ -3113,8 +3102,8 @@ static void test_repeating_element(void)
test = HeapAlloc( GetProcessHeap(), 0, sizeof(*test) + 2 * sizeof(const WCHAR *) );
test->val = (const WCHAR **)(test + 1);
- test->val[0] = oneW;
- test->val[1] = twoW;
+ test->val[0] = L"1";
+ test->val[1] = L"2";
test->count = 2;
hr = WsWriteType( writer, WS_ELEMENT_TYPE_MAPPING, WS_STRUCT_TYPE, &s,
WS_WRITE_REQUIRED_POINTER, &test, sizeof(test), NULL );
@@ -3317,7 +3306,6 @@ static void test_WsWriteBytes(void)
static void test_WsWriteChars(void)
{
WS_XML_STRING localname = {1, (BYTE *)"t"}, localname2 = {1, (BYTE *)"a"}, ns = {0, NULL};
- static const WCHAR testW[] = {'t','e','s','t'};
WS_XML_WRITER *writer;
HRESULT hr;
@@ -3330,19 +3318,19 @@ static void test_WsWriteChars(void)
hr = WsWriteChars( writer, NULL, 0, NULL );
ok( hr == WS_E_INVALID_OPERATION, "got %08x\n", hr );
- hr = WsWriteChars( writer, testW, 0, NULL );
+ hr = WsWriteChars( writer, L"test", 0, NULL );
ok( hr == WS_E_INVALID_OPERATION, "got %08x\n", hr );
hr = WsWriteChars( writer, NULL, 1, NULL );
ok( hr == WS_E_INVALID_OPERATION, "got %08x\n", hr );
- hr = WsWriteChars( writer, testW, 4, NULL );
+ hr = WsWriteChars( writer, L"test", 4, NULL );
ok( hr == WS_E_INVALID_OPERATION, "got %08x\n", hr );
hr = set_output( writer );
ok( hr == S_OK, "got %08x\n", hr );
- hr = WsWriteChars( writer, testW, 4, NULL );
+ hr = WsWriteChars( writer, L"test", 4, NULL );
ok( hr == WS_E_INVALID_FORMAT, "got %08x\n", hr );
hr = set_output( writer );
@@ -3352,10 +3340,10 @@ static void test_WsWriteChars(void)
hr = WsWriteStartElement( writer, NULL, &localname, &ns, NULL );
ok( hr == S_OK, "got %08x\n", hr );
- hr = WsWriteChars( writer, testW, 4, NULL );
+ hr = WsWriteChars( writer, L"test", 4, NULL );
ok( hr == S_OK, "got %08x\n", hr );
- hr = WsWriteChars( writer, testW, 4, NULL );
+ hr = WsWriteChars( writer, L"test", 4, NULL );
ok( hr == S_OK, "got %08x\n", hr );
hr = WsWriteEndElement( writer, NULL );
@@ -3372,10 +3360,10 @@ static void test_WsWriteChars(void)
hr = WsWriteStartAttribute( writer, NULL, &localname2, &ns, FALSE, NULL );
ok( hr == S_OK, "got %08x\n", hr );
- hr = WsWriteChars( writer, testW, 4, NULL );
+ hr = WsWriteChars( writer, L"test", 4, NULL );
ok( hr == S_OK, "got %08x\n", hr );
- hr = WsWriteChars( writer, testW, 4, NULL );
+ hr = WsWriteChars( writer, L"test", 4, NULL );
ok( hr == S_OK, "got %08x\n", hr );
hr = WsWriteEndAttribute( writer, NULL );
@@ -3904,7 +3892,6 @@ static void test_dictionary(void)
static void test_union_type(void)
{
- static const WCHAR testW[] = {'t','e','s','t',0};
static WS_XML_STRING str_ns = {0, NULL}, str_a = {1, (BYTE *)"a"}, str_b = {1, (BYTE *)"b"};
static WS_XML_STRING str_none = {4, (BYTE *)"none"}, str_s = {1, (BYTE *)"s"}, str_t = {1, (BYTE *)"t"};
HRESULT hr;
@@ -3974,7 +3961,7 @@ static void test_union_type(void)
hr = WsWriteStartElement( writer, NULL, &str_t, &str_ns, NULL );
ok( hr == S_OK, "got %08x\n", hr );
test.choice = CHOICE_A;
- test.value.a = testW;
+ test.value.a = L"test";
hr = WsWriteType( writer, WS_ELEMENT_CONTENT_TYPE_MAPPING, WS_STRUCT_TYPE, &s,
WS_WRITE_REQUIRED_VALUE, &test, sizeof(test), NULL );
ok( hr == S_OK, "got %08x\n", hr );
@@ -4069,7 +4056,6 @@ static void prepare_binary_type_test( WS_XML_WRITER *writer, const WS_XML_STRING
static void test_text_types_binary(void)
{
- static WCHAR testW[] = {'t','e','s','t'};
static WS_XML_STRING str_s = {1, (BYTE *)"s"}, str_t = {1, (BYTE *)"t"}, str_u = {1, (BYTE *)"u"};
static WS_XML_STRING str_ns = {0, NULL};
static const char res[] =
@@ -4310,7 +4296,7 @@ static void test_text_types_binary(void)
prepare_binary_type_test( writer, NULL, &str_t, &str_ns );
test.type = WS_XML_TEXT_TYPE_UTF16;
- test.u.val_utf16.chars = testW;
+ test.u.val_utf16.chars = (WCHAR *)L"test";
test.u.val_utf16.length = 4;
hr = WsWriteType( writer, WS_ELEMENT_CONTENT_TYPE_MAPPING, WS_STRUCT_TYPE, &s, WS_WRITE_REQUIRED_VALUE,
&test, sizeof(test), NULL );
@@ -4575,7 +4561,6 @@ static void test_text_types_binary(void)
static void test_repeating_element_choice(void)
{
- static const WCHAR testW[] = {'t','e','s','t',0};
static WS_XML_STRING str_ns = {0, NULL}, str_a = {1, (BYTE *)"a"}, str_b = {1, (BYTE *)"b"};
static WS_XML_STRING str_s = {1, (BYTE *)"s"}, str_t = {1, (BYTE *)"t"};
HRESULT hr;
@@ -4647,7 +4632,7 @@ static void test_repeating_element_choice(void)
s.typeNs = &str_ns;
items[0].choice = CHOICE_A;
- items[0].value.a = testW;
+ items[0].value.a = L"test";
items[1].choice = CHOICE_B;
items[1].value.b = 1;
test.items = items;
--
2.20.1
1
0
17 Mar '20
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
---
dlls/webservices/channel.c | 7 ++-----
dlls/webservices/listener.c | 3 +--
dlls/webservices/msg.c | 25 +++++++---------------
dlls/webservices/url.c | 41 +++++++++++++++----------------------
4 files changed, 27 insertions(+), 49 deletions(-)
diff --git a/dlls/webservices/channel.c b/dlls/webservices/channel.c
index 10c33dc07d..f2906c8673 100644
--- a/dlls/webservices/channel.c
+++ b/dlls/webservices/channel.c
@@ -910,8 +910,6 @@ error:
static HRESULT connect_channel_http( struct channel *channel )
{
- static const WCHAR agentW[] =
- {'M','S','-','W','e','b','S','e','r','v','i','c','e','s','/','1','.','0',0};
HINTERNET ses = NULL, con = NULL;
URL_COMPONENTS uc;
HRESULT hr;
@@ -943,7 +941,7 @@ static HRESULT connect_channel_http( struct channel *channel )
goto done;
}
- if (!(ses = WinHttpOpen( agentW, 0, NULL, NULL, 0 )))
+ if (!(ses = WinHttpOpen( L"MS-WebServices/1.0", 0, NULL, NULL, 0 )))
{
hr = HRESULT_FROM_WIN32( GetLastError() );
goto done;
@@ -1267,8 +1265,7 @@ static HRESULT send_sized_envelope( struct channel *channel, BYTE *data, ULONG l
static HRESULT open_http_request( struct channel *channel, HINTERNET *req )
{
- static const WCHAR postW[] = {'P','O','S','T',0};
- if ((*req = WinHttpOpenRequest( channel->u.http.connect, postW, channel->u.http.path,
+ if ((*req = WinHttpOpenRequest( channel->u.http.connect, L"POST", channel->u.http.path,
NULL, NULL, NULL, channel->u.http.flags ))) return S_OK;
return HRESULT_FROM_WIN32( GetLastError() );
}
diff --git a/dlls/webservices/listener.c b/dlls/webservices/listener.c
index 9b32369fd4..d41b64b974 100644
--- a/dlls/webservices/listener.c
+++ b/dlls/webservices/listener.c
@@ -286,7 +286,6 @@ void WINAPI WsFreeListener( WS_LISTENER *handle )
HRESULT resolve_hostname( const WCHAR *host, USHORT port, struct sockaddr *addr, int *addr_len, int flags )
{
- static const WCHAR fmtW[] = {'%','u',0};
WCHAR service[6];
ADDRINFOW hints, *res, *info;
HRESULT hr = WS_E_ADDRESS_NOT_AVAILABLE;
@@ -296,7 +295,7 @@ HRESULT resolve_hostname( const WCHAR *host, USHORT port, struct sockaddr *addr,
hints.ai_family = AF_INET;
*addr_len = 0;
- swprintf( service, ARRAY_SIZE(service), fmtW, port );
+ swprintf( service, ARRAY_SIZE(service), L"%u", port );
if (GetAddrInfoW( host, service, &hints, &res )) return HRESULT_FROM_WIN32( WSAGetLastError() );
info = res;
diff --git a/dlls/webservices/msg.c b/dlls/webservices/msg.c
index 6922224a05..d955e173b4 100644
--- a/dlls/webservices/msg.c
+++ b/dlls/webservices/msg.c
@@ -1901,14 +1901,6 @@ static HRESULT insert_mapped_headers( struct msg *msg, HINTERNET req )
HRESULT message_insert_http_headers( WS_MESSAGE *handle, HINTERNET req )
{
- static const WCHAR contenttypeW[] =
- {'C','o','n','t','e','n','t','-','T','y','p','e',0};
- static const WCHAR soapxmlW[] =
- {'a','p','p','l','i','c','a','t','i','o','n','/','s','o','a','p','+','x','m','l',0};
- static const WCHAR textxmlW[] =
- {'t','e','x','t','/','x','m','l',0};
- static const WCHAR charsetW[] =
- {'c','h','a','r','s','e','t','=','u','t','f','-','8',0};
struct msg *msg = (struct msg *)handle;
HRESULT hr = E_OUTOFMEMORY;
WCHAR *header = NULL, *buf;
@@ -1925,11 +1917,11 @@ HRESULT message_insert_http_headers( WS_MESSAGE *handle, HINTERNET req )
switch (msg->version_env)
{
case WS_ENVELOPE_VERSION_SOAP_1_1:
- header = build_http_header( contenttypeW, textxmlW, &len );
+ header = build_http_header( L"Content-Type", L"text/xml", &len );
break;
case WS_ENVELOPE_VERSION_SOAP_1_2:
- header = build_http_header( contenttypeW, soapxmlW, &len );
+ header = build_http_header( L"Content-Type", L"application/soap+xml", &len );
break;
default:
@@ -1942,7 +1934,7 @@ HRESULT message_insert_http_headers( WS_MESSAGE *handle, HINTERNET req )
heap_free( header );
hr = E_OUTOFMEMORY;
- if (!(header = build_http_header( contenttypeW, charsetW, &len ))) goto done;
+ if (!(header = build_http_header( L"Content-Type", L"charset=utf-8", &len ))) goto done;
if ((hr = insert_http_header( req, header, len, WINHTTP_ADDREQ_FLAG_COALESCE_WITH_SEMICOLON )) != S_OK)
goto done;
heap_free( header );
@@ -1952,8 +1944,6 @@ HRESULT message_insert_http_headers( WS_MESSAGE *handle, HINTERNET req )
{
case WS_ENVELOPE_VERSION_SOAP_1_1:
{
- static const WCHAR soapactionW[] = {'S','O','A','P','A','c','t','i','o','n',0};
-
if (!(len = MultiByteToWideChar( CP_UTF8, 0, (char *)msg->action->bytes, msg->action->length, NULL, 0 )))
break;
@@ -1964,7 +1954,7 @@ HRESULT message_insert_http_headers( WS_MESSAGE *handle, HINTERNET req )
buf[len + 1] = '"';
buf[len + 2] = 0;
- header = build_http_header( soapactionW, buf, &len );
+ header = build_http_header( L"SOAPAction", buf, &len );
heap_free( buf );
if (!header) goto done;
@@ -1973,21 +1963,20 @@ HRESULT message_insert_http_headers( WS_MESSAGE *handle, HINTERNET req )
}
case WS_ENVELOPE_VERSION_SOAP_1_2:
{
- static const WCHAR actionW[] = {'a','c','t','i','o','n','=','"'};
- ULONG len_action = ARRAY_SIZE( actionW );
+ ULONG len_action = ARRAY_SIZE( L"action=\"" ) - 1;
if (!(len = MultiByteToWideChar( CP_UTF8, 0, (char *)msg->action->bytes, msg->action->length, NULL, 0 )))
break;
hr = E_OUTOFMEMORY;
if (!(buf = heap_alloc( (len + len_action + 2) * sizeof(WCHAR) ))) goto done;
- memcpy( buf, actionW, len_action * sizeof(WCHAR) );
+ memcpy( buf, L"action=\"", len_action * sizeof(WCHAR) );
MultiByteToWideChar( CP_UTF8, 0, (char *)msg->action->bytes, msg->action->length, buf + len_action, len );
len += len_action;
buf[len++] = '"';
buf[len] = 0;
- header = build_http_header( contenttypeW, buf, &len );
+ header = build_http_header( L"Content-Type", buf, &len );
heap_free( buf );
if (!header) goto done;
diff --git a/dlls/webservices/url.c b/dlls/webservices/url.c
index 6f2ce9d6c9..f2fbda83c1 100644
--- a/dlls/webservices/url.c
+++ b/dlls/webservices/url.c
@@ -31,27 +31,21 @@
WINE_DEFAULT_DEBUG_CHANNEL(webservices);
-static const WCHAR http[] = {'h','t','t','p'};
-static const WCHAR https[] = {'h','t','t','p','s'};
-static const WCHAR nettcp[] = {'n','e','t','.','t','c','p'};
-static const WCHAR soapudp[] = {'s','o','a','p','.','u','d','p'};
-static const WCHAR netpipe[] = {'n','e','t','.','p','i','p','e'};
-
static WS_URL_SCHEME_TYPE scheme_type( const WCHAR *str, ULONG len )
{
- if (len == ARRAY_SIZE( http ) && !wcsnicmp( str, http, ARRAY_SIZE( http )))
+ if (len == ARRAY_SIZE( L"http" ) - 1 && !wcsnicmp( str, L"http", ARRAY_SIZE( L"http" ) - 1 ))
return WS_URL_HTTP_SCHEME_TYPE;
- if (len == ARRAY_SIZE( https ) && !wcsnicmp( str, https, ARRAY_SIZE( https )))
+ if (len == ARRAY_SIZE( L"https" ) - 1 && !wcsnicmp( str, L"https", ARRAY_SIZE( L"https" ) - 1 ))
return WS_URL_HTTPS_SCHEME_TYPE;
- if (len == ARRAY_SIZE( nettcp ) && !wcsnicmp( str, nettcp, ARRAY_SIZE( nettcp )))
+ if (len == ARRAY_SIZE( L"net.tcp" ) - 1 && !wcsnicmp( str, L"net.tcp", ARRAY_SIZE( L"net.tcp" ) - 1 ))
return WS_URL_NETTCP_SCHEME_TYPE;
- if (len == ARRAY_SIZE( soapudp ) && !wcsnicmp( str, soapudp, ARRAY_SIZE( soapudp )))
+ if (len == ARRAY_SIZE( L"soap.udp" ) - 1 && !wcsnicmp( str, L"soap.udp", ARRAY_SIZE( L"soap.udp" ) - 1 ))
return WS_URL_SOAPUDP_SCHEME_TYPE;
- if (len == ARRAY_SIZE( netpipe ) && !wcsnicmp( str, netpipe, ARRAY_SIZE( netpipe )))
+ if (len == ARRAY_SIZE( L"net.pipe" ) - 1 && !wcsnicmp( str, L"net.pipe", ARRAY_SIZE( L"net.pipe" ) - 1 ))
return WS_URL_NETPIPE_SCHEME_TYPE;
return ~0u;
@@ -278,24 +272,24 @@ static const WCHAR *scheme_str( WS_URL_SCHEME_TYPE scheme, ULONG *len )
switch (scheme)
{
case WS_URL_HTTP_SCHEME_TYPE:
- *len = ARRAY_SIZE( http );
- return http;
+ *len = ARRAY_SIZE( L"http" ) - 1;
+ return L"http";
case WS_URL_HTTPS_SCHEME_TYPE:
- *len = ARRAY_SIZE( https );
- return https;
+ *len = ARRAY_SIZE( L"https" ) - 1;
+ return L"https";
case WS_URL_NETTCP_SCHEME_TYPE:
- *len = ARRAY_SIZE( nettcp );
- return nettcp;
+ *len = ARRAY_SIZE( L"net.tcp" ) - 1;
+ return L"net.tcp";
case WS_URL_SOAPUDP_SCHEME_TYPE:
- *len = ARRAY_SIZE( soapudp );
- return soapudp;
+ *len = ARRAY_SIZE( L"soap.udp" ) - 1;
+ return L"soap.udp";
case WS_URL_NETPIPE_SCHEME_TYPE:
- *len = ARRAY_SIZE( netpipe );
- return netpipe;
+ *len = ARRAY_SIZE( L"net.pipe" ) - 1;
+ return L"net.pipe";
default:
ERR( "unhandled scheme %u\n", scheme );
@@ -364,7 +358,7 @@ static HRESULT url_encode_size( const WCHAR *str, ULONG len, const char *except,
static ULONG url_encode_byte( unsigned char byte, const char *except, WCHAR *buf )
{
- static const WCHAR hex[] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
+ static const WCHAR hex[] = L"0123456789ABCDEF";
switch (escape_size( byte, except ))
{
case 3:
@@ -426,7 +420,6 @@ static HRESULT url_encode( const WCHAR *str, ULONG len, WCHAR *buf, const char *
HRESULT WINAPI WsEncodeUrl( const WS_URL *base, ULONG flags, WS_HEAP *heap, WS_STRING *ret,
WS_ERROR *error )
{
- static const WCHAR fmtW[] = {':','%','u',0};
ULONG len = 0, len_scheme, len_enc, ret_size = 0;
const WS_HTTP_URL *url = (const WS_HTTP_URL *)base;
const WCHAR *scheme;
@@ -504,7 +497,7 @@ HRESULT WINAPI WsEncodeUrl( const WS_URL *base, ULONG flags, WS_HEAP *heap, WS_S
if (port)
{
WCHAR buf[7];
- len = swprintf( buf, ARRAY_SIZE(buf), fmtW, port );
+ len = swprintf( buf, ARRAY_SIZE(buf), L":%u", port );
memcpy( p, buf, len * sizeof(WCHAR) );
p += len;
}
--
2.20.1
1
0
[PATCH 1/6] mfplat: Implement ConvertToContiguousBuffer() for multiple buffers.
by Nikolay Sivov 17 Mar '20
by Nikolay Sivov 17 Mar '20
17 Mar '20
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
dlls/mfplat/buffer.c | 110 ++++++++++++++++++++++++++++++-------
dlls/mfplat/tests/mfplat.c | 23 ++++++--
2 files changed, 107 insertions(+), 26 deletions(-)
diff --git a/dlls/mfplat/buffer.c b/dlls/mfplat/buffer.c
index 69633134f5..1727ff1e90 100644
--- a/dlls/mfplat/buffer.c
+++ b/dlls/mfplat/buffer.c
@@ -1136,9 +1136,78 @@ static HRESULT WINAPI sample_GetBufferByIndex(IMFSample *iface, DWORD index, IMF
return hr;
}
+static unsigned int sample_get_total_length(struct sample *sample)
+{
+ DWORD total_length = 0, length;
+ size_t i;
+
+ for (i = 0; i < sample->buffer_count; ++i)
+ {
+ length = 0;
+ if (SUCCEEDED(IMFMediaBuffer_GetCurrentLength(sample->buffers[i], &length)))
+ total_length += length;
+ }
+
+ return total_length;
+}
+
+static HRESULT sample_copy_to_buffer(struct sample *sample, IMFMediaBuffer *buffer)
+{
+ DWORD total_length, dst_length, dst_current_length, src_max_length, current_length;
+ BYTE *src_ptr, *dst_ptr;
+ BOOL locked;
+ HRESULT hr;
+ size_t i;
+
+ total_length = sample_get_total_length(sample);
+ dst_current_length = 0;
+
+ dst_ptr = NULL;
+ dst_length = current_length = 0;
+ locked = SUCCEEDED(hr = IMFMediaBuffer_Lock(buffer, &dst_ptr, &dst_length, ¤t_length));
+ if (locked)
+ {
+ if (dst_length < total_length)
+ hr = MF_E_BUFFERTOOSMALL;
+ else if (dst_ptr)
+ {
+ for (i = 0; i < sample->buffer_count && SUCCEEDED(hr); ++i)
+ {
+ src_ptr = NULL;
+ src_max_length = current_length = 0;
+ if (SUCCEEDED(hr = IMFMediaBuffer_Lock(sample->buffers[i], &src_ptr, &src_max_length, ¤t_length)))
+ {
+ if (src_ptr)
+ {
+ if (current_length > dst_length)
+ hr = MF_E_BUFFERTOOSMALL;
+ else if (current_length)
+ {
+ memcpy(dst_ptr, src_ptr, current_length);
+ dst_length -= current_length;
+ dst_current_length += current_length;
+ dst_ptr += current_length;
+ }
+ }
+ IMFMediaBuffer_Unlock(sample->buffers[i]);
+ }
+ }
+ }
+ }
+
+ IMFMediaBuffer_SetCurrentLength(buffer, dst_current_length);
+
+ if (locked)
+ IMFMediaBuffer_Unlock(buffer);
+
+ return hr;
+}
+
static HRESULT WINAPI sample_ConvertToContiguousBuffer(IMFSample *iface, IMFMediaBuffer **buffer)
{
struct sample *sample = impl_from_IMFSample(iface);
+ unsigned int total_length, i;
+ IMFMediaBuffer *dest_buffer;
HRESULT hr = S_OK;
TRACE("%p, %p.\n", iface, buffer);
@@ -1147,15 +1216,29 @@ static HRESULT WINAPI sample_ConvertToContiguousBuffer(IMFSample *iface, IMFMedi
if (sample->buffer_count == 0)
hr = E_UNEXPECTED;
- else if (sample->buffer_count == 1)
+ else if (sample->buffer_count > 1)
{
- *buffer = sample->buffers[0];
- IMFMediaBuffer_AddRef(*buffer);
+ total_length = sample_get_total_length(sample);
+ if (SUCCEEDED(hr = MFCreateMemoryBuffer(total_length, &dest_buffer)))
+ {
+ if (SUCCEEDED(hr = sample_copy_to_buffer(sample, dest_buffer)))
+ {
+ for (i = 0; i < sample->buffer_count; ++i)
+ IMFMediaBuffer_Release(sample->buffers[i]);
+
+ sample->buffers[0] = dest_buffer;
+ IMFMediaBuffer_AddRef(sample->buffers[0]);
+
+ sample->buffer_count = 1;
+ }
+ IMFMediaBuffer_Release(dest_buffer);
+ }
}
- else
+
+ if (SUCCEEDED(hr))
{
- FIXME("Samples with multiple buffers are not supported.\n");
- hr = E_NOTIMPL;
+ *buffer = sample->buffers[0];
+ IMFMediaBuffer_AddRef(*buffer);
}
LeaveCriticalSection(&sample->attributes.cs);
@@ -1225,21 +1308,6 @@ static HRESULT WINAPI sample_RemoveAllBuffers(IMFSample *iface)
return S_OK;
}
-static DWORD sample_get_total_length(struct sample *sample)
-{
- DWORD total_length = 0, length;
- size_t i;
-
- for (i = 0; i < sample->buffer_count; ++i)
- {
- length = 0;
- if (SUCCEEDED(IMFMediaBuffer_GetCurrentLength(sample->buffers[i], &length)))
- total_length += length;
- }
-
- return total_length;
-}
-
static HRESULT WINAPI sample_GetTotalLength(IMFSample *iface, DWORD *total_length)
{
struct sample *sample = impl_from_IMFSample(iface);
diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c
index bf63337b60..a2bc7115a5 100644
--- a/dlls/mfplat/tests/mfplat.c
+++ b/dlls/mfplat/tests/mfplat.c
@@ -1778,7 +1778,7 @@ static void test_system_memory_buffer(void)
static void test_sample(void)
{
static const DWORD test_pattern = 0x22222222;
- IMFMediaBuffer *buffer, *buffer2;
+ IMFMediaBuffer *buffer, *buffer2, *buffer3;
DWORD count, flags, length;
IMFAttributes *attributes;
IMFSample *sample;
@@ -1998,9 +1998,15 @@ static void test_sample(void)
ok(buffer2 == buffer, "Unexpected buffer instance.\n");
IMFMediaBuffer_Release(buffer2);
+ hr = IMFMediaBuffer_SetCurrentLength(buffer, 3);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+
hr = MFCreateMemoryBuffer(16, &buffer2);
ok(hr == S_OK, "Failed to create a buffer, hr %#x.\n", hr);
+ hr = IMFMediaBuffer_SetCurrentLength(buffer2, 4);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+
hr = IMFSample_AddBuffer(sample, buffer2);
ok(hr == S_OK, "Failed to add buffer, hr %#x.\n", hr);
IMFMediaBuffer_Release(buffer2);
@@ -2009,15 +2015,22 @@ static void test_sample(void)
ok(hr == S_OK, "Failed to get buffer count, hr %#x.\n", hr);
ok(count == 2, "Unexpected buffer count %u.\n", count);
- hr = IMFSample_ConvertToContiguousBuffer(sample, &buffer2);
-todo_wine
+ hr = IMFSample_ConvertToContiguousBuffer(sample, &buffer3);
ok(hr == S_OK, "Failed to convert, hr %#x.\n", hr);
+
+ hr = IMFMediaBuffer_GetMaxLength(buffer3, &length);
+ ok(hr == S_OK, "Failed to get maximum length, hr %#x.\n", hr);
+ ok(length == 7, "Unexpected length %u.\n", length);
+
+ hr = IMFMediaBuffer_GetCurrentLength(buffer3, &length);
+ ok(hr == S_OK, "Failed to get maximum length, hr %#x.\n", hr);
+ ok(length == 7, "Unexpected length %u.\n", length);
+
if (SUCCEEDED(hr))
- IMFMediaBuffer_Release(buffer2);
+ IMFMediaBuffer_Release(buffer3);
hr = IMFSample_GetBufferCount(sample, &count);
ok(hr == S_OK, "Failed to get buffer count, hr %#x.\n", hr);
-todo_wine
ok(count == 1, "Unexpected buffer count %u.\n", count);
IMFMediaBuffer_Release(buffer);
--
2.25.1
2
7