mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
Bug 410485 - Windows updater broken from bug 396052, r=luser
This commit is contained in:
parent
1b2b4df61a
commit
12691cf4ab
@ -76,6 +76,10 @@ typedef int (* MarItemCallback)(MarFile *mar, const MarItem *item, void *data);
|
||||
*/
|
||||
MarFile *mar_open(const char *path);
|
||||
|
||||
#ifdef XP_WIN
|
||||
MarFile *mar_wopen(const PRUnichar *path);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Close a MAR file that was opened using mar_open.
|
||||
* @param mar The MarFile object to close.
|
||||
|
@ -179,13 +179,13 @@ static int mar_read_index(MarFile *mar) {
|
||||
return (bufptr == bufend) ? 0 : -1;
|
||||
}
|
||||
|
||||
MarFile *mar_open(const char *path) {
|
||||
/**
|
||||
* Internal shared code for mar_open and mar_wopen.
|
||||
* On failure, will fclose(fp).
|
||||
*/
|
||||
static MarFile *mar_fpopen(FILE *fp)
|
||||
{
|
||||
MarFile *mar;
|
||||
FILE *fp;
|
||||
|
||||
fp = fopen(path, "rb");
|
||||
if (!fp)
|
||||
return NULL;
|
||||
|
||||
mar = (MarFile *) malloc(sizeof(*mar));
|
||||
if (!mar) {
|
||||
@ -203,6 +203,28 @@ MarFile *mar_open(const char *path) {
|
||||
return mar;
|
||||
}
|
||||
|
||||
MarFile *mar_open(const char *path) {
|
||||
FILE *fp;
|
||||
|
||||
fp = fopen(path, "rb");
|
||||
if (!fp)
|
||||
return NULL;
|
||||
|
||||
return mar_fpopen(fp);
|
||||
}
|
||||
|
||||
#ifdef XP_WIN
|
||||
MarFile *mar_wopen(const PRUnichar *path) {
|
||||
FILE *fp;
|
||||
|
||||
fp = _wfopen(path, L"rb");
|
||||
if (!fp)
|
||||
return NULL;
|
||||
|
||||
return mar_fpopen(fp);
|
||||
}
|
||||
#endif
|
||||
|
||||
void mar_close(MarFile *mar) {
|
||||
MarItem *item;
|
||||
int i;
|
||||
|
@ -49,12 +49,20 @@
|
||||
#endif
|
||||
|
||||
int
|
||||
#ifdef XP_WIN
|
||||
ArchiveReader::Open(const WCHAR *path)
|
||||
#else
|
||||
ArchiveReader::Open(const char *path)
|
||||
#endif
|
||||
{
|
||||
if (mArchive)
|
||||
Close();
|
||||
|
||||
#ifdef XP_WIN
|
||||
mArchive = mar_wopen(path);
|
||||
#else
|
||||
mArchive = mar_open(path);
|
||||
#endif
|
||||
if (!mArchive)
|
||||
return READ_ERROR;
|
||||
|
||||
|
@ -49,7 +49,12 @@ public:
|
||||
ArchiveReader() : mArchive(NULL) {}
|
||||
~ArchiveReader() { Close(); }
|
||||
|
||||
#ifdef XP_WIN
|
||||
int Open(const WCHAR *path);
|
||||
#else
|
||||
int Open(const char *path);
|
||||
#endif
|
||||
|
||||
void Close();
|
||||
|
||||
int ExtractFile(const char *item, const char *destination);
|
||||
|
@ -1127,10 +1127,10 @@ WriteStatusFile(int status)
|
||||
{
|
||||
// This is how we communicate our completion status to the main application.
|
||||
|
||||
char filename[MAXPATHLEN];
|
||||
snprintf(filename, MAXPATHLEN, "%s/update.status", gSourcePath);
|
||||
NS_tchar filename[MAXPATHLEN];
|
||||
NS_tsnprintf(filename, MAXPATHLEN, NS_T("%s/update.status"), gSourcePath);
|
||||
|
||||
AutoFD fd = ensure_open(filename, O_WRONLY | O_TRUNC | O_CREAT | _O_BINARY, 0644);
|
||||
AutoFD fd = NS_topen(filename, O_WRONLY | O_TRUNC | O_CREAT | _O_BINARY, 0644);
|
||||
if (fd < 0)
|
||||
return;
|
||||
|
||||
@ -1151,8 +1151,8 @@ UpdateThreadFunc(void *param)
|
||||
{
|
||||
// open ZIP archive and process...
|
||||
|
||||
char dataFile[MAXPATHLEN];
|
||||
snprintf(dataFile, MAXPATHLEN, "%s/update.mar", gSourcePath);
|
||||
NS_tchar dataFile[MAXPATHLEN];
|
||||
NS_tsnprintf(dataFile, MAXPATHLEN, NS_T("%s/update.mar"), gSourcePath);
|
||||
|
||||
int rv = gArchiveReader.Open(dataFile);
|
||||
if (rv == OK) {
|
||||
|
Loading…
Reference in New Issue
Block a user