You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by bu...@apache.org on 2001/10/15 21:34:51 UTC

DO NOT REPLY [Bug 4177] New: - setupRange uses non-portable code

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=4177>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=4177

setupRange uses non-portable code

           Summary: setupRange uses non-portable code
           Product: Xerces-C++
           Version: 1.5.1
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Utilities
        AssignedTo: xerces-c-dev@xml.apache.org
        ReportedBy: Russell.Stringham@powerquest.com


The function setupRange() in src/util/regx/XMLRangeFactory.cpp contains the 
following non-portable code on line 120:

    while (*pchCur) {
        rangeTok->addRange(*pchCur, *pchCur++);
    }

C++ does not guarantee whether the first or last argument to a function will be 
processed first. Better code would be:

    while (*pchCur) {
        const XMLCh ch = *pchCur++;
        rangeTok->addRange(ch, ch);
    }
or
    while (*pchCur) {
        rangeTok->addRange(*pchCur, *pchCur);
        ++pchCur;
    }

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org