39{
41
42 INT i, label_start, label_end, out_label,
out = 0;
44
45 DPRINT(
"%x %p %d %p %d\n",
dwFlags, lpASCIICharStr, cchASCIIChar,
46 lpUnicodeCharStr, cchUnicodeChar);
47
48 for(label_start=0; label_start<cchASCIIChar;) {
50
52 for(
i=label_start;
i<cchASCIIChar;
i++) {
53 ch = lpASCIICharStr[
i];
54
55 if(ch>0x7f || (
i!=cchASCIIChar-1 && !ch)) {
57 return 0;
58 }
59
60 if(!ch || ch=='.')
61 break;
62 if(ch == '-')
64
65 if((
dwFlags&IDN_USE_STD3_ASCII_RULES) == 0)
66 continue;
67 if((ch>='a' && ch<='z') || (ch>='A' && ch<='Z')
68 || (ch>='0' && ch<='9') || ch=='-')
69 continue;
70
72 return 0;
73 }
75
76 if(label_start==label_end && ch) {
78 return 0;
79 }
80
81 if((
dwFlags&IDN_USE_STD3_ASCII_RULES) && (lpASCIICharStr[label_start]==
'-' ||
82 lpASCIICharStr[label_end-1]=='-')) {
84 return 0;
85 }
86 if(label_end-label_start > 63) {
88 return 0;
89 }
90
91 if(label_end-label_start<4 ||
92 tolowerW(lpASCIICharStr[label_start])!=
'x' ||
93 tolowerW(lpASCIICharStr[label_start+1])!=
'n' ||
94 lpASCIICharStr[label_start+2]!='-' || lpASCIICharStr[label_start+3]!='-') {
95 if(label_end < cchASCIIChar)
96 label_end++;
97
98 if(!lpUnicodeCharStr) {
99 out += label_end-label_start;
100 }
else if(
out+label_end-label_start <= cchUnicodeChar) {
101 memcpy(lpUnicodeCharStr+
out, lpASCIICharStr+label_start,
102 (label_end-label_start)*
sizeof(
WCHAR));
103 out += label_end-label_start;
104 }else {
106 return 0;
107 }
108
109 label_start = label_end;
110 continue;
111 }
112
113 if(delim == label_start+3)
114 delim++;
115 if(!lpUnicodeCharStr) {
116 out += delim-label_start-4;
117 }
else if(
out+delim-label_start-4 <= cchUnicodeChar) {
118 memcpy(lpUnicodeCharStr+
out, lpASCIICharStr+label_start+4,
119 (delim-label_start-4)*
sizeof(
WCHAR));
120 out += delim-label_start-4;
121 }else {
123 return 0;
124 }
126 delim++;
127
128 for(
i=delim;
i<label_end;) {
132 ch =
i<label_end ?
tolowerW(lpASCIICharStr[
i++]) : 0;
133 if((ch<'a' || ch>'z') && (ch<'0' || ch>'9')) {
135 return 0;
136 }
137 digit = ch<='9' ? ch-'0'+'z'-'a'+1 : ch-'a';
141 break;
143 }
147
148 if((
dwFlags&IDN_ALLOW_UNASSIGNED)==0 &&
151 return 0;
152 }
153 if(!lpUnicodeCharStr) {
155 }
else if(
out+1 <= cchASCIIChar) {
157 lpUnicodeCharStr+out_label+
pos,
159 lpUnicodeCharStr[out_label+
pos] =
n;
161 }else {
163 return 0;
164 }
166 }
167
168 if(
out-out_label > 63) {
170 return 0;
171 }
172
173 if(label_end < cchASCIIChar) {
174 if(!lpUnicodeCharStr) {
176 }
else if(
out+1 <= cchUnicodeChar) {
177 lpUnicodeCharStr[
out++] = lpASCIICharStr[label_end];
178 }else {
180 return 0;
181 }
182 }
183 label_start = label_end+1;
184 }
185
187}
static INT adapt(INT delta, INT numpoints, BOOL firsttime)
static unsigned short get_table_entry(const unsigned short *table, WCHAR ch)
#define ERROR_INSUFFICIENT_BUFFER
#define ERROR_INVALID_NAME
GLubyte GLubyte GLubyte GLubyte w
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define memcpy(s1, s2, n)
#define memmove(s1, s2, n)
const unsigned short nameprep_char_type[4432]
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags