]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/imagxpm.cpp
really fixed wxConfig bug
[wxWidgets.git] / src / common / imagxpm.cpp
index 39689e1f5f53b35defe24846ff5d739a05b15725..19ae615e707bdef45da73729263ef263e2d5992f 100644 (file)
@@ -128,12 +128,16 @@ bool wxXPMHandler::SaveFile(wxImage * image,
         chars_per_pixel++;
 
     // 2. write the header:
-    tmp.Printf("/* XPM */\n"
+    char tmpbuf[200];
+    // VS: 200b is safe upper bound for anything produced by sprintf bellow
+    //     (101 bytes the string, neither %i can expand into more than 10 chars)
+    sprintf(tmpbuf, 
+               "/* XPM */\n"
                "static char *xpm_data[] = {\n"
                "/* columns rows colors chars-per-pixel */\n"
                "\"%i %i %i %i\",\n",
                image->GetWidth(), image->GetHeight(), cols, chars_per_pixel);
-    stream.Write(tmp.mb_str(), tmp.Length());
+    stream.Write(tmpbuf, strlen(tmpbuf));
 
     // 3. create color symbols table:
     wxHashTable table(wxKEY_INTEGER);