Commit e36b97e1 authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Use wcsncmp() instead of strncmpW().

parent 4501ab0a
......@@ -36,7 +36,6 @@
#include "ntdll_misc.h"
#include "wine/exception.h"
#include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(actctx);
......@@ -754,7 +753,7 @@ static WCHAR *xmlstrdupW(const xmlstr_t* str)
static inline BOOL xmlstr_cmp(const xmlstr_t* xmlstr, const WCHAR *str)
{
return !strncmpW(xmlstr->ptr, str, xmlstr->len) && !str[xmlstr->len];
return !wcsncmp(xmlstr->ptr, str, xmlstr->len) && !str[xmlstr->len];
}
static inline BOOL xmlstr_cmpi(const xmlstr_t* xmlstr, const WCHAR *str)
......@@ -771,8 +770,8 @@ static BOOL xml_name_cmp( const struct xml_elem *elem1, const struct xml_elem *e
{
return (elem1->name.len == elem2->name.len &&
elem1->ns.len == elem2->ns.len &&
!strncmpW( elem1->name.ptr, elem2->name.ptr, elem1->name.len ) &&
!strncmpW( elem1->ns.ptr, elem2->ns.ptr, elem1->ns.len ));
!wcsncmp( elem1->name.ptr, elem2->name.ptr, elem1->name.len ) &&
!wcsncmp( elem1->ns.ptr, elem2->ns.ptr, elem1->ns.len ));
}
static inline BOOL xml_elem_cmp(const struct xml_elem *elem, const WCHAR *str, const WCHAR *namespace)
......@@ -1230,7 +1229,7 @@ static BOOL is_xmlns_attr( const struct xml_attr *attr )
{
const int len = wcslen( xmlnsW );
if (attr->name.len < len) return FALSE;
if (strncmpW( attr->name.ptr, xmlnsW, len )) return FALSE;
if (wcsncmp( attr->name.ptr, xmlnsW, len )) return FALSE;
return (attr->name.len == len || attr->name.ptr[len] == ':');
}
......@@ -1262,7 +1261,7 @@ static xmlstr_t find_xmlns( xmlbuf_t *xmlbuf, const xmlstr_t *name )
for (i = xmlbuf->ns_pos - 1; i >= 0; i--)
{
if (xmlbuf->namespaces[i].name.len == name->len &&
!strncmpW( xmlbuf->namespaces[i].name.ptr, name->ptr, name->len ))
!wcsncmp( xmlbuf->namespaces[i].name.ptr, name->ptr, name->len ))
return xmlbuf->namespaces[i].value;
}
if (xmlbuf->ns_pos) WARN( "namespace %s not found\n", debugstr_xmlstr( name ));
......@@ -1602,7 +1601,7 @@ static OLEMISC get_olemisc_value(const WCHAR *str, int len)
n = (min+max)/2;
c = strncmpW(olemisc_values[n].name, str, len);
c = wcsncmp(olemisc_values[n].name, str, len);
if (!c && !olemisc_values[n].name[len])
return olemisc_values[n].value;
......
......@@ -104,7 +104,6 @@
#include "winternl.h"
#include "ddk/wdm.h"
#include "ntdll_misc.h"
#include "wine/unicode.h"
#include "wine/server.h"
#include "wine/list.h"
#include "wine/library.h"
......@@ -2254,7 +2253,7 @@ static int match_redirect( const WCHAR *path, int len, const WCHAR *redir, BOOLE
while (i < len && !IS_SEPARATOR(path[i])) i++;
if (check_case)
{
if (strncmpW( path + start, redir, i - start )) return 0;
if (wcsncmp( path + start, redir, i - start )) return 0;
}
else
{
......
......@@ -32,7 +32,6 @@
#include "ntdll_misc.h"
#include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(module);
......@@ -439,7 +438,7 @@ enum loadorder get_load_order( const WCHAR *app_name, const UNICODE_STRING *nt_n
if (!init_done) init_load_order();
std_key = get_standard_key();
if (app_name) app_key = get_app_key( app_name );
if (!strncmpW( path, nt_prefixW, 4 )) path += 4;
if (!wcsncmp( path, nt_prefixW, 4 )) path += 4;
TRACE("looking for %s\n", debugstr_w(path));
......
......@@ -24,6 +24,7 @@
#include <locale.h>
#include <langinfo.h>
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
......@@ -34,9 +35,11 @@
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "ntdll_misc.h"
#include "wine/library.h"
#include "wine/unicode.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(nls);
......@@ -2032,7 +2035,7 @@ NTSTATUS WINAPI RtlIsNormalizedString( ULONG form, const WCHAR *str, INT len, BO
WCHAR *buffer = RtlAllocateHeap( GetProcessHeap(), 0, dstlen * sizeof(WCHAR) );
if (!buffer) return STATUS_NO_MEMORY;
status = RtlNormalizeString( form, str, len, buffer, &dstlen );
result = !status && (dstlen == len) && !strncmpW( buffer, str, len );
result = !status && (dstlen == len) && !wcsncmp( buffer, str, len );
RtlFreeHeap( GetProcessHeap(), 0, buffer );
}
*res = result;
......
......@@ -312,6 +312,7 @@ int WINAPIV NTDLL_swprintf( WCHAR *str, const WCHAR *format, ... );
#define wcscspn(s,r) NTDLL_wcscspn(s,r)
#define wcsspn(s,a) NTDLL_wcsspn(s,a)
#define wcscmp(s1,s2) NTDLL_wcscmp(s1,s2)
#define wcsncmp(s1,s2,n) NTDLL_wcsncmp(s1,s2,n)
/* convert from straight ASCII to Unicode without depending on the current codepage */
static inline void ascii_to_unicode( WCHAR *dst, const char *src, size_t len )
......
......@@ -53,7 +53,6 @@
#include "wine/exception.h"
#include "wine/library.h"
#include "wine/server.h"
#include "wine/unicode.h"
#ifdef HAVE_MACH_MACH_H
#include <mach/mach.h>
......@@ -1434,7 +1433,7 @@ static ULONG get_env_size( const RTL_USER_PROCESS_PARAMETERS *params, char **win
while (*ptr)
{
static const WCHAR WINEDEBUG[] = {'W','I','N','E','D','E','B','U','G','=',0};
if (!*winedebug && !strncmpW( ptr, WINEDEBUG, ARRAY_SIZE( WINEDEBUG ) - 1 ))
if (!*winedebug && !wcsncmp( ptr, WINEDEBUG, ARRAY_SIZE( WINEDEBUG ) - 1 ))
{
DWORD len = wcslen(ptr) * 3 + 1;
if ((*winedebug = RtlAllocateHeap( GetProcessHeap(), 0, len )))
......
......@@ -43,7 +43,6 @@
#include "ntdll_misc.h"
#include "wine/asm.h"
#include "wine/exception.h"
#include "wine/unicode.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(resource);
......@@ -152,7 +151,7 @@ static const IMAGE_RESOURCE_DIRECTORY *find_entry_by_name( const IMAGE_RESOURCE_
{
pos = (min + max) / 2;
str = (const IMAGE_RESOURCE_DIR_STRING_U *)((const char *)root + entry[pos].u.s.NameOffset);
res = strncmpW( name, str->NameString, str->Length );
res = wcsncmp( name, str->NameString, str->Length );
if (!res && namelen == str->Length)
{
if (!entry[pos].u2.s2.DataIsDirectory == !want_dir)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment