mirror of
https://github.com/keymanapp/keyman.git
synced 2026-09-23 16:17:40 +00:00
chore(developer): typos, comments, add function u16rchr()
This commit is contained in:
parent
af20847229
commit
121d39883e
7 changed files with 24 additions and 11 deletions
|
|
@ -20,7 +20,7 @@ The naming convention of the files is as follows:
|
|||
|
||||
* After the second underscore all combination of char can be used.
|
||||
|
||||
* The 4 characters following CERR_ correspond to the last 4 digits of the error-Code which is expected to be produced by this file.
|
||||
* The 4 characters following CERR_ correspond to the last 4 digits of the error code which is expected to be produced by this file.
|
||||
|
||||
( e.g. CERR_404D_balochi_phonetic.kmn should produce error 0x0000404D).
|
||||
|
||||
|
|
@ -33,11 +33,11 @@ While running, kmcompxtest extracts those 4 characters from the Filename (e.g. 4
|
|||
|
||||
* If these 4 characters correspond to the actual error given, the test will be marked as OK. (Code 0)
|
||||
<br/>
|
||||
* If these 4 characters signifiy an error but **no error** does occur, the test will be marked as FAILED (Code 1)
|
||||
* If these 4 characters signify an error but **no error** does occur, the test will be marked as FAILED (Code 1)
|
||||
<br/>
|
||||
* If these 4 characters signifiy an error but this **specific error** does not occur, the test will be marked as FAILED (Code 4)
|
||||
* If these 4 characters signify an error but this **specific error** does not occur, the test will be marked as FAILED (Code 4)
|
||||
<br/>
|
||||
* If these 4 characters signifiy an error number that is **not correct**, the test will be marked as FAILED (Code 5)
|
||||
* If these 4 characters signify an error number that is **not correct**, the test will be marked as FAILED (Code 5)
|
||||
<br/>
|
||||
* If more than 1 error is produced, only the error coded in the Filename will be detected
|
||||
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ KMX_DWORD CheckFilenameConsistency(KMX_WCHAR const * Filename, bool ReportMissin
|
|||
}
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
const KMX_WCHAR* cptr1 = u16chr(Name, '\\'); // _S2 const wchar_t* cptr1 = wcsrchr(Name, '\\');
|
||||
const KMX_WCHAR* cptr1 = u16rchr(Name, '\\'); // _S2 const wchar_t* cptr1 = wcsrchr(Name, '\\');
|
||||
#else
|
||||
const KMX_WCHAR* cptr1 = u16rchr(Name, '/');
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ const struct CompilerError CompilerErrors[] = {
|
|||
{ CERR_DuplicateGroup , "A group with this name has already been defined."},
|
||||
{ CERR_DuplicateStore , "A store with this name has already been defined."},
|
||||
{ CERR_RepeatedBegin , "Begin has already been set"},
|
||||
{ CHINT_FilenameHasDifferingCase , "HINT: Casing differences may fail on some platforms:"},
|
||||
{ CHINT_FilenameHasDifferingCase , "HINT: Casing differences may fail on some platforms."},
|
||||
|
||||
{ 0, nullptr }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3425,8 +3425,8 @@ KMX_DWORD ReadLine(FILE* fp_in , PKMX_WCHAR wstr, KMX_BOOL PreProcess)
|
|||
|
||||
if (cur == fsize)
|
||||
|
||||
// Always a "\r\n" to the EOF, avoids funny bugs
|
||||
//u16ncat(str, u"\r\n", _countof(str)); // I3481 // S: do we need changes at other places as well when we skip \r?
|
||||
// S: Is replacing "\r\n" with "\n" here sufficient or do we need changes at other places as well when we skip "\r"?
|
||||
// u16ncat(str, u"\r\n", _countof(str)); // I3481 // Always a "\r\n" to the EOF, avoids funny bugs
|
||||
u16ncat(str, u"\n", _countof(str)); // I3481
|
||||
|
||||
if (len == 0) return CERR_EndOfFile;
|
||||
|
|
|
|||
|
|
@ -8,12 +8,12 @@ namespace kmcmp {
|
|||
extern int currentLine;
|
||||
}
|
||||
|
||||
KMX_BOOL AddCompileError (KMX_DWORD msg);
|
||||
KMX_BOOL AddCompileError(KMX_DWORD msg);
|
||||
|
||||
// TODO: These macros can return FALSE in functions that expect a DWORD CERR_x
|
||||
// return value type. This is just plain wrong!
|
||||
#define SetError(err) { if(AddCompileError (err) || (err & CERR_FATAL)) return FALSE; }
|
||||
#define AddWarning(warn) { if(AddCompileError (warn)) return FALSE; }
|
||||
#define SetError(err) { if(AddCompileError(err) || (err & CERR_FATAL)) return FALSE; }
|
||||
#define AddWarning(warn) { if(AddCompileError(warn)) return FALSE; }
|
||||
|
||||
PKMX_WCHAR strtowstr(PKMX_STR in);
|
||||
PFILE_STORE FindSystemStore(PFILE_KEYBOARD fk, KMX_DWORD dwSystemID);
|
||||
|
|
|
|||
|
|
@ -104,6 +104,18 @@ const KMX_WCHAR * u16ncat(KMX_WCHAR *dst, const KMX_WCHAR *src, size_t max) {
|
|||
return o;
|
||||
}
|
||||
|
||||
// u16rchr returns last occurence of ch in p; It returns p_end + 1 if ch = '\0' and NULL if ch is not found
|
||||
const KMX_WCHAR* u16rchr(const KMX_WCHAR* p, KMX_WCHAR ch) {
|
||||
const KMX_WCHAR* p_end = p + u16len(p) - 1;
|
||||
|
||||
if (ch == '\0') return p_end + 1;
|
||||
while (p_end >= p) {
|
||||
if (*p_end == ch) return p_end;
|
||||
p_end--;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const KMX_WCHAR * u16chr(const KMX_WCHAR *p, KMX_WCHAR ch) {
|
||||
while (*p) {
|
||||
if (*p == ch) return p;
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ int u16ncmp(const KMX_WCHAR *p, const KMX_WCHAR *q, size_t count);
|
|||
int u16nicmp(const KMX_WCHAR *p, const KMX_WCHAR *q, size_t count) ;
|
||||
const KMX_WCHAR * u16ncpy(KMX_WCHAR *dst, const KMX_WCHAR *src, size_t max);
|
||||
const KMX_WCHAR * u16cpy(KMX_WCHAR *dst, const KMX_WCHAR *src);
|
||||
const KMX_WCHAR * u16rchr(const KMX_WCHAR *p, KMX_WCHAR ch) ;
|
||||
const KMX_WCHAR * u16chr(const KMX_WCHAR *p, KMX_WCHAR ch) ;
|
||||
const KMX_WCHAR * u16ncat(KMX_WCHAR *dst, const KMX_WCHAR *src, size_t max);
|
||||
KMX_WCHAR * u16tok(KMX_WCHAR *p, KMX_WCHAR ch, KMX_WCHAR **ctx) ;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue