[gs-commits] rev 11771 - trunk/gs/base

ken at ghostscript.com ken at ghostscript.com
Thu Oct 7 13:59:50 UTC 2010


Author: ken
Date: 2010-10-07 13:59:49 +0000 (Thu, 07 Oct 2010)
New Revision: 11771

Modified:
   trunk/gs/base/gdevpdfj.c
   trunk/gs/base/gdevpdfp.c
   trunk/gs/base/gdevpdfu.c
Log:
Put back some statements. It turns out that we can either have gcc be warning free or
the static analysis warning free. The problem is gs_note_error which uses
gs_log_error, on a release build gs_log_error is defined as the error value. 

If we don't do something with that value then gcc complains that the 'statement has no
effect'. So the code was set like this:

ecode = gs_note_error(error code);

But if we want to actually ignore the error and just note the problem, then we don't use
ecode and the static analysis complains that the variable is unused....

I'd rather have no warnings from gcc so I've restored that.


Modified: trunk/gs/base/gdevpdfj.c
===================================================================
--- trunk/gs/base/gdevpdfj.c	2010-10-07 12:49:54 UTC (rev 11770)
+++ trunk/gs/base/gdevpdfj.c	2010-10-07 13:59:49 UTC (rev 11771)
@@ -419,7 +419,7 @@
 	    int lines_left = piw->height - data_h;
 	    byte buf[256];
 	    const uint lb = sizeof(buf);
-	    int i, l, status;
+	    int i, l;
 	    uint ignore;
 
 	    memset(buf, 128, lb);

Modified: trunk/gs/base/gdevpdfp.c
===================================================================
--- trunk/gs/base/gdevpdfp.c	2010-10-07 12:49:54 UTC (rev 11770)
+++ trunk/gs/base/gdevpdfp.c	2010-10-07 13:59:49 UTC (rev 11771)
@@ -463,14 +463,14 @@
 	  strcmp(pdev->color_info.cm_name, "DeviceGray"))) {
 	emprintf(pdev->memory,
                  "ColorConversionStrategy is incompatible to ProcessColorModel.\n");
-	gs_note_error(gs_error_rangecheck);
+	ecode = gs_note_error(gs_error_rangecheck);
 	pdev->params.ColorConversionStrategy = save_ccs;
     }
     if (pdev->params.ColorConversionStrategy == ccs_UseDeviceIndependentColor) {
 	if (!pdev->UseCIEColor) {
 	    emprintf(pdev->memory,
                      "Set UseCIEColor for UseDeviceIndependentColor to work properly.\n");
-	    gs_note_error(gs_error_rangecheck);
+	    ecode = gs_note_error(gs_error_rangecheck);
 	    pdev->UseCIEColor = true;
 	}
     }
@@ -482,7 +482,7 @@
 	    if (!pdev->UseCIEColor) {
 		emprintf(pdev->memory,
                          "Set UseCIEColor for UseDeviceIndependentColor to work properly.\n");
-		gs_note_error(gs_error_rangecheck);
+		ecode = gs_note_error(gs_error_rangecheck);
 		pdev->UseCIEColor = true;
 	    }
 	}
@@ -506,19 +506,19 @@
 	    !strcmp(pdev->params.ColorImage.Filter, "JPXEncode")) {
 	emprintf(pdev->memory,
                  "JPXEncode requires CompatibilityLevel >= 1.5 .\n");
-	gs_note_error(gs_error_rangecheck);
+	ecode = gs_note_error(gs_error_rangecheck);
     }
     if (cl < 1.5 && pdev->params.GrayImage.Filter != NULL &&
 	    !strcmp(pdev->params.GrayImage.Filter, "JPXEncode")) {
 	emprintf(pdev->memory,
                  "JPXEncode requires CompatibilityLevel >= 1.5 .\n");
-	gs_note_error(gs_error_rangecheck);
+	ecode = gs_note_error(gs_error_rangecheck);
     }
     if (cl < 1.4  && pdev->params.MonoImage.Filter != NULL &&
 	    !strcmp(pdev->params.MonoImage.Filter, "JBIG2Encode")) {
 	emprintf(pdev->memory,
                  "JBIG2Encode requires CompatibilityLevel >= 1.4 .\n");
-	gs_note_error(gs_error_rangecheck);
+	ecode = gs_note_error(gs_error_rangecheck);
     }
     if (pdev->HaveTrueTypes && pdev->version == psdf_version_level2) {
 	pdev->version = psdf_version_level2_with_TT ;

Modified: trunk/gs/base/gdevpdfu.c
===================================================================
--- trunk/gs/base/gdevpdfu.c	2010-10-07 12:49:54 UTC (rev 11770)
+++ trunk/gs/base/gdevpdfu.c	2010-10-07 13:59:49 UTC (rev 11771)
@@ -1292,7 +1292,7 @@
 void
 pdf_copy_data(stream *s, FILE *file, long count, stream_arcfour_state *ss)
 {
-    long r, left = count;
+    long r, left = count, code;
     byte buf[sbuf_size];
     
     while (left > 0) {
@@ -1300,7 +1300,7 @@
 
 	r = fread(buf, 1, copy, file);
 	if (r < 1) {
-	    gs_note_error(gs_error_ioerror);
+	    code = gs_note_error(gs_error_ioerror);
 	    return;
 	}
 	if (ss)
@@ -1316,7 +1316,7 @@
 void
 pdf_copy_data_safe(stream *s, FILE *file, long position, long count)
 {   
-    long r, left = count;
+    long r, left = count, code;
 
     while (left > 0) {
 	byte buf[sbuf_size];
@@ -1326,7 +1326,7 @@
 	fseek(file, position + count - left, SEEK_SET);
 	r = fread(buf, 1, copy, file);
 	if (r < 1) {
-	    gs_note_error(gs_error_ioerror);
+	    code = gs_note_error(gs_error_ioerror);
 	    return;
 	}
 	fseek(file, end_pos, SEEK_SET);



More information about the gs-commits mailing list