Ignore:
Timestamp:
Feb 6, 2002, 9:18:30 PM (24 years ago)
Author:
sandervl
Message:

Wine resync

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/shlwapi/string.c

    r7508 r7820  
    1 //Note: Odin changes marked by #ifdef __WIN32OS2__!
    2 #ifdef __WIN32OS2__
    3 #include <odin.h>
    4 #include <odinwrap.h>
    5 #include <os2sel.h>
    6 
    7 #include <string.h>
    8 #include <wctype.h>
    9 #include <wcstr.h>
    10 #define HAVE_WCTYPE_H
    11 #include <win\shlwapi.h>
    12 
    13 #include <heapstring.h>
    14 #include <winnls.h>
    15 #endif
    161#include <ctype.h>
    172#include <stdlib.h>
     
    249#include "wingdi.h"
    2510#include "winuser.h"
     11#include "winreg.h"
     12#ifdef __WIN32OS2__
     13#include "shlobj.h"
     14#define NO_SHLWAPI_STREAM
     15#include "shlwapi.h"
     16#else
     17#define NO_SHLWAPI_STREAM
    2618#include "shlwapi.h"
    2719#include "shlobj.h"
     20#endif
    2821#include "wine/unicode.h"
    2922#include "debugtools.h"
     
    3225
    3326/*************************************************************************
    34  * StrChrA                                      [SHLWAPI]
     27 * ChrCmpIA                                     [SHLWAPI.385]
     28 *
     29 * Note: Returns 0 (FALSE) if characters are equal (insensitive).
     30 */
     31BOOL WINAPI ChrCmpIA (WORD w1, WORD w2)
     32{
     33        TRACE("%c ? %c\n", w1, w2);
     34        return (toupper(w1) != toupper(w2));
     35}
     36
     37/*************************************************************************
     38 * ChrCmpIW                                     [SHLWAPI.386]
     39 *
     40 * Note: Returns 0 (FALSE) if characters are equal (insensitive).
     41 */
     42BOOL WINAPI ChrCmpIW (WCHAR w1, WCHAR w2)
     43{
     44        TRACE("%c ? %c\n", w1, w2);
     45        return (toupperW(w1) != toupperW(w2));
     46}
     47
     48/*************************************************************************
     49 * StrChrA                                      [SHLWAPI.@]
    3550 */
    3651LPSTR WINAPI StrChrA (LPCSTR str, WORD c)
     
    4156
    4257/*************************************************************************
    43  * StrChrW                                      [SHLWAPI]
     58 * StrChrW                                      [SHLWAPI.@]
    4459 *
    4560 */
     
    4964        return strchrW(str, x);
    5065}
    51 #ifndef __WIN32OS2__
    52 /*************************************************************************
    53  * StrCmpIW                                     [SHLWAPI]
     66
     67/*************************************************************************
     68 * StrCmpIW                                     [SHLWAPI.@]
    5469 */
    5570int WINAPI StrCmpIW ( LPCWSTR wstr1, LPCWSTR wstr2 )
     
    5873    return strcmpiW( wstr1, wstr2 );
    5974}
    60 #endif
    61 
    62 /*************************************************************************
    63  * StrCmpNA                                     [SHLWAPI]
     75
     76/*************************************************************************
     77 * StrCmpNA                                     [SHLWAPI.@]
    6478 */
    6579INT WINAPI StrCmpNA ( LPCSTR str1, LPCSTR str2, INT len)
     
    7084
    7185/*************************************************************************
    72  * StrCmpNW                                     [SHLWAPI]
     86 * StrCmpNW                                     [SHLWAPI.@]
    7387 */
    7488INT WINAPI StrCmpNW ( LPCWSTR wstr1, LPCWSTR wstr2, INT len)
     
    7993
    8094/*************************************************************************
    81  * StrCmpNIA                                    [SHLWAPI]
     95 * StrCmpNIA                                    [SHLWAPI.@]
    8296 */
    8397int WINAPI StrCmpNIA ( LPCSTR str1, LPCSTR str2, int len)
     
    88102
    89103/*************************************************************************
    90  * StrCmpNIW                                    [SHLWAPI]
     104 * StrCmpNIW                                    [SHLWAPI.@]
    91105 */
    92106int WINAPI StrCmpNIW ( LPCWSTR wstr1, LPCWSTR wstr2, int len)
     
    97111
    98112/*************************************************************************
    99  * StrCmpW                                      [SHLWAPI]
     113 * StrCmpW                                      [SHLWAPI.@]
    100114 */
    101115int WINAPI StrCmpW ( LPCWSTR wstr1, LPCWSTR wstr2 )
     
    106120
    107121/*************************************************************************
    108  * StrCatW                                      [SHLWAPI]
     122 * StrCatW                                      [SHLWAPI.@]
    109123 */
    110124LPWSTR WINAPI StrCatW( LPWSTR wstr1, LPCWSTR wstr2 )
     
    115129
    116130/*************************************************************************
    117  * StrCpyW                                      [SHLWAPI]
     131 * StrCpyW                                      [SHLWAPI.@]
    118132 */
    119133LPWSTR WINAPI StrCpyW( LPWSTR wstr1, LPCWSTR wstr2 )
     
    124138
    125139/*************************************************************************
    126  * StrCpyNW                                     [SHLWAPI]
     140 * StrCpyNW                                     [SHLWAPI.@]
    127141 */
    128142LPWSTR WINAPI StrCpyNW( LPWSTR wstr1, LPCWSTR wstr2, int n )
     
    133147
    134148/*************************************************************************
    135  * StrStrA                                      [SHLWAPI]
     149 * StrStrA                                      [SHLWAPI.@]
    136150 */
    137151LPSTR WINAPI StrStrA(LPCSTR lpFirst, LPCSTR lpSrch)
     
    148162
    149163/*************************************************************************
    150  * StrStrW                                      [SHLWAPI]
     164 * StrStrW                                      [SHLWAPI.@]
    151165 */
    152166LPWSTR WINAPI StrStrW(LPCWSTR lpFirst, LPCWSTR lpSrch)
     
    163177
    164178/*************************************************************************
    165  * StrStrIA                                     [SHLWAPI]
     179 * StrStrIA                                     [SHLWAPI.@]
    166180 */
    167181LPSTR WINAPI StrStrIA(LPCSTR lpFirst, LPCSTR lpSrch)
     
    178192
    179193/*************************************************************************
    180  * StrStrIW                                     [SHLWAPI]
     194 * StrStrIW                                     [SHLWAPI.@]
    181195 */
    182196LPWSTR WINAPI StrStrIW(LPCWSTR lpFirst, LPCWSTR lpSrch)
     
    193207
    194208/*************************************************************************
    195  *      StrToIntA                       [SHLWAPI]
     209 *      StrToIntA                       [SHLWAPI.@]
    196210 */
    197211int WINAPI StrToIntA(LPCSTR lpSrc)
     
    202216
    203217/*************************************************************************
    204  *      StrToIntW                       [SHLWAPI]
     218 *      StrToIntW                       [SHLWAPI.@]
    205219 */
    206220int WINAPI StrToIntW(LPCWSTR lpSrc)
     
    215229
    216230/*************************************************************************
    217  *      StrToIntExA                     [SHLWAPI]
     231 *      StrToIntExA                     [SHLWAPI.@]
    218232 */
    219233BOOL WINAPI StrToIntExA( LPCSTR pszString, DWORD dwFlags, LPINT piRet)
     
    225239
    226240/*************************************************************************
    227  *      StrToIntExW                     [SHLWAPI]
     241 *      StrToIntExW                     [SHLWAPI.@]
    228242 */
    229243BOOL WINAPI StrToIntExW( LPCWSTR pszString, DWORD dwFlags, LPINT piRet)
     
    235249
    236250/*************************************************************************
    237  *      StrDupA                 [SHLWAPI]
     251 *      StrDupA                 [SHLWAPI.@]
    238252 */
    239253LPSTR WINAPI StrDupA (LPCSTR lpSrc)
     
    249263
    250264/*************************************************************************
    251  *      StrDupW                 [SHLWAPI]
     265 *      StrDupW                 [SHLWAPI.@]
    252266 */
    253267LPWSTR WINAPI StrDupW (LPCWSTR lpSrc)
     
    263277
    264278/*************************************************************************
    265  *      StrCSpnA                [SHLWAPI]
     279 *      StrCSpnA                [SHLWAPI.@]
    266280 */
    267281int WINAPI StrCSpnA (LPCSTR lpStr, LPCSTR lpSet)
     
    287301
    288302/*************************************************************************
    289  *      StrCSpnW                [SHLWAPI]
     303 *      StrCSpnW                [SHLWAPI.@]
    290304 */
    291305int WINAPI StrCSpnW (LPCWSTR lpStr, LPCWSTR lpSet)
     
    320334
    321335    TRACE("(%p, %p, %x)\n", lpStart, lpEnd, wMatch);
    322 
     336    if (!lpStart && !lpEnd) return NULL;
    323337    if (!lpEnd) lpEnd = lpStart + strlen(lpStart);
    324338
     
    342356
    343357    TRACE("(%p, %p, %x)\n", lpStart, lpEnd, wMatch);
     358    if (!lpStart && !lpEnd) return NULL;
    344359    if (!lpEnd) lpEnd = lpStart + strlenW(lpStart);
    345360
     
    351366
    352367
    353 /*************************************************************************
    354  *      StrCatBuffA             [SHLWAPI]
     368/**************************************************************************
     369 * StrRChrIA [SHLWAPI.@]
     370 *
     371 */
     372LPSTR WINAPI StrRChrIA( LPCSTR lpStart, LPCSTR lpEnd, WORD wMatch )
     373{
     374    LPCSTR lpGotIt = NULL;
     375    BOOL dbcs = IsDBCSLeadByte( LOBYTE(wMatch) );
     376
     377    TRACE("(%p, %p, %x)\n", lpStart, lpEnd, wMatch);
     378    if (!lpStart && !lpEnd) return NULL;
     379    if (!lpEnd) lpEnd = lpStart + strlen(lpStart);
     380
     381    for(; lpStart < lpEnd; lpStart = CharNextA(lpStart))
     382    {
     383        if (dbcs) {
     384            /*
     385            if (_mbctoupper(*lpStart) == _mbctoupper(wMatch))
     386                lpGotIt = lpStart;
     387            */
     388            if (toupper(*lpStart) == toupper(wMatch)) lpGotIt = lpStart;
     389        } else {
     390            if (toupper(*lpStart) == toupper(wMatch)) lpGotIt = lpStart;
     391        }
     392    }   
     393    return (LPSTR)lpGotIt;
     394}
     395
     396
     397/**************************************************************************
     398 * StrRChrIW [SHLWAPI.@]
     399 *
     400 */
     401LPWSTR WINAPI StrRChrIW( LPCWSTR lpStart, LPCWSTR lpEnd, WORD wMatch)
     402{
     403    LPCWSTR lpGotIt = NULL;
     404
     405    TRACE("(%p, %p, %x)\n", lpStart, lpEnd, wMatch);
     406    if (!lpStart && !lpEnd) return NULL;
     407    if (!lpEnd) lpEnd = lpStart + strlenW(lpStart);
     408
     409    for(; lpStart < lpEnd; lpStart = CharNextW(lpStart))
     410        if (toupperW(*lpStart) == toupperW(wMatch)) lpGotIt = lpStart;
     411
     412    return (LPWSTR)lpGotIt;
     413}
     414
     415
     416/*************************************************************************
     417 *      StrCatBuffA             [SHLWAPI.@]
    355418 *
    356419 * Appends back onto front, stopping when front is size-1 characters long.
     
    370433
    371434/*************************************************************************
    372  *      StrCatBuffW             [SHLWAPI]
     435 *      StrCatBuffW             [SHLWAPI.@]
    373436 *
    374437 * Appends back onto front, stopping when front is size-1 characters long.
     
    394457 * NOTES
    395458 *  the pidl is for STRRET OFFSET
     459 *
     460 * ***** NOTE *****
     461 *  This routine is identical to StrRetToStrNA in dlls/shell32/shellstring.c.
     462 *  It was duplicated there because not every version of Shlwapi.dll exports
     463 *  StrRetToBufA. If you change one routine, change them both. YOU HAVE BEEN
     464 *  WARNED.
     465 * ***** NOTE *****
    396466 */
    397467HRESULT WINAPI StrRetToBufA (LPSTRRET src, const ITEMIDLIST *pidl, LPSTR dest, DWORD len)
    398468{
    399         TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest,len,src,pidl);
     469        TRACE("dest=%p len=0x%lx strret=%p pidl=%p stub\n",dest,len,src,pidl);
    400470
    401471        switch (src->uType)
     
    432502 * NOTES
    433503 *  the pidl is for STRRET OFFSET
     504 *
     505 * ***** NOTE *****
     506 *  This routine is identical to StrRetToStrNW in dlls/shell32/shellstring.c.
     507 *  It was duplicated there because not every version of Shlwapi.dll exports
     508 *  StrRetToBufW. If you change one routine, change them both. YOU HAVE BEEN
     509 *  WARNED.
     510 * ***** NOTE *****
    434511 */
    435512HRESULT WINAPI StrRetToBufW (LPSTRRET src, const ITEMIDLIST *pidl, LPWSTR dest, DWORD len)
    436513{
    437         TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest,len,src,pidl);
     514        TRACE("dest=%p len=0x%lx strret=%p pidl=%p stub\n",dest,len,src,pidl);
    438515
    439516        switch (src->uType)
     
    469546
    470547/*************************************************************************
    471  * StrFormatByteSizeA                           [SHLWAPI]
     548 * StrFormatByteSizeA                           [SHLWAPI.@]
    472549 */
    473550LPSTR WINAPI StrFormatByteSizeA ( DWORD dw, LPSTR pszBuf, UINT cchBuf )
     
    491568
    492569/*************************************************************************
    493  * StrFormatByteSizeW                           [SHLWAPI]
     570 * StrFormatByteSizeW                           [SHLWAPI.@]
    494571 */
    495572LPWSTR WINAPI StrFormatByteSizeW ( DWORD dw, LPWSTR pszBuf, UINT cchBuf )
     
    503580
    504581/*************************************************************************
    505  *      StrNCatA        [SHLWAPI]
     582 *      StrNCatA        [SHLWAPI.@]
    506583 */
    507584LPSTR WINAPI StrNCatA(LPSTR front, LPCSTR back, INT cchMax)
     
    512589
    513590/*************************************************************************
    514  *      StrNCatW        [SHLWAPI]
     591 *      StrNCatW        [SHLWAPI.@]
    515592 */
    516593LPWSTR WINAPI StrNCatW(LPWSTR front, LPCWSTR back, INT cchMax)
     
    546623
    547624/*************************************************************************
    548  *      wnsprintfA      [SHLWAPI]
     625 *      wnsprintfA      [SHLWAPI.@]
    549626 */
    550627int WINAPIV wnsprintfA(LPSTR lpOut, int cchLimitIn, LPCSTR lpFmt, ...)
     
    560637
    561638/*************************************************************************
    562  *      wnsprintfW      [SHLWAPI]
     639 *      wnsprintfW      [SHLWAPI.@]
    563640 */
    564641int WINAPIV wnsprintfW(LPWSTR lpOut, int cchLimitIn, LPCWSTR lpFmt, ...)
Note: See TracChangeset for help on using the changeset viewer.