Ignore:
Timestamp:
Jan 20, 2006 9:03:36 PM (18 years ago)
Author:
bennylp
Message:

Completed testing for WinCE port

File:
1 moved

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/src/pj/unicode_win32.c

    r125 r126  
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  
    1818 */ 
    19 #include <pj/compat/unicode.h> 
     19#include <pj/unicode.h> 
    2020#include <pj/assert.h> 
    2121#include <pj/string.h> 
     
    2323 
    2424 
    25 PJ_DEF(wchar_t*) pj_ansi_to_unicode(const char *s, wchar_t *buf, 
    26                                     pj_size_t buf_count) 
     25PJ_DEF(wchar_t*) pj_ansi_to_unicode(const char *s, pj_size_t len, 
     26                                    wchar_t *buf, pj_size_t buf_count) 
    2727{ 
    28     int len; 
     28    PJ_ASSERT_RETURN(s && buf, NULL); 
    2929 
    30     PJ_ASSERT_RETURN(s, NULL); 
    31  
    32     len = MultiByteToWideChar(CP_ACP, 0, s, strlen(s),  
     30    len = MultiByteToWideChar(CP_ACP, 0, s, len,  
    3331                              buf, buf_count); 
    34     if (!len) 
    35         return NULL; 
    36  
     32    buf[len] = 0; 
    3733    return buf; 
    3834} 
     35 
     36 
     37PJ_DEF(char*) pj_unicode_to_ansi( const wchar_t *wstr, pj_size_t len, 
     38                                  char *buf, pj_size_t buf_size) 
     39{ 
     40    PJ_ASSERT_RETURN(wstr && buf, NULL); 
     41 
     42    len = WideCharToMultiByte(CP_ACP, 0, wstr, len, buf, buf_size, NULL, NULL); 
     43    buf[len] = '\0'; 
     44    return buf; 
     45} 
     46 
Note: See TracChangeset for help on using the changeset viewer.