|
From: <and...@us...> - 2008-12-15 09:51:00
|
Revision: 9110
http://plplot.svn.sourceforge.net/plplot/?rev=9110&view=rev
Author: andrewross
Date: 2008-12-15 09:50:50 +0000 (Mon, 15 Dec 2008)
Log Message:
-----------
Fix a couple of compile warnings with gcc4.3.2.
For constant strings it is better to use fputs rather than fprintf. This
prevents inadvertently or maliciously including format characters such
as %d in the string which would cause fprintf to fail.
Also, on 64-bit platforms size_t may not be an int so explicitly cast
the value to an int to prevent mismatch with %d format. Newer glibc
versions include a z length modifier which signifies size_t, but unless
this is widely available it is likely only to cause additional problems.
Modified Paths:
--------------
trunk/src/plbuf.c
trunk/src/plctrl.c
Modified: trunk/src/plbuf.c
===================================================================
--- trunk/src/plbuf.c 2008-12-15 02:06:53 UTC (rev 9109)
+++ trunk/src/plbuf.c 2008-12-15 09:50:50 UTC (rev 9110)
@@ -924,7 +924,7 @@
pls->plbuf_buffer_size += pls->plbuf_buffer_grow;
if (pls->verbose)
- printf("Growing buffer to %d KB\n", pls->plbuf_buffer_size / 1024);
+ printf("Growing buffer to %d KB\n", (int)(pls->plbuf_buffer_size / 1024));
if ((pls->plbuf_buffer = realloc(pls->plbuf_buffer, pls->plbuf_buffer_size)) == NULL)
plexit("plbuf wr_data: Plot buffer grow failed");
}
Modified: trunk/src/plctrl.c
===================================================================
--- trunk/src/plctrl.c 2008-12-15 02:06:53 UTC (rev 9109)
+++ trunk/src/plctrl.c 2008-12-15 09:50:50 UTC (rev 9110)
@@ -2053,7 +2053,7 @@
char line[256];
while (i++ < 10) {
- fprintf(stdout, s);
+ fputs(s, stdout);
plio_fgets(line, sizeof(line), stdin);
#ifdef MSDOS
@@ -2084,7 +2084,7 @@
char line[256];
while (i++ < 10) {
- fprintf(stdout, s);
+ fputs(s, stdout);
plio_fgets(line, sizeof(line), stdin);
#ifdef MSDOS
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|