summaryrefslogtreecommitdiff
path: root/packages/portabase/metakit-2.4.9.3/metakit-2.4.9.3.patch
blob: 35babe28b440bc23251031af638ba3041afee527 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
diff -Naur metakit-2.4.9.3/include/mk4.h metakit-2.4.9.3-patched/include/mk4.h
--- metakit-2.4.9.3/include/mk4.h	2004-01-26 04:54:45.000000000 -0500
+++ metakit-2.4.9.3-patched/include/mk4.h	2004-02-28 21:07:34.000000000 -0500
@@ -217,6 +217,9 @@
 bool operator< (const t4_i64 a_, const t4_i64 b_);
 #endif
 
+typedef int ((*StringCompareFunc)(const char*, const char*));
+typedef int ((*Win32FileOpenFunc)(const char*, int));
+
 //---------------------------------------------------------------------------
 
 class c4_View
@@ -330,6 +333,7 @@
   friend bool operator> (const c4_View&, const c4_View&);
   friend bool operator<= (const c4_View&, const c4_View&);
   friend bool operator>= (const c4_View&, const c4_View&);
+  static StringCompareFunc stringCompareFunc;
   
 protected:
   void _IncSeqRef();
@@ -554,6 +558,8 @@
   bool LoadFrom(c4_Stream&);
   void SaveTo(c4_Stream&);
 
+  static Win32FileOpenFunc win32FileOpenFunc;
+
   //DROPPED: c4_Storage (const char* filename_, const char* description_);
   //DROPPED: c4_View Store(const char* name_, const c4_View& view_);
   //DROPPED: c4_HandlerSeq& RootTable() const;
diff -Naur metakit-2.4.9.3/src/fileio.cpp metakit-2.4.9.3-patched/src/fileio.cpp
--- metakit-2.4.9.3/src/fileio.cpp	2003-11-22 20:42:51.000000000 -0500
+++ metakit-2.4.9.3-patched/src/fileio.cpp	2004-02-28 21:07:34.000000000 -0500
@@ -321,7 +321,7 @@
 
 #if q4_WIN32 && !q4_BORC && !q4_WINCE
   int flags = _O_BINARY | _O_NOINHERIT | (mode_ > 0 ? _O_RDWR : _O_RDONLY);
-  int fd = _open(fname_, flags);
+  int fd = (*c4_Storage::win32FileOpenFunc)(fname_, flags);
   if (fd != -1)
     _cleanup = _file = _fdopen(fd, mode_ > 0 ? "r+b" : "rb");
 #else
@@ -339,7 +339,8 @@
 
   if (mode_ > 0) {
 #if q4_WIN32 && !q4_BORC && !q4_WINCE
-    fd = _open(fname_, flags | _O_CREAT, _S_IREAD | _S_IWRITE);
+    flags = flags | _O_CREAT, _S_IREAD | _S_IWRITE;
+    fd = (*c4_Storage::win32FileOpenFunc)(fname_, flags);
     if (fd != -1)
       _cleanup = _file = _fdopen(fd, "w+b");
 #else
diff -Naur metakit-2.4.9.3/src/format.cpp metakit-2.4.9.3-patched/src/format.cpp
--- metakit-2.4.9.3/src/format.cpp	2004-01-19 17:49:43.000000000 -0500
+++ metakit-2.4.9.3-patched/src/format.cpp	2004-02-28 21:07:35.000000000 -0500
@@ -923,7 +923,7 @@
   c4_String v1 ((const char*) b1_.Contents(), b1_.Size());
   c4_String v2 ((const char*) b2_.Contents(), b2_.Size());
   
-  return v1.CompareNoCase(v2);
+  return (*c4_View::stringCompareFunc)(v1, v2);
 }
 
 void c4_FormatS::Insert(int index_, const c4_Bytes& buf_, int count_)
diff -Naur metakit-2.4.9.3/src/store.cpp metakit-2.4.9.3-patched/src/store.cpp
--- metakit-2.4.9.3/src/store.cpp	2003-11-22 20:42:51.000000000 -0500
+++ metakit-2.4.9.3-patched/src/store.cpp	2004-02-28 21:09:26.000000000 -0500
@@ -18,6 +18,10 @@
 #if !q4_INLINE
 #include "store.inl"
 #endif
+
+#if q4_WIN32
+#include <io.h>
+#endif
   
 /////////////////////////////////////////////////////////////////////////////
 
@@ -426,6 +430,17 @@
   c4_Persist::Save(&stream_, Persist()->Root());
 }
 
+int f4_Latin1OpenFunc(const char *fname_, int mode_)
+{
+#if q4_WIN32
+  return _open(fname_, mode_);
+#else
+  return -1;
+#endif
+}
+
+Win32FileOpenFunc c4_Storage::win32FileOpenFunc = f4_Latin1OpenFunc;
+
 /////////////////////////////////////////////////////////////////////////////
 
 c4_DerivedSeq::c4_DerivedSeq (c4_Sequence& seq_)
diff -Naur metakit-2.4.9.3/src/view.cpp metakit-2.4.9.3-patched/src/view.cpp
--- metakit-2.4.9.3/src/view.cpp	2003-11-22 20:42:51.000000000 -0500
+++ metakit-2.4.9.3-patched/src/view.cpp	2004-02-28 21:07:35.000000000 -0500
@@ -1005,6 +1005,8 @@
   return na == nb ? 0 : i < na ? +1 : -1;
 }
 
+StringCompareFunc c4_View::stringCompareFunc = strcmp;
+
 /////////////////////////////////////////////////////////////////////////////
 
 /** @class c4_Cursor