delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1996/06/05/09:22:05

Date: Wed, 05 Jun 1996 14:16:39 +0200 (MET DST)
From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
Subject: doscan.c: the next problem fixed
In-reply-to: <199606030816.SAA18391@janus.cat.csiro.au>
To: cjd AT cat DOT csiro DOT au (Cameron Davidson)
Cc: djgpp-workers AT delorie DOT com
Message-id: <01I5JWDX4VMQ0013CA@mail.rwth-aachen.de>

Hello, djgpp-workers, and who else cares!

Cameron Davidson told me he had problems with scan formats containing
"%*s" formats: the scan unconditionally failed after processing this
format, after applying the patch I had sent him. That patch was the
same one I also finally put into the bug tracker as an updated
solution for bug # 68 (my first patch was incorrect, as Alexander
Lukyanov has told me).  That patch is functionally identical to the
one Alexander sent to djgpp-workers sometime near the first of
April. This new patch was now proven to be slightly incorrect as
well. That scanf() family turns out to be a neverending story, doesn't
it? :-(

The reason for this bug is that we fixed the other bugs a bit too good,
it seems. DJ's original version (as of V2.final) didn't exhibit this bug
because it was hidden behind the other ones: for ptr==0, the return
value of _innum was ignored completely, but now it is respected
properly. But for ptr==0, both _instr and _innum always returned
'failure', even if the matching process worked flawlessly. I changed
that (see patch for details, it is relative to my patched version
from bug 68).

Surprisingly enough, this bug would have never gone by unnoticed the
last time Alex and I looked at doscan.c, if only I had ever used this
changed version in a complete library rebuild (including the utilities),
because this bug breaks mkdoc completely (generated libc2.tex lacks all
the references)! Maybe I should re-check my checking methods :-)

If you find yet another bug, please tell me (or Alexander Lukyanov, or
someone else who can fix it), for yet another chapter to be added to
this tale. If this is all nonsense in your opinion, tell me as well.

Hans-Bernhard Br"oker  
(new adress! ---> broeker AT physik DOT rwth-aachen DOT de )

--- dosc_hbb.c  Thu Apr 11 10:40:50 1996
+++ doscan.c	Tue Jun  4 23:26:18 1996
@@ -234,8 +234,10 @@
   } else
     *eofptr = 1;
   nchars--;
-  if (ptr==NULL || np==numbuf || (negflg && np==numbuf+1) ) /* gene dykes*/
+  if (np==numbuf || (negflg && np==numbuf+1) ) /* gene dykes*/
     return(0);
+  if (ptr==0)   /* HBB: shouldn't report 'failed' just because ptr==0 */
+    return(1);
   *np++ = 0;
   switch((scale<<4) | size) {
 
@@ -315,7 +317,7 @@
       *ptr++ = '\0';
     return(1);
   }
-  return(0);
+  return(ptr==0); /* HBB: shouldn't report 'failed' just because ptr==0 */
 }
 
 static const char *



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019