[Libreoffice-commits] .: dmake/unix lpsolve/lp_solve-fixed-warn.patch lpsolve/makefile.mk solenv/bin

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Oct 26 03:33:24 PDT 2012


 dmake/unix/arlib.c                |    6 +-
 lpsolve/lp_solve-fixed-warn.patch |   84 ++++++++++++++++++++++++++++++++++++++
 lpsolve/makefile.mk               |    3 -
 solenv/bin/concat-deps.c          |    4 -
 4 files changed, 91 insertions(+), 6 deletions(-)

New commits:
commit 249a4da9cd5217b0c340edd779bd17e44e21d678
Author: René Kjellerup <rk.katana.steel at gmail.com>
Date:   Thu Oct 18 16:44:29 2012 -0700

    warn free build of dmake, concat-deps and lpsolve
    
    add error handling for fread, fwrite, and fscanf calls
    
    use "fputs" instead of "fprintf" to avoid warning that it couldn't varify
    the format string because it wasn't a string literal.
    
    Change-Id: I1137160d28461fbac69c8e05d32ba010da491c57
    Reviewed-on: https://gerrit.libreoffice.org/903
    Reviewed-by: Petr Mladek <pmladek at suse.cz>
    Tested-by: Petr Mladek <pmladek at suse.cz>

diff --git a/dmake/unix/arlib.c b/dmake/unix/arlib.c
index b401245..708063f 100644
--- a/dmake/unix/arlib.c
+++ b/dmake/unix/arlib.c
@@ -290,15 +290,15 @@ struct   ar_args *arg;
 
 #if ASCARCH
 #if defined(_AIX)
-   fread( (char *)&flhdr, sizeof(flhdr), 1, f );
+   if( fread( (char *)&flhdr, sizeof(flhdr), 1, f ) != 1 ) return (-1);
    if( strncmp(flhdr.fl_magic,AIAMAG, SAIAMAG) != 0 ) return(-1);
    fseek(f, atol(flhdr.fl_fstmoff), 0 ); /* postition to first member */
 #else
-   fread( magic, sizeof(magic), 1, f );
+   if( fread( magic, sizeof(magic), 1, f ) != 1 ) return( -1 );
    if( strncmp(magic, ARMAG, SARMAG) != 0 ) return( -1 );
 #endif
 #else
-   fread( (char*)&word, sizeof(word), 1, f );
+   if( fread( (char*)&word, sizeof(word), 1, f ) != 1 ) return( -1 );
    if( word != ARMAG ) return( -1 );
 #endif
 
