Hylafax Developers Mailing List Archives

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

[hylafax-devel] Re: Ummmm.... repost of crackArgv patch



------- =_aaaaaaaaaa0
Content-Type: text/plain; charset="us-ascii"
Content-ID: <14230.959631468.1@hewes.dazza.org>

>>>>> On Mon, 29 May 2000, "Steve" == Steve Williams wrote:

  Steve> Hi,

  Steve> Way back in March, I posted a patch for crackArgv.

  Steve> What is currently in the CVS doesn't bear much relation to what I
  Steve> posted...

Please can you review the following correspondence, and let me know why you 
might have said:

steve@genie96.com said:
> Thanks for checking in the CrackArgv patch...I grabbed it from the
> latest CVS & it seems fine. 

As far as I can tell, Aidan's patch is your work against current CVS. If 
you're happy for me to apply this, please indicate this on this list once you 
have reviewed the history, and I'll apply it.

-Darren

>Hi,
>
>A little closer examination & C 101 ( array indices start at 0 - DUH ),
>would indicate that fxStr is fine, and that crackArgv was broken, and 
>that the ASSERT was totally correct!!
>
>So, a new crackArgv using the length() method rather than looking for 
>null byte..
>
>Using this, I have a functional, running, backwards compatable faxq 
>process running.... YEAH!!!
>
>So, can some other eyeballs look at this new routine, and if it's OK,
>log the changes to the CVS...
>
>static void
>crackArgv(fxStr& s)
>{
>    int i = 0;
>    do {
>        while ( (i < s.length()) && !isspace(s[i])) 
>	    i++;
>        if ( i == s.length() ) break;	/* read to the end of string, quit */
>
>        s[i++] = '\0';			/* null terminate to isspace */
>
>        int j = i;			/* check for multiple whitespace */
>        while (j < s.length() && isspace(s[j]))
>            j++;
>
>        if (j > i) {
>            s.remove(i, j - i);
>        }
>    } while (i < s.length() );
>    s.resize(i);
>}
>
>----------------------------------------------------------------------
>--- faxQueueApp.c++	Mon Mar  6 23:21:04 2000
>+++ faxQueueApp.c++.org	Mon Mar  6 23:19:28 2000
>@@ -2699,26 +2699,20 @@
>     }
> }
> 
>-
> static void
. crackArgv(fxStr& s)
> {
>     int i = 0;
>     do {
>-        while ( (i < s.length()) && !isspace(s[i])) 
>-	    i++;
>-        if ( i == s.length() ) break;	/* read to the end of string, quit */
>-
>-        s[i++] = '\0';			/* not end, null terminate to isspace */
>-
>-        int j = i;			/* check for multiple whitespace */
>-        while (j < s.length() && isspace(s[j]))
>-            j++;
>-
>-        if (j > i) {			/* and remove it if there is any */
>+        while (s[i] && !isspace(s[i])) i++;
>+        if (s[i] == '\0') break;
>+        s[i++] = '\0';
>+        int j = i;
>+        while (isspace(s[j])) j++;
>+        if (j > i) {
>             s.remove(i, j - i);
>         }
>-    } while (i < s.length() );
>+    } while (s[i] != '\0');
>     s.resize(i);
> }
> 

____________________ HylaFAX(tm) Developers Mailing List ____________________
 To unsub: mail -s unsubscribe hylafax-devel-request@hylafax.org < /dev/null



Home
Report any problems to webmaster@hylafax.org

HylaFAX is a trademark of Silicon Graphics Corporation.
Internet connectivity for hylafax.org is provided by:
VirtuALL Private Host Services