summaryrefslogtreecommitdiff
path: root/lpsolve/lp_solve-fixed-warn.patch
blob: 46742887a85fad4b4a7eda8e003e7a9ae149b974 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
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]--;
     }