summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/installer/setup/main.cc12
-rw-r--r--third_party/bspatch/README.google3
-rw-r--r--third_party/bspatch/mbspatch.cc10
-rw-r--r--third_party/bspatch/mbspatch.h4
4 files changed, 16 insertions, 13 deletions
diff --git a/chrome/installer/setup/main.cc b/chrome/installer/setup/main.cc
index 7d10579..1925e22 100644
--- a/chrome/installer/setup/main.cc
+++ b/chrome/installer/setup/main.cc
@@ -72,9 +72,9 @@ int PatchArchiveFile(bool system_install, const std::wstring& archive_path,
LOG(INFO) << "Applying patch " << patch_archive
<< " to file " << existing_archive
<< " and generating file " << uncompressed_archive;
- return ApplyBinaryPatch(WideToUTF8(existing_archive).c_str(),
- WideToUTF8(patch_archive).c_str(),
- WideToUTF8(uncompressed_archive).c_str());
+ return ApplyBinaryPatch(existing_archive.c_str(),
+ patch_archive.c_str(),
+ uncompressed_archive.c_str());
}
@@ -126,9 +126,9 @@ DWORD UnPackArchive(const std::wstring& archive, bool system_install,
<< "installed on the system.";
return 1;
}
- if (PatchArchiveFile(system_install, temp_path, uncompressed_archive,
- installed_version)) {
- LOG(ERROR) << "Binary patching failed.";
+ if (int i = PatchArchiveFile(system_install, temp_path,
+ uncompressed_archive, installed_version)) {
+ LOG(ERROR) << "Binary patching failed with error " << i;
return 1;
}
}
diff --git a/third_party/bspatch/README.google b/third_party/bspatch/README.google
index 9f26265..3c6f8685 100644
--- a/third_party/bspatch/README.google
+++ b/third_party/bspatch/README.google
@@ -8,3 +8,6 @@ http://lxr.mozilla.org/mozilla/source/toolkit/mozapps/update/src/updater/
The license is shared in common with bsdiff.
Local changes include CRC32 verification.
+
+Update(08 Sep 08): Changed ApplyBinaryPatch to accept wchar_t paths
+instead of char paths. \ No newline at end of file
diff --git a/third_party/bspatch/mbspatch.cc b/third_party/bspatch/mbspatch.cc
index 87d7895..f67aa11 100644
--- a/third_party/bspatch/mbspatch.cc
+++ b/third_party/bspatch/mbspatch.cc
@@ -209,16 +209,16 @@ int CalculateCrc(const unsigned char *buf, int size) {
# define _O_BINARY 0
#endif
-int ApplyBinaryPatch(const char *old_file, const char *patch_file,
- const char *new_file) {
+int ApplyBinaryPatch(const wchar_t *old_file, const wchar_t *patch_file,
+ const wchar_t *new_file) {
int ret = 0;
- int pfd = open(patch_file, O_RDONLY | _O_BINARY);
+ int pfd = _wopen(patch_file, O_RDONLY | _O_BINARY);
if (pfd < 0) return READ_ERROR;
MBSPatchHeader header;
if (ret = MBS_ReadHeader(pfd, &header)) return ret;
- int ofd = open(old_file, O_RDONLY | _O_BINARY);
+ int ofd = _wopen(old_file, O_RDONLY | _O_BINARY);
if (ofd < 0) return READ_ERROR;
struct stat os;
@@ -232,7 +232,7 @@ int ApplyBinaryPatch(const char *old_file, const char *patch_file,
if (CalculateCrc(buf, header.slen) != header.scrc32)
return CRC_ERROR;
- int nfd = open(new_file, O_WRONLY | O_TRUNC | O_CREAT | _O_BINARY);
+ int nfd = _wopen(new_file, O_WRONLY | O_TRUNC | O_CREAT | _O_BINARY);
if (nfd < 0) return READ_ERROR;
MBS_ApplyPatch(&header, pfd, buf, nfd);
diff --git a/third_party/bspatch/mbspatch.h b/third_party/bspatch/mbspatch.h
index 9e5123b..1a901d7 100644
--- a/third_party/bspatch/mbspatch.h
+++ b/third_party/bspatch/mbspatch.h
@@ -102,8 +102,8 @@ typedef struct MBSPatchTriple_ {
* the CRC of the original file stored in the patch file, before applying the
* patch to it.
*/
-int ApplyBinaryPatch(const char *old_file, const char *patch_file,
- const char *new_file);
+int ApplyBinaryPatch(const wchar_t *old_file, const wchar_t *patch_file,
+ const wchar_t *new_file);
/**
* Calculates Crc of the given buffer by calling CRC method in LZMA SDK