qlatincodec.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/codecs/qlatincodec.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6QLatin1Codec::~QLatin1Codec()-
7{-
8}-
9-
10QString QLatin1Codec::convertToUnicode(const char *chars, int len, ConverterState *) const-
11{-
12 if (chars == 0
chars == 0Description
TRUEnever evaluated
FALSEevaluated 122 times by 5 tests
Evaluated by:
  • tst_QSettings
  • tst_QString
  • tst_QTextBrowser
  • tst_QTextCodec
  • tst_QTextStream
)
0-122
13 return
never executed: return QString();
QString();
never executed: return QString();
0
14-
15 return
executed 122 times by 5 tests: return QString::fromLatin1(chars, len);
Executed by:
  • tst_QSettings
  • tst_QString
  • tst_QTextBrowser
  • tst_QTextCodec
  • tst_QTextStream
QString::fromLatin1(chars, len);
executed 122 times by 5 tests: return QString::fromLatin1(chars, len);
Executed by:
  • tst_QSettings
  • tst_QString
  • tst_QTextBrowser
  • tst_QTextCodec
  • tst_QTextStream
122
16}-
17-
18-
19QByteArray QLatin1Codec::convertFromUnicode(const QChar *ch, int len, ConverterState *state) const-
20{-
21 const char replacement = (state
stateDescription
TRUEevaluated 38 times by 2 tests
Evaluated by:
  • tst_QString
  • tst_QTextStream
FALSEevaluated 63 times by 3 tests
Evaluated by:
  • tst_QSettings
  • tst_QString
  • tst_QTextCodec
&& state->flags & ConvertInvalidToNull) ? 0 : '?';
38-63
22 QByteArray r(len, Qt::Uninitialized);-
23 char *d = r.data();-
24 int invalid = 0;-
25 for (int i = 0; i < len
i < lenDescription
TRUEevaluated 11686 times by 4 tests
Evaluated by:
  • tst_QSettings
  • tst_QString
  • tst_QTextCodec
  • tst_QTextStream
FALSEevaluated 101 times by 4 tests
Evaluated by:
  • tst_QSettings
  • tst_QString
  • tst_QTextCodec
  • tst_QTextStream
; ++i) {
101-11686
26 if (ch[i] > 0xff
ch[i] > 0xffDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_QString
FALSEevaluated 11678 times by 4 tests
Evaluated by:
  • tst_QSettings
  • tst_QString
  • tst_QTextCodec
  • tst_QTextStream
) {
8-11678
27 d[i] = replacement;-
28 ++invalid;-
29 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_QString
else {
8
30 d[i] = (char)ch[i].cell();-
31 }
executed 11678 times by 4 tests: end of block
Executed by:
  • tst_QSettings
  • tst_QString
  • tst_QTextCodec
  • tst_QTextStream
11678
32 }-
33 if (state
stateDescription
TRUEevaluated 38 times by 2 tests
Evaluated by:
  • tst_QString
  • tst_QTextStream
FALSEevaluated 63 times by 3 tests
Evaluated by:
  • tst_QSettings
  • tst_QString
  • tst_QTextCodec
) {
38-63
34 state->invalidChars += invalid;-
35 }
executed 38 times by 2 tests: end of block
Executed by:
  • tst_QString
  • tst_QTextStream
38
36 return
executed 101 times by 4 tests: return r;
Executed by:
  • tst_QSettings
  • tst_QString
  • tst_QTextCodec
  • tst_QTextStream
r;
executed 101 times by 4 tests: return r;
Executed by:
  • tst_QSettings
  • tst_QString
  • tst_QTextCodec
  • tst_QTextStream
101
37}-
38-
39QByteArray QLatin1Codec::name() const-
40{-
41 return
executed 148 times by 7 tests: return "ISO-8859-1";
Executed by:
  • tst_QSettings
  • tst_QString
  • tst_QTextBrowser
  • tst_QTextCodec
  • tst_QTextDocument
  • tst_QTextStream
  • tst_QXmlStream
"ISO-8859-1";
executed 148 times by 7 tests: return "ISO-8859-1";
Executed by:
  • tst_QSettings
  • tst_QString
  • tst_QTextBrowser
  • tst_QTextCodec
  • tst_QTextDocument
  • tst_QTextStream
  • tst_QXmlStream
148
42}-
43-
44QList<QByteArray> QLatin1Codec::aliases() const-
45{-
46 QList<QByteArray> list;-
47 list << "latin1"-
48 << "CP819"-
49 << "IBM819"-
50 << "iso-ir-100"-
51 << "csISOLatin1";-
52 return
executed 142 times by 6 tests: return list;
Executed by:
  • tst_QSettings
  • tst_QString
  • tst_QTextCodec
  • tst_QTextDocument
  • tst_QTextStream
  • tst_QXmlStream
list;
executed 142 times by 6 tests: return list;
Executed by:
  • tst_QSettings
  • tst_QString
  • tst_QTextCodec
  • tst_QTextDocument
  • tst_QTextStream
  • tst_QXmlStream
142
53}-
54-
55-
56int QLatin1Codec::mibEnum() const-
57{-
58 return
executed 36 times by 2 tests: return 4;
Executed by:
  • tst_QTextCodec
  • tst_QXmlStream
4;
executed 36 times by 2 tests: return 4;
Executed by:
  • tst_QTextCodec
  • tst_QXmlStream
36
59}-
60-
61-
62QLatin15Codec::~QLatin15Codec()-
63{-
64}-
65-
66QString QLatin15Codec::convertToUnicode(const char* chars, int len, ConverterState *) const-
67{-
68 if (chars == 0
chars == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
69 return
never executed: return QString();
QString();
never executed: return QString();
0
70-
71 QString str = QString::fromLatin1(chars, len);-
72 QChar *uc = str.data();-
73 while(len--
len--Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
74 switch(uc->unicode()) {-
75 case
never executed: case 0xa4:
0xa4:
never executed: case 0xa4:
0
76 *uc = 0x20ac;-
77 break;
never executed: break;
0
78 case
never executed: case 0xa6:
0xa6:
never executed: case 0xa6:
0
79 *uc = 0x0160;-
80 break;
never executed: break;
0
81 case
never executed: case 0xa8:
0xa8:
never executed: case 0xa8:
0
82 *uc = 0x0161;-
83 break;
never executed: break;
0
84 case
never executed: case 0xb4:
0xb4:
never executed: case 0xb4:
0
85 *uc = 0x017d;-
86 break;
never executed: break;
0
87 case
never executed: case 0xb8:
0xb8:
never executed: case 0xb8:
0
88 *uc = 0x017e;-
89 break;
never executed: break;
0
90 case
never executed: case 0xbc:
0xbc:
never executed: case 0xbc:
0
91 *uc = 0x0152;-
92 break;
never executed: break;
0
93 case
never executed: case 0xbd:
0xbd:
never executed: case 0xbd:
0
94 *uc = 0x0153;-
95 break;
never executed: break;
0
96 case
never executed: case 0xbe:
0xbe:
never executed: case 0xbe:
0
97 *uc = 0x0178;-
98 break;
never executed: break;
0
99 default
never executed: default:
:
never executed: default:
0
100 break;
never executed: break;
0
101 }-
102 uc++;-
103 }
never executed: end of block
0
104 return
never executed: return str;
str;
never executed: return str;
0
105}-
106-
107QByteArray QLatin15Codec::convertFromUnicode(const QChar *in, int length, ConverterState *state) const-
108{-
109 const char replacement = (state
stateDescription
TRUEnever evaluated
FALSEnever evaluated
&& state->flags & ConvertInvalidToNull
state->flags &...tInvalidToNullDescription
TRUEnever evaluated
FALSEnever evaluated
) ? 0 : '?';
0
110 QByteArray r(length, Qt::Uninitialized);-
111 char *d = r.data();-
112 int invalid = 0;-
113 for (int i = 0; i < length
i < lengthDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
114 uchar c;-
115 ushort uc = in[i].unicode();-
116 if (uc < 0x0100
uc < 0x0100Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
117 if (uc > 0xa3
uc > 0xa3Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
118 switch(uc) {-
119 case
never executed: case 0xa4:
0xa4:
never executed: case 0xa4:
0
120 case
never executed: case 0xa6:
0xa6:
never executed: case 0xa6:
0
121 case
never executed: case 0xa8:
0xa8:
never executed: case 0xa8:
0
122 case
never executed: case 0xb4:
0xb4:
never executed: case 0xb4:
0
123 case
never executed: case 0xb8:
0xb8:
never executed: case 0xb8:
0
124 case
never executed: case 0xbc:
0xbc:
never executed: case 0xbc:
0
125 case
never executed: case 0xbd:
0xbd:
never executed: case 0xbd:
0
126 case
never executed: case 0xbe:
0xbe:
never executed: case 0xbe:
0
127 c = replacement;-
128 ++invalid;-
129 break;
never executed: break;
0
130 default
never executed: default:
:
never executed: default:
0
131 c = (unsigned char) uc;-
132 break;
never executed: break;
0
133 }-
134 } else {-
135 c = (unsigned char) uc;-
136 }
never executed: end of block
0
137 } else {-
138 if (uc == 0x20ac
uc == 0x20acDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
139 c = 0xa4;
never executed: c = 0xa4;
0
140 else if ((
(uc & 0xff00) == 0x0100Description
TRUEnever evaluated
FALSEnever evaluated
uc & 0xff00) == 0x0100
(uc & 0xff00) == 0x0100Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
141 switch(uc) {-
142 case
never executed: case 0x0160:
0x0160:
never executed: case 0x0160:
0
143 c = 0xa6;-
144 break;
never executed: break;
0
145 case
never executed: case 0x0161:
0x0161:
never executed: case 0x0161:
0
146 c = 0xa8;-
147 break;
never executed: break;
0
148 case
never executed: case 0x017d:
0x017d:
never executed: case 0x017d:
0
149 c = 0xb4;-
150 break;
never executed: break;
0
151 case
never executed: case 0x017e:
0x017e:
never executed: case 0x017e:
0
152 c = 0xb8;-
153 break;
never executed: break;
0
154 case
never executed: case 0x0152:
0x0152:
never executed: case 0x0152:
0
155 c = 0xbc;-
156 break;
never executed: break;
0
157 case
never executed: case 0x0153:
0x0153:
never executed: case 0x0153:
0
158 c = 0xbd;-
159 break;
never executed: break;
0
160 case
never executed: case 0x0178:
0x0178:
never executed: case 0x0178:
0
161 c = 0xbe;-
162 break;
never executed: break;
0
163 default
never executed: default:
:
never executed: default:
0
164 c = replacement;-
165 ++invalid;-
166 }
never executed: end of block
0
167 } else {-
168 c = replacement;-
169 ++invalid;-
170 }
never executed: end of block
0
171 }-
172 d[i] = (char)c;-
173 }
never executed: end of block
0
174 if (state
stateDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
175 state->remainingChars = 0;-
176 state->invalidChars += invalid;-
177 }
never executed: end of block
0
178 return
never executed: return r;
r;
never executed: return r;
0
179}-
180-
181-
182QByteArray QLatin15Codec::name() const-
183{-
184 return
never executed: return "ISO-8859-15";
"ISO-8859-15";
never executed: return "ISO-8859-15";
0
185}-
186-
187QList<QByteArray> QLatin15Codec::aliases() const-
188{-
189 QList<QByteArray> list;-
190 list << "latin9";-
191 return
never executed: return list;
list;
never executed: return list;
0
192}-
193-
194int QLatin15Codec::mibEnum() const-
195{-
196 return
never executed: return 111;
111;
never executed: return 111;
0
197}-
198-
199-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9