Changeset 22942
- Timestamp:
- 2010-09-22T13:52:18+12:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/runtime-src/src/recpt/cgiutils.cpp
r22934 r22942 412 412 text_t::const_iterator end = intext.end (); 413 413 414 /*while (here != end) { 415 if (((here+2)<end) && *here == '%' && *(here+1) == '2' 416 && (*(here+2) == 'C' || *(here+2) == 'c')) { 417 here += 2; 418 outtext.push_back(','); 419 420 }else outtext.push_back (*here); 421 ++here; 422 } 423 return outtext;*/ 424 425 // iterators do not allow a forward increment/peek that goes past 426 // iterator's end: tests like (here+2 <end) above cause errors if 427 // the result ends up being > end. So have to test one character 428 // at a time, since tests like (here != end) *are* allowed: 429 430 while (here != end) { // look for "%2C" to replace with "," 431 if(*here == '%') { 432 ++here; 433 if(here != end && *here == '2') { 434 ++here; 435 if(here != end && (*here == 'C' || *here == 'c')) { 414 // for loop 415 int intext_len = intext.size(); 416 for(int i = 0; i < intext_len; i++) { 417 if ((i+2)<intext_len) { 418 if(intext[i] == '%' && intext[i+1] == '2' 419 && (intext[i+2] == 'C' || intext[i+2] == 'c')) { 420 i += 2; 436 421 outtext.push_back(','); 437 } else { 438 here -= 2; 439 outtext.push_back (*here); 440 } 441 } else { // go back to % char and push it back 442 --here; 443 outtext.push_back (*here); 444 } 445 } else { 446 outtext.push_back (*here); 447 } 448 449 ++here; 450 } // end while 451 return outtext; 422 continue; 423 } 424 } 425 outtext.push_back (intext[i]); 426 } 427 return outtext; 452 428 } 453 429
Note:
See TracChangeset
for help on using the changeset viewer.