< prev index next >

src/java.base/share/native/libzip/ZipFile.c

Print this page
rev 12879 : 8136556: Add the ability to perform static builds of MacOSX x64 binaries
Reviewed-by: ihse, bdelsart, gadams, lfoltan, rriggs, hseigel, twisti
   1 /*
   2  * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  37 #include "jvm.h"
  38 #include "jni.h"
  39 #include "jni_util.h"
  40 #include "zip_util.h"
  41 #ifdef WIN32
  42 #include "io_util_md.h"
  43 #else
  44 #include "io_util.h"
  45 #endif
  46 
  47 #include "java_util_zip_ZipFile.h"
  48 #include "java_util_jar_JarFile.h"
  49 
  50 #define DEFLATED 8
  51 #define STORED 0
  52 
  53 static jfieldID jzfileID;
  54 
  55 static int OPEN_READ = java_util_zip_ZipFile_OPEN_READ;
  56 static int OPEN_DELETE = java_util_zip_ZipFile_OPEN_DELETE;






  57 
  58 JNIEXPORT void JNICALL
  59 Java_java_util_zip_ZipFile_initIDs(JNIEnv *env, jclass cls)
  60 {
  61     jzfileID = (*env)->GetFieldID(env, cls, "jzfile", "J");
  62     assert(jzfileID != 0);
  63 }
  64 
  65 static void
  66 ThrowZipException(JNIEnv *env, const char *msg)
  67 {
  68     jstring s = NULL;
  69     jobject x;
  70 
  71     if (msg != NULL) {
  72         s = JNU_NewStringPlatform(env, msg);
  73     }
  74     if (s != NULL) {
  75         x = JNU_NewObjectByName(env,
  76                             "java/util/zip/ZipException",


   1 /*
   2  * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  37 #include "jvm.h"
  38 #include "jni.h"
  39 #include "jni_util.h"
  40 #include "zip_util.h"
  41 #ifdef WIN32
  42 #include "io_util_md.h"
  43 #else
  44 #include "io_util.h"
  45 #endif
  46 
  47 #include "java_util_zip_ZipFile.h"
  48 #include "java_util_jar_JarFile.h"
  49 
  50 #define DEFLATED 8
  51 #define STORED 0
  52 
  53 static jfieldID jzfileID;
  54 
  55 static int OPEN_READ = java_util_zip_ZipFile_OPEN_READ;
  56 static int OPEN_DELETE = java_util_zip_ZipFile_OPEN_DELETE;
  57 
  58 
  59 /*
  60  * Declare library specific JNI_Onload entry if static build
  61  */
  62 DEF_STATIC_JNI_OnLoad
  63 
  64 JNIEXPORT void JNICALL
  65 Java_java_util_zip_ZipFile_initIDs(JNIEnv *env, jclass cls)
  66 {
  67     jzfileID = (*env)->GetFieldID(env, cls, "jzfile", "J");
  68     assert(jzfileID != 0);
  69 }
  70 
  71 static void
  72 ThrowZipException(JNIEnv *env, const char *msg)
  73 {
  74     jstring s = NULL;
  75     jobject x;
  76 
  77     if (msg != NULL) {
  78         s = JNU_NewStringPlatform(env, msg);
  79     }
  80     if (s != NULL) {
  81         x = JNU_NewObjectByName(env,
  82                             "java/util/zip/ZipException",


< prev index next >