diff --git a/lpsolve/lp_solve-fixed-warn.patch b/lpsolve/lp_solve-fixed-warn.patch
new file mode 100644
index 0000000..4674288
--- /dev/null
+++ b/lpsolve/lp_solve-fixed-warn.patch
@@ -0,0 +1,84 @@
+--- misc/build/lp_solve_5.5/lp_report.c	2007-01-14 10:31:34.000000000 -0800
++++ misc/build/lp_solve_5.5/lp_report.c	2007-01-14 10:31:34.000000000 -0800
+@@ -160,7 +160,7 @@
+ {
+   int i, k = 0;
+ 
+-  fprintf(output, label);
++  fputs(label, output);
+   fprintf(output, "\n");
+   for(i = first; i <= last; i++) {
+     fprintf(output, " %18g", vector[i]);
+@@ -189,7 +189,7 @@
+   if(last < 0)
+     last = lp->rows;
+ 
+-  fprintf(output, label);
++  fputs(label, output);
+   fprintf(output, "\n");
+ 
+   if(first == 0) {
+@@ -254,7 +254,7 @@
+   if(last < 0)
+     last = lp->rows;
+ 
+-  fprintf(output, label);
++  fputs(label, output);
+   fprintf(output, "\n");
+ 
+   for(i = first; i <= last; i++) {
+--- misc/build/lp_solve_5.5/lp_rlp.h	2007-01-14 10:31:52.000000000 -0800
++++ misc/build/lp_solve_5.5/lp_rlp.h	2007-01-14 10:31:52.000000000 -0800
+@@ -615,7 +615,7 @@
+ /* This used to be an fputs(), but since the string might contain NUL's,
+  * we now use fwrite().
+  */
+-#define ECHO (void) fwrite( lp_yytext, lp_yyleng, 1, lp_yyout )
++#define ECHO if(fwrite( lp_yytext, lp_yyleng, 1, lp_yyout ) != 1) YY_FATAL_ERROR( "can't write into lp_yytext" )
+ #endif
+ 
+ /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
+--- misc/build/lp_solve_5.5/shared/commonlib.c	2007-01-14 10:33:14.000000000 -0800
++++ misc/build/lp_solve_5.5/shared/commonlib.c	2007-01-14 10:33:14.000000000 -0800
+@@ -715,7 +715,7 @@
+ {
+   int i, k = 0;
+ 
+-  fprintf(output, label);
++  fputs(label, output);
+   fprintf(output, "\n");
+   for(i = first; i <= last; i++) {
+     fprintf(output, " %5d", myvector[i]);
+@@ -734,7 +734,7 @@
+ {
+   int i, k = 0;
+ 
+-  fprintf(output, label);
++  fputs(label, output);
+   fprintf(output, "\n");
+   for(i = first; i <= last; i++) {
+     if(asRaw)
+@@ -756,7 +756,7 @@
+ {
+   int i, k = 0;
+ 
+-  fprintf(output, label);
++  fputs(label, output);
+   fprintf(output, "\n");
+   for(i = first; i <= last; i++) {
+     fprintf(output, " %18g", myvector[i]);
+--- misc/build/lp_solve_5.5/shared/mmio.c	2007-01-14 10:33:14.000000000 -0800
++++ misc/build/lp_solve_5.5/shared/mmio.c	2007-01-14 10:33:14.000000000 -0800
+@@ -74,7 +74,11 @@
+  
+     for (i=0; i<nz; i++)
+     {
+-        fscanf(f, "%d %d %lg\n", &I[i], &J[i], &val[i]);
++        if(fscanf(f, "%d %d %lg\n", &I[i], &J[i], &val[i]) != 3)
++        {
++            fprintf(stderr, "read_unsymmetric_sparse(): could not parse values.\n");
++            return -1;
++        }
+         I[i]--;  /* adjust from 1-based to 0-based */
+         J[i]--;
+     }
diff --git a/lpsolve/makefile.mk b/lpsolve/makefile.mk
index 6f0c9f9..b2f12aa 100644
--- a/lpsolve/makefile.mk
+++ b/lpsolve/makefile.mk
@@ -46,7 +46,8 @@ PATCH_FILES=lp_solve_5.5-windows.patch
 .ELSE
 PATCH_FILES=\
     lp_solve_5.5.patch \
-    lp_solve-aix.patch
+    lp_solve-aix.patch \
+    lp_solve-fixed-warn.patch
 ADDITIONAL_FILES=lpsolve55$/ccc.solaris lpsolve55$/ccc.static
 .ENDIF
 
diff --git a/solenv/bin/concat-deps.c b/solenv/bin/concat-deps.c
index d2d9d50..64d2d36 100644
--- a/solenv/bin/concat-deps.c
+++ b/solenv/bin/concat-deps.c
@@ -798,12 +798,12 @@ static inline void print_fullpaths(char* line)
         else if(*token == ':' || *token == '\\' || *token == '/' ||
                 *token == '$' || ':' == token[1])
         {
-            fwrite(token, token_len, 1, stdout);
+            assert(fwrite(token, token_len, 1, stdout) == 1);
             fputc(' ', stdout);
         }
         else
         {
-            fwrite(token, end - token, 1, stdout);
+            assert(fwrite(token, end - token, 1, stdout) == 1);
             fputc(' ', stdout);
         }
         token = end;


More information about the Libreoffice-commits mailing list