summaryrefslogtreecommitdiff
path: root/src/mir_core/utils.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-02-01 09:08:30 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-02-01 09:08:30 +0000
commite936e3f9ea190db91d4c22218338a80af9f3d412 (patch)
tree19ad3a1a2776d2bdc0b7fffb4f987fc182e44a8e /src/mir_core/utils.cpp
parent7c16f0bc7af13884de18712d9b66c7e7218d51c0 (diff)
missing checks added
git-svn-id: http://svn.miranda-ng.org/main/trunk@7982 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/mir_core/utils.cpp')
-rw-r--r--src/mir_core/utils.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/mir_core/utils.cpp b/src/mir_core/utils.cpp
index 996654ea84..0da7cdadf8 100644
--- a/src/mir_core/utils.cpp
+++ b/src/mir_core/utils.cpp
@@ -144,7 +144,10 @@ MIR_CORE_DLL(WCHAR*) ltrimpw(WCHAR *str)
MIR_CORE_DLL(int) wildcmp(const char *name, const char *mask)
{
- const char *last='\0';
+ if (name == NULL || mask == NULL)
+ return false;
+
+ const char *last = '\0';
for (;; mask++, name++) {
if (*mask != '?' && *mask != *name) break;
if (*name == '\0') return ((BOOL)!*mask);
@@ -162,6 +165,9 @@ MIR_CORE_DLL(int) wildcmp(const char *name, const char *mask)
MIR_CORE_DLL(int) wildcmpw(const WCHAR *name, const WCHAR *mask)
{
+ if (name == NULL || mask == NULL)
+ return false;
+
const WCHAR* last = '\0';
for (;; mask++, name++) {
if (*mask != '?' && *mask != *name) break;
@@ -182,6 +188,9 @@ MIR_CORE_DLL(int) wildcmpw(const WCHAR *name, const WCHAR *mask)
MIR_CORE_DLL(int) wildcmpi(const char *name, const char *mask)
{
+ if (name == NULL || mask == NULL)
+ return false;
+
const char *last = NULL;
for (;; mask++, name++) {
if (*mask != '?' && _qtoupper(*mask) != _qtoupper(*name)) break;
@@ -200,6 +209,9 @@ MIR_CORE_DLL(int) wildcmpi(const char *name, const char *mask)
MIR_CORE_DLL(int) wildcmpiw(const WCHAR *name, const WCHAR *mask)
{
+ if (name == NULL || mask == NULL)
+ return false;
+
const WCHAR* last = NULL;
for (;; mask++, name++) {
if (*mask != '?' && _qtoupper(*mask) != _qtoupper(*name)) break;