Changeset: de1fc334addb for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/de1fc334addb
Modified Files:
        clients/mapiclient/dump.c
Branch: default
Log Message:

Work around Windows restriction.

%n cannot be used in printf formats because it supposedly is
 "inherently unsafe" (yeah, when you allow non fixed format strings).


diffs (21 lines):

diff --git a/clients/mapiclient/dump.c b/clients/mapiclient/dump.c
--- a/clients/mapiclient/dump.c
+++ b/clients/mapiclient/dump.c
@@ -1817,14 +1817,11 @@ dump_table_data(Mapi mid, const char *sc
                        if (fn == NULL)
                                goto bailout;
                        int off;
-#ifdef MSC_VER
-                       /* bloody Windows: enable %n format specifier */
-                       _set_printf_count_output(1);
-#endif
+                       off = snprintf(fn, fnl, "%s%c", ddir, DIR_SEP);
                        if (ext)
-                               snprintf(fn, fnl, "%s%c%n%s.%s.csv.%s", ddir, 
DIR_SEP, &off, schema, tname, ext);
+                               snprintf(fn + off, fnl - off, "%s.%s.csv.%s", 
schema, tname, ext);
                        else
-                               snprintf(fn, fnl, "%s%c%n%s.%s.csv", ddir, 
DIR_SEP, &off, schema, tname);
+                               snprintf(fn + off, fnl - off, "%s.%s.csv", 
schema, tname);
                        mnstr_printf(sqlf, " FROM E");
                        squoted_print(sqlf, fn + off, '\'', false);
                        mnstr_printf(sqlf, " ON CLIENT");
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to