Skip to content

Commit 287e4be

Browse files
authored
Merge pull request #85 from meinemitternacht/meinemitternacht-patch-1
Fix uploading large amounts of data
2 parents 111dc30 + 7676aa9 commit 287e4be

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/s3.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ typedef struct growbuffer
432432
// returns nonzero on success, zero on out of memory
433433
static int growbuffer_append(growbuffer **gb, const char *data, int dataLen)
434434
{
435-
int toCopy = 0 ;
435+
int origDataLen = dataLen;
436436
while (dataLen) {
437437
growbuffer *buf = *gb ? (*gb)->prev : 0;
438438
if (!buf || (buf->size == sizeof(buf->data))) {
@@ -454,7 +454,7 @@ static int growbuffer_append(growbuffer **gb, const char *data, int dataLen)
454454
}
455455
}
456456

457-
toCopy = (sizeof(buf->data) - buf->size);
457+
int toCopy = (sizeof(buf->data) - buf->size);
458458
if (toCopy > dataLen) {
459459
toCopy = dataLen;
460460
}
@@ -464,7 +464,7 @@ static int growbuffer_append(growbuffer **gb, const char *data, int dataLen)
464464
buf->size += toCopy, data += toCopy, dataLen -= toCopy;
465465
}
466466

467-
return toCopy;
467+
return origDataLen;
468468
}
469469

470470

@@ -2064,7 +2064,7 @@ static int putObjectDataCallback(int bufferSize, char *buffer,
20642064
return ret;
20652065
}
20662066

2067-
#define MULTIPART_CHUNK_SIZE (15 << 20) // multipart is 15M
2067+
#define MULTIPART_CHUNK_SIZE (768 << 20) // multipart is 768M
20682068

20692069
typedef struct MultipartPartData {
20702070
put_object_callback_data put_object_data;
@@ -2208,9 +2208,9 @@ static void put_object(int argc, char **argv, int optindex,
22082208
CONTENT_LENGTH_PREFIX_LEN)) {
22092209
contentLength = convertInt(&(param[CONTENT_LENGTH_PREFIX_LEN]),
22102210
"contentLength");
2211-
if (contentLength > (5LL * 1024 * 1024 * 1024)) {
2211+
if (contentLength > (5LL * 1024 * 1024 * 1024 * 1024)) {
22122212
fprintf(stderr, "\nERROR: contentLength must be no greater "
2213-
"than 5 GB\n");
2213+
"than 5 TB\n");
22142214
usageExit(stderr);
22152215
}
22162216
}

0 commit comments

Comments
 (0)