+static wxString
+FormatTiffMessage(const char *module, const char *fmt, va_list ap)
+{
+ char buf[512];
+ if ( wxCRT_VsnprintfA(buf, WXSIZEOF(buf), fmt, ap) <= 0 )
+ {
+ // this isn't supposed to happen, but if it does, it's better
+ // than nothing
+ strcpy(buf, "Incorrectly formatted TIFF message");
+ }
+ buf[WXSIZEOF(buf)-1] = 0; // make sure it is always NULL-terminated
+
+ wxString msg(buf);
+ if ( module )
+ msg += wxString::Format(_(" (in module \"%s\")"), module);
+
+ return msg;
+}
+