Article View: gnu.g++.bug
Article #1702fix for bug in Regex gsub in libg++ 1.32
From: Jason Venner
Date: Thu, 23 Feb 1989 08:04
Date: Thu, 23 Feb 1989 08:04
49 lines
1545 bytes
1545 bytes
*** /viarag/gnu/libg++/src/String.cc Wed Jan 11 04:17:10 1989
--- String.cc Wed Feb 22 23:03:59 1989
***************
*** 576,591 ****
const char* s = rep->s;
StrRep* nrep = Sresize(0, 2 * sl); // guess size
! char* x = rep->s;
int si = 0;
int xi = 0;
int remaining = sl;
! int pos, pl;
while (remaining > 0)
{
! pos = pat.search(s, sl, pl, si);
if (pos < 0 || pl <= 0)
break;
else
--- 576,591 ----
const char* s = rep->s;
StrRep* nrep = Sresize(0, 2 * sl); // guess size
! char* x = nrep->s;
int si = 0;
int xi = 0;
int remaining = sl;
! int pos, pl = 0; // how long is a regular expression?
while (remaining > 0)
{
! pos = pat.search(s, sl, pl, si); // unlike string search, the pos returned here is absolute
if (pos < 0 || pl <= 0)
break;
else
***************
*** 596,601 ****
--- 596,602 ----
nrep = Sresize(nrep, mustfit);
x = nrep->s;
}
+ pos -= si;
ncopy(&(s[si]), &(x[xi]), pos);
ncopy(r, &(x[xi + pos]), rl);
si += pos + pl;
Technical Details
Message-ID:
<9823.604224240@kadmon>Path:
arc1-ca.pugleaf.net!utzoo!telly!attcan!uunet!tut.cis.ohio-state.edu!MTXINU.COM!kadmon!jasonShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!uunet!tut.cis.ohio-state.edu!MTXINU.COM!kadmon!jason From: kadmon!jason@MTXINU.COM (Jason Venner) Newsgroups: gnu.g++.bug Subject: fix for bug in Regex gsub in libg++ 1.32 Message-ID: <9823.604224240@kadmon> Date: 23 Feb 89 08:04:00 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 49