< prev index next >

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

Print this page
rev 50999 : 8207233: Minor improvements of jdk C-coding


 722 #ifdef USE_MMAP
 723     if (!zip->usemmap)
 724 #endif
 725         free(cenbuf);
 726 
 727     return cenpos;
 728 }
 729 
 730 /*
 731  * Opens a zip file with the specified mode. Returns the jzfile object
 732  * or NULL if an error occurred. If a zip error occurred then *pmsg will
 733  * be set to the error message text if pmsg != 0. Otherwise, *pmsg will be
 734  * set to NULL. Caller is responsible to free the error message.
 735  */
 736 jzfile *
 737 ZIP_Open_Generic(const char *name, char **pmsg, int mode, jlong lastModified)
 738 {
 739     jzfile *zip = NULL;
 740 
 741     /* Clear zip error message */
 742     if (pmsg != 0) {
 743         *pmsg = NULL;
 744     }
 745 
 746     zip = ZIP_Get_From_Cache(name, pmsg, lastModified);
 747 
 748     if (zip == NULL && *pmsg == NULL) {
 749         ZFILE zfd = ZFILE_Open(name, mode);
 750         zip = ZIP_Put_In_Cache(name, zfd, pmsg, lastModified);
 751     }
 752     return zip;
 753 }
 754 
 755 /*
 756  * Returns the jzfile corresponding to the given file name from the cache of
 757  * zip files, or NULL if the file is not in the cache.  If the name is longer
 758  * than PATH_MAX or a zip error occurred then *pmsg will be set to the error
 759  * message text if pmsg != 0. Otherwise, *pmsg will be set to NULL. Caller
 760  * is responsible to free the error message.
 761  */
 762 jzfile *
 763 ZIP_Get_From_Cache(const char *name, char **pmsg, jlong lastModified)
 764 {
 765     char buf[PATH_MAX];
 766     jzfile *zip;
 767 
 768     if (InitializeZip()) {




 722 #ifdef USE_MMAP
 723     if (!zip->usemmap)
 724 #endif
 725         free(cenbuf);
 726 
 727     return cenpos;
 728 }
 729 
 730 /*
 731  * Opens a zip file with the specified mode. Returns the jzfile object
 732  * or NULL if an error occurred. If a zip error occurred then *pmsg will
 733  * be set to the error message text if pmsg != 0. Otherwise, *pmsg will be
 734  * set to NULL. Caller is responsible to free the error message.
 735  */
 736 jzfile *
 737 ZIP_Open_Generic(const char *name, char **pmsg, int mode, jlong lastModified)
 738 {
 739     jzfile *zip = NULL;
 740 
 741     /* Clear zip error message */
 742     if (pmsg != NULL) {
 743         *pmsg = NULL;
 744     }
 745 
 746     zip = ZIP_Get_From_Cache(name, pmsg, lastModified);
 747 
 748     if (zip == NULL && pmsg != NULL && *pmsg == NULL) {
 749         ZFILE zfd = ZFILE_Open(name, mode);
 750         zip = ZIP_Put_In_Cache(name, zfd, pmsg, lastModified);
 751     }
 752     return zip;
 753 }
 754 
 755 /*
 756  * Returns the jzfile corresponding to the given file name from the cache of
 757  * zip files, or NULL if the file is not in the cache.  If the name is longer
 758  * than PATH_MAX or a zip error occurred then *pmsg will be set to the error
 759  * message text if pmsg != 0. Otherwise, *pmsg will be set to NULL. Caller
 760  * is responsible to free the error message.
 761  */
 762 jzfile *
 763 ZIP_Get_From_Cache(const char *name, char **pmsg, jlong lastModified)
 764 {
 765     char buf[PATH_MAX];
 766     jzfile *zip;
 767 
 768     if (InitializeZip()) {


< prev index next >