dtsr: Resolve all -Wformat-security warnings.
authorPeter Howkins <flibble@users.sourceforge.net>
Wed, 29 Aug 2012 17:21:05 +0000 (18:21 +0100)
committerPeter Howkins <flibble@users.sourceforge.net>
Wed, 29 Aug 2012 17:21:05 +0000 (18:21 +0100)
cde/programs/dtsr/dtsrcreate.c
cde/programs/dtsr/dtsrdbrec.c
cde/programs/dtsr/dtsrhan.c
cde/programs/dtsr/huffcode.c
cde/programs/dtsr/tomita.c

index f1b2292432eec21326350bd5084b4a67b0ef7aa2..f5e81316fdba15883d692e221df273d22881075e 100644 (file)
@@ -224,7 +224,7 @@ static int      change_max_wordsize (char *new_size)
 
     /* Give user a final warning about large word sizes */
     if (maxwordsz > STANDARD_MAXWORD && language != DtSrLaDEU && !quiet_mode)
-       printf (catgets (dtsearch_catd, MS_initausd, 10,
+       printf ("%s", catgets (dtsearch_catd, MS_initausd, 10,
                PROGNAME" Specifying large maximum word sizes may "
                "significantly\n  increase storage requirements.\n"));
     return TRUE;
@@ -262,7 +262,7 @@ static int      change_min_wordsize (char *new_size)
 
        /* give user a warning about short word sizes */
        if (minwordsz < DEFAULT_MINWORD)
-           printf (catgets (dtsearch_catd, MS_initausd, 9,
+           printf ("%s", catgets (dtsearch_catd, MS_initausd, 9,
                    PROGNAME " Specifying small minimum word sizes"
                    " may require extensive\n"
                    "  editing of stopword file to prevent significantly\n"
@@ -800,7 +800,7 @@ DBD_OKAY:
        printf ("060*** fillnew dbrec.\n");
     d_fillnew (OR_DBREC, &dbrec, 0);
     if (db_status != S_OKAY) {
-       printf (catgets (dtsearch_catd, MS_initausd, 509,
+       printf ("%s", catgets (dtsearch_catd, MS_initausd, 509,
                PROGNAME "509 Could not initialize database header record.\n"));
        puts (vista_msg (PROGNAME "510"));
        DtSearchExit (3);
index 90d42a3b97be5946b496b7966689b9226c9a7f5c..800c7e5b7c8e9c752e76fbd770f69d4e3ba791a9 100644 (file)
@@ -112,7 +112,7 @@ void            print_dbrec (char *dbname, struct or_dbrec * dbrec)
            "Maximum object key size (sizeof(objkey)) is %ld bytes.\n"),
        DtSrMAX_DB_KEYSIZE);
     if (ORD_USEHUGEKEYS & dbrec->or_dbflags)
-       printf (catgets (dtsearch_catd, MS_dbrec, 4,
+       printf ("%s", catgets (dtsearch_catd, MS_dbrec, 4,
                "Optional 'Huge' keys enabled.\n"));
 
     printf (catgets (dtsearch_catd, MS_dbrec, 12,
index e002aef7eb0d3ac8aee6df92246b49c12e07ca2f..b579b48a5513e844b7199265085b3ef09c7b0f48 100644 (file)
@@ -339,7 +339,7 @@ void            open_outfile ()
            printf ( catgets(dtsearch_catd, MS_chandel, 3,
                "Output file '%s' already exists.\n") ,
                outfile);
-           printf ( catgets(dtsearch_catd, MS_chandel, 4,
+           printf ( "%s", catgets(dtsearch_catd, MS_chandel, 4,
                "Append, overwrite, or quit? [a,o,q] ") );
            i = tolower (getchar ());
 
@@ -1366,17 +1366,17 @@ BAD_ABSTR:
     /*---- Process tables, and check for identifiers referenced ----*/
     if (!top_defined && !bot_defined) {
        bad_profile = TRUE;
-       printf ( catgets(dtsearch_catd, MS_chandel, 49,
+       printf ( "%s", catgets(dtsearch_catd, MS_chandel, 49,
                "Error - delimiter not defined.\n") );
     }
     if (!key_defined) {
        bad_profile = TRUE;
-       printf ( catgets(dtsearch_catd, MS_chandel, 50,
+       printf ( "%s", catgets(dtsearch_catd, MS_chandel, 50,
                "Error - key-type character never defined.\n") );
     }
     if (!key_pos_defined) {
        bad_profile = TRUE;
-       printf ( catgets(dtsearch_catd, MS_chandel, 51,
+       printf ( "%s", catgets(dtsearch_catd, MS_chandel, 51,
                "Error - key never defined.\n") );
     }
     if (bad_profile)
@@ -2223,7 +2223,7 @@ static void       user_arg_processor (int argc, char **argv)
 
            case 'w':
                if ((screen_width = atoi (argptr + 2)) == 0) {
-                   printf ( catgets(dtsearch_catd, MS_chandel, 72,
+                   printf ( "%s", catgets(dtsearch_catd, MS_chandel, 72,
                        "Invalid screen width specified.\n") );
                    bad_parm = TRUE;
                }
@@ -2255,7 +2255,7 @@ static void       user_arg_processor (int argc, char **argv)
     }                          /*--while--*/
 
     if (argc-- <= 0) {
-       printf ( catgets(dtsearch_catd, MS_chandel, 77,
+       printf ( "%s", catgets(dtsearch_catd, MS_chandel, 77,
                "Missing required profile-file name.\n") );
        bad_parm = TRUE;
     }
@@ -2272,7 +2272,7 @@ static void       user_arg_processor (int argc, char **argv)
     }
 
     if (argc-- <= 0) {
-       printf ( catgets(dtsearch_catd, MS_chandel, 78,
+       printf ( "%s", catgets(dtsearch_catd, MS_chandel, 78,
                "Missing required input-file name.\n") );
        bad_parm = TRUE;
     }
@@ -2290,7 +2290,7 @@ static void       user_arg_processor (int argc, char **argv)
          strcat(outfile,EXT_FZKEY);
 *****************/
        if (strcmp (infile, "-") == 0) {
-           printf ( catgets(dtsearch_catd, MS_chandel, 79, "Error - using "
+           printf ( "%s", catgets(dtsearch_catd, MS_chandel, 79, "Error - using "
                "stdin as input, output filename is required!\n") );
            exit (FILE_ERROR);
        } else {
@@ -2341,13 +2341,13 @@ static void     user_arg_processor (int argc, char **argv)
        printf ( catgets(dtsearch_catd, MS_chandel, 83,
                "        Profile file: %s\n") , profile);
        if (strcmp (infile, "-") == 0)
-           printf ( catgets(dtsearch_catd, MS_chandel, 84,
+           printf ( "%s", catgets(dtsearch_catd, MS_chandel, 84,
                "          Input file: stdin\n") );
        else
            printf ( catgets(dtsearch_catd, MS_chandel, 85,
                "          Input file: %s\n") , infile);
        if (strcmp (outfile, "-") == 0)
-           printf ( catgets(dtsearch_catd, MS_chandel, 86,
+           printf ( "%s", catgets(dtsearch_catd, MS_chandel, 86,
                "         Output file: stdout\n") );
        else
            printf ( catgets(dtsearch_catd, MS_chandel, 87,
@@ -2405,13 +2405,13 @@ int             main (int argc, char **argv)
        oops = fclose (outstream);
        fclose (instream);
        if (oops < 0) {
-           printf ( catgets(dtsearch_catd, MS_chandel, 90,
+           printf ( "%s", catgets(dtsearch_catd, MS_chandel, 90,
                "\nError closing output file - disk full?\n") );
            exit (FILE_ERROR);
        }
     }
     else {
-       printf ( catgets(dtsearch_catd, MS_chandel, 91,
+       printf ( "%s", catgets(dtsearch_catd, MS_chandel, 91,
                "Quitting due to errors in profile file.\n") );
        exit (BAD_PROFILE);
     }
index 8e7278b60d62f00ed8e19366533e9be596dbcc12..56e5fc99645889a1413deec1fa19dd9a5917ab8b 100644 (file)
@@ -265,14 +265,14 @@ static int      build_tree (void)
         * tree level, quit. 
         */
        if (hctree1[i].sort > MAX_BITLEN) {
-           fprintf (stderr, catgets(dtsearch_catd, MS_huff, 30,
+           fprintf (stderr, "%s", catgets(dtsearch_catd, MS_huff, 30,
                "\n183 Bit strings have grown too large.  You probably "
                "have literals\n  turned off with grossly unbalanced "
                "character counts.\n\7"));
            exit (2);
        }
        if (hctree1[curr].count >= total_count) {
-           fprintf (stderr, catgets(dtsearch_catd, MS_huff, 31,
+           fprintf (stderr, "%s", catgets(dtsearch_catd, MS_huff, 31,
                "\n191 Programming Error:  Still trying to build\n"
                "  Huffman Code Tree after root created.\n\7"));
            exit (2);
@@ -583,7 +583,7 @@ static void     huffman_code (time_t idstamp)
            bit_string + 1,     /* hop over LAST_BIT */
            hctree1[i].count,
            char_label (i));
-       fprintf (outstream_huf, sprintbuf);
+       fprintf (outstream_huf, "%s", sprintbuf);
 
     }  /* end forloop printing out each tree base entry */
 
@@ -669,7 +669,7 @@ static void     user_args_processor (int argc, char **argv)
 
     /* test for required tree file name */
     if (argc <= 0) {
-       fprintf (stderr, catgets(dtsearch_catd, MS_huff, 37,
+       fprintf (stderr, "%s", catgets(dtsearch_catd, MS_huff, 37,
            "576 Missing Huffman Code file names prefix.\n"));
        print_usage ();
        exit (2);
@@ -735,7 +735,7 @@ int             main (int argc, char *argv[])
     /* initialize tree table, using the table file if it exists */
     init_treebase ();
     if (total_count == 0L)
-       printf (catgets(dtsearch_catd, MS_huff, 41,
+       printf ("%s", catgets(dtsearch_catd, MS_huff, 41,
            "Huffman Code Tables will be newly created.\n"));
     else
        printf (catgets(dtsearch_catd, MS_huff, 42,
index 9e17c500417f5e268082702f1485e7a2b96a23df..91aad3baf2f825c499be6b7a7836f114d7c5c756 100644 (file)
@@ -196,7 +196,7 @@ static int      change_database (char *newname)
        return FALSE;
 
     /* If browsing, tell user his options */
-    fprintf (aa_stderr,  catgets(dtsearch_catd, MS_tomita, 5,
+    fprintf (aa_stderr, "%s", catgets(dtsearch_catd, MS_tomita, 5,
        "Available choices are:") );
     for (db = usrblk.dblist; db != NULL; db = db->link)
        fprintf (aa_stderr, "   '%s'", db->name);
@@ -422,7 +422,7 @@ static int      browser (void)
                continue;
 
            default:
-               printf (catgets(dtsearch_catd, MS_tomita, 16, "...what?\n"));
+               printf ("%s", catgets(dtsearch_catd, MS_tomita, 16, "...what?\n"));
                continue;
        }       /* end switch */
 
@@ -471,7 +471,7 @@ DISPLAY_RECORD:
            if (pausing && *ptr == '\n') {
                if (++pause_counter >= PAUSE_ROWS) {
                    /* Msg 21 is used in two places */
-                   printf ( catgets(dtsearch_catd, MS_tomita, 21,
+                   printf ( "%s", catgets(dtsearch_catd, MS_tomita, 21,
                        "\n...push ENTER to continue... ") );
 
                    *userbuf = '\0';
@@ -500,7 +500,7 @@ DISPLAY_RECORD:
                    if (pausing && *ptr == '\n')
                        if (++pause_counter >= PAUSE_ROWS) {
                            /* Msg 21 is used in two places */
-                           printf ( catgets(dtsearch_catd, MS_tomita, 21,
+                           printf ( "%s", catgets(dtsearch_catd, MS_tomita, 21,
                                "\n...push ENTER to continue... ") );
 
                            *userbuf = '\0';
@@ -920,7 +920,7 @@ BAD_ARGS:
 
     usrblk.request = OE_SHUTDOWN;
     Opera_Engine ();
-    printf ( catgets(dtsearch_catd, MS_tomita, 36,
+    printf ( "%s", catgets(dtsearch_catd, MS_tomita, 36,
        "Normal engine shutdown.\n") );
     DtSearchExit (0);
 }  /* main() */