Ignore:
Timestamp:
Dec 1, 2003, 2:13:26 PM (22 years ago)
Author:
sandervl
Message:

KOM: wvsnprintfA/W: fixed ascii and unicode conversion

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/wsprintf.cpp

    r6707 r10348  
    1212
    1313#include <misc.h>
     14
     15#include <winnls.h>
    1416
    1517#define DBG_LOCALLOG    DBG_wsprintf
     
    373375    WPRINTF_DATA argData;
    374376
     377#ifdef __WIN32OS2__
     378    TRACE("wvsnprintfA : %p %u %s\n", buffer, maxlen, debugstr_a(spec));
     379#else
    375380    TRACE("%p %u %s\n", buffer, maxlen, debugstr_a(spec));
     381#endif
    376382
    377383    while (*spec && (maxlen > 1))
     
    413419        {
    414420        case WPR_WCHAR:
     421#ifdef __WIN32OS2__
     422            i = WideCharToMultiByte( CP_ACP, 0, &argData.wchar_view, 1, p, maxlen, 0, NULL );
     423            if( i )
     424            {
     425                p += i - 1;
     426                len = i;
     427            }
     428#else
    415429            *p = argData.wchar_view;
     430#endif
    416431            if (*p != '\0') p++;
    417432            else if (format.width > 1) *p++ = ' ';
     
    431446            {
    432447                LPCWSTR ptr = argData.lpcwstr_view;
     448#ifdef __WIN32OS2__
     449                i = WideCharToMultiByte( CP_ACP, 0, ptr, len, p, maxlen, 0, 0 );
     450                if( i )
     451                {
     452                    p += i;
     453                    len = i;
     454                }
     455#else
    433456                for (i = 0; i < len; i++) *p++ = (CHAR)*ptr++;
     457#endif
    434458            }
    435459            break;
     
    458482    }
    459483    *p = 0;
     484#ifdef __WIN32OS2__
     485    TRACE("%s\n",buffer);
     486#else
    460487    TRACE("%s\n",debugstr_a(buffer));
     488#endif
    461489    return (maxlen > 1) ? (INT)(p - buffer) : -1;
    462490}
     
    474502    WPRINTF_DATA argData;
    475503
    476     TRACE("%p %u %s\n", buffer, maxlen, debugstr_w(spec));
     504    TRACE("wvsnprintfW : %p %u %s\n", buffer, maxlen, debugstr_w(spec));
    477505
    478506    while (*spec && (maxlen > 1))
     
    520548            break;
    521549        case WPR_CHAR:
     550#ifdef __WIN32OS2__
     551            MultiByteToWideChar( CP_ACP, 0, &argData.char_view, 1, p, maxlen );
     552#else
    522553            *p = argData.char_view;
     554#endif
    523555            if (*p != '\0') p++;
    524556            else if (format.width > 1) *p++ = ' ';
     
    528560            {
    529561                LPCSTR ptr = argData.lpcstr_view;
     562#ifdef __WIN32OS2__
     563                i = MultiByteToWideChar( CP_ACP, 0, ptr, len, p, maxlen );
     564                if( i )
     565                {
     566                    p += i;
     567                    len = i;
     568                }
     569#else
    530570                for (i = 0; i < len; i++) *p++ = (WCHAR)*ptr++;
     571#endif
    531572            }
    532573            break;
Note: See TracChangeset for help on using the changeset viewer.