]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
removed references to file size computation and file size function
authorPaul Cruz <paulcruz74@fb.com>
Wed, 5 Jul 2017 18:54:21 +0000 (11:54 -0700)
committerPaul Cruz <paulcruz74@fb.com>
Wed, 5 Jul 2017 18:54:21 +0000 (11:54 -0700)
contrib/adaptive-compression/multi.c

index a60f48ece3a49b7ff53e6107bdfe6ca551388cc8..79904551d33defdb01c8ebab6ac06051c09473e8 100644 (file)
@@ -226,28 +226,6 @@ static void* outputThread(void* arg)
     return arg;
 }
 
-
-static size_t getFileSize(const char* const filename)
-{
-    FILE* fd = fopen(filename, "rb");
-    if (fd == NULL) {
-        DISPLAY("Error: could not open file in order to get file size\n");
-        return -1; /* intentional underflow */
-    }
-    if (fseek(fd, 0, SEEK_END) != 0) {
-        DISPLAY("Error: fseek failed during file size computation\n");
-        return -1;
-    }
-    {
-        size_t const fileSize = ftell(fd);
-        if (fclose(fd) != 0) {
-            DISPLAY("Error: could not close file during file size computation\n");
-            return -1;
-        }
-        return fileSize;
-    }
-}
-
 static int createCompressionJob(adaptCCtx* ctx, BYTE* data, size_t srcSize)
 {
     unsigned const nextJob = ctx->nextJobID;
@@ -290,17 +268,12 @@ static int compressFilename(const char* const srcFilename, const char* const dst
 {
     BYTE* const src = malloc(FILE_CHUNK_SIZE);
     FILE* const srcFile = fopen(srcFilename, "rb");
-    size_t fileSize = getFileSize(srcFilename);
     size_t const numJobs = MAX_NUM_JOBS;
     int ret = 0;
     adaptCCtx* ctx = NULL;
 
 
     /* checking for errors */
-    if (fileSize == (size_t)(-1)) {
-        ret = 1;
-        goto cleanup;
-    }
     if (!srcFilename || !dstFilename || !src || !srcFile) {
         DISPLAY("Error: initial variables could not be allocated\n");
         ret = 1;