#include <stdlib.h>
#include <string.h>
#include "ED2KLink.h"
-#include "GrowingBuffer.h"
#include "GlobalSettings.h"
static int getDigits(size_t number) {
int hashIndex;
unsigned char hash[16];
char* pipeIndex;
- GrowingBuffer growingBuffer;
+ int stringLength;
GlobalSettings::isVerbose() && fprintf(stderr, "[%s:%d] trying to parse “%s”...\n", __FILE__, __LINE__, buffer);
GlobalSettings::isVerbose() && fprintf(stderr, "[%s:%d] expected pipe character (‘|’) but found none.\n", __FILE__, __LINE__);
return NULL;
}
- growingBuffer.write(tempBuffer, (char*) pipeIndex - tempBuffer);
- filename = (char*) malloc(growingBuffer.getLimit() + 1);
- growingBuffer.read(filename, growingBuffer.getLimit());
- sizeString[growingBuffer.getLimit()] = '\0';
- growingBuffer.clear();
+ stringLength = (char*) pipeIndex - tempBuffer;
+ filename = (char*) malloc(stringLength + 1);
+ memcpy(filename, tempBuffer, stringLength);
+ sizeString[stringLength] = '\0';
tempBuffer = pipeIndex + 1;
GlobalSettings::isVerbose() && fprintf(stderr, "[%s:%d] parsed filename: “%s”.\n", __FILE__, __LINE__, filename);
GlobalSettings::isVerbose() && fprintf(stderr, "[%s:%d] expected pipe character (‘|’) but found none.\n", __FILE__, __LINE__);
return NULL;
}
- growingBuffer.write(tempBuffer, (char*) pipeIndex - tempBuffer);
- sizeString = (char*) malloc(growingBuffer.getLimit() + 1);
- growingBuffer.read(sizeString, growingBuffer.getLimit());
- sizeString[growingBuffer.getLimit()] = '\0';
- growingBuffer.clear();
+ stringLength = (char*) pipeIndex - tempBuffer;
+ sizeString = (char*) malloc(stringLength + 1);
+ memcpy(sizeString, tempBuffer, stringLength);
+ sizeString[stringLength] = '\0';
tempBuffer = pipeIndex + 1;
size = atol(sizeString);