diff --git a/Makefile.in b/Makefile.in index 44f308929a5e..eafb93c1591c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -92,7 +92,6 @@ DIRS += \ modules/libpref \ modules/libimg \ modules/oji \ - modules/zlib/standalone \ modules/libjar \ caps \ expat \ diff --git a/modules/libjar/Makefile.in b/modules/libjar/Makefile.in index a49de9855fea..1636327c74e5 100644 --- a/modules/libjar/Makefile.in +++ b/modules/libjar/Makefile.in @@ -27,8 +27,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -DIRS = standalone - MODULE = jar LIBRARY_NAME = jar$(VERSION_NUMBER) IS_COMPONENT = 1 diff --git a/modules/zlib/src/zutil.c b/modules/zlib/src/zutil.c index ffbae41328ae..adc74c5becb9 100644 --- a/modules/zlib/src/zutil.c +++ b/modules/zlib/src/zutil.c @@ -3,7 +3,7 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ /* This file was modified since it was taken from the zlib distribution */ -/* $Id: zutil.c,v 3.4 2000/08/18 23:22:11 sgehani%netscape.com Exp $ */ +/* $Id: zutil.c,v 3.5 2000/08/19 00:15:08 sgehani%netscape.com Exp $ */ #include @@ -42,9 +42,7 @@ PR_PUBLIC_API(const char *) zlibVersion() void z_error (m) char *m; { -#ifndef XP_UNIX - /* PR_ASSERT(0); */ -#endif + PR_ASSERT(0); } #endif diff --git a/modules/zlib/standalone/.cvsignore b/modules/zlib/standalone/.cvsignore index b818807d4c08..7e599ab65d51 100644 --- a/modules/zlib/standalone/.cvsignore +++ b/modules/zlib/standalone/.cvsignore @@ -1,4 +1,3 @@ -Makefile adler32.c compress.c crc32.c diff --git a/xpinstall/wizard/unix/src2/Makefile.in b/xpinstall/wizard/unix/src2/Makefile.in index c02c41c5de0c..a955dc4dec0e 100644 --- a/xpinstall/wizard/unix/src2/Makefile.in +++ b/xpinstall/wizard/unix/src2/Makefile.in @@ -42,7 +42,6 @@ CPPSRCS = \ nsSetupTypeDlg.cpp \ nsComponentsDlg.cpp \ nsInstallDlg.cpp \ - nsZipExtractor.cpp \ nsXIOptions.cpp \ nsXIContext.cpp \ nsXInstaller.cpp \ @@ -52,7 +51,6 @@ CPPSRCS = \ LIBS = \ `gtk-config --libs` \ - -ljar50_s \ $(NULL) LOCAL_INCLUDES += -I$(srcdir)/../../../stub diff --git a/xpinstall/wizard/unix/src2/nsXIEngine.cpp b/xpinstall/wizard/unix/src2/nsXIEngine.cpp index 952d858ddfc1..0ab432e2f2fb 100644 --- a/xpinstall/wizard/unix/src2/nsXIEngine.cpp +++ b/xpinstall/wizard/unix/src2/nsXIEngine.cpp @@ -25,6 +25,21 @@ #include "nsXIEngine.h" #define CORE_LIB_COUNT 10 +static char sCoreLibs[ CORE_LIB_COUNT * 2 ][ 32 ] = +{ +/* Archive Subdir File */ +/* -------------- ---- */ + "bin/", "libjsdom.so", + "bin/", "libmozjs.so", + "bin/", "libnspr4.so", + "bin/", "libplc4.so", + "bin/", "libplds4.so", + "bin/", "libxpcom.so", + "bin/", "libxpistub.so", + "bin/", "libzlib.so", + "bin/components/", "libxpinstall.so", + "bin/components/", "libjar50.so" +}; nsXIEngine::nsXIEngine() : mTmp(NULL), @@ -106,11 +121,38 @@ nsXIEngine::Download(int aCustom, nsComponentList *aComps) int nsXIEngine::Extract(nsComponent *aXPIEngine) { - if (!aXPIEngine) + DUMP("Extract"); + + char path[MAXPATHLEN]; + char bindir[512]; + char unzipcmd[512]; + struct stat dummy; + int i; + + if (!aXPIEngine || !(aXPIEngine->GetArchive())) return E_PARAM; - nsZipExtractor *unzip = new nsZipExtractor(mTmp); - return unzip->Extract(aXPIEngine, CORE_LIB_COUNT); + sprintf(path, "%s/%s", mTmp, aXPIEngine->GetArchive()); + if (-1 == stat(path, &dummy)) + return E_NO_DOWNLOAD; + + for (i = 0; i < CORE_LIB_COUNT*2; i++) + { + // update UI + nsInstallDlg::MajorProgressCB(sCoreLibs[i+1], ((i+2)/2), + CORE_LIB_COUNT, nsInstallDlg::ACT_EXTRACT); + + sprintf(unzipcmd, "unzip %s -d %s %s%s > /dev/null", + path, mTmp, sCoreLibs[i], sCoreLibs[i+1]); + i++; + system(unzipcmd); + } + + sprintf(bindir, "%s/%s", mTmp, TMP_EXTRACT_SUBDIR); + if (-1 == stat(bindir, &dummy)) + return E_EXTRACTION; + + return OK; } int @@ -173,6 +215,7 @@ nsXIEngine::MakeUniqueTmpDir() int err = OK; int i; char buf[MAXPATHLEN]; + char cmd[1030]; struct stat dummy; mTmp = NULL; @@ -187,7 +230,8 @@ nsXIEngine::MakeUniqueTmpDir() if (!mTmp) return E_MEM; sprintf(mTmp, "%s", buf); - mkdir(mTmp, 0755); + sprintf(cmd, "mkdir %s", mTmp); + system(cmd); return err; } diff --git a/xpinstall/wizard/unix/src2/nsXIEngine.h b/xpinstall/wizard/unix/src2/nsXIEngine.h index 8ea1b5ec1279..6bc11bda97c4 100644 --- a/xpinstall/wizard/unix/src2/nsXIEngine.h +++ b/xpinstall/wizard/unix/src2/nsXIEngine.h @@ -30,7 +30,6 @@ #include "nsComponent.h" #include "nsComponentList.h" #include "nsInstallDlg.h" -#include "nsZipExtractor.h" #include "xpistub.h" diff --git a/xpinstall/wizard/unix/src2/nsZipExtractor.cpp b/xpinstall/wizard/unix/src2/nsZipExtractor.cpp deleted file mode 100644 index b94d14a78cf5..000000000000 --- a/xpinstall/wizard/unix/src2/nsZipExtractor.cpp +++ /dev/null @@ -1,166 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* - * The contents of this file are subject to the Netscape Public - * License Version 1.1 (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.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is Mozilla Communicator client code, - * released March 31, 1998. - * - * The Initial Developer of the Original Code is Netscape Communications - * Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - * Samir Gehani - */ - -#include "nsZipExtractor.h" - -#define STANDALONE 1 -#include "zipstub.h" -#include "zipfile.h" - -nsZipExtractor::nsZipExtractor(char *aTmp) : - mTmp(aTmp) -{ -} - -nsZipExtractor::~nsZipExtractor() -{ - // don't free mTmp: we don't own it -} - -int -nsZipExtractor::Extract(nsComponent *aXPIEngine, int aTotal) -{ - DUMP("Extract"); - - char apath[MAXPATHLEN]; /* archive path */ - char bindir[512]; - char zpath[MAXPATHLEN]; /* path of file in zip archive */ - char epath[MAXPATHLEN]; /* path of file after being extracted */ - char *leaf = NULL, *lslash = NULL; - struct stat dummy; - int i, bFoundAll = FALSE, err = OK; - PRInt32 zerr = ZIP_OK; - void *hZip = NULL, *hFind = NULL; - - if (!aXPIEngine || !(aXPIEngine->GetArchive())) - return E_PARAM; - - sprintf(apath, "%s/%s", mTmp, aXPIEngine->GetArchive()); - if (-1 == stat(apath, &dummy)) - return E_NO_DOWNLOAD; - - /* initialize archive etc. - */ - zerr = ZIP_OpenArchive(apath, &hZip); - if (zerr != ZIP_OK) return E_EXTRACTION; - hFind = ZIP_FindInit(hZip, (const char *) NULL); - if (!hFind) - { - err = E_EXTRACTION; - goto au_revoir; - } - - /* extract files - */ - i = 0; - while (!bFoundAll) - { - memset(zpath, 0, MAXPATHLEN); - zerr = ZIP_FindNext(hFind, zpath, MAXPATHLEN); - if (zerr == ZIP_ERR_FNF) - { - bFoundAll = true; - break; - } - if (zerr != ZIP_OK) - { - err = E_EXTRACTION; - goto au_revoir; - } - - /* directory encountered: ignore entry - */ - lslash = strrchr(zpath, '/'); - if (lslash == (zpath + strlen(zpath) - 1)) - continue; - - if (!lslash) - leaf = zpath; - else - leaf = lslash + 1; - if (!leaf) - continue; - - /* update UI - */ - nsInstallDlg::MajorProgressCB(leaf, i, - aTotal, nsInstallDlg::ACT_EXTRACT); - - sprintf(epath, "%s/%s", mTmp, zpath); - err = DirCreateRecursive(epath); - if (err != OK) goto au_revoir; - - zerr = ZIP_ExtractFile(hZip, zpath, epath); - if (zerr != ZIP_OK) - { - err = E_EXTRACTION; - goto au_revoir; - } - - i++; - } - - sprintf(bindir, "%s/%s", mTmp, TMP_EXTRACT_SUBDIR); - if (-1 == stat(bindir, &dummy)) - err = E_EXTRACTION; - -au_revoir: - /* close archive etc. - */ - if (hFind) - ZIP_FindFree(hFind); - if (hZip) - ZIP_CloseArchive(&hZip); - return err; -} - -int -nsZipExtractor::DirCreateRecursive(char *aPath) -{ - int err = OK; - char *slash = NULL, *pathpos = NULL; - char currdir[MAXPATHLEN]; - struct stat dummy; - - if (!aPath || !mTmp) - return E_PARAM; - - slash = aPath + strlen(mTmp); - if (*slash != '/') - return E_INVALID_PTR; - - while (slash) - { - memset(currdir, 0, MAXPATHLEN); - strncpy(currdir, aPath, slash - aPath); - - if (-1 == stat(currdir, &dummy)) - mkdir(currdir, 0755); - - pathpos = slash; - slash = strchr(pathpos+1, '/'); - } - - return err; -} diff --git a/xpinstall/wizard/unix/src2/nsZipExtractor.h b/xpinstall/wizard/unix/src2/nsZipExtractor.h deleted file mode 100644 index 5238debcbe0c..000000000000 --- a/xpinstall/wizard/unix/src2/nsZipExtractor.h +++ /dev/null @@ -1,48 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* - * The contents of this file are subject to the Netscape Public - * License Version 1.1 (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.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is Mozilla Communicator client code, - * released March 31, 1998. - * - * The Initial Developer of the Original Code is Netscape Communications - * Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - * Samir Gehani - */ - -#ifndef _NS_ZIPEXTRACTOR_H_ -#define _NS_ZIPEXTRACTOR_H_ - -#include "XIDefines.h" -#include "nsComponent.h" -#include "nsXInstaller.h" - -#include - -class nsZipExtractor -{ -public: - nsZipExtractor(char *aTmp); - ~nsZipExtractor(); - - int Extract(nsComponent *aXPIEngine, int aTotal); - -private: - int DirCreateRecursive(char *aPath); - - char *mTmp; -}; - -#endif /* _NS_ZIPEXTRACTOR_H_ */