* Lucas Nussbaum <lu...@lucas-nussbaum.net>, 2009-12-11, 09:09:
c++ -g -O2 -g -Wall -O2 -fPIC -pipe -fno-implicit-templates -I. 
-I/build/user-singular_3-0-4-3.dfsg-3-amd64-aEMvZn/singular-3-0-4-3.dfsg/debian/tmp//usr/include/singular/
 
-I/build/user-singular_3-0-4-3.dfsg-3-amd64-aEMvZn/singular-3-0-4-3.dfsg/debian/tmp//usr/include/singular/
  -DNDEBUG -DOM_NDEBUG -Dx86_64_Linux -DHAVE_CONFIG_H -c febase.cc
febase.cc: In function 'FILE* feFopen(const char*, const char*, char*, int, 
int)':
febase.cc:752: error: invalid conversion from 'const char*' to 'char*'
febase.cc: In function 'void Print(const char*, ...)':
febase.cc:1118: warning: comparison between signed and unsigned integer 
expressions
febase.cc: At global scope:
febase.cc:96: warning: 'BT_name' defined but not used
make[2]: *** [febase.o] Error 1

The attached patch should fix this bug (though the last hunk is 100% untested).

--
Jakub Wilk
--- singular-3-0-4-3.dfsg.orig/kernel/febase.cc
+++ singular-3-0-4-3.dfsg/kernel/febase.cc
@@ -749,7 +749,7 @@
       if (pw_entry != NULL)
       {
         strcpy(longpath, pw_entry->pw_dir);
-        dir_sep = strchr(path, DIR_SEP);
+        const char *dir_sep = strchr(path, DIR_SEP);
         strcat(longpath, dir_sep);
         path = longpath;
       }
only in patch2:
unchanged:
--- singular-3-0-4-3.dfsg.orig/kernel/mpr_complex.cc
+++ singular-3-0-4-3.dfsg/kernel/mpr_complex.cc
@@ -79,31 +79,28 @@
 
 void gmp_float::setFromStr(const char * in )
 {
+  int len = strlen(in)+2;
+  char* c_in = (char*) omAlloc(len);
   BOOLEAN neg=false;
   if (*in == '-') { in++; neg=TRUE; }
-  char *s;
-  if ((s=strchr(in,'E')) !=NULL)
-  {
-    *s='e';
-  }
 
   // gmp doesn't understand number which begin with "." -- it needs 0.
   // so, insert the zero
   if (*in == '.')
   {
-    int len = strlen(in)+2;
-    char* c_in = (char*) omAlloc(len);
     *c_in = '0';
     strcpy(&(c_in[1]), in);
-
-    mpf_set_str( t, c_in, 10 );
-    omFreeSize((void*)c_in, len);
   }
   else
+    strcpy(c_in, in);
+  char *s;
+  if ((s=strchr(c_in,'E')) !=NULL)
   {
-    mpf_set_str( t, in, 10 );
+    *s='e';
   }
+  mpf_set_str( t, c_in, 10 );
   if (neg)  mpf_neg( t, t );
+  omFreeSize((void*)c_in, len);
 }
 
 

Attachment: signature.asc
Description: Digital signature

Reply via email to