On Sun, Jun 18, 2006 at 10:43:17PM +0200, Giuseppe Sacco wrote:
> 
> ------- Comment #11 from [EMAIL PROTECTED]  2006-06-16 15:56 -------
> 
> > * ./faxinfo -r '!'  fax07138.tif
> >   Could not open !; either not TIFF or corrupted
> 
> Fixed.
> 
> > * there seems to be an off-by-1 problem with -[cC], it'd print eg.
> >   [EMAIL PROTECTED] 1234 [EMAIL PROTECTED]
> >   where '@' shouldn't be there and the printout is actually '[EMAIL 
> > PROTECTED]'
> 
> Can you give me an example?

problem is in escapedString() - solved with [pseudo-diff]:

-    res = (char*)malloc(len);
+    res = (char*)calloc(len+1, sizeof(char));
...
-               if (src[i] == '\\')
+               if (src[i] == '\\' && i < len-1)

btw, in same function [pseudo-diff]:

-    }
+    } else
+      exit (ENOMEM);
     return res;
  }

just for fun I've added in main() [pseudo-diff]:

+     int debug=0;

-     while ((c = getopt(argc, argv, "C:c:rnS:s:e:E:")) != -1)
+     while ((c = getopt(argc, argv, "C:c:DrnS:s:e:E:")) != -1)
...
+            case 'D':
+              debug = 1;
+              break;
          }
+     if (debug)
+       fprintf(stderr,
+          "faxStart='%s'\nfieldStart='%s'\nfieldEnd='%s'\nfaxEnd'%s'\n",
+          faxStart,fieldStart,fieldEnd,faxEnd);

handy to see the mess we're going to have ;)

BTW, faxinfo() still always exit with 0 - instead it should exit with non-0
code if any error occurs.

> Using the format params S/s/e/E gives you access directly into the printf

which reminds me to ask for a sanity check in escapedString() as well - 
eg. just avoid %n ...

thanks for explanation :)
 
> ------- Comment #13 from [EMAIL PROTECTED]  2006-06-16 16:04 -------
> Created an attachment (id=1089)
>  --> (http://bugs.hylafax.org/attachment.cgi?id=1089&action=view)
> faxinfo-format-4.patch

> old format                      new format
> -------------------             -----------------
> -s '%.0s'                       -s ''
> -e '%1$s'                       -e '%s'
> 
> Can anyone think of any flexibility *lost* by splitting them up?  The
> simplicity gained seems worth it.

Let me re-check & re-think a bit on that.

thanks

-- paolo


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to