Skip to content

Commit

Permalink
Merge pull request #85 from meinemitternacht/meinemitternacht-patch-1
Browse files Browse the repository at this point in the history
Fix uploading large amounts of data
  • Loading branch information
bji authored Apr 9, 2019
2 parents 111dc30 + 7676aa9 commit 287e4be
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/s3.c
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ typedef struct growbuffer
// returns nonzero on success, zero on out of memory
static int growbuffer_append(growbuffer **gb, const char *data, int dataLen)
{
int toCopy = 0 ;
int origDataLen = dataLen;
while (dataLen) {
growbuffer *buf = *gb ? (*gb)->prev : 0;
if (!buf || (buf->size == sizeof(buf->data))) {
Expand All @@ -454,7 +454,7 @@ static int growbuffer_append(growbuffer **gb, const char *data, int dataLen)
}
}

toCopy = (sizeof(buf->data) - buf->size);
int toCopy = (sizeof(buf->data) - buf->size);
if (toCopy > dataLen) {
toCopy = dataLen;
}
Expand All @@ -464,7 +464,7 @@ static int growbuffer_append(growbuffer **gb, const char *data, int dataLen)
buf->size += toCopy, data += toCopy, dataLen -= toCopy;
}

return toCopy;
return origDataLen;
}


Expand Down Expand Up @@ -2064,7 +2064,7 @@ static int putObjectDataCallback(int bufferSize, char *buffer,
return ret;
}

#define MULTIPART_CHUNK_SIZE (15 << 20) // multipart is 15M
#define MULTIPART_CHUNK_SIZE (768 << 20) // multipart is 768M

typedef struct MultipartPartData {
put_object_callback_data put_object_data;
Expand Down Expand Up @@ -2208,9 +2208,9 @@ static void put_object(int argc, char **argv, int optindex,
CONTENT_LENGTH_PREFIX_LEN)) {
contentLength = convertInt(&(param[CONTENT_LENGTH_PREFIX_LEN]),
"contentLength");
if (contentLength > (5LL * 1024 * 1024 * 1024)) {
if (contentLength > (5LL * 1024 * 1024 * 1024 * 1024)) {
fprintf(stderr, "\nERROR: contentLength must be no greater "
"than 5 GB\n");
"than 5 TB\n");
usageExit(stderr);
}
}
Expand Down

0 comments on commit 287e4be

Please sign in to comment.