Francois Gouget : msxml3: Fix printing NULL strings.

Alexandre Julliard julliard at winehq.org
Wed Sep 21 13:35:16 CDT 2011


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

Author: Francois Gouget <fgouget at free.fr>
Date:   Wed Sep 21 16:45:11 2011 +0200

msxml3: Fix printing NULL strings.

---

 dlls/msxml3/element.c       |    8 ++++----
 dlls/msxml3/httprequest.c   |    4 ++--
 dlls/msxml3/main.c          |    4 ++--
 dlls/msxml3/msxml_private.h |    1 +
 dlls/msxml3/schema.c        |    9 +++++++--
 5 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/dlls/msxml3/element.c b/dlls/msxml3/element.c
index f84dcb5..6cd3a6d 100644
--- a/dlls/msxml3/element.c
+++ b/dlls/msxml3/element.c
@@ -663,7 +663,7 @@ static inline HRESULT variant_from_dt(XDR_DT dt, xmlChar* str, VARIANT* v)
     case DT_IDREF:
     case DT_IDREFS:
     case DT_NOTATION:
-        FIXME("need to handle dt:%s\n", dt_to_str(dt));
+        FIXME("need to handle dt:%s\n", debugstr_dt(dt));
         V_VT(v) = VT_BSTR;
         V_BSTR(v) = bstr_from_xmlChar(str);
         if (!V_BSTR(v))
@@ -729,7 +729,7 @@ static XDR_DT element_get_dt(xmlNodePtr node)
         }
     }
 
-    TRACE("=> dt:%s\n", dt_to_str(dt));
+    TRACE("=> dt:%s\n", debugstr_dt(dt));
     return dt;
 }
 
@@ -786,7 +786,7 @@ static HRESULT WINAPI domelem_put_nodeTypedValue(
     }
     else
     {
-        FIXME("not implemented for dt:%s\n", dt_to_str(dt));
+        FIXME("not implemented for dt:%s\n", debugstr_dt(dt));
         return E_NOTIMPL;
     }
 
@@ -934,7 +934,7 @@ static HRESULT WINAPI domelem_put_dataType(
             }
             break;
         default:
-            FIXME("need to handle dt:%s\n", dt_to_str(dt));
+            FIXME("need to handle dt:%s\n", debugstr_dt(dt));
             break;
         }
     }
diff --git a/dlls/msxml3/httprequest.c b/dlls/msxml3/httprequest.c
index 8203129..0265c1a 100644
--- a/dlls/msxml3/httprequest.c
+++ b/dlls/msxml3/httprequest.c
@@ -888,12 +888,12 @@ static HRESULT WINAPI httprequest_get_responseText(IXMLHTTPRequest *iface, BSTR
         if (size >= 4)
         {
             encoding = xmlDetectCharEncoding(ptr, 4);
-            TRACE("detected encoding: %s\n", xmlGetCharEncodingName(encoding));
+            TRACE("detected encoding: %s\n", debugstr_a(xmlGetCharEncodingName(encoding)));
             if ( encoding != XML_CHAR_ENCODING_UTF8 &&
                  encoding != XML_CHAR_ENCODING_UTF16LE &&
                  encoding != XML_CHAR_ENCODING_NONE )
             {
-                FIXME("unsupported encoding: %s\n", xmlGetCharEncodingName(encoding));
+                FIXME("unsupported encoding: %s\n", debugstr_a(xmlGetCharEncodingName(encoding)));
                 GlobalUnlock(hglobal);
                 return E_FAIL;
             }
diff --git a/dlls/msxml3/main.c b/dlls/msxml3/main.c
index 2363008..c4e4303 100644
--- a/dlls/msxml3/main.c
+++ b/dlls/msxml3/main.c
@@ -105,7 +105,7 @@ void wineXmlCallbackError(char const* caller, xmlErrorPtr err)
     case XML_ERR_WARNING: dbcl = __WINE_DBCL_WARN; break;
     default:              dbcl = __WINE_DBCL_ERR; break;
     }
-    wine_dbg_log(dbcl, &__wine_dbch_msxml, caller, "%s", err->message);
+    wine_dbg_log(dbcl, &__wine_dbch_msxml, caller, "%s", debugstr_a(err->message));
 }
 
 /* Support for loading xml files from a Wine Windows drive */
@@ -288,7 +288,7 @@ const char *debugstr_variant(const VARIANT *v)
         return wine_dbg_sprintf("{VT_UINT: %u}", V_UINT(v));
     case VT_BSTR|VT_BYREF:
         return wine_dbg_sprintf("{VT_BSTR|VT_BYREF: ptr %p, data %s}",
-            V_BSTRREF(v), V_BSTRREF(v) ? debugstr_w(*V_BSTRREF(v)) : NULL);
+            V_BSTRREF(v), debugstr_w(V_BSTRREF(v) ? *V_BSTRREF(v) : NULL));
     default:
         return wine_dbg_sprintf("{vt %d}", V_VT(v));
     }
diff --git a/dlls/msxml3/msxml_private.h b/dlls/msxml3/msxml_private.h
index e7f82ea..bc90c99 100644
--- a/dlls/msxml3/msxml_private.h
+++ b/dlls/msxml3/msxml_private.h
@@ -333,6 +333,7 @@ extern XDR_DT  SchemaCache_get_node_dt(IXMLDOMSchemaCollection2* iface, xmlNodeP
 extern XDR_DT str_to_dt(xmlChar const* str, int len /* calculated if -1 */) DECLSPEC_HIDDEN;
 extern XDR_DT bstr_to_dt(OLECHAR const* bstr, int len /* calculated if -1 */) DECLSPEC_HIDDEN;
 extern xmlChar const* dt_to_str(XDR_DT dt) DECLSPEC_HIDDEN;
+extern const char* debugstr_dt(XDR_DT dt) DECLSPEC_HIDDEN;
 extern OLECHAR const* dt_to_bstr(XDR_DT dt) DECLSPEC_HIDDEN;
 extern HRESULT dt_validate(XDR_DT dt, xmlChar const* content) DECLSPEC_HIDDEN;
 
diff --git a/dlls/msxml3/schema.c b/dlls/msxml3/schema.c
index 8f2acb4..1c5255b 100644
--- a/dlls/msxml3/schema.c
+++ b/dlls/msxml3/schema.c
@@ -573,6 +573,11 @@ OLECHAR const* dt_to_bstr(XDR_DT dt)
     return DT_wstring_table[dt];
 }
 
+const char* debugstr_dt(XDR_DT dt)
+{
+    return debugstr_a(dt != DT_INVALID ? (const char*)DT_string_table[dt] : NULL);
+}
+
 HRESULT dt_validate(XDR_DT dt, xmlChar const* content)
 {
     xmlDocPtr tmp_doc;
@@ -580,7 +585,7 @@ HRESULT dt_validate(XDR_DT dt, xmlChar const* content)
     xmlNsPtr ns;
     HRESULT hr;
 
-    TRACE("(dt:%s, %s)\n", dt_to_str(dt), wine_dbgstr_a((char const*)content));
+    TRACE("(dt:%s, %s)\n", debugstr_dt(dt), wine_dbgstr_a((char const*)content));
 
     if (!datatypes_schema)
     {
@@ -650,7 +655,7 @@ HRESULT dt_validate(XDR_DT dt, xmlChar const* content)
             }
             return hr;
         default:
-            FIXME("need to handle dt:%s\n", dt_to_str(dt));
+            FIXME("need to handle dt:%s\n", debugstr_dt(dt));
             return S_OK;
     }
 }




More information about the wine-cvs mailing list