GlobalSettings::isVerbose() && fprintf(stderr, "[%s:%d] resizing buffer from %d to %d bytes to fit in %d bytes.\n", __FILE__, __LINE__, size, newSize, length);
void* newData = malloc(newSize);
} while (length > (newSize - limit));
GlobalSettings::isVerbose() && fprintf(stderr, "[%s:%d] resizing buffer from %d to %d bytes to fit in %d bytes.\n", __FILE__, __LINE__, size, newSize, length);
void* newData = malloc(newSize);
+ GlobalSettings::isVerbose() && fprintf(stderr, "[%s:%d] copying %d bytes into new buffer.\n", __FILE__, __LINE__, limit);
memcpy(newData, data, limit);
free(data);
data = newData;
}
GlobalSettings::isVerbose() && fprintf(stderr, "[%s:%d] writing %d bytes to buffer at position %d.\n", __FILE__, __LINE__, length, limit);
memcpy(newData, data, limit);
free(data);
data = newData;
}
GlobalSettings::isVerbose() && fprintf(stderr, "[%s:%d] writing %d bytes to buffer at position %d.\n", __FILE__, __LINE__, length, limit);
- memcpy((ptrdiff_t*) data + limit, buffer, length);
- foundIndex = memchr((ptrdiff_t*) data + position + start, c, (limit - start));
+ GlobalSettings::isVerbose() && fprintf(stderr, "[%s:%d] searching for (char) 0x%02x from %d to %d.\n", __FILE__, __LINE__, c, position + start, position + (limit - start));
+ foundIndex = memchr((char*) data + position + start, c, (limit - (position + start)));
if (foundIndex) {
if (foundIndex) {
- return (ptrdiff_t) foundIndex - ((ptrdiff_t) data + position);
+ GlobalSettings::isVerbose() && fprintf(stderr, "[%s:%d] found character at %d.\n", __FILE__, __LINE__, (char*) foundIndex - ((char*) data + position));
+ return (char*) foundIndex - ((char*) data - position);