Loading...
libkern/c++/OSObject.cpp xnu-2050.22.13 xnu-2782.40.9
--- xnu/xnu-2050.22.13/libkern/c++/OSObject.cpp
+++ xnu/xnu-2782.40.9/libkern/c++/OSObject.cpp
@@ -28,6 +28,7 @@
 /* OSObject.cpp created by gvdl on Fri 1998-11-17 */
 
 #include <libkern/c++/OSObject.h>
+#include <libkern/c++/OSString.h>
 #include <libkern/c++/OSArray.h>
 #include <libkern/c++/OSSerialize.h>
 #include <libkern/c++/OSLib.h>
@@ -241,14 +242,19 @@
 
 bool OSObject::serialize(OSSerialize *s) const
 {
-    if (s->previouslySerialized(this)) return true;
-
-    if (!s->addXMLStartTag(this, "string")) return false;
-
-    if (!s->addString(getClassName(this))) return false;
-    if (!s->addString(" is not serializable")) return false;
-    
-    return s->addXMLEndTag("string");
+    char cstr[128];
+    bool ok;
+
+    snprintf(cstr, sizeof(cstr), "%s is not serializable", getClassName(this));
+
+    OSString * str;
+    str = OSString::withCStringNoCopy(cstr);
+    if (!str) return false;
+
+    ok = str->serialize(s);
+    str->release();
+
+    return (ok);
 }