You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@corinthia.apache.org by ja...@apache.org on 2015/02/23 12:39:20 UTC

[17/31] incubator-corinthia git commit:

changed wrapper file
X-Virus-Checked: Checked by ClamAV on apache.org


changed wrapper file


Project: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/commit/6148efc3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/tree/6148efc3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/diff/6148efc3

Branch: refs/heads/experimentzip
Commit: 6148efc365b8d3ca1d1adb4f4cba9747bbfad8fc
Parents: b2ab848
Author: jani <ja...@apache.org>
Authored: Fri Feb 13 12:50:54 2015 +0100
Committer: jani <ja...@apache.org>
Committed: Fri Feb 13 12:50:54 2015 +0100

----------------------------------------------------------------------
 DocFormats/platform/CMakeLists.txt |   3 +-
 DocFormats/platform/src/Wrapper.c  | 148 --------------------------------
 2 files changed, 1 insertion(+), 150 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/6148efc3/DocFormats/platform/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/DocFormats/platform/CMakeLists.txt b/DocFormats/platform/CMakeLists.txt
index cd7c28f..3be4eff 100644
--- a/DocFormats/platform/CMakeLists.txt
+++ b/DocFormats/platform/CMakeLists.txt
@@ -93,8 +93,7 @@ set(GroupSrc
     src/Linux.c
     src/Unix.c
     src/Win32.c
-    src/ZipWrapper.c
-    src/Wrapper.c)
+    src/ZipWrapper.c)
 
 set(GroupTests
     tests/OStests.c

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/6148efc3/DocFormats/platform/src/Wrapper.c
----------------------------------------------------------------------
diff --git a/DocFormats/platform/src/Wrapper.c b/DocFormats/platform/src/Wrapper.c
deleted file mode 100644
index c623425..0000000
--- a/DocFormats/platform/src/Wrapper.c
+++ /dev/null
@@ -1,148 +0,0 @@
-// Copyright 2012-2014 UX Productivity Pty Ltd
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-#include <string.h>
-#include <stdlib.h>
-#include "DFPlatform.h"
-#include "unzip.h"
-#include "zip.h"
-
-
-#ifdef JANI
-DFextZipHandleP DFextZipOpen(const char *zipFilename, int doUnzip) {
-    DFextZipHandleP zipHandle = malloc(sizeof(DFextZipHandle));
- 
-    // no more 
-    if (!zipHandle)
-        return NULL;
-
-    // Open file
-    zipHandle->zipFirst = 1;
-    zipHandle->zipFlag = doUnzip;
-    if (doUnzip)
-        zipHandle->handle = unzOpen(zipFilename);
-    else
-        zipHandle->handle = zipOpen(zipFilename, APPEND_STATUS_CREATE);
-
-    if (zipHandle->handle)
-        return zipHandle;
-
-    free(zipHandle);
-    return NULL;
-}
-
-
-
-int DFextZipClose(DFextZipHandleP zipHandle)
-{
-    int rc = 0;
-
-    if (zipHandle->handle) {
-        if (zipHandle->zipFlag)
-            rc = (unzClose(zipHandle->handle) == UNZ_OK);
-        else
-            rc = (zipClose(zipHandle->handle, NULL) == ZIP_OK);
-        zipHandle->handle = NULL;
-    }
-
-    free(zipHandle);
-    return rc ? 1 : -1;
-}
-
-
-
-int DFextZipOpenNextFile(DFextZipHandleP zipHandle, char *entryName, const int maxName)
-{
-    int rc;
-
-
-    if (zipHandle->zipFlag) {
-        unz_file_info info;
-
-        // handling of first file and all others are different
-        if (zipHandle->zipFirst) {
-            rc = unzGoToFirstFile(zipHandle->handle);
-            zipHandle->zipFirst = 0;
-        }
-        else
-            rc = unzGoToNextFile(zipHandle->handle);
-
-        // Error or past last file
-        if (rc != UNZ_OK)
-            return (rc == UNZ_END_OF_LIST_OF_FILE) ? 0 : -1;
-
-        // get file name
-        if (unzGetCurrentFileInfo(zipHandle->handle, &info, entryName, maxName, NULL, 0, NULL, 0) != UNZ_OK)
-            return -1;
-
-        // check for prefix "/" and if present skip file
-        if (entryName[strlen(entryName) - 1] == '/')
-            return DFextZipOpenNextFile(zipHandle, entryName, maxName);
-
-        // open Regular file
-        if (unzOpenCurrentFile(zipHandle->handle) != UNZ_OK)
-            return -1;
-    }
-    else {
-        return -1; // Zip file is open in write-only mode
-    }
-
-    // ready to read
-    return 1;
-}
-
-int DFextZipAppendNewFile(DFextZipHandleP zipHandle, const char *entryName)
-{
-    zip_fileinfo fileinfo;
-    memset(&fileinfo, 0, sizeof(fileinfo));
-
-    if (zipHandle->zipFlag)
-        return -1; // Zip file is open in read-only mode
-
-    if (zipOpenNewFileInZip(zipHandle->handle,
-                            entryName,
-                            &fileinfo,
-                            NULL, 0,
-                            NULL, 0,
-                            NULL,
-                            Z_DEFLATED,
-                            Z_DEFAULT_COMPRESSION) != ZIP_OK) {
-        return -1;
-    }
-
-    return 1;
-}
-
-int DFextZipCloseFile(DFextZipHandleP zipHandle)
-{
-    if (zipHandle->zipFlag)
-        return (unzCloseCurrentFile(zipHandle->handle) != UNZ_OK) ? -1 : 1;
-    else
-        return (zipCloseFileInZip(zipHandle->handle) != UNZ_OK) ? -1 : 1;
-}
-
-
- 
-
-int DFextZipReadCurrentFile(DFextZipHandleP zipHandle, void *buf, const int maxLen)
-{
-    return unzReadCurrentFile(zipHandle->handle, buf, maxLen);
-}
-
-
-
-int DFextZipWriteCurrentFile(DFextZipHandleP zipHandle, const void *buf, const int len)
-{
-    return (zipWriteInFileInZip(zipHandle->handle, buf, len) == ZIP_OK) ? 1 : -1;
-}
-#endif
\ No newline at end of file