Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37787564
en ru br
Репозитории ALT
S:3.3.8d-alt16.1
5.1: 3.3.8b-alt7
4.1: 3.3.8b-alt2.qa1
4.0: 3.3.8b-alt0.M40.1
3.0: 3.3.4-alt6
+updates:3.3.4-alt6.3.M30
www.altlinux.org/Changes

Группа :: Система/Библиотеки
Пакет: qt3

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: 9005-qt-x11-free-3.3.3-codecs.patch
Скачать


diff -Naur qt-x11-free-3.3.3.orig/src/codecs/qbig5codec.cpp qt-x11-free-3.3.3/src/codecs/qbig5codec.cpp
--- qt-x11-free-3.3.3.orig/src/codecs/qbig5codec.cpp	2004-08-05 18:42:01 +0400
+++ qt-x11-free-3.3.3/src/codecs/qbig5codec.cpp	2004-12-30 12:27:59 +0300
@@ -141,6 +141,11 @@
     {
 	//qDebug("QBig5Decoder::toUnicode(const char* chars = \"%s\", int len = %d)", chars, len);
 	QString result;
+	if (!chars) return QString::null;
+	if (chars && (chars[0]=='\0' || len==0)) {
+	    result.setLength(0);
+	    return result;
+	}
 	for (int i=0; i<len; i++) {
 	    uchar ch = chars[i];
 	    switch (nbuf) {
@@ -226,6 +231,11 @@
 {
     //qDebug("QBig5Codec::toUnicode(const char* chars \"%s\", int len = %d)", chars, len);
     QString result;
+    if (!chars) return QString::null;
+    if (chars && (chars[0]=='\0' || len==0)) {
+        result.setLength(0);
+	return result;
+    }
     for (int i=0; i<len; i++) {
 	uchar ch = chars[i];
 	if ( IsLatin(ch) ) {
@@ -427,6 +437,11 @@
     {
 	//qDebug("QBig5hkscsDecoder::toUnicode(const char* chars = \"%s\", int len = %d)", chars, len);
 	QString result;
+	if (!chars) return QString::null;
+	if (chars && (chars[0]=='\0' || len==0)) {
+	    result.setLength(0);
+	    return result;
+	}
 	for (int i=0; i<len; i++) {
 	    uchar ch = chars[i];
 	    switch (nbuf) {
@@ -509,6 +524,11 @@
 {
     //qDebug("QBig5hkscsCodec::toUnicode(const char* chars = \"%s\", int len = %d)", chars, len);
     QString result;
+    if (!chars) return QString::null;
+    if (chars && (chars[0]=='\0' || len==0)) {
+        result.setLength(0);
+        return result;
+    }
     for (int i=0; i<len; i++) {
 	uchar ch = chars[i];
 	if ( IsLatin(ch) ) {
diff -Naur qt-x11-free-3.3.3.orig/src/codecs/qeucjpcodec.cpp qt-x11-free-3.3.3/src/codecs/qeucjpcodec.cpp
--- qt-x11-free-3.3.3.orig/src/codecs/qeucjpcodec.cpp	2004-08-05 18:42:01 +0400
+++ qt-x11-free-3.3.3/src/codecs/qeucjpcodec.cpp	2004-12-30 12:27:59 +0300
@@ -213,6 +213,11 @@
 QString QEucJpCodec::toUnicode(const char* chars, int len) const
 {
     QString result;
+    if (!chars) return QString::null;
+    if (chars && (chars[0]=='\0' || len==0)) {
+        result.setLength(0);
+        return result;
+    }
     for (int i=0; i<len; i++) {
 	uchar ch = chars[i];
 	if ( ch < 0x80 ) {
@@ -404,6 +409,11 @@
     QString toUnicode(const char* chars, int len)
     {
 	QString result;
+	if (!chars) return QString::null;
+	if (chars && (chars[0]=='\0' || len==0)) {
+	    result.setLength(0);
+	    return result;
+	}
 	for (int i=0; i<len; i++) {
 	    uchar ch = chars[i];
 	    switch (nbuf) {
diff -Naur qt-x11-free-3.3.3.orig/src/codecs/qeuckrcodec.cpp qt-x11-free-3.3.3/src/codecs/qeuckrcodec.cpp
--- qt-x11-free-3.3.3.orig/src/codecs/qeuckrcodec.cpp	2004-08-05 18:42:01 +0400
+++ qt-x11-free-3.3.3/src/codecs/qeuckrcodec.cpp	2004-12-30 12:27:59 +0300
@@ -155,6 +155,11 @@
 QString QEucKrCodec::toUnicode(const char* chars, int len) const
 {
     QString result;
+    if (!chars) return QString::null;
+    if (chars && (chars[0]=='\0' || len==0)) {
+        result.setLength(0);
+        return result;
+    }
     for (int i=0; i<len; i++) {
 	uchar ch = chars[i];
 	if (ch == 0)
@@ -286,6 +291,11 @@
     QString toUnicode(const char* chars, int len)
     {
 	QString result;
+	if (!chars) return QString::null;
+	if (chars && (chars[0]=='\0' || len==0)) {
+	    result.setLength(0);
+	    return result;
+	}
 	for (int i=0; i<len; i++) {
 	    uchar ch = chars[i];
 	    if (ch == 0)
diff -Naur qt-x11-free-3.3.3.orig/src/codecs/qgb18030codec.cpp qt-x11-free-3.3.3/src/codecs/qgb18030codec.cpp
--- qt-x11-free-3.3.3.orig/src/codecs/qgb18030codec.cpp	2004-05-16 19:44:11 +0400
+++ qt-x11-free-3.3.3/src/codecs/qgb18030codec.cpp	2004-12-30 12:27:59 +0300
@@ -225,6 +225,11 @@
 QString QGb18030Codec::toUnicode(const char* chars, int len) const
 {
     QString result;
+    if (!chars) return QString::null;
+    if (chars && (chars[0]=='\0' || len==0)) {
+        result.setLength(0);
+        return result;
+    }
     int clen;
 
     //qDebug("QGb18030Codec::toUnicode(const char* chars, int len = %d)", len);
@@ -347,6 +352,11 @@
     QString toUnicode(const char* chars, int len)
     {
 	QString result;
+	if (!chars) return QString::null;
+	if (chars && (chars[0]=='\0' || len==0)) {
+	    result.setLength(0);
+	    return result;
+	}
 	//qDebug("QGb18030Decoder::toUnicode(const char* chars, int len = %d)", len);
 	for (int i=0; i<len; i++) {
 	    uchar ch = chars[i];
@@ -521,6 +531,11 @@
     QString toUnicode(const char* chars, int len)
     {
 	QString result;
+	if (!chars) return QString::null;
+	if (chars && (chars[0]=='\0' || len==0)) {
+	    result.setLength(0);
+	    return result;
+	}
 
 	//qDebug("QGbkDecoder::toUnicode(const char* chars = \"%s\", int len = %d)", chars, len);
 	for (int i=0; i<len; i++) {
@@ -604,6 +619,11 @@
 QString QGbkCodec::toUnicode(const char* chars, int len) const
 {
     QString result;
+    if (!chars) return QString::null;
+    if (chars && (chars[0]=='\0' || len==0)) {
+        result.setLength(0);
+	return result;
+    }
     int clen;
 
     //qDebug("QGbkCodec::toUnicode(const char* chars, int len = %d)", len);
@@ -721,6 +741,11 @@
     QString toUnicode(const char* chars, int len)
     {
 	QString result;
+	if (!chars) return QString::null;
+	if (chars && (chars[0]=='\0' || len==0)) {
+	    result.setLength(0);
+	    return result;
+	}
 	//qDebug("QGb2312Decoder::toUnicode(const char* chars, int len = %d)", len);
 	for (int i=0; i<len; i++) {
 	    uchar ch = chars[i];
@@ -804,6 +829,11 @@
 QString QGb2312Codec::toUnicode(const char* chars, int len) const
 {
     QString result;
+    if (!chars) return QString::null;
+    if (chars && (chars[0]=='\0' || len==0)) {
+        result.setLength(0);
+        return result;
+    }
     int clen;
 
     //qDebug("QGb2312Codec::toUnicode(const char* chars, int len = %d)", len);
diff -Naur qt-x11-free-3.3.3.orig/src/codecs/qjiscodec.cpp qt-x11-free-3.3.3/src/codecs/qjiscodec.cpp
--- qt-x11-free-3.3.3.orig/src/codecs/qjiscodec.cpp	2004-08-05 18:42:01 +0400
+++ qt-x11-free-3.3.3/src/codecs/qjiscodec.cpp	2004-12-30 12:27:59 +0300
@@ -261,6 +261,11 @@
 QString QJisCodec::toUnicode(const char* chars, int len) const
 {
     QString result;
+    if (!chars) return QString::null;
+    if (chars && (chars[0]=='\0' || len==0)) {
+        result.setLength(0);
+	return result;
+    }
     Iso2022State state = Ascii, prev = Ascii;
     for (int i=0; i<len; i++) {
 	uchar ch = chars[i];
@@ -562,6 +567,11 @@
     QString toUnicode(const char* chars, int len)
     {
 	QString result;
+	if (!chars) return QString::null;
+	if (chars && (chars[0]=='\0' || len==0)) {
+	    result.setLength(0);
+	    return result;
+	}
 	for (int i=0; i<len; i++) {
 	    uchar ch = chars[i];
 	    if (esc) {
diff -Naur qt-x11-free-3.3.3.orig/src/codecs/qrtlcodec.cpp qt-x11-free-3.3.3/src/codecs/qrtlcodec.cpp
--- qt-x11-free-3.3.3.orig/src/codecs/qrtlcodec.cpp	2004-08-05 18:42:01 +0400
+++ qt-x11-free-3.3.3/src/codecs/qrtlcodec.cpp	2004-12-30 12:27:59 +0300
@@ -505,6 +505,11 @@
 QString QHebrewCodec::toUnicode(const char* chars, int len ) const
 {
     QString r;
+    if (!chars) return QString::null;
+    if (chars && (chars[0]=='\0' || len==0)) {
+        r.setLength(0);
+	return r;
+    }
     const unsigned char * c = (const unsigned char *)chars;
     QChar::Direction basicDir = QChar::DirON; // neutral, we don't know
 
diff -Naur qt-x11-free-3.3.3.orig/src/codecs/qsjiscodec.cpp qt-x11-free-3.3.3/src/codecs/qsjiscodec.cpp
--- qt-x11-free-3.3.3.orig/src/codecs/qsjiscodec.cpp	2004-08-05 18:42:01 +0400
+++ qt-x11-free-3.3.3/src/codecs/qsjiscodec.cpp	2004-12-30 12:27:59 +0300
@@ -179,6 +179,11 @@
 QString QSjisCodec::toUnicode(const char* chars, int len) const
 {
     QString result;
+    if (!chars) return QString::null;
+    if (chars && (chars[0]=='\0' || len==0)) {
+        result.setLength(0);
+        return result;
+    }
     for (int i=0; i<len; i++) {
 	uchar ch = chars[i];
 	if ( ch < 0x80 || IsKana(ch) ) {
@@ -312,6 +317,11 @@
     QString toUnicode(const char* chars, int len)
     {
 	QString result;
+	if (!chars) return QString::null;
+	if (chars && (chars[0]=='\0' || len==0)) {
+	    result.setLength(0);
+	    return result;
+	}
 	for (int i=0; i<len; i++) {
 	    uchar ch = chars[i];
 	    switch (nbuf) {
diff -Naur qt-x11-free-3.3.3.orig/src/codecs/qtextcodec.cpp qt-x11-free-3.3.3/src/codecs/qtextcodec.cpp
--- qt-x11-free-3.3.3.orig/src/codecs/qtextcodec.cpp	2004-08-05 18:42:01 +0400
+++ qt-x11-free-3.3.3/src/codecs/qtextcodec.cpp	2004-12-30 12:27:59 +0300
@@ -466,19 +466,19 @@
 // returns a string containing the letters and numbers from input,
 // with a space separating run of a character class. e.g. "iso8859-1"
 // becomes "iso 8859 1"
-static QString lettersAndNumbers( const char * input )
+static QCString lettersAndNumbers( const char * input )
 {
-    QString result;
+    QCString result;
     QChar c;
 
     while( input && *input ) {
-	c = *input;
+	c = QChar( *input, 0 );
  	if ( c.isLetter() || c.isNumber() )
- 	    result += c.lower();
+ 	    result += c.lower().cell();
 	if ( input[1] ) {
 	    // add space at character class transition, except
 	    // transition from upper-case to lower-case letter
-	    QChar n( input[1] );
+	    QChar n( input[1], 0 );
 	    if ( c.isLetter() && n.isLetter() ) {
 		if ( c == c.lower() && n == n.upper() )
 		    result += ' ';
@@ -505,8 +505,8 @@
 
     // if the letters and numbers are the same, we have an "almost"
     // perfect match.
-    QString h( lettersAndNumbers( hint ) );
-    QString n( lettersAndNumbers( name ) );
+    QCString h( lettersAndNumbers( hint ) );
+    QCString n( lettersAndNumbers( name ) );
     if ( h == n )
 	return qstrlen( hint )-1;
 
@@ -588,6 +588,13 @@
 
 QString QWindowsLocalCodec::toUnicode(const char* chars, int len) const
 {
+    if ( !chars ) return QString::null;
+    if ( chars && (chars[0]=='\0' || len==0) ) {
+        QString blank;
+        blank.setLength(0);
+        return blank;
+    }
+
     if ( len == 1 && chars ) {          // Optimization; avoids allocation
 	char c[2];
 	c[0] = *chars;
@@ -937,8 +944,13 @@
 */
 QString QTextCodec::toUnicode(const char* chars, int len) const
 {
-    if ( chars == 0 )
-	return QString::null;
+    if ( !chars ) return QString::null;
+    if ( chars && (chars[0]=='\0' || len==0) ) {
+        QString blank;
+        blank.setLength(0);
+        return blank;
+    }
+
     QTextDecoder* i = makeDecoder();
     QString result = i->toUnicode(chars,len);
     delete i;
@@ -1414,6 +1426,13 @@
 
     QString toUnicode(const char* chars, int len) const
     {
+        if ( !chars ) return QString::null;
+        if ( chars && (chars[0]=='\0' || len==0) ) {
+            QString blank;
+            blank.setLength(0);
+            return blank;
+        }
+
 	const uchar* uchars = (const uchar*)chars;
 	QString result;
 	QMultiByteUnicodeTable* multiByte=to_unicode_multiByte;
@@ -1486,6 +1505,13 @@
 
 QString QTextCodecFromIODDecoder::toUnicode(const char* chars, int len)
 {
+    if ( !chars ) return QString::null;
+    if ( chars && (chars[0]=='\0' || len==0) ) {
+        QString blank;
+        blank.setLength(0);
+        return blank;
+    }
+
     const uchar* uchars = (const uchar*)chars;
     QString result;
     while (len--) {
@@ -2239,13 +2265,17 @@
 
 QString QSimpleTextCodec::toUnicode(const char* chars, int len) const
 {
-    if ( len <= 0 || chars == 0 )
-	return QString::null;
+    if ( !chars ) return QString::null;
+    if ( chars && (chars[0]=='\0' || len==0) ) {
+        QString blank;
+        blank.setLength(0);
+        return blank;
+    }
 
     const unsigned char * c = (const unsigned char *)chars;
     int i;
 
-    for ( i = 0; i < len; i++ )
+    for ( i = 0; i < len || len < 0; i++ )
 	if ( c[i] == '\0' ) {
 	    len = i;
 	    break;
@@ -2435,10 +2465,29 @@
 
 QString QLatin1Codec::toUnicode(const char* chars, int len) const
 {
-    if ( chars == 0 )
-	return QString::null;
+    if ( !chars ) return QString::null;
+    if ( chars && (chars[0]=='\0' || len==0) ) {
+        QString blank;
+        blank.setLength(0);
+        return blank;
+    }
 
-    return QString::fromLatin1(chars, len);
+    QString r;
+ 
+    const unsigned char * c = (const unsigned char *)chars;
+    int i;
+
+    for ( i = 0; i < len; i++ ) 
+        if ( c[i] == '\0' ) len = i;
+
+    if( len > 0 ) {
+        r.setUnicode(0, len);
+        QChar* uc = (QChar*)r.unicode(); // const_cast
+
+        for ( i = 0; i < len; i++ )
+            uc[i] = QChar( c[i], 0 );
+    }
+    return r;
 }
 
 
diff -Naur qt-x11-free-3.3.3.orig/src/codecs/qutfcodec.cpp qt-x11-free-3.3.3/src/codecs/qutfcodec.cpp
--- qt-x11-free-3.3.3.orig/src/codecs/qutfcodec.cpp	2004-08-05 18:42:01 +0400
+++ qt-x11-free-3.3.3/src/codecs/qutfcodec.cpp	2004-12-30 12:27:59 +0300
@@ -164,6 +164,11 @@
     QString toUnicode(const char* chars, int len)
     {
 	QString result;
+        if (!chars) return QString::null;
+        if (chars && (chars[0]=='\0' || len==0)) {
+            result.setLength(0);
+            return result;
+        }
 	result.setLength( len ); // worst case
 	QChar *qch = (QChar *)result.unicode();
 	uchar ch;
@@ -286,6 +291,11 @@
     QString toUnicode(const char* chars, int len)
     {
 	QString result;
+        if (!chars) return QString::null;
+        if (chars && (chars[0]=='\0' || len==0)) {
+            result.setLength(0);
+            return result;
+        }
 	result.setLength( len ); // worst case
 	QChar *qch = (QChar *)result.unicode();
 	QChar ch;
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin