- Timestamp:
- Jun 30, 1999, 11:19:42 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/unicode.cpp
r250 r257 1 /* $Id: unicode.cpp,v 1.1 0 1999-06-30 13:25:01sandervl Exp $ */1 /* $Id: unicode.cpp,v 1.11 1999-06-30 21:19:42 sandervl Exp $ */ 2 2 3 3 /* … … 140 140 } 141 141 142 uni_chars_left = unilen ; //elements143 out_bytes_left = uni len; //size in bytes142 uni_chars_left = unilen-1; //elements 143 out_bytes_left = uni_chars_left; //size in bytes == elements 144 144 in_buf = (UniChar*)ustring; 145 145 out_buf = astring; … … 149 149 &num_subs); 150 150 151 unilen -= 1+out_bytes_left; //end + left bytes 152 astring[unilen] = 0; //terminate 153 154 return unilen; 155 151 156 // dprintf(("KERNEL32: UnicodeToAsciiN(%d) '%s'\n", rc, astring )); 152 157 } else 153 158 { 154 159 /* idiots unicode conversion :) */ 155 for (i = 0; i < unilen-1; i++)160 for (i = 0; i < unilen-1; i++) 156 161 { 157 162 astring[i] = (ustring[i] > 255) ? (char)20 : (char)ustring[i]; //CB: handle invalid characters as space 158 163 if (ustring[i] == 0) return i; //asta la vista, baby 159 164 } 160 } 161 162 astring[unilen-1] = 0; // @@@PH: 1999/06/09 fix - always terminate string 163 164 return(unilen-1);165 166 astring[unilen-1] = 0; // @@@PH: 1999/06/09 fix - always terminate string 167 168 return(unilen-1); 169 } 165 170 } 166 171 //****************************************************************************** … … 232 237 233 238 in_buf = ascii; 234 in_bytes_left = asciilen ; //buffer size in bytes239 in_bytes_left = asciilen-1; //buffer size in bytes 235 240 out_buf = (UniChar*)unicode; 236 241 237 uni_chars_left = asciilen; //elements242 uni_chars_left = in_bytes_left; //elements 238 243 dprintf(("KERNEL32: AsciiToUnicode %d\n", in_bytes_left)); 239 244 … … 243 248 &num_subs ); 244 249 250 unicode[asciilen-1-in_bytes_left] = 0; 251 245 252 //if (rc != ULS_SUCCESS && in_bytes_left > 0) //CB: never the case during my tests 246 253 // dprintf(("KERNEL32: AsciiToUnicode failed, %d bytes left!\n",in_bytes_left)); … … 254 261 if (ascii[i] == 0) return; //work done 255 262 } 256 } 257 258 unicode[asciilen-1] = 0;263 264 unicode[asciilen-1] = 0; 265 } 259 266 } 260 267 //****************************************************************************** … … 279 286 280 287 288
Note:
See TracChangeset
for help on using the changeset viewer.