9 #ifdef INT_COMPILER_MSVC 17 while (len < maxlen && s[len])
40 for (i = 0; i < len; i++)
42 if (buf[i] >= u
'A' && buf[i] <= u
'Z')
46 else if (buf[i] == u
'\0')
69 for (i = 0; i < len; i++)
71 if (buf[i] >=
'A' && buf[i] <=
'Z')
75 else if (buf[i] ==
'\0')
91 for (; *buf1 == *buf2 && *buf1 && *buf2; buf1++, buf2++) {}
114 for (
size_t i = 0; buf1[i] || buf2[i]; i++)
121 if (c1 >= u
'A' && c1 <= u
'Z')
126 if (c2 >= u
'A' && c2 <= u
'Z')
163 for (
size_t i = 0; i < len; i++)
170 if (c1 >= u
'A' && c1 <= u
'Z')
175 if (c2 >= u
'A' && c2 <= u
'Z')
205 while (buf1[i] && buf2[j])
210 if (c1 >= u
'A' && c1 <= u
'Z')
215 if (c2 >= u
'A' && c2 <= u
'Z')
232 if ((buf2[j] == 0) && (j > 0))
240 #ifdef INT_COMPILER_MSVC 253 if ((NULL == buf1) || (NULL == buf2))
260 while (buf1[i] && buf2[j])
265 if (c1 >=
'A' && c1 <=
'Z')
270 if (c2 >=
'A' && c2 <=
'Z')
287 if ((buf2[j] == 0) && (j > 0))
297 #ifdef INT_COMPILER_MSVC 319 if ((NULL == buf1) || (NULL == buf2))
324 for (i = 0; i < len; i++)
331 if (c1 >=
'A' && c1 <=
'Z')
336 if (c2 >=
'A' && c2 <=
'Z')
374 if ((NULL == buf1) || (NULL == buf2))
379 for (i = 0; buf1[i] || buf2[i]; i++)
386 if (c1 >=
'A' && c1 <=
'Z')
391 if (c2 >=
'A' && c2 <=
'Z')
430 for (
size_t i = 0; i < len; i++)
435 if (c1 >=
'A' && c1 <=
'Z')
440 if (c2 >= u
'A' && c2 <= u
'Z')
468 for (i = 0; (i < DestinationMaxLength - 1) && (Source[i] != 0); i++)
470 Destination[i] = (
CHAR)Source[i];
488 for (i = 0; (i < DestinationMaxLength - 1) && (Source[i] != 0); i++)
490 char c = (char)Source[i];
492 if (c >=
'A' && c <=
'Z')
509 _In_z_ const char *Source,
515 for (i = 0; (i < DestinationMaxLength - 1) && (Source[i] != 0); i++)
517 Destination[i] = (
WCHAR)Source[i];
529 _In_ size_t MaxBufferSize,
544 while (i < MaxBufferSize)
553 if (Buffer[i] < 0x20 && Buffer[i] !=
'\n' && Buffer[i] !=
'\t')
558 if ((
UCHAR)Buffer[i] >= 0x7f)
579 _In_ size_t DestinationSize,
580 _In_ size_t SourceSize
587 if (DestinationSize >= SourceSize)
589 memcpy(Destination, Source, DestinationSize);
594 memcpy(Destination, (
void *)((
size_t)Source + SourceSize - DestinationSize), DestinationSize);
604 return value > 0 ? value : -value;
610 _In_z_ char const *Pattern,
611 _In_z_ char const *String,
625 char const *backPattern = NULL, *back_str = NULL;
636 unsigned char strChar = *String++;
637 unsigned char patChar = *Pattern++;
641 strChar = (
unsigned char)
tolower(strChar);
642 patChar = (
unsigned char)
tolower(patChar);
658 if (*Pattern ==
'\0')
663 backPattern = Pattern;
669 int match = 0, inverted = (*Pattern ==
'!');
670 char const *
class = Pattern + inverted;
671 unsigned char startChar = *
class ++;
679 unsigned char endChar = startChar;
682 if (startChar ==
'\0')
687 if (
class[0] ==
'-' &&
class[1] !=
']')
701 startChar = (
unsigned char)
tolower(startChar);
702 endChar = (
unsigned char)
tolower(endChar);
705 match |= (startChar <= strChar && strChar <= endChar);
706 }
while ((startChar = *
class ++) !=
']');
708 if (match == inverted)
718 patChar = *Pattern++;
722 patChar = (
unsigned char)
tolower(patChar);
728 if (strChar == patChar)
739 if (patChar ==
'\0' && Truncated && !backPattern)
745 if (strChar ==
'\0' || !backPattern)
752 Pattern = backPattern;
767 _In_z_ char const *Pattern,
779 char const *backPattern = NULL, *back_str = NULL;
790 unsigned char strChar = *String++;
791 unsigned char patChar = *Pattern++;
806 if (*Pattern ==
'\0')
811 backPattern = Pattern;
817 QWORD first, last, nr;
820 int match = 0, inverted = (*Pattern ==
'!');
821 char const *
class = Pattern + inverted;
830 first =
strtoul(
class, &next, 0);
832 if (
class == next || *next !=
'-')
847 last =
strtoul(
class, &next, 0);
849 if (
class == next || *next !=
']')
858 nr =
strtoul(String - 1, &next, 0);
859 if (String - 1 == next)
864 match = (first <= nr && nr <= last);
865 if (match == inverted)
876 patChar = *Pattern++;
881 if (strChar == patChar)
891 if (strChar ==
'\0' || !backPattern)
898 Pattern = backPattern;
910 _In_z_ char const *Pattern,
925 char const *backPattern = NULL;
926 WCHAR const *back_str = NULL;
937 unsigned char strChar = (
unsigned char) * String++;
938 unsigned char patChar = *Pattern++;
942 strChar = (
unsigned char)
tolower(strChar);
943 patChar = (
unsigned char)
tolower(patChar);
959 if (*Pattern ==
'\0')
964 backPattern = Pattern;
970 int match = 0, inverted = (*Pattern ==
'!');
971 char const *
class = Pattern + inverted;
972 unsigned char startChar = *
class ++;
980 unsigned char endChar = startChar;
983 if (startChar ==
'\0')
988 if (
class[0] ==
'-' &&
class[1] !=
']')
1002 startChar = (
unsigned char)
tolower(startChar);
1003 endChar = (
unsigned char)
tolower(endChar);
1006 match |= (startChar <= strChar && strChar <= endChar);
1007 }
while ((startChar = *
class ++) !=
']');
1009 if (match == inverted)
1019 patChar = *Pattern++;
1023 patChar = (
unsigned char)
tolower(patChar);
1029 if (strChar == patChar)
1031 if (patChar ==
'\0')
1040 if (patChar ==
'\0' && Truncated && !backPattern)
1046 if (strChar ==
'\0' || !backPattern)
1053 Pattern = backPattern;
1054 String = ++back_str;
1070 while (len < maxlen && s[len])
1086 for (i = 0; str[i] != 0; i++) {}
1099 const char *orig_src = src;
1110 while (--dest_size != 0)
1112 if (0 == (*dst++ = *src))
1126 return src - orig_src;
1137 const WCHAR *orig_src = src;
1148 while (--dest_size != 0)
1150 if (0 == (*dst++ = *src))
1164 return src - orig_src;
1176 const char *s = src;
1190 while ((n-- != 0) && (*d != 0))
1196 n = size - dest_len;
1200 return dest_len + strlen(s);
1216 return dest_len + (s - src);
1226 nd_vsnprintf_s(
char *str,
size_t sizeOfBuffer,
size_t count,
const char *format, va_list args)
1234 return vsnprintf(str, count, format, args);
1244 return memset(s, c, n);
1248 #ifdef INT_COMPILER_MSVC 1250 # pragma function(memcpy) 1252 memcpy(
void *dest,
const void *src,
size_t n)
1258 # pragma function(memset) 1260 memset(
void *s,
int c,
size_t n)
1266 # pragma function(memcmp) 1268 memcmp(
const void *vl,
const void *vr,
size_t n)
1270 const unsigned char *l = vl, *r = vr;
1271 for (; n && *l == *r; n--, l++, r++)
1273 return n ? *l - *r : 0;
1276 # pragma function(strcmp) 1278 strcmp(
const char *l,
const char *r)
1280 for (; *l == *r && *l; l++, r++)
1282 return *(
unsigned char *)l - *(
unsigned char *)r;
1285 # pragma function(strlen) 1287 strlen(
const char *s)
1296 strncmp(
const char *_l,
const char *_r,
size_t n)
1298 const unsigned char *l = (
void *)_l, *r = (
void *)_r;
1301 for (; *l && *r && n && *l == *r; l++, r++, n--)
1313 const char *cp = str1;
1314 const char *s1, *s2;
1321 while (*s1 && *s2 && !(*s1 - *s2))
1344 while (*str && *str != (
char)c)
1349 if (*str == (
char)c)
1363 const char *start = str;
1369 while (--str != start && *str != (
char)c)
1374 if (*str == (
char)c)
1382 # pragma function(strcpy) 1391 #pragma warning(push) 1392 #pragma warning(suppress : 4127) 1394 while ((*cp++ = *src++) !=
'\0')
1397 #pragma warning(pop) 1402 #endif // INT_COMPILER_MSVC
size_t strlcat(char *dst, const char *src, size_t size)
static void __stosb(uint8_t *dst, uint8_t x, size_t n)
char * utf16toutf8(char *Destination, const WCHAR *Source, DWORD DestinationMaxLength)
#define _Out_writes_bytes_(expr)
int wstrcmp(const WCHAR *buf1, const WCHAR *buf2)
long long my_llabs(long long value)
int strcasecmp_utf8_utf16(const char *buf1, const WCHAR *buf2, size_t len)
size_t wstrlcpy(WCHAR *dst, const WCHAR *src, size_t dest_size)
int strlower_utf16(WCHAR *buf, size_t len)
static void __movsb(uint8_t *dst, uint8_t const *src, size_t n)
size_t wstrnlen(const WCHAR *s, size_t maxlen)
#define _In_reads_z_(expr)
__noreturn void IntBugCheck(void)
void * nd_memset(void *s, int c, size_t n)
char * utf16tolowerutf8(char *Destination, const WCHAR *Source, DWORD DestinationMaxLength)
size_t strlcpy(char *dst, const char *src, size_t dest_size)
int is_str_ansi(const char *Buffer, size_t MaxBufferSize, size_t MinSize)
BOOLEAN glob_match_numeric_utf8(char const *Pattern, char const *String)
#define _In_reads_or_z_(expr)
#define _Inout_updates_(expr)
#define UNREFERENCED_PARAMETER(P)
int nd_vsnprintf_s(char *str, size_t sizeOfBuffer, size_t count, const char *format, va_list args)
size_t wstrlen(const WCHAR *str)
#define _In_reads_bytes_(expr)
UINT32 __cdecl strtoul(const INT8 *nptr, INT8 **endptr, INT32 ibase)
int wstrcasecmp(const WCHAR *buf1, const WCHAR *buf2)
int wstrncasecmp(const WCHAR *buf1, const WCHAR *buf2, size_t len)
WCHAR * utf8toutf16(WCHAR *Destination, const char *Source, DWORD DestinationMaxLength)
#define _Out_writes_z_(expr)
const WCHAR * strstr_utf16(const WCHAR *buf1, const WCHAR *buf2)
int strlower_utf8(char *buf, size_t len)
BOOLEAN glob_match_utf8(char const *Pattern, char const *String, BOOLEAN IgnoreCase, BOOLEAN Truncated)
BOOLEAN glob_match_utf16(char const *Pattern, WCHAR const *String, BOOLEAN IgnoreCase, BOOLEAN Truncated)
void memcpy_end(void *Destination, const void *Source, size_t DestinationSize, size_t SourceSize)