summaryrefslogtreecommitdiffstats
path: root/third_party/bspatch
diff options
context:
space:
mode:
authorkeunwoo@google.com <keunwoo@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-07-29 00:21:11 +0000
committerkeunwoo@google.com <keunwoo@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-07-29 00:21:11 +0000
commitad89a6dc97029138b9f7f04135f3e8e164491eb5 (patch)
treefeebaac506b97b95913c701fd06dc0f04da0fadb /third_party/bspatch
parente724599d3f3120f186bcb6e45fa7a2d932fe8d6c (diff)
downloadchromium_src-ad89a6dc97029138b9f7f04135f3e8e164491eb5.zip
chromium_src-ad89a6dc97029138b9f7f04135f3e8e164491eb5.tar.gz
chromium_src-ad89a6dc97029138b9f7f04135f3e8e164491eb5.tar.bz2
Fix mbspatch.cc to work on non-Windows platforms.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party/bspatch')
-rw-r--r--third_party/bspatch/mbspatch.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/third_party/bspatch/mbspatch.cc b/third_party/bspatch/mbspatch.cc
index 2b4d76a..87d7895 100644
--- a/third_party/bspatch/mbspatch.cc
+++ b/third_party/bspatch/mbspatch.cc
@@ -197,6 +197,18 @@ int CalculateCrc(const unsigned char *buf, int size) {
return crc;
}
+/* _O_BINARY is a MSWindows open() mode flag. When absent, MSWindows
+ * open() translates CR+LF to LF; when present, it passes bytes
+ * through faithfully. Under *nix, we are always in binary mode, so
+ * the following #define turns this flag into a no-op w.r.t. bitwise
+ * OR. Note that this would be DANGEROUS AND UNSOUND if we used
+ * _O_BINARY other than as a bitwise OR mask (e.g., as a bitwise AND
+ * mask to check for binary mode), but it seems OK in the limited
+ * context of the following small function. */
+#ifndef _O_BINARY
+# define _O_BINARY 0
+#endif
+
int ApplyBinaryPatch(const char *old_file, const char *patch_file,
const char *new_file) {
int ret = 0;
@@ -231,4 +243,3 @@ int ApplyBinaryPatch(const char *old_file, const char *patch_file,
close(nfd);
return OK;
}
-