зеркало из https://github.com/mozilla/pjs.git
Backing out changes.
This commit is contained in:
Родитель
50f7099807
Коммит
8d15a7a463
|
@ -92,7 +92,6 @@ DIRS += \
|
|||
modules/libpref \
|
||||
modules/libimg \
|
||||
modules/oji \
|
||||
modules/zlib/standalone \
|
||||
modules/libjar \
|
||||
caps \
|
||||
expat \
|
||||
|
|
|
@ -27,8 +27,6 @@ VPATH = @srcdir@
|
|||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = standalone
|
||||
|
||||
MODULE = jar
|
||||
LIBRARY_NAME = jar$(VERSION_NUMBER)
|
||||
IS_COMPONENT = 1
|
||||
|
|
|
@ -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 <stdio.h>
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
Makefile
|
||||
adler32.c
|
||||
compress.c
|
||||
crc32.c
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include "nsComponent.h"
|
||||
#include "nsComponentList.h"
|
||||
#include "nsInstallDlg.h"
|
||||
#include "nsZipExtractor.h"
|
||||
|
||||
#include "xpistub.h"
|
||||
|
||||
|
|
|
@ -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 <sgehani@netscape.com>
|
||||
*/
|
||||
|
||||
#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;
|
||||
}
|
|
@ -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 <sgehani@netscape.com>
|
||||
*/
|
||||
|
||||
#ifndef _NS_ZIPEXTRACTOR_H_
|
||||
#define _NS_ZIPEXTRACTOR_H_
|
||||
|
||||
#include "XIDefines.h"
|
||||
#include "nsComponent.h"
|
||||
#include "nsXInstaller.h"
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
class nsZipExtractor
|
||||
{
|
||||
public:
|
||||
nsZipExtractor(char *aTmp);
|
||||
~nsZipExtractor();
|
||||
|
||||
int Extract(nsComponent *aXPIEngine, int aTotal);
|
||||
|
||||
private:
|
||||
int DirCreateRecursive(char *aPath);
|
||||
|
||||
char *mTmp;
|
||||
};
|
||||
|
||||
#endif /* _NS_ZIPEXTRACTOR_H_ */
|
Загрузка…
Ссылка в новой задаче