summaryrefslogtreecommitdiffstats
path: root/third_party/bspatch
diff options
context:
space:
mode:
authorrahulk@google.com <rahulk@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-08 17:40:14 +0000
committerrahulk@google.com <rahulk@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-08 17:40:14 +0000
commit584fa1d4f6bcc7e0c769e0dbfa36f819a93f3ec2 (patch)
treef4f30864356f5f32caa4fe5f1caf5d5174f5a4ce /third_party/bspatch
parentbc440904b0a365ee6cad952086662e5cdd60a5c1 (diff)
downloadchromium_src-584fa1d4f6bcc7e0c769e0dbfa36f819a93f3ec2.zip
chromium_src-584fa1d4f6bcc7e0c769e0dbfa36f819a93f3ec2.tar.gz
chromium_src-584fa1d4f6bcc7e0c769e0dbfa36f819a93f3ec2.tar.bz2
Fix binary patching for localized OS. Not sure how it was working till now.
BUG=1557 Review URL: http://codereview.chromium.org/268 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1848 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party/bspatch')
-rw-r--r--third_party/bspatch/README.google3
-rw-r--r--third_party/bspatch/mbspatch.cc10
-rw-r--r--third_party/bspatch/mbspatch.h4
3 files changed, 10 insertions, 7 deletions
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