diff options
Diffstat (limited to 'libmsi/unicode.h')
-rw-r--r-- | libmsi/unicode.h | 154 |
1 files changed, 0 insertions, 154 deletions
diff --git a/libmsi/unicode.h b/libmsi/unicode.h deleted file mode 100644 index d134f3e..0000000 --- a/libmsi/unicode.h +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Wine internal Unicode definitions - * - * Copyright 2000 Alexandre Julliard - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#ifndef __WINE_WINE_UNICODE_H -#define __WINE_WINE_UNICODE_H - -#include <stdarg.h> - -#include <windef.h> -#include <winbase.h> -#include <winnls.h> - -#ifdef __cplusplus -extern "C" { -#endif - -extern long int strtolW( const WCHAR *nptr, WCHAR **endptr, int base ); -extern int sprintfW( WCHAR *str, const WCHAR *format, ... ); -extern int snprintfW( WCHAR *str, size_t len, const WCHAR *format, ... ); -extern int vsprintfW( WCHAR *str, const WCHAR *format, va_list valist ); -extern int vsnprintfW( WCHAR *str, size_t len, const WCHAR *format, va_list valist ); - -/* some useful string manipulation routines */ - -static inline unsigned int strlenW( const WCHAR *str ) -{ - const WCHAR *s = str; - while (*s) s++; - return s - str; -} - -static inline WCHAR *strcpyW( WCHAR *dst, const WCHAR *src ) -{ - WCHAR *p = dst; - while ((*p++ = *src++)); - return dst; -} - -/* strncpy doesn't do what you think, don't use it */ -#define strncpyW(d,s,n) error do_not_use_strncpyW_use_lstrcpynW_or_memcpy_instead - -static inline WCHAR *strcpynW( WCHAR *dst, const WCHAR *src, unsigned count ) -{ - WCHAR *d = dst; - const WCHAR *s = src; - - while ((count > 1) && *s) - { - count--; - *d++ = *s++; - } - if (count) *d = 0; - return dst; -} - -static inline int strcmpW( const WCHAR *str1, const WCHAR *str2 ) -{ - while (*str1 && (*str1 == *str2)) { str1++; str2++; } - return *str1 - *str2; -} - -static inline int strncmpW( const WCHAR *str1, const WCHAR *str2, int n ) -{ - if (n <= 0) return 0; - while ((--n > 0) && *str1 && (*str1 == *str2)) { str1++; str2++; } - return *str1 - *str2; -} - -static inline WCHAR *strcatW( WCHAR *dst, const WCHAR *src ) -{ - strcpyW( dst + strlenW(dst), src ); - return dst; -} - -static inline WCHAR *strchrW( const WCHAR *str, WCHAR ch ) -{ - do { if (*str == ch) return (WCHAR *)(uintptr_t)str; } while (*str++); - return NULL; -} - -static inline WCHAR *strrchrW( const WCHAR *str, WCHAR ch ) -{ - WCHAR *ret = NULL; - do { if (*str == ch) ret = (WCHAR *)(uintptr_t)str; } while (*str++); - return ret; -} - -static inline WCHAR *strpbrkW( const WCHAR *str, const WCHAR *accept ) -{ - for ( ; *str; str++) if (strchrW( accept, *str )) return (WCHAR *)(uintptr_t)str; - return NULL; -} - -static inline size_t strspnW( const WCHAR *str, const WCHAR *accept ) -{ - const WCHAR *ptr; - for (ptr = str; *ptr; ptr++) if (!strchrW( accept, *ptr )) break; - return ptr - str; -} - -static inline size_t strcspnW( const WCHAR *str, const WCHAR *reject ) -{ - const WCHAR *ptr; - for (ptr = str; *ptr; ptr++) if (strchrW( reject, *ptr )) break; - return ptr - str; -} - -static inline WCHAR *memchrW( const WCHAR *ptr, WCHAR ch, size_t n ) -{ - const WCHAR *end; - for (end = ptr + n; ptr < end; ptr++) if (*ptr == ch) return (WCHAR *)(uintptr_t)ptr; - return NULL; -} - -static inline WCHAR *memrchrW( const WCHAR *ptr, WCHAR ch, size_t n ) -{ - const WCHAR *end; - WCHAR *ret = NULL; - for (end = ptr + n; ptr < end; ptr++) if (*ptr == ch) ret = (WCHAR *)(uintptr_t)ptr; - return ret; -} - -static inline long int atolW( const WCHAR *str ) -{ - return strtolW( str, (WCHAR **)0, 10 ); -} - -static inline int atoiW( const WCHAR *str ) -{ - return (int)atolW( str ); -} - -#ifdef __cplusplus -} -#endif - -#endif /* __WINE_WINE_UNICODE_H */ |