Changeset 7820 for trunk/src/shlwapi/string_odin.cpp
- Timestamp:
- Feb 6, 2002, 9:18:30 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/shlwapi/string_odin.cpp
r6650 r7820 1 /* $Id: string_odin.cpp,v 1.5 2001-09-05 13:48:39 bird Exp $ */ 1 /* $Id: string_odin.cpp,v 1.6 2002-02-06 20:18:30 sandervl Exp $ */ 2 2 3 /* 3 4 * Win32 Lightweight SHELL32 for OS/2 … … 69 70 70 71 71 /*****************************************************************************72 * Name : ChrCmpIA73 * Purpose :74 * Parameters:75 * Variables :76 * Result :77 * Remark :78 * Status : PARTIALLY IMPLEMENTED UNTESTED79 *80 * Author : Patrick Haller [Wed, 1999/12/29 09:00]81 *****************************************************************************/82 83 ODINFUNCTION2(INT, ChrCmpIA,84 INT, ch1,85 INT, ch2)86 {87 // Note: IsDBCSLeadByte ignored !88 89 if ( (ch1 >= 'A') && (ch1 <= 'Z') ) ch1 |= 0x20;90 if ( (ch2 >= 'A') && (ch2 <= 'Z') ) ch2 |= 0x20;91 92 return ch1 - ch2;93 }94 95 96 #if 097 /*************************************************************************98 * OleStrToStrN [SHELL32.78]99 */100 BOOL WINAPI OleStrToStrNA (LPSTR lpStr, INT nStr, LPCWSTR lpOle, INT nOle)101 {102 TRACE("%p %x %s %x\n", lpStr, nStr, debugstr_w(lpOle), nOle);103 return WideCharToMultiByte (0, 0, lpOle, nOle, lpStr, nStr, NULL, NULL);104 }105 106 BOOL WINAPI OleStrToStrNW (LPWSTR lpwStr, INT nwStr, LPCWSTR lpOle, INT nOle)107 {108 TRACE("%p %x %s %x\n", lpwStr, nwStr, debugstr_w(lpOle), nOle);109 110 if (lstrcpynW ( lpwStr, lpOle, nwStr))111 { return lstrlenW (lpwStr);112 }113 return 0;114 }115 116 BOOL WINAPI OleStrToStrNAW (LPVOID lpOut, INT nOut, LPCVOID lpIn, INT nIn)117 {118 if (VERSION_OsIsUnicode())119 return OleStrToStrNW ((LPWSTR)lpOut, nOut, (LPCWSTR)lpIn, nIn);120 return OleStrToStrNA ((LPSTR)lpOut, nOut, (LPCWSTR)lpIn, nIn);121 }122 123 /*************************************************************************124 * StrToOleStrN [SHELL32.79]125 * lpMulti, nMulti, nWide [IN]126 * lpWide [OUT]127 */128 BOOL WINAPI StrToOleStrNA (LPWSTR lpWide, INT nWide, LPCSTR lpStrA, INT nStr)129 {130 TRACE("%p %x %s %x\n", lpWide, nWide, lpStrA, nStr);131 return MultiByteToWideChar (0, 0, lpStrA, nStr, lpWide, nWide);132 }133 BOOL WINAPI StrToOleStrNW (LPWSTR lpWide, INT nWide, LPCWSTR lpStrW, INT nStr)134 {135 TRACE("%p %x %s %x\n", lpWide, nWide, debugstr_w(lpStrW), nStr);136 137 if (lstrcpynW (lpWide, lpStrW, nWide))138 { return lstrlenW (lpWide);139 }140 return 0;141 }142 143 BOOL WINAPI StrToOleStrNAW (LPWSTR lpWide, INT nWide, LPCVOID lpStr, INT nStr)144 {145 if (VERSION_OsIsUnicode())146 return StrToOleStrNW (lpWide, nWide, (LPWSTR)lpStr, nStr);147 return StrToOleStrNA (lpWide, nWide, (LPSTR)lpStr, nStr);148 }149 150 151 152 153 /************************************************************************154 * StrToOleStr [SHELL32.163]155 *156 */157 int WINAPI StrToOleStrA (LPWSTR lpWideCharStr, LPCSTR lpMultiByteString)158 {159 TRACE("%p %p(%s)\n",160 lpWideCharStr, lpMultiByteString, lpMultiByteString);161 162 return MultiByteToWideChar(0, 0, lpMultiByteString, -1, lpWideCharStr, MAX_PATH);163 164 }165 int WINAPI StrToOleStrW (LPWSTR lpWideCharStr, LPCWSTR lpWString)166 {167 TRACE("%p %p(%s)\n",168 lpWideCharStr, lpWString, debugstr_w(lpWString));169 170 if (lstrcpyW (lpWideCharStr, lpWString ))171 { return lstrlenW (lpWideCharStr);172 }173 return 0;174 }175 176 BOOL WINAPI StrToOleStrAW (LPWSTR lpWideCharStr, LPCVOID lpString)177 {178 if (VERSION_OsIsUnicode())179 return StrToOleStrW (lpWideCharStr, (LPCWSTR)lpString);180 return StrToOleStrA (lpWideCharStr, (LPCSTR)lpString);181 }182 #endif183 72 184 73 … … 200 89 ODINFUNCTION2(LPSTR, StrChrIA, 201 90 LPCSTR, lpStart, 202 WORD, wMatch)91 char, cMatch) 203 92 { 204 93 LPSTR lpRes; 205 94 206 wMatch = tolower(wMatch);207 lpRes = strchr(lpStart, wMatch); // lower case comparsion95 cMatch = tolower(cMatch); 96 lpRes = strchr(lpStart, cMatch); // lower case comparsion 208 97 if (NULL == lpRes) 209 98 { 210 wMatch = toupper(wMatch);211 lpRes = strchr(lpStart, wMatch); // upper case comparsion99 cMatch = toupper(cMatch); 100 lpRes = strchr(lpStart, cMatch); // upper case comparsion 212 101 } 213 102 … … 293 182 (lpString2 == NULL) ) 294 183 return 0; 295 184 296 185 LPSTR lpLoop = (LPSTR)lpString1; 297 186 298 187 for (; (*lpLoop != 0); lpLoop++ ) 299 188 if ( StrChrA( lpString2, *lpLoop ) ) 300 189 return (INT) (lpLoop - lpString1); 301 190 302 191 return (INT) (lpLoop - lpString1); 303 192 } … … 327 216 (lpString2 == NULL) ) 328 217 return 0; 329 218 330 219 LPWSTR lpLoop = (LPWSTR)lpString1; 331 220 332 221 for (; (*lpLoop != 0); lpLoop++ ) 333 222 if ( StrChrW( lpString2, *lpLoop ) ) 334 223 return (INT) (lpLoop - lpString1); 335 224 336 225 return (INT) (lpLoop - lpString1); 337 226 } … … 344 233 * Variables : 345 234 * Result : 346 * Remark : 235 * Remark : 347 236 * Status : UNTESTED 348 237 * … … 355 244 { 356 245 register LPSTR s1; 357 246 358 247 while (*lpString1) 359 248 { … … 369 258 lpString1++; 370 259 } 371 260 372 261 return (LPSTR)NULL; 373 262 } … … 380 269 * Variables : 381 270 * Result : 382 * Remark : 271 * Remark : 383 272 * Status : UNTESTED 384 273 * … … 391 280 { 392 281 register LPWSTR s1; 393 282 394 283 while (*lpString1) 395 284 { … … 405 294 lpString1++; 406 295 } 407 296 408 297 return (LPWSTR)NULL; 409 298 } … … 411 300 412 301 /************************************************************************* 413 * StrRStrIA 302 * StrRStrIA [SHLWAPI] 414 303 */ 415 LPSTR WINAPI StrRStrIA(LPCSTR lpFirst, LPCSTR lpSrch )304 LPSTR WINAPI StrRStrIA(LPCSTR lpFirst, LPCSTR lpSrch, LPCSTR unknown) 416 305 { 417 306 INT iLen = lstrlenA(lpFirst) - lstrlenA(lpSrch); 418 307 308 dprintf(("StrRStrIA %x %x %x NOT IMPLEMENTED correctly", lpFirst, lpSrch, unknown)); 309 419 310 // lpSrch cannot fit into lpFirst 420 311 if (iLen < 0) 421 312 return (LPSTR)NULL; 422 313 423 314 LPSTR lpThis = (LPSTR)lpFirst + iLen; 424 315 425 316 while (lpThis >= lpFirst) 426 317 { … … 430 321 lpThis--; 431 322 } 432 323 433 324 return NULL; 434 325 } … … 436 327 437 328 /************************************************************************* 438 * StrRStrIW 329 * StrRStrIW [SHLWAPI] 439 330 */ 440 LPWSTR WINAPI StrRStrIW(LPCWSTR lpFirst, LPCWSTR lpSrch )331 LPWSTR WINAPI StrRStrIW(LPCWSTR lpFirst, LPCWSTR lpSrch, LPCWSTR unknown) 441 332 { 442 333 INT iLen = lstrlenW(lpFirst) - lstrlenW(lpSrch); 443 334 335 dprintf(("StrRStrIA %x %x %x NOT IMPLEMENTED correctly", lpFirst, lpSrch, unknown)); 336 444 337 // lpSrch cannot fit into lpFirst 445 338 if (iLen < 0) 446 339 return (LPWSTR)NULL; 447 340 448 341 LPWSTR lpThis = (LPWSTR)lpFirst + iLen; 449 342 450 343 while (lpThis >= lpFirst) 451 344 { … … 455 348 lpThis--; 456 349 } 457 350 458 351 return NULL; 459 352 }
Note:
See TracChangeset
for help on using the changeset viewer.