From 0c588ea0ca7f929a95e8e57b01bd9977f13d08b0 Mon Sep 17 00:00:00 2001 From: Daniel Glassey Date: Wed, 31 Oct 2018 16:24:45 +0700 Subject: patch-02-warning Avoid compiler warning. Gbp-Pq: Name patch-02-warning --- source/Compiler.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/Compiler.h b/source/Compiler.h index b468417..00da282 100644 --- a/source/Compiler.h +++ b/source/Compiler.h @@ -230,7 +230,7 @@ protected: vector byteClassLines; vector uniClassLines; - long passType; + UInt32 passType; UInt32 uniDefault; UInt8 byteDefault; bool supplementaryChars; -- cgit v1.2.3 From 830640fbdba0d6ac49e839e3b47fcd4f7958b01c Mon Sep 17 00:00:00 2001 From: Daniel Glassey Date: Wed, 31 Oct 2018 16:24:45 +0700 Subject: patch-03-warnings Avoid more compiler warnings. Gbp-Pq: Name patch-03-warnings --- source/Compiler.cpp | 6 +++--- source/Engine.cpp | 4 ++-- source/Engine.h | 2 +- source/Public-headers/TECkit_Compiler.h | 4 ++-- source/Sample-tools/TECkit_Compile.cpp | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/source/Compiler.cpp b/source/Compiler.cpp index 66b74c7..6158645 100644 --- a/source/Compiler.cpp +++ b/source/Compiler.cpp @@ -189,14 +189,14 @@ TECkit_DisposeCompiled(Byte* table) 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; @@ -2133,7 +2133,7 @@ Compiler::Error(const char* msg, const char* s, UInt32 line) cout << " at line " << line << endl; } else - (*errorFunction)(errFuncUserData, (char*)msg, (char*)s, line); + (*errorFunction)(errFuncUserData, msg, s, line); errorState = true; ++errorCount; } diff --git a/source/Engine.cpp b/source/Engine.cpp index 14a7b5f..8d050c1 100644 --- a/source/Engine.cpp +++ b/source/Engine.cpp @@ -1093,7 +1093,7 @@ if (traceLevel > 0) { 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; @@ -2194,7 +2194,7 @@ TECkit_GetMappingName( 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 --git a/source/Engine.h b/source/Engine.h index 10bdb11..ac8eaa8 100644 --- a/source/Engine.h +++ b/source/Engine.h @@ -117,7 +117,7 @@ protected: 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 --git a/source/Public-headers/TECkit_Compiler.h b/source/Public-headers/TECkit_Compiler.h index 688271d..b3f2db6 100644 --- a/source/Public-headers/TECkit_Compiler.h +++ b/source/Public-headers/TECkit_Compiler.h @@ -56,7 +56,7 @@ extern "C" { #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 @@ WINAPI EXPORTED 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 --git a/source/Sample-tools/TECkit_Compile.cpp b/source/Sample-tools/TECkit_Compile.cpp index 5f85d8c..5924864 100644 --- a/source/Sample-tools/TECkit_Compile.cpp +++ b/source/Sample-tools/TECkit_Compile.cpp @@ -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) { fprintf(stderr, "%s", msg); if (param != 0) -- cgit v1.2.3 From ea2abf39117eb8265150824d7baaae2b95b82008 Mon Sep 17 00:00:00 2001 From: Daniel Glassey Date: Wed, 31 Oct 2018 16:24:45 +0700 Subject: patch-04-pragmas Remove the '#pragma's, they seem to cause problems for MSVC and are certainly not needed otherwise. Gbp-Pq: Name patch-04-pragmas --- source/Engine.cpp | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/source/Engine.cpp b/source/Engine.cpp index 8d050c1..dd47e54 100644 --- a/source/Engine.cpp +++ b/source/Engine.cpp @@ -102,10 +102,6 @@ READ(const UInt32 p) #endif } -#ifndef __GNUC__ -#pragma mark --- class Stage --- -#endif - Stage::Stage() : oBuffer(0) , oBufSize(0) @@ -127,10 +123,6 @@ Stage::lookaheadCount() const return 0; } -#ifndef __GNUC__ -#pragma mark --- class Normalizer --- -#endif - #include "NormalizationData.c" Normalizer::Normalizer(bool compose) @@ -400,10 +392,6 @@ Normalizer::getChar() return c; } -#ifndef __GNUC__ -#pragma mark --- class Pass --- -#endif - Pass::Pass(const TableHeader* inTable, Converter* cnv) : converter(cnv) , tableHeader(inTable) @@ -1288,10 +1276,6 @@ if (traceLevel > 0) return 0; } -#ifndef __GNUC__ -#pragma mark --- class Converter --- -#endif - Converter::Converter(const Byte* inTable, UInt32 inTableSize, bool inForward, UInt16 inForm, UInt16 outForm) : table(0) @@ -1942,10 +1926,6 @@ Converter::Validate(const Converter* cnv) return true; } -#ifndef __GNUC__ -#pragma mark --- Public "C" API functions --- -#endif - TECkit_Status WINAPI TECkit_CreateConverter( -- cgit v1.2.3 From cd988d04f8e87b02d6737e23f5429e24592463a8 Mon Sep 17 00:00:00 2001 From: Daniel Glassey Date: Thu, 1 Nov 2018 11:24:11 +0700 Subject: patch-02-warning Avoid compiler warning. Gbp-Pq: Name patch-02-warning --- source/Compiler.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/Compiler.h b/source/Compiler.h index b468417..00da282 100644 --- a/source/Compiler.h +++ b/source/Compiler.h @@ -230,7 +230,7 @@ protected: vector byteClassLines; vector uniClassLines; - long passType; + UInt32 passType; UInt32 uniDefault; UInt8 byteDefault; bool supplementaryChars; -- cgit v1.2.3 From eaaaacf9245456782fde5e5f70203678806f22bb Mon Sep 17 00:00:00 2001 From: Daniel Glassey Date: Thu, 1 Nov 2018 11:24:11 +0700 Subject: patch-03-warnings Avoid more compiler warnings. Gbp-Pq: Name patch-03-warnings --- source/Compiler.cpp | 6 +++--- source/Engine.cpp | 4 ++-- source/Engine.h | 2 +- source/Public-headers/TECkit_Compiler.h | 4 ++-- source/Sample-tools/TECkit_Compile.cpp | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/source/Compiler.cpp b/source/Compiler.cpp index 66b74c7..6158645 100644 --- a/source/Compiler.cpp +++ b/source/Compiler.cpp @@ -189,14 +189,14 @@ TECkit_DisposeCompiled(Byte* table) 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; @@ -2133,7 +2133,7 @@ Compiler::Error(const char* msg, const char* s, UInt32 line) cout << " at line " << line << endl; } else - (*errorFunction)(errFuncUserData, (char*)msg, (char*)s, line); + (*errorFunction)(errFuncUserData, msg, s, line); errorState = true; ++errorCount; } diff --git a/source/Engine.cpp b/source/Engine.cpp index 14a7b5f..8d050c1 100644 --- a/source/Engine.cpp +++ b/source/Engine.cpp @@ -1093,7 +1093,7 @@ if (traceLevel > 0) { 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; @@ -2194,7 +2194,7 @@ TECkit_GetMappingName( 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 --git a/source/Engine.h b/source/Engine.h index 10bdb11..ac8eaa8 100644 --- a/source/Engine.h +++ b/source/Engine.h @@ -117,7 +117,7 @@ protected: 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 --git a/source/Public-headers/TECkit_Compiler.h b/source/Public-headers/TECkit_Compiler.h index 688271d..b3f2db6 100644 --- a/source/Public-headers/TECkit_Compiler.h +++ b/source/Public-headers/TECkit_Compiler.h @@ -56,7 +56,7 @@ extern "C" { #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 @@ WINAPI EXPORTED 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 --git a/source/Sample-tools/TECkit_Compile.cpp b/source/Sample-tools/TECkit_Compile.cpp index 5f85d8c..5924864 100644 --- a/source/Sample-tools/TECkit_Compile.cpp +++ b/source/Sample-tools/TECkit_Compile.cpp @@ -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) { fprintf(stderr, "%s", msg); if (param != 0) -- cgit v1.2.3 From 1532404b9ed7b735362ee6bbefab5b8014f19d1f Mon Sep 17 00:00:00 2001 From: Daniel Glassey Date: Thu, 1 Nov 2018 11:24:11 +0700 Subject: patch-04-pragmas Remove the '#pragma's, they seem to cause problems for MSVC and are certainly not needed otherwise. Gbp-Pq: Name patch-04-pragmas --- source/Engine.cpp | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/source/Engine.cpp b/source/Engine.cpp index 8d050c1..dd47e54 100644 --- a/source/Engine.cpp +++ b/source/Engine.cpp @@ -102,10 +102,6 @@ READ(const UInt32 p) #endif } -#ifndef __GNUC__ -#pragma mark --- class Stage --- -#endif - Stage::Stage() : oBuffer(0) , oBufSize(0) @@ -127,10 +123,6 @@ Stage::lookaheadCount() const return 0; } -#ifndef __GNUC__ -#pragma mark --- class Normalizer --- -#endif - #include "NormalizationData.c" Normalizer::Normalizer(bool compose) @@ -400,10 +392,6 @@ Normalizer::getChar() return c; } -#ifndef __GNUC__ -#pragma mark --- class Pass --- -#endif - Pass::Pass(const TableHeader* inTable, Converter* cnv) : converter(cnv) , tableHeader(inTable) @@ -1288,10 +1276,6 @@ if (traceLevel > 0) return 0; } -#ifndef __GNUC__ -#pragma mark --- class Converter --- -#endif - Converter::Converter(const Byte* inTable, UInt32 inTableSize, bool inForward, UInt16 inForm, UInt16 outForm) : table(0) @@ -1942,10 +1926,6 @@ Converter::Validate(const Converter* cnv) return true; } -#ifndef __GNUC__ -#pragma mark --- Public "C" API functions --- -#endif - TECkit_Status WINAPI TECkit_CreateConverter( -- cgit v1.2.3