summaryrefslogtreecommitdiffstats
path: root/src/codecs/tqtextcodec.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/codecs/tqtextcodec.cpp')
-rw-r--r--src/codecs/tqtextcodec.cpp61
1 files changed, 0 insertions, 61 deletions
diff --git a/src/codecs/tqtextcodec.cpp b/src/codecs/tqtextcodec.cpp
index cf7c6b93d..0609ae294 100644
--- a/src/codecs/tqtextcodec.cpp
+++ b/src/codecs/tqtextcodec.cpp
@@ -1686,16 +1686,9 @@ private:
void buildReverseMap();
int forwardIndex;
-#ifndef TQ_WS_QWS
TQMemArray<unsigned char> *reverseMap;
-#endif
};
-#ifdef TQ_WS_QWS
-static const TQSimpleTextCodec * reverseOwner = 0;
-static TQMemArray<unsigned char> * reverseMap = 0;
-#endif
-
#define LAST_MIB 2004
static const struct {
@@ -2264,54 +2257,17 @@ static const struct {
TQSimpleTextCodec::TQSimpleTextCodec( int i )
: TQTextCodec(), forwardIndex( i )
{
-#ifndef TQ_WS_QWS
reverseMap = 0;
-#endif
}
TQSimpleTextCodec::~TQSimpleTextCodec()
{
-#ifndef TQ_WS_QWS
delete reverseMap;
-#else
- if ( reverseOwner == this ) {
- delete reverseMap;
- reverseMap = 0;
- reverseOwner = 0;
- }
-#endif
}
void TQSimpleTextCodec::buildReverseMap()
{
-#ifdef TQ_WS_QWS
- if ( reverseOwner != this ) {
- int m = 0;
- int i = 0;
- while( i < 128 ) {
- if ( unicodevalues[forwardIndex].values[i] > m &&
- unicodevalues[forwardIndex].values[i] < 0xfffd )
- m = unicodevalues[forwardIndex].values[i];
- i++;
- }
- m++;
- if ( !reverseMap )
- reverseMap = new TQMemArray<unsigned char>( m );
- if ( m > (int)(reverseMap->size()) )
- reverseMap->resize( m );
- for( i = 0; i < 128 && i < m; i++ )
- (*reverseMap)[i] = (char)i;
- for( ;i < m; i++ )
- (*reverseMap)[i] = 0;
- for( i=128; i<256; i++ ) {
- int u = unicodevalues[forwardIndex].values[i-128];
- if ( u < m )
- (*reverseMap)[u] = (char)(unsigned char)(i);
- }
- reverseOwner = this;
- }
-#else
if ( !reverseMap ) {
TQMemArray<unsigned char> **map = &((TQSimpleTextCodec *)this)->reverseMap;
int m = 0;
@@ -2334,7 +2290,6 @@ void TQSimpleTextCodec::buildReverseMap()
(**map)[u] = (char)(unsigned char)(i);
}
}
-#endif
}
TQString TQSimpleTextCodec::toUnicode(const char* chars, int len) const
@@ -2367,11 +2322,7 @@ TQString TQSimpleTextCodec::toUnicode(const char* chars, int len) const
TQCString TQSimpleTextCodec::fromUnicode(const TQString& uc, int& len ) const
{
-#ifdef TQ_WS_QWS
- if ( this != reverseOwner )
-#else
if ( !reverseMap )
-#endif
((TQSimpleTextCodec *)this)->buildReverseMap();
if ( len <0 || len > (int)uc.length() )
@@ -2397,11 +2348,7 @@ TQCString TQSimpleTextCodec::fromUnicode(const TQString& uc, int& len ) const
void TQSimpleTextCodec::fromUnicode( const TQChar *in, unsigned short *out, int length ) const
{
-#ifdef TQ_WS_QWS
- if ( this != reverseOwner )
-#else
if ( !reverseMap )
-#endif
((TQSimpleTextCodec *)this)->buildReverseMap();
unsigned char* rmp = reverseMap->data();
@@ -2416,11 +2363,7 @@ void TQSimpleTextCodec::fromUnicode( const TQChar *in, unsigned short *out, int
unsigned short TQSimpleTextCodec::characterFromUnicode(const TQString &str, int pos) const
{
-#ifdef TQ_WS_QWS
- if ( this != reverseOwner )
-#else
if ( !reverseMap )
-#endif
((TQSimpleTextCodec *)this)->buildReverseMap();
unsigned short u = str[pos].unicode();
@@ -2431,11 +2374,7 @@ unsigned short TQSimpleTextCodec::characterFromUnicode(const TQString &str, int
bool TQSimpleTextCodec::canEncode( TQChar ch ) const
{
-#ifdef TQ_WS_QWS
- if ( this != reverseOwner )
-#else
if ( !reverseMap )
-#endif
((TQSimpleTextCodec *)this)->buildReverseMap();
unsigned short u = ch.unicode();