summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-08-11 22:42:09 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-08-11 22:42:09 +0000
commit3944b14a2aaad2fcb95bf448d9b18c35e6f74ec8 (patch)
treeef6e3b8d1533058221a008827a777bdfbe95ab31 /src
parent088403332a5a0a0312441a7938ed66f80126018f (diff)
missing string comparison functions
git-svn-id: http://svn.miranda-ng.org/main/trunk@14918 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r--src/mir_core/src/mir_core.def4
-rw-r--r--src/mir_core/src/mir_core64.def4
-rw-r--r--src/mir_core/src/utils.cpp36
3 files changed, 44 insertions, 0 deletions
diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def
index 8412723e7f..57f8bfcfd9 100644
--- a/src/mir_core/src/mir_core.def
+++ b/src/mir_core/src/mir_core.def
@@ -977,3 +977,7 @@ GetOSDisplayString @1134
IsWinVer10Plus @1135
IsWinVer81Plus @1136
IsWinVer8Plus @1137
+mir_strncmp @1138
+mir_strncmpi @1139
+mir_wstrncmp @1140
+mir_wstrncmpi @1141
diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def
index b29f37541d..c44c595634 100644
--- a/src/mir_core/src/mir_core64.def
+++ b/src/mir_core/src/mir_core64.def
@@ -977,3 +977,7 @@ GetOSDisplayString @1134
IsWinVer10Plus @1135
IsWinVer81Plus @1136
IsWinVer8Plus @1137
+mir_strncmp @1138
+mir_strncmpi @1139
+mir_wstrncmp @1140
+mir_wstrncmpi @1141
diff --git a/src/mir_core/src/utils.cpp b/src/mir_core/src/utils.cpp
index af1685a63e..5f4d0d063b 100644
--- a/src/mir_core/src/utils.cpp
+++ b/src/mir_core/src/utils.cpp
@@ -410,6 +410,42 @@ MIR_CORE_DLL(int) mir_wstrcmpi(const wchar_t *p1, const wchar_t *p2)
return CompareStringW(LOCALE_USER_DEFAULT, NORM_IGNORECASE, p1, -1, p2, -1) - 2;
}
+MIR_CORE_DLL(int) mir_strncmp(const char *p1, const char *p2, size_t n)
+{
+ if (p1 == NULL)
+ return (p2 == NULL) ? 0 : -1;
+ if (p2 == NULL)
+ return 1;
+ return CompareStringA(LOCALE_USER_DEFAULT, 0, p1, (int)n, p2, (int)n) - 2;
+}
+
+MIR_CORE_DLL(int) mir_wstrncmp(const wchar_t *p1, const wchar_t *p2, size_t n)
+{
+ if (p1 == NULL)
+ return (p2 == NULL) ? 0 : -1;
+ if (p2 == NULL)
+ return 1;
+ return CompareStringW(LOCALE_USER_DEFAULT, 0, p1, (int)n, p2, (int)n) - 2;
+}
+
+MIR_CORE_DLL(int) mir_strncmpi(const char *p1, const char *p2, size_t n)
+{
+ if (p1 == NULL)
+ return (p2 == NULL) ? 0 : -1;
+ if (p2 == NULL)
+ return 1;
+ return CompareStringA(LOCALE_USER_DEFAULT, NORM_IGNORECASE, p1, (int)n, p2, (int)n) - 2;
+}
+
+MIR_CORE_DLL(int) mir_wstrncmpi(const wchar_t *p1, const wchar_t *p2, size_t n)
+{
+ if (p1 == NULL)
+ return (p2 == NULL) ? 0 : -1;
+ if (p2 == NULL)
+ return 1;
+ return CompareStringW(LOCALE_USER_DEFAULT, NORM_IGNORECASE, p1, (int)n, p2, (int)n) - 2;
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
PGENRANDOM pfnRtlGenRandom;