summaryrefslogtreecommitdiff
path: root/src/fileops.h
diff options
context:
space:
mode:
authorRamsay Jones <ramsay@ramsay1.demon.co.uk>2009-03-16 17:08:45 +0000
committerShawn O. Pearce <spearce@spearce.org>2009-03-17 19:10:51 -0700
commit7a6cf8153799563464d6f1761e55352c327b4122 (patch)
treed0f0c327029d770d1b10efc7a6c93080ed7d6844 /src/fileops.h
parent0f39781c25a06c1d38877adef4ff5a6a5f67f1ca (diff)
downloadlibgit2-7a6cf8153799563464d6f1761e55352c327b4122.tar.gz
win32: Open or create files in binary mode
On windows, unless we use the O_BINARY flag in the open() call, the file I/O routines will perform line ending conversion (\r\n => \n on input, \n => \r\n on output). In addition to the performance penalty, most files in the object database are binary and will, therefore, become corrupted by this conversion. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'src/fileops.h')
-rw-r--r--src/fileops.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/fileops.h b/src/fileops.h
index 963dd0fe0..3cc1e1683 100644
--- a/src/fileops.h
+++ b/src/fileops.h
@@ -15,6 +15,10 @@
#include <time.h>
#include <dirent.h>
+#if !defined(O_BINARY)
+#define O_BINARY 0
+#endif
+
#define GITFO_BUF_INIT {NULL, 0}
typedef int git_file;