diff options
author | Strangerke | 2011-06-26 12:52:07 +0200 |
---|---|---|
committer | Strangerke | 2011-06-26 12:52:07 +0200 |
commit | e0673c113563ab9fc28d08c07a3bcb5c3b98fa1c (patch) | |
tree | d1aa5376b9aaf214b517e851a08b9e3837dd7314 | |
parent | a06a75b9a41fb3ef9da2c7420ee9dee257c89cca (diff) | |
download | scummvm-rg350-e0673c113563ab9fc28d08c07a3bcb5c3b98fa1c.tar.gz scummvm-rg350-e0673c113563ab9fc28d08c07a3bcb5c3b98fa1c.tar.bz2 scummvm-rg350-e0673c113563ab9fc28d08c07a3bcb5c3b98fa1c.zip |
CGE: get rid of memicmp
-rw-r--r-- | engines/cge/btfile.cpp | 13 | ||||
-rw-r--r-- | engines/cge/startup.cpp | 2 |
2 files changed, 7 insertions, 8 deletions
diff --git a/engines/cge/btfile.cpp b/engines/cge/btfile.cpp index 12c3519466..db0ebc2d5f 100644 --- a/engines/cge/btfile.cpp +++ b/engines/cge/btfile.cpp @@ -72,7 +72,7 @@ void BTFILE::PutPage(int lev, bool hard) { BT_PAGE *BTFILE::GetPage(int lev, uint16 pgn) { if (Buff[lev].PgNo != pgn) { - uint32 pos = pgn * sizeof(BT_PAGE); + int32 pos = pgn * sizeof(BT_PAGE); PutPage(lev); Buff[lev].PgNo = pgn; if (Size() > pos) { @@ -90,9 +90,6 @@ BT_PAGE *BTFILE::GetPage(int lev, uint16 pgn) { return Buff[lev].Page; } -// Does this work, or does it have to compare the entire buffer? -#define memicmp(s1, s2, n) scumm_strnicmp((const char *)s1, (const char *)s2, n) - BT_KEYPACK *BTFILE::Find(const char *key) { int lev = 0; uint16 nxt = BT_ROOT; @@ -102,7 +99,8 @@ BT_KEYPACK *BTFILE::Find(const char *key) { if (pg->Hea.Down != BT_NONE) { int i; for (i = 0; i < pg->Hea.Count; i++) { - if (memicmp(key, pg->Inn[i].Key, BT_KEYLEN) < 0) + // Does this work, or does it have to compare the entire buffer? + if (scumm_strnicmp((const char *) key, (const char*)pg->Inn[i].Key, BT_KEYLEN) < 0) break; } nxt = (i) ? pg->Inn[i - 1].Down : pg->Hea.Down; @@ -110,9 +108,10 @@ BT_KEYPACK *BTFILE::Find(const char *key) { ++ lev; } else { int i; - for (i = 0; i < pg->Hea.Count - 1; i++) + for (i = 0; i < pg->Hea.Count - 1; i++) { if (scumm_stricmp((const char *)key, (const char *)pg->Lea[i].Key) <= 0) break; + } Buff[lev].Indx = i; return &pg->Lea[i]; } @@ -122,7 +121,7 @@ BT_KEYPACK *BTFILE::Find(const char *key) { int keycomp(const void *k1, const void *k2) { - return memicmp(k1, k2, BT_KEYLEN); + return scumm_strnicmp((const char *) k1, (const char*) k2, BT_KEYLEN); } diff --git a/engines/cge/startup.cpp b/engines/cge/startup.cpp index 631a64d732..4895ce9861 100644 --- a/engines/cge/startup.cpp +++ b/engines/cge/startup.cpp @@ -150,7 +150,7 @@ const char *UsrPath(const char *nam) { if (j) if (buf[--j] == '\n') buf[j] = '\0'; - if (memicmp(buf, key, i) == 0) + if (scumm_strnicmp((const char *) buf, (const char*) key, i) == 0) ok = true; } if (ok) { |