Changeset 989 for cpp/frams/util
- Timestamp:
- 07/09/20 00:21:37 (4 years ago)
- Location:
- cpp/frams/util
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/util/sstring-simple.cpp
r973 r989 76 76 { 77 77 if (newlength < 0) newlength = strlen(txt); 78 else txt[newlength] = 0; 78 else 79 { 80 if (newlength >= allocated) 81 { 82 assert(newlength < allocated); 83 if (allocated == 0) return; 84 newlength = allocated - 1; 85 } 86 txt[newlength] = 0; 87 } 79 88 used = newlength; 80 assert(used < allocated);81 89 } 82 90 83 91 void SString::endAppend(int newappend) 84 92 { 85 if (newappend < 0) newappend = strlen(txt + appending); 86 else txt[appending + newappend] = 0; 87 used = appending + newappend; 88 assert(used < allocated); 93 if (newappend < 0) endWrite(appending + strlen(txt + appending)); 94 else endWrite(newappend + appending); 89 95 } 90 96 -
cpp/frams/util/sstring.cpp
r973 r989 222 222 { 223 223 if (newlength < 0) newlength = strlen(buf->txt); 224 else buf->txt[newlength] = 0; 224 else 225 { 226 if ((newlength >= (buf->size + 1)) || (buf->size == 0)) 227 { 228 assert((newlength < (buf->size + 1)) && (buf->size > 0)); 229 if (buf->size == 0) return; 230 newlength = buf->size; 231 } 232 buf->txt[newlength] = 0; 233 } 225 234 buf->used = newlength; 226 235 } … … 228 237 void SString::endAppend(int newappend) 229 238 { 230 if (newappend < 0) newappend = strlen(buf->txt + appending); 231 else buf->txt[appending + newappend] = 0; 232 buf->used = appending + newappend; 239 if (newappend < 0) endWrite(appending + strlen(buf->txt + appending)); 240 else endWrite(newappend + appending); 233 241 } 234 242
Note: See TracChangeset
for help on using the changeset viewer.