Fixed some of the range delete bugs. There still seems to be a bug when the remainder is one however.
This commit is contained in:
+1
-1
@@ -11,7 +11,7 @@ int ReadAllString(const char* path, char** content_ptr, size_t* bytes_read) {
|
||||
}
|
||||
|
||||
char *content = NULL, *temp;
|
||||
size_t used = 0, capacity = 0, read = 0; //Allows initialize stack allocated values to zero!
|
||||
size_t used = 0, capacity = 0, read = 0; //Always initialize stack allocated values to zero!
|
||||
|
||||
while(1) {
|
||||
if (used + FUTIL_READ_SIZE + 1 > capacity) {
|
||||
|
||||
+4
-3
@@ -128,15 +128,16 @@ void TStringRemoveRange(int startIndex, int count, TString* string) {
|
||||
}
|
||||
|
||||
if (remainder > 0) {
|
||||
memset(buffer, 0, sizeof buffer);
|
||||
memcpy(buffer, &string->Characters[string->ByteCount - remainder], remainder);
|
||||
printf("Buffer: %s\n", buffer);
|
||||
memcpy(&string->Characters[startByte + fullBuffers * sizeof buffer], buffer, remainder);
|
||||
}
|
||||
|
||||
memset(&string->Characters[string->ByteCount - endByte - startByte], '\0', endByte - startByte);
|
||||
|
||||
string->Length -= glyphCount;
|
||||
string->ByteCount -= endByte - startByte;
|
||||
string->ByteCount -= endByte - startByte;
|
||||
|
||||
memset(&string->Characters[string->ByteCount], '\0', string->Capacity - string->ByteCount);
|
||||
}
|
||||
|
||||
void TStringInsertText(const char* text, int index, TString* string) {
|
||||
|
||||
Reference in New Issue
Block a user