[pcre-dev] [Bug 639] New: pcrecpp RE::GlobalReplace returns …

Kezdőlap
Üzenet törlése
Szerző: mike
Dátum:  
Címzett: pcre-dev
Tárgy: [pcre-dev] [Bug 639] New: pcrecpp RE::GlobalReplace returns wrong replacement count
------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=639
           Summary: pcrecpp RE::GlobalReplace returns wrong replacement
                    count
           Product: PCRE
           Version: N/A
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: bug
          Priority: medium
         Component: Code
        AssignedTo: ph10@???
        ReportedBy: mike@???
                CC: pcre-dev@???



Version is pcre-7.4

The variable 'count' is incremented twice in RE::GlobalReplace, on lines 372
and 412 of pcrecpp.cc. As a result, the number of replacements returned is
double what it should be:

int main()
{
    string s = "ABCDE F F F";
    cout << s << endl;
    cout << pcrecpp::RE("F").GlobalReplace("X", &s)
              << endl;
    cout << s << endl;
    return 0;
}


outputs:
ABCDE F F F
6
ABCDE X X X


--
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email