Changeset 6712 for trunk/src/avifil32/string.c
- Timestamp:
- Sep 15, 2001, 11:47:44 AM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/avifil32/string.c
r6652 r6712 1 /* $Id: string.c,v 1.2 2001-09-05 14:16:46 bird Exp $ */2 1 /* 3 2 * Copyright 2001 Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp> … … 25 24 INT AVIFILE_strlenAtoW( LPCSTR lpstr ) 26 25 { 27 INTlen;26 INT len; 28 27 29 30 28 len = MultiByteToWideChar( CP_ACP, 0, lpstr, -1, NULL, 0 ); 29 return ( len > 0 ) ? (len-1) : 0; 31 30 } 32 31 33 32 INT AVIFILE_strlenWtoA( LPCWSTR lpwstr ) 34 33 { 35 INTlen;34 INT len; 36 35 37 38 39 36 len = WideCharToMultiByte( CP_ACP, 0, lpwstr, -1, 37 NULL, 0, NULL, NULL ); 38 return ( len > 0 ) ? (len-1) : 0; 40 39 } 41 40 42 41 LPWSTR AVIFILE_strncpyAtoW( LPWSTR lpwstr, LPCSTR lpstr, INT wbuflen ) 43 42 { 44 INTlen;43 INT len; 45 44 46 47 48 49 45 len = MultiByteToWideChar( CP_ACP, 0, lpstr, -1, lpwstr, wbuflen ); 46 if ( len == 0 ) 47 *lpwstr = 0; 48 return lpwstr; 50 49 } 51 50 52 51 LPSTR AVIFILE_strncpyWtoA( LPSTR lpstr, LPCWSTR lpwstr, INT abuflen ) 53 52 { 54 INTlen;53 INT len; 55 54 56 57 58 59 60 55 len = WideCharToMultiByte( CP_ACP, 0, lpwstr, -1, 56 lpstr, abuflen, NULL, NULL ); 57 if ( len == 0 ) 58 *lpstr = 0; 59 return lpstr; 61 60 } 62 61 63 62 LPWSTR AVIFILE_strdupAtoW( LPCSTR lpstr ) 64 63 { 65 66 64 INT len; 65 LPWSTR lpwstr = NULL; 67 66 68 69 70 71 72 73 74 67 len = AVIFILE_strlenAtoW( lpstr ); 68 if ( len > 0 ) 69 { 70 lpwstr = (LPWSTR)HeapAlloc( AVIFILE_data.hHeap, 0, sizeof(WCHAR)*(len+1) ); 71 if ( lpwstr != NULL ) 72 (void)AVIFILE_strncpyAtoW( lpwstr, lpstr, len+1 ); 73 } 75 74 76 75 return lpwstr; 77 76 } 78 77 79 78 LPSTR AVIFILE_strdupWtoA( LPCWSTR lpwstr ) 80 79 { 81 82 80 INT len; 81 LPSTR lpstr = NULL; 83 82 84 85 86 87 88 89 90 83 len = AVIFILE_strlenWtoA( lpwstr ); 84 if ( len > 0 ) 85 { 86 lpstr = (LPSTR)HeapAlloc( AVIFILE_data.hHeap, 0, sizeof(CHAR)*(len+1) ); 87 if ( lpstr != NULL ) 88 (void)AVIFILE_strncpyWtoA( lpstr, lpwstr, len+1 ); 89 } 91 90 92 91 return lpstr; 93 92 } 94 93
Note:
See TracChangeset
for help on using the changeset viewer.