Browse Source

libs3 Commit 98f667b2 (2024-04-24)

No relevant changes

Source commit: 39958cec990324aed938ca5fbd1b9b373a92bf70
Martin Prikryl 1 week ago
parent
commit
2f855773b3
2 changed files with 13 additions and 8 deletions
  1. 7 2
      libs/libs3/GNUmakefile
  2. 6 6
      libs/libs3/src/s3.c

+ 7 - 2
libs/libs3/GNUmakefile

@@ -142,7 +142,7 @@ ifndef CFLAGS
     endif
 endif
 
-CFLAGS += -Wall -Werror -Wshadow -Wextra -Iinc \
+CFLAGS += -Wall -Wshadow -Wextra -Iinc \
           $(CURL_CFLAGS) $(LIBXML2_CFLAGS) \
           -DLIBS3_VER_MAJOR=\"$(LIBS3_VER_MAJOR)\" \
           -DLIBS3_VER_MINOR=\"$(LIBS3_VER_MINOR)\" \
@@ -168,7 +168,7 @@ all: exported test
 # Exported targets are the library and driver program
 
 .PHONY: exported
-exported: libs3 s3 headers
+exported: libs3 s3 s3-static headers
 
 
 # --------------------------------------------------------------------------
@@ -264,12 +264,17 @@ $(LIBS3_STATIC): $(LIBS3_SOURCES:%.c=$(BUILD)/obj/%.o)
 
 .PHONY: s3
 s3: $(BUILD)/bin/s3
+s3-static: $(BUILD)/bin/s3-static
 
 $(BUILD)/bin/s3: $(BUILD)/obj/s3.o $(LIBS3_SHARED)
 	$(QUIET_ECHO) $@: Building executable
 	@ mkdir -p $(dir $@)
 	$(VERBOSE_SHOW) $(CC) -o $@ $^ $(LDFLAGS)
 
+$(BUILD)/bin/s3-static: $(BUILD)/obj/s3.o $(LIBS3_STATIC)
+	$(QUIET_ECHO) $@: Building static executable
+	@ mkdir -p $(dir $@)
+	$(VERBOSE_SHOW) $(CC) -o $@ $^ $(LDFLAGS)
 
 # --------------------------------------------------------------------------
 # libs3 header targets

+ 6 - 6
libs/libs3/src/s3.c

@@ -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))) {
@@ -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;
         }
@@ -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;
 }
 
 
@@ -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;
@@ -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);
             }
         }