d3dcompiler: Allow D3DCompile2() to succeed with null output shader blob pointer.
[wine.git] / dlls / user32 / lstr.c
bloba5a906a90761cca1efba9faa06fc6d339ee2a141
1 /*
2 * USER string functions
4 * Copyright 1993 Yngvi Sigurjonsson (yngvi@hafro.is)
5 * Copyright 1996 Alexandre Julliard
6 * Copyright 1996 Marcus Meissner
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #include <ctype.h>
24 #include <stdarg.h>
25 #include <stdlib.h>
26 #include <stdio.h>
27 #include <string.h>
29 #include "windef.h"
30 #include "winbase.h"
31 #include "winnls.h"
32 #include "winuser.h"
33 #include "winerror.h"
36 /***********************************************************************
37 * CharNextExW (USER32.@)
39 LPWSTR WINAPI CharNextExW( WORD codepage, LPCWSTR ptr, DWORD flags )
41 /* doesn't make sense, there are no codepages for Unicode */
42 return NULL;
46 /***********************************************************************
47 * CharPrevExW (USER32.@)
49 LPSTR WINAPI CharPrevExW( WORD codepage, LPCWSTR start, LPCWSTR ptr, DWORD flags )
51 /* doesn't make sense, there are no codepages for Unicode */
52 return NULL;
56 /***********************************************************************
57 * CharToOemA (USER32.@)
59 BOOL WINAPI CharToOemA( LPCSTR s, LPSTR d )
61 if (!s || !d) return FALSE;
62 return CharToOemBuffA( s, d, strlen( s ) + 1 );
66 /***********************************************************************
67 * CharToOemBuffA (USER32.@)
69 BOOL WINAPI CharToOemBuffA( LPCSTR s, LPSTR d, DWORD len )
71 WCHAR *bufW;
73 if (!s || !d) return FALSE;
75 bufW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
76 if( bufW )
78 MultiByteToWideChar( CP_ACP, 0, s, len, bufW, len );
79 WideCharToMultiByte( CP_OEMCP, 0, bufW, len, d, len, NULL, NULL );
80 HeapFree( GetProcessHeap(), 0, bufW );
82 return TRUE;
86 /***********************************************************************
87 * CharToOemBuffW (USER32.@)
89 BOOL WINAPI CharToOemBuffW( LPCWSTR s, LPSTR d, DWORD len )
91 if (!s || !d) return FALSE;
92 WideCharToMultiByte( CP_OEMCP, 0, s, len, d, len, NULL, NULL );
93 return TRUE;
97 /***********************************************************************
98 * CharToOemW (USER32.@)
100 BOOL WINAPI CharToOemW( LPCWSTR s, LPSTR d )
102 if (!s || !d) return FALSE;
103 return CharToOemBuffW( s, d, lstrlenW( s ) + 1 );
107 /***********************************************************************
108 * OemToCharA (USER32.@)
110 BOOL WINAPI OemToCharA( LPCSTR s, LPSTR d )
112 if (!s || !d) return FALSE;
113 return OemToCharBuffA( s, d, strlen( s ) + 1 );
117 /***********************************************************************
118 * OemToCharBuffA (USER32.@)
120 BOOL WINAPI OemToCharBuffA( LPCSTR s, LPSTR d, DWORD len )
122 WCHAR *bufW;
124 if (!s || !d) return FALSE;
126 bufW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
127 if( bufW )
129 MultiByteToWideChar( CP_OEMCP, 0, s, len, bufW, len );
130 WideCharToMultiByte( CP_ACP, 0, bufW, len, d, len, NULL, NULL );
131 HeapFree( GetProcessHeap(), 0, bufW );
133 return TRUE;
137 /***********************************************************************
138 * OemToCharBuffW (USER32.@)
140 BOOL WINAPI OemToCharBuffW( LPCSTR s, LPWSTR d, DWORD len )
142 if (!s || !d) return FALSE;
143 MultiByteToWideChar( CP_OEMCP, MB_PRECOMPOSED | MB_USEGLYPHCHARS, s, len, d, len );
144 return TRUE;
148 /***********************************************************************
149 * OemToCharW (USER32.@)
151 BOOL WINAPI OemToCharW( LPCSTR s, LPWSTR d )
153 if (!s || !d) return FALSE;
154 return OemToCharBuffW( s, d, strlen( s ) + 1 );