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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
Avoid more compiler warnings.
diff -ur TECkit-2.5.1.orig/source/Compiler.cpp TECkit-2.5.1/source/Compiler.cpp
--- TECkit-2.5.1.orig/source/Compiler.cpp 2008-11-17 21:06:09.000000000 +0100
+++ TECkit-2.5.1/source/Compiler.cpp 2009-10-01 22:06:09.000000000 +0200
@@ -191,14 +191,14 @@
free(table);
}
-char*
+const char*
WINAPI
TECkit_GetUnicodeName(UInt32 usv)
{
const CharName *c = &gUnicodeNames[0];
while (c->name != 0)
if (c->usv == usv)
- return (char*)c->name;
+ return c->name;
else
++c;
return NULL;
@@ -263,13 +263,13 @@
return -1;
}
-static inline UInt8
+inline UInt8
READ(const UInt8 p)
{
return p;
}
-static inline UInt16
+inline UInt16
READ(const UInt16 p)
{
#ifdef WORDS_BIGENDIAN
@@ -279,7 +279,7 @@
#endif
}
-static inline UInt32
+inline UInt32
READ(const UInt32 p)
{
#ifdef WORDS_BIGENDIAN
@@ -290,7 +290,7 @@
}
template<class T>
-inline static void
+inline void
WRITE(T& t, UInt32 v)
{
t = READ(T(v));
@@ -2133,7 +2133,7 @@
cout << " at line " << line << endl;
}
else
- (*errorFunction)(errFuncUserData, (char*)msg, (char*)s, line);
+ (*errorFunction)(errFuncUserData, msg, s, line);
errorState = true;
++errorCount;
}
diff -ur TECkit-2.5.1.orig/source/Engine.cpp TECkit-2.5.1/source/Engine.cpp
--- TECkit-2.5.1.orig/source/Engine.cpp 2008-04-07 16:21:12.000000000 +0200
+++ TECkit-2.5.1/source/Engine.cpp 2009-10-01 22:17:12.000000000 +0200
@@ -76,13 +76,13 @@
using namespace std;
/* we apply READ to values read from the compiled table, to provide byte-swapping where needed */
-static inline UInt8
+inline UInt8
READ(const UInt8 p)
{
return p;
}
-static inline UInt16
+inline UInt16
READ(const UInt16 p)
{
#ifdef WORDS_BIGENDIAN
@@ -92,7 +92,7 @@
#endif
}
-static inline UInt32
+inline UInt32
READ(const UInt32 p)
{
#ifdef WORDS_BIGENDIAN
@@ -1087,7 +1087,7 @@
if (matchElems == 0 && allowInsertion == false)
continue;
patternLength = matchElems + READ(rule->postLength);
- pattern = (MatchElem*)(rule + 1); // point past the defined struct for the rule header
+ pattern = (const MatchElem*)(rule + 1); // point past the defined struct for the rule header
direction = 1;
infoLimit = matchElems;
@@ -2185,7 +2185,7 @@
status = kStatus_BadMappingVersion;
else {
const Byte* namePtr;
- if (getNamePtrFromTable((Byte*)fh, nameID, namePtr, *nameLength)) {
+ if (getNamePtrFromTable((const Byte*)fh, nameID, namePtr, *nameLength)) {
UInt16 copyBytes = *nameLength < bufferSize ? *nameLength : bufferSize;
if (copyBytes > 0)
memcpy(nameBuffer, namePtr, copyBytes);
diff -ur TECkit-2.5.1.orig/source/Engine.h TECkit-2.5.1/source/Engine.h
--- TECkit-2.5.1.orig/source/Engine.h 2008-04-07 16:21:12.000000000 +0200
+++ TECkit-2.5.1/source/Engine.h 2009-10-01 22:16:40.000000000 +0200
@@ -117,7 +117,7 @@
UInt32 match(int index, int repeats, int textLoc);
// returns 0 for no match, 1 for match, or kNeedMoreInput/kInvalidChar
- MatchElem* pattern;
+ const MatchElem* pattern;
int patternLength;
int direction;
MatchInfo info[256];
diff -ur TECkit-2.5.1.orig/source/Public-headers/TECkit_Compiler.h TECkit-2.5.1/source/Public-headers/TECkit_Compiler.h
--- TECkit-2.5.1.orig/source/Public-headers/TECkit_Compiler.h 2008-04-07 16:21:12.000000000 +0200
+++ TECkit-2.5.1/source/Public-headers/TECkit_Compiler.h 2009-10-01 22:03:59.000000000 +0200
@@ -56,7 +56,7 @@
#define kCompilerOpts_Compress 0x00000010 /* generate compressed mapping table */
#define kCompilerOpts_XML 0x00000020 /* instead of a compiled binary table, generate an XML representation of the mapping */
-typedef void (CALLBACK *TECkit_ErrorFn)(void* userData, char* msg, char* param, UInt32 line);
+typedef void (CALLBACK *TECkit_ErrorFn)(void* userData, const char* msg, const char* param, UInt32 line);
TECkit_Status
WINAPI EXPORTED
@@ -75,7 +75,7 @@
TECkit_GetCompilerVersion();
/* new APIs for looking up Unicode names (as NUL-terminated C strings) */
-char*
+const char*
WINAPI EXPORTED
TECkit_GetUnicodeName(UInt32 usv);
/* returns the Unicode name of usv, if available, else NULL */
diff -ur TECkit-2.5.1.orig/source/Sample-tools/TECkit_Compile.cpp TECkit-2.5.1/source/Sample-tools/TECkit_Compile.cpp
--- TECkit-2.5.1.orig/source/Sample-tools/TECkit_Compile.cpp 2008-04-07 16:21:12.000000000 +0200
+++ TECkit-2.5.1/source/Sample-tools/TECkit_Compile.cpp 2009-10-01 22:00:14.000000000 +0200
@@ -24,13 +24,13 @@
#endif
extern "C" {
- static void CALLBACK errFunc(void* userData, char* msg, char* param, UInt32 line);
+ static void CALLBACK errFunc(void* userData, const char* msg, const char* param, UInt32 line);
};
static
void
CALLBACK
-errFunc(void* userData, char* msg, char* param, UInt32 line)
+errFunc(void* userData, const char* msg, const char* param, UInt32 line)
{
#pragma unused(userData)
|