diff options
author | George Hazan <george.hazan@gmail.com> | 2012-06-26 16:50:14 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-06-26 16:50:14 +0000 |
commit | c992cb2fdc11f1cac4bc5cbce26e8e2bb3b57da0 (patch) | |
tree | 697bdbf38a8a1f6b828a8bfbd08a478e19a82c6b /plugins/helpers | |
parent | f616294363c642d138f9dc0ef6eceae639e2434c (diff) |
- microkernel addded;
- version bumped to 0.92.2
git-svn-id: http://svn.miranda-ng.org/main/trunk@641 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/helpers')
-rw-r--r-- | plugins/helpers/gen_helpers.cpp | 134 | ||||
-rw-r--r-- | plugins/helpers/gen_helpers.h | 4 |
2 files changed, 0 insertions, 138 deletions
diff --git a/plugins/helpers/gen_helpers.cpp b/plugins/helpers/gen_helpers.cpp index a792493284..87dd135c6f 100644 --- a/plugins/helpers/gen_helpers.cpp +++ b/plugins/helpers/gen_helpers.cpp @@ -267,140 +267,6 @@ TCHAR *itot(int num) { }
-/////////////////////////////////////////////////////////////////////////////////////////
-// Utf8Decode - converts UTF8-encoded string to the UCS2/MBCS format
-
-void Utf8Decode( char* str, wchar_t** ucs2 )
-{
- if ( str == NULL )
- return;
-
- size_t len = strlen( str );
- if ( len < 2 ) {
- if ( ucs2 != NULL ) {
- *ucs2 = ( wchar_t* )malloc(( len+1 )*sizeof( wchar_t ));
- MultiByteToWideChar( CP_ACP, 0, str, len, *ucs2, len );
- ( *ucs2 )[ len ] = 0;
- }
- return;
- }
-
- wchar_t* tempBuf = ( wchar_t* )alloca(( len+1 )*sizeof( wchar_t ));
- {
- wchar_t* d = tempBuf;
- BYTE* s = ( BYTE* )str;
-
- while( *s )
- {
- if (( *s & 0x80 ) == 0 ) {
- *d++ = *s++;
- continue;
- }
-
- if (( s[0] & 0xE0 ) == 0xE0 && ( s[1] & 0xC0 ) == 0x80 && ( s[2] & 0xC0 ) == 0x80 ) {
- *d++ = (( WORD )( s[0] & 0x0F) << 12 ) + ( WORD )(( s[1] & 0x3F ) << 6 ) + ( WORD )( s[2] & 0x3F );
- s += 3;
- continue;
- }
-
- if (( s[0] & 0xE0 ) == 0xC0 && ( s[1] & 0xC0 ) == 0x80 ) {
- *d++ = ( WORD )(( s[0] & 0x1F ) << 6 ) + ( WORD )( s[1] & 0x3F );
- s += 2;
- continue;
- }
-
- *d++ = *s++;
- }
-
- *d = 0;
- }
-
- if ( ucs2 != NULL ) {
- int fullLen = ( len+1 )*sizeof( wchar_t );
- *ucs2 = ( wchar_t* )malloc( fullLen );
- memcpy( *ucs2, tempBuf, fullLen );
- }
-
- WideCharToMultiByte( CP_ACP, 0, tempBuf, -1, str, len, NULL, NULL );
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// Utf8Encode - converts MBCS string to the UTF8-encoded format
-
-char* Utf8Encode( const char* src )
-{
- if ( src == NULL )
- return NULL;
-
- size_t len = strlen( src );
- char* result = ( char* )malloc( len*3 + 1 );
- if ( result == NULL )
- return NULL;
-
- wchar_t* tempBuf = ( wchar_t* )alloca(( len+1 )*sizeof( wchar_t ));
- MultiByteToWideChar( CP_ACP, 0, src, -1, tempBuf, len );
- tempBuf[ len ] = 0;
- {
- wchar_t* s = tempBuf;
- BYTE* d = ( BYTE* )result;
-
- while( *s ) {
- int U = *s++;
-
- if ( U < 0x80 ) {
- *d++ = ( BYTE )U;
- }
- else if ( U < 0x800 ) {
- *d++ = 0xC0 + (( U >> 6 ) & 0x3F );
- *d++ = 0x80 + ( U & 0x003F );
- }
- else {
- *d++ = 0xE0 + ( U >> 12 );
- *d++ = 0x80 + (( U >> 6 ) & 0x3F );
- *d++ = 0x80 + ( U & 0x3F );
- } }
-
- *d = 0;
- }
-
- return result;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// Utf8Encode - converts UCS2 string to the UTF8-encoded format
-
-char* Utf8EncodeUcs2( const wchar_t* src )
-{
- int len = wcslen( src );
- char* result = ( char* )malloc( len*3 + 1 );
- if ( result == NULL )
- return NULL;
-
- { const wchar_t* s = src;
- BYTE* d = ( BYTE* )result;
-
- while( *s ) {
- int U = *s++;
-
- if ( U < 0x80 ) {
- *d++ = ( BYTE )U;
- }
- else if ( U < 0x800 ) {
- *d++ = 0xC0 + (( U >> 6 ) & 0x3F );
- *d++ = 0x80 + ( U & 0x003F );
- }
- else {
- *d++ = 0xE0 + ( U >> 12 );
- *d++ = 0x80 + (( U >> 6 ) & 0x3F );
- *d++ = 0x80 + ( U & 0x3F );
- } }
-
- *d = 0;
- }
-
- return result;
-}
-
// Helper functions that need MODULENAME
#define SETTING_NOENCODINGCHECK "NoEncodingCheck"
diff --git a/plugins/helpers/gen_helpers.h b/plugins/helpers/gen_helpers.h index 8f4d91b940..110ea9d30a 100644 --- a/plugins/helpers/gen_helpers.h +++ b/plugins/helpers/gen_helpers.h @@ -33,10 +33,6 @@ wchar_t* a2u( char* src ); int ttoi(TCHAR *string);
TCHAR *itot(int num);
-char* Utf8EncodeUcs2( const wchar_t* src );
-char* Utf8Encode( const char* src );
-void Utf8Decode( char* str, wchar_t** ucs2 );
-
#define MAX_DEBUG 1024
#define __LOGLEVEL_DEBUG 10
|