Changeset 126 for pjproject/trunk/pjlib/src/pj/unicode_win32.c
- Timestamp:
- Jan 20, 2006 9:03:36 PM (18 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/src/pj/unicode_win32.c
r125 r126 17 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 18 */ 19 #include <pj/ compat/unicode.h>19 #include <pj/unicode.h> 20 20 #include <pj/assert.h> 21 21 #include <pj/string.h> … … 23 23 24 24 25 PJ_DEF(wchar_t*) pj_ansi_to_unicode(const char *s, wchar_t *buf,26 pj_size_t buf_count)25 PJ_DEF(wchar_t*) pj_ansi_to_unicode(const char *s, pj_size_t len, 26 wchar_t *buf, pj_size_t buf_count) 27 27 { 28 int len;28 PJ_ASSERT_RETURN(s && buf, NULL); 29 29 30 PJ_ASSERT_RETURN(s, NULL); 31 32 len = MultiByteToWideChar(CP_ACP, 0, s, strlen(s), 30 len = MultiByteToWideChar(CP_ACP, 0, s, len, 33 31 buf, buf_count); 34 if (!len) 35 return NULL; 36 32 buf[len] = 0; 37 33 return buf; 38 34 } 35 36 37 PJ_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.