]> git.saurik.com Git - wxWidgets.git/commitdiff
reverted previous commit and added a comment explaining why CByteArrayFormat should...
authorVáclav Slavík <vslavik@fastmail.fm>
Tue, 10 Apr 2007 19:32:48 +0000 (19:32 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Tue, 10 Apr 2007 19:32:48 +0000 (19:32 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45390 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

tests/mbconv/mbconvtest.cpp

index 7109ffb22320160c00cda0408c30ae2efc5222b3..0a57609cdc4f0dc9d0bfd10cb22ba3c145188ef2 100644 (file)
@@ -241,6 +241,33 @@ void MBConvTestCase::WC2CP1250()
     }
 }
 
+// Print an unsigned character array as a C unsigned character array.
+// NB: Please don't remove this function even though it's not used anywhere,
+//     it's very useful when debugging a failed test.
+wxString CByteArrayFormat( const void* data, size_t len, const wxChar* name )
+{
+    const unsigned char* bytes = (unsigned char*)data;
+    wxString result;
+
+    result.Printf( _T("const static unsigned char %s[%i] = \n{"), name, (int)len );
+
+    for ( size_t i = 0; i < len; i++ )
+    {
+        if ( i != 0 )
+        {
+            result.append( _T(",") );
+        }
+        if ((i%16)==0)
+        {
+            result.append( _T("\n    ") );
+        }
+        wxString byte = wxString::Format( _T("0x%02x"), bytes[i] );
+        result.append(byte);
+    }
+    result.append( _T("\n};\n") );
+    return result;
+}
+
 // The following bytes represent the same string, containing Japanese and English 
 // characters, encoded in several different formats.