Changeset 245 for trunk/src/helpers/xstring.c
- Timestamp:
- Feb 2, 2003, 9:22:17 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/helpers/xstring.c
r222 r245 1113 1113 * especially with large string bufffers. 1114 1114 * 1115 * None of the pointers can be NULL, but if pstrReplace 1116 * is empty, this effectively erases pstrSearch in pxstr. 1115 * pxstr and pstrReplace may not be NULL, but if 1116 * pstrReplace is null or empty, this effectively 1117 * erases pstrSearch in pxstr. 1117 1118 * 1118 1119 * Returns the length of the new string (exclusing the … … 1169 1170 *@@changed V0.9.6 (2000-11-12) [umoeller]: now using strhmemfind 1170 1171 *@@changed V0.9.7 (2001-01-15) [umoeller]: renamed from xstrrpl; extracted new xstrrpl 1172 *@@changed V1.0.1 (2003-02-02) [umoeller]: now allowing for NULL pstrReplace 1171 1173 */ 1172 1174 … … 1175 1177 // out: ofs of first char after replacement string 1176 1178 const XSTRING *pstrSearch, // in: search string; cannot be NULL 1177 const XSTRING *pstrReplace, // in: replacement string ; cannot beNULL1179 const XSTRING *pstrReplace, // in: replacement string or NULL 1178 1180 size_t *pShiftTable, // in: shift table (see strhmemfind) 1179 1181 PBOOL pfRepeatFind) // in: repeat find? (see strhmemfind) … … 1181 1183 ULONG ulrc = 0; // default: not found 1182 1184 1183 if ((pxstr) && (pstrSearch) && (pstrReplace))1185 if ((pxstr) && (pstrSearch)) 1184 1186 { 1185 1187 ULONG cSearchLen = pstrSearch->ulLength; … … 1201 1203 { 1202 1204 ULONG ulFirstReplOfs = pFound - pxstr->psz; 1205 ULONG lenRepl = pstrReplace ? (pstrReplace->ulLength) : 0; 1203 1206 // found in buffer from ofs: 1204 1207 // replace pFound with pstrReplace … … 1206 1209 ulFirstReplOfs, // where to start 1207 1210 cSearchLen, // chars to replace 1208 pstrReplace ->psz,1209 pstrReplace->ulLength); // adjusted V0.9.11 (2001-04-22) [umoeller]1211 pstrReplace ? (pstrReplace->psz) : NULL, 1212 lenRepl); // adjusted V0.9.11 (2001-04-22) [umoeller] 1210 1213 1211 1214 // return new length 1212 *pulOfs = ulFirstReplOfs + pstrReplace->ulLength;1215 *pulOfs = ulFirstReplOfs + lenRepl; 1213 1216 } // end if (pFound) 1214 1217 } // end if ( (*pulOfs < pxstr->ulLength) ...
Note:
See TracChangeset
for help on using the changeset viewer.