Dmitry Timoshkov : schedsvc: Skip the UTF-8 byte order mark when returing XML to the client.

Alexandre Julliard julliard at winehq.org
Mon Mar 24 15:59:46 CDT 2014


Module: wine
Branch: master
Commit: 285922ca7115424bb4bf3ce5b5bda7ffba8eba96
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=285922ca7115424bb4bf3ce5b5bda7ffba8eba96

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Mon Mar 24 16:08:34 2014 +0900

schedsvc: Skip the UTF-8 byte order mark when returing XML to the client.

---

 dlls/schedsvc/schedsvc.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/dlls/schedsvc/schedsvc.c b/dlls/schedsvc/schedsvc.c
index 988430d..5c7d359 100644
--- a/dlls/schedsvc/schedsvc.c
+++ b/dlls/schedsvc/schedsvc.c
@@ -29,6 +29,8 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(schedsvc);
 
+static const char bom_utf8[] = { 0xef,0xbb,0xbf };
+
 HRESULT __cdecl SchRpcHighestVersion(DWORD *version)
 {
     TRACE("%p\n", version);
@@ -105,7 +107,6 @@ static HRESULT create_directory(const WCHAR *path)
 
 static HRESULT write_xml_utf8(const WCHAR *name, DWORD disposition, const WCHAR *xmlW)
 {
-    static const char bom_utf8[] = { 0xef,0xbb,0xbf };
     static const char comment[] = "<!-- Task definition created by Wine -->\n";
     HANDLE hfile;
     DWORD size;
@@ -220,8 +221,6 @@ HRESULT __cdecl SchRpcRegisterTask(const WCHAR *path, const WCHAR *xml, DWORD fl
 
 static int detect_encoding(const void *buffer, DWORD size)
 {
-    static const char bom_utf8[] = { 0xef,0xbb,0xbf };
-
     if (size >= sizeof(bom_utf8) && !memcmp(buffer, bom_utf8, sizeof(bom_utf8)))
         return CP_UTF8;
     else
@@ -270,6 +269,9 @@ static HRESULT read_xml(const WCHAR *name, WCHAR **xml)
         return S_OK;
     }
 
+    if (cp == CP_UTF8 && size >= sizeof(bom_utf8) && !memcmp(src, bom_utf8, sizeof(bom_utf8)))
+        src += sizeof(bom_utf8);
+
     size = MultiByteToWideChar(cp, 0, src, -1, NULL, 0);
     *xml = heap_alloc(size * sizeof(WCHAR));
     if (!*xml) return E_OUTOFMEMORY;




More information about the wine-cvs mailing list