summaryrefslogtreecommitdiff
authorerik <erik>2007-01-10 17:31:08 (UTC)
committer erik <erik>2007-01-10 17:31:08 (UTC)
commit6825f30b665952864dbe35fe8329a0e4c264d4b8 (patch) (unidiff)
tree7c8d178f835d4a7d294b6ef65e0040c40579e84e
parentd8e580a239ab84fbe063b2f3779d417598d5ca0a (diff)
downloadopie-6825f30b665952864dbe35fe8329a0e4c264d4b8.zip
opie-6825f30b665952864dbe35fe8329a0e4c264d4b8.tar.gz
opie-6825f30b665952864dbe35fe8329a0e4c264d4b8.tar.bz2
All of the files included have instances where an array is new'ed but
the corresponding delete does not have the corresponding [] argument.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/TEScreen.cpp4
-rw-r--r--noncore/apps/checkbook/listedit.cpp2
-rw-r--r--noncore/apps/opie-console/TEScreen.cpp4
-rw-r--r--noncore/apps/opie-sheet/Excel.cpp2
-rw-r--r--noncore/apps/tinykate/libkate/document/katedocument.cpp4
-rw-r--r--noncore/comm/keypebble/krfbdecoder.cpp6
-rw-r--r--noncore/games/sfcave/sfcave.cpp2
-rw-r--r--noncore/settings/aqpkg/settingsimpl.cpp2
-rw-r--r--noncore/settings/aqpkg/version.cpp2
9 files changed, 14 insertions, 14 deletions
diff --git a/core/apps/embeddedkonsole/TEScreen.cpp b/core/apps/embeddedkonsole/TEScreen.cpp
index 8e69a88..1db34d2 100644
--- a/core/apps/embeddedkonsole/TEScreen.cpp
+++ b/core/apps/embeddedkonsole/TEScreen.cpp
@@ -1093,98 +1093,98 @@ QString TEScreen::getSelText(const BOOL preserve_line_breaks)
1093 { 1093 {
1094 while ((eol > s) && 1094 while ((eol > s) &&
1095 isspace(image[eol - hist_BR].c)) 1095 isspace(image[eol - hist_BR].c))
1096 { 1096 {
1097 eol--; 1097 eol--;
1098 } 1098 }
1099 } 1099 }
1100 else 1100 else
1101 { 1101 {
1102 eol = sel_BR; 1102 eol = sel_BR;
1103 } 1103 }
1104 1104
1105 while (s <= eol) 1105 while (s <= eol)
1106 { 1106 {
1107 m[d++] = image[s++ - hist_BR].c; 1107 m[d++] = image[s++ - hist_BR].c;
1108 } 1108 }
1109 1109
1110 if (eol < sel_BR) 1110 if (eol < sel_BR)
1111 { 1111 {
1112 // eol processing see below ... 1112 // eol processing see below ...
1113 if ((eol + 1) % columns == 0) 1113 if ((eol + 1) % columns == 0)
1114 { 1114 {
1115 if (image[eol - hist_BR].c == ' ') 1115 if (image[eol - hist_BR].c == ' ')
1116 { 1116 {
1117 m[d++] = ' '; 1117 m[d++] = ' ';
1118 } 1118 }
1119 } 1119 }
1120 else 1120 else
1121 { 1121 {
1122 m[d++] = ((preserve_line_breaks || 1122 m[d++] = ((preserve_line_breaks ||
1123 ((eol % columns) == 0)) ? 1123 ((eol % columns) == 0)) ?
1124 '\n' : ' '); 1124 '\n' : ' ');
1125 } 1125 }
1126 } 1126 }
1127 1127
1128 s = (eol / columns + 1) * columns; 1128 s = (eol / columns + 1) * columns;
1129 } 1129 }
1130 } 1130 }
1131 1131
1132 QChar* qc = new QChar[d]; 1132 QChar* qc = new QChar[d];
1133 1133
1134 for (int i = 0; i < d; i++) 1134 for (int i = 0; i < d; i++)
1135 { 1135 {
1136 qc[i] = m[i]; 1136 qc[i] = m[i];
1137 } 1137 }
1138 1138
1139 QString res(qc, d); 1139 QString res(qc, d);
1140 1140
1141 delete m; 1141 delete [] m;
1142 delete qc; 1142 delete [] qc;
1143 1143
1144 return res; 1144 return res;
1145} 1145}
1146/* above ... end of line processing for selection -- psilva 1146/* above ... end of line processing for selection -- psilva
1147cases: 1147cases:
1148 1148
11491) (eol+1)%columns == 0 --> the whole line is filled. 11491) (eol+1)%columns == 0 --> the whole line is filled.
1150 If the last char is a space, insert (preserve) space. otherwise 1150 If the last char is a space, insert (preserve) space. otherwise
1151 leave the text alone, so that words that are broken by linewrap 1151 leave the text alone, so that words that are broken by linewrap
1152 are preserved. 1152 are preserved.
1153 1153
1154FIXME: 1154FIXME:
1155 * this suppresses \n for command output that is 1155 * this suppresses \n for command output that is
1156 sized to the exact column width of the screen. 1156 sized to the exact column width of the screen.
1157 1157
11582) eol%columns == 0 --> blank line. 11582) eol%columns == 0 --> blank line.
1159 insert a \n unconditionally. 1159 insert a \n unconditionally.
1160 Do it either you would because you are in preserve_line_break mode, 1160 Do it either you would because you are in preserve_line_break mode,
1161 or because it's an ASCII paragraph delimiter, so even when 1161 or because it's an ASCII paragraph delimiter, so even when
1162 not preserving line_breaks, you want to preserve paragraph breaks. 1162 not preserving line_breaks, you want to preserve paragraph breaks.
1163 1163
11643) else --> partially filled line 11643) else --> partially filled line
1165 insert a \n in preserve line break mode, else a space 1165 insert a \n in preserve line break mode, else a space
1166 The space prevents concatenation of the last word of one 1166 The space prevents concatenation of the last word of one
1167 line with the first of the next. 1167 line with the first of the next.
1168 1168
1169*/ 1169*/
1170 1170
1171void TEScreen::addHistLine() 1171void TEScreen::addHistLine()
1172{ 1172{
1173 assert(hasScroll() || histCursor == 0); 1173 assert(hasScroll() || histCursor == 0);
1174 1174
1175 // add to hist buffer 1175 // add to hist buffer
1176 // we have to take care about scrolling, too... 1176 // we have to take care about scrolling, too...
1177 1177
1178 if (hasScroll()){ 1178 if (hasScroll()){
1179 ca dft; 1179 ca dft;
1180 1180
1181 int end = columns - 1; 1181 int end = columns - 1;
1182 while (end >= 0 && image[end] == dft) 1182 while (end >= 0 && image[end] == dft)
1183 end -= 1; 1183 end -= 1;
1184 1184
1185 hist.addCells( image, end + 1); 1185 hist.addCells( image, end + 1);
1186 hist.addLine(); 1186 hist.addLine();
1187 1187
1188 // adjust history cursor 1188 // adjust history cursor
1189 histCursor += ( hist.getLines() - 1 == histCursor); 1189 histCursor += ( hist.getLines() - 1 == histCursor);
1190 } 1190 }
diff --git a/noncore/apps/checkbook/listedit.cpp b/noncore/apps/checkbook/listedit.cpp
index e40377b..b297d69 100644
--- a/noncore/apps/checkbook/listedit.cpp
+++ b/noncore/apps/checkbook/listedit.cpp
@@ -191,97 +191,97 @@ void ListEdit::fixTypes(int iColumn)
191 cur=cur->nextSibling(); 191 cur=cur->nextSibling();
192 } 192 }
193 193
194 // fix empty entries 194 // fix empty entries
195 int i=0; 195 int i=0;
196 for(QString *ptr=lst.first(); ptr; ptr=lst.next()) { 196 for(QString *ptr=lst.first(); ptr; ptr=lst.next()) {
197 *ptr=ptr->stripWhiteSpace(); 197 *ptr=ptr->stripWhiteSpace();
198 if( ptr->isEmpty() ) { 198 if( ptr->isEmpty() ) {
199 i++; 199 i++;
200 if( i==1 ) *ptr=pDef->getNewValue(); 200 if( i==1 ) *ptr=pDef->getNewValue();
201 else ptr->sprintf("%s %d", (const char *)pDef->getNewValue(), i); 201 else ptr->sprintf("%s %d", (const char *)pDef->getNewValue(), i);
202 } 202 }
203 } 203 }
204 204
205 // fix dups 205 // fix dups
206 lst.sort(); 206 lst.sort();
207 QString repl; 207 QString repl;
208 for(uint iCur=0; iCur<lst.count()-1; iCur++) { 208 for(uint iCur=0; iCur<lst.count()-1; iCur++) {
209 QString *current=lst.at(iCur); 209 QString *current=lst.at(iCur);
210 for(uint iNext=iCur+1; iNext<lst.count(); iNext++ ) { 210 for(uint iNext=iCur+1; iNext<lst.count(); iNext++ ) {
211 if( *current!=*lst.at(iNext) ) continue; 211 if( *current!=*lst.at(iNext) ) continue;
212 for(int i=2; ; i++) { 212 for(int i=2; ; i++) {
213 repl.sprintf("%s %d", (const char *)*current, i); 213 repl.sprintf("%s %d", (const char *)*current, i);
214 bool bDup=false; 214 bool bDup=false;
215 uint iChk=iNext+1; 215 uint iChk=iNext+1;
216 while( iChk<lst.count() ) { 216 while( iChk<lst.count() ) {
217 QString *chk=lst.at(iChk); 217 QString *chk=lst.at(iChk);
218 if( !chk->startsWith(*current) ) break; 218 if( !chk->startsWith(*current) ) break;
219 if( *chk==repl ) { 219 if( *chk==repl ) {
220 bDup=true; 220 bDup=true;
221 break; 221 break;
222 } 222 }
223 iChk++; 223 iChk++;
224 } 224 }
225 if( !bDup ) { 225 if( !bDup ) {
226 *lst.at(iNext)=repl; 226 *lst.at(iNext)=repl;
227 break; 227 break;
228 } 228 }
229 } 229 }
230 } 230 }
231 } 231 }
232 lst.sort(); 232 lst.sort();
233 233
234 // copy back clean up col map 234 // copy back clean up col map
235 for(int i=0; i<_typeTable->childCount(); i++) { 235 for(int i=0; i<_typeTable->childCount(); i++) {
236 colMap[i]->getItem()->setText(iColumn, colMap[i]->getValue()); 236 colMap[i]->getItem()->setText(iColumn, colMap[i]->getValue());
237 delete colMap[i]; 237 delete colMap[i];
238 } 238 }
239 delete colMap; 239 delete [] colMap;
240} 240}
241 241
242void ListEdit::fixTypes() 242void ListEdit::fixTypes()
243{ 243{
244 int i; 244 int i;
245 ColumnDef *pDef; 245 ColumnDef *pDef;
246 for(pDef=this->first(), i=0; pDef; pDef=this->next(), i++) { 246 for(pDef=this->first(), i=0; pDef; pDef=this->next(), i++) {
247 if( pDef->hasFlag(ColumnDef::typeUnique) ) 247 if( pDef->hasFlag(ColumnDef::typeUnique) )
248 fixTypes(i); 248 fixTypes(i);
249 } 249 }
250 _typeTable->sort(); 250 _typeTable->sort();
251} 251}
252 252
253 253
254// --- storeInList ------------------------------------------------------------ 254// --- storeInList ------------------------------------------------------------
255void ListEdit::storeInList(QStringList &lst) 255void ListEdit::storeInList(QStringList &lst)
256{ 256{
257 // delete old content 257 // delete old content
258 lst.clear(); 258 lst.clear();
259 259
260 // add new one 260 // add new one
261 fixTypes(); 261 fixTypes();
262 QListViewItem *itm=_typeTable->firstChild(); 262 QListViewItem *itm=_typeTable->firstChild();
263 while( itm ) { 263 while( itm ) {
264 int i=0; 264 int i=0;
265 QString sAdd; 265 QString sAdd;
266 ColumnDef *pDef; 266 ColumnDef *pDef;
267 for(pDef=this->first(), i=0; pDef; pDef=this->next(), i++) { 267 for(pDef=this->first(), i=0; pDef; pDef=this->next(), i++) {
268 if( i>=1 ) sAdd+=";"; 268 if( i>=1 ) sAdd+=";";
269 sAdd += itm->text(i); 269 sAdd += itm->text(i);
270 } 270 }
271 lst.append( sAdd ); 271 lst.append( sAdd );
272 itm=itm->nextSibling(); 272 itm=itm->nextSibling();
273 } 273 }
274} 274}
275 275
276 276
277// --- slotClicked ------------------------------------------------------------ 277// --- slotClicked ------------------------------------------------------------
278void ListEdit::slotClick(QListViewItem *itm, const QPoint &pnt, int col) 278void ListEdit::slotClick(QListViewItem *itm, const QPoint &pnt, int col)
279{ 279{
280 (void)pnt; // get rid of unused warning; 280 (void)pnt; // get rid of unused warning;
281 281
282 // save values 282 // save values
283 _currentItem=itm; 283 _currentItem=itm;
284 _currentColumn=col; 284 _currentColumn=col;
285 if( itm==NULL ) { 285 if( itm==NULL ) {
286 _typeEdit->setText(""); 286 _typeEdit->setText("");
287 _stack->raiseWidget(_typeEdit); 287 _stack->raiseWidget(_typeEdit);
diff --git a/noncore/apps/opie-console/TEScreen.cpp b/noncore/apps/opie-console/TEScreen.cpp
index 2675d31..8e91532 100644
--- a/noncore/apps/opie-console/TEScreen.cpp
+++ b/noncore/apps/opie-console/TEScreen.cpp
@@ -1070,98 +1070,98 @@ QString TEScreen::getSelText(const BOOL preserve_line_breaks)
1070 { 1070 {
1071 while ((eol > s) && 1071 while ((eol > s) &&
1072 isspace(image[eol - hist_BR].c)) 1072 isspace(image[eol - hist_BR].c))
1073 { 1073 {
1074 eol--; 1074 eol--;
1075 } 1075 }
1076 } 1076 }
1077 else 1077 else
1078 { 1078 {
1079 eol = sel_BR; 1079 eol = sel_BR;
1080 } 1080 }
1081 1081
1082 while (s <= eol) 1082 while (s <= eol)
1083 { 1083 {
1084 m[d++] = image[s++ - hist_BR].c; 1084 m[d++] = image[s++ - hist_BR].c;
1085 } 1085 }
1086 1086
1087 if (eol < sel_BR) 1087 if (eol < sel_BR)
1088 { 1088 {
1089 // eol processing see below ... 1089 // eol processing see below ...
1090 if ((eol + 1) % columns == 0) 1090 if ((eol + 1) % columns == 0)
1091 { 1091 {
1092 if (image[eol - hist_BR].c == ' ') 1092 if (image[eol - hist_BR].c == ' ')
1093 { 1093 {
1094 m[d++] = ' '; 1094 m[d++] = ' ';
1095 } 1095 }
1096 } 1096 }
1097 else 1097 else
1098 { 1098 {
1099 m[d++] = ((preserve_line_breaks || 1099 m[d++] = ((preserve_line_breaks ||
1100 ((eol % columns) == 0)) ? 1100 ((eol % columns) == 0)) ?
1101 '\n' : ' '); 1101 '\n' : ' ');
1102 } 1102 }
1103 } 1103 }
1104 1104
1105 s = (eol / columns + 1) * columns; 1105 s = (eol / columns + 1) * columns;
1106 } 1106 }
1107 } 1107 }
1108 1108
1109 QChar* qc = new QChar[d]; 1109 QChar* qc = new QChar[d];
1110 1110
1111 for (int i = 0; i < d; i++) 1111 for (int i = 0; i < d; i++)
1112 { 1112 {
1113 qc[i] = m[i]; 1113 qc[i] = m[i];
1114 } 1114 }
1115 1115
1116 QString res(qc, d); 1116 QString res(qc, d);
1117 1117
1118 delete m; 1118 delete [] m;
1119 delete qc; 1119 delete [] qc;
1120 1120
1121 return res; 1121 return res;
1122} 1122}
1123QString TEScreen::getHistory() { 1123QString TEScreen::getHistory() {
1124 sel_begin = 0; 1124 sel_begin = 0;
1125 sel_BR = sel_begin; 1125 sel_BR = sel_begin;
1126 sel_TL = sel_begin; 1126 sel_TL = sel_begin;
1127 setSelExtentXY(columns-1,lines-1); 1127 setSelExtentXY(columns-1,lines-1);
1128 QString tmp=getSelText(true); 1128 QString tmp=getSelText(true);
1129 while (tmp.at(tmp.length()-2).unicode()==10 && tmp.at(tmp.length()-1).unicode()==10) 1129 while (tmp.at(tmp.length()-2).unicode()==10 && tmp.at(tmp.length()-1).unicode()==10)
1130 tmp.truncate(tmp.length()-1); 1130 tmp.truncate(tmp.length()-1);
1131 1131
1132 return tmp; 1132 return tmp;
1133} 1133}
1134/* above ... end of line processing for selection -- psilva 1134/* above ... end of line processing for selection -- psilva
1135cases: 1135cases:
1136 1136
11371) (eol+1)%columns == 0 --> the whole line is filled. 11371) (eol+1)%columns == 0 --> the whole line is filled.
1138 If the last char is a space, insert (preserve) space. otherwise 1138 If the last char is a space, insert (preserve) space. otherwise
1139 leave the text alone, so that words that are broken by linewrap 1139 leave the text alone, so that words that are broken by linewrap
1140 are preserved. 1140 are preserved.
1141 1141
1142FIXME: 1142FIXME:
1143 * this suppresses \n for command output that is 1143 * this suppresses \n for command output that is
1144 sized to the exact column width of the screen. 1144 sized to the exact column width of the screen.
1145 1145
11462) eol%columns == 0 --> blank line. 11462) eol%columns == 0 --> blank line.
1147 insert a \n unconditionally. 1147 insert a \n unconditionally.
1148 Do it either you would because you are in preserve_line_break mode, 1148 Do it either you would because you are in preserve_line_break mode,
1149 or because it's an ASCII paragraph delimiter, so even when 1149 or because it's an ASCII paragraph delimiter, so even when
1150 not preserving line_breaks, you want to preserve paragraph breaks. 1150 not preserving line_breaks, you want to preserve paragraph breaks.
1151 1151
1152 3) else --> partially filled line 1152 3) else --> partially filled line
1153 insert a \n in preserve line break mode, else a space 1153 insert a \n in preserve line break mode, else a space
1154 The space prevents concatenation of the last word of one 1154 The space prevents concatenation of the last word of one
1155 line with the first of the next. 1155 line with the first of the next.
1156 1156
1157*/ 1157*/
1158 1158
1159void TEScreen::addHistLine() 1159void TEScreen::addHistLine()
1160{ 1160{
1161 assert(hasScroll() || histCursor == 0); 1161 assert(hasScroll() || histCursor == 0);
1162 1162
1163 // add to hist buffer 1163 // add to hist buffer
1164 // we have to take care about scrolling, too... 1164 // we have to take care about scrolling, too...
1165 1165
1166 if (hasScroll()) 1166 if (hasScroll())
1167 { ca dft; 1167 { ca dft;
diff --git a/noncore/apps/opie-sheet/Excel.cpp b/noncore/apps/opie-sheet/Excel.cpp
index 338bc30..51fe707 100644
--- a/noncore/apps/opie-sheet/Excel.cpp
+++ b/noncore/apps/opie-sheet/Excel.cpp
@@ -293,97 +293,97 @@ char* ExcelBook::Read(int pos, int length)
293 for(i=0; i<length; i++) 293 for(i=0; i<length; i++)
294 { 294 {
295 if(!feof(File)) data[i]=fgetc(File); 295 if(!feof(File)) data[i]=fgetc(File);
296 }; 296 };
297 Position= Position+length; 297 Position= Position+length;
298 return data; 298 return data;
299}; 299};
300 300
301QString ExcelBook::ReadUnicodeChar(int pos, int length) 301QString ExcelBook::ReadUnicodeChar(int pos, int length)
302{ 302{
303 int i; 303 int i;
304 QString data; 304 QString data;
305 int i1=' ',i2=' ',ii; 305 int i1=' ',i2=' ',ii;
306 SeekPosition(pos); 306 SeekPosition(pos);
307 for(i=0; i<length; i++) 307 for(i=0; i<length; i++)
308 { 308 {
309 if(!feof(File)) i1=fgetc(File); 309 if(!feof(File)) i1=fgetc(File);
310 if(!feof(File)) i2=fgetc(File); 310 if(!feof(File)) i2=fgetc(File);
311 ii=Integer2Byte(i1,i2); 311 ii=Integer2Byte(i1,i2);
312 data.append(ii); 312 data.append(ii);
313 Position+=2; 313 Position+=2;
314 }; 314 };
315 return data; 315 return data;
316}; 316};
317 317
318QString* ExcelBook::GetString(int num) 318QString* ExcelBook::GetString(int num)
319{ 319{
320 if(num>=0 && num<(int)SharedStrings.count()) 320 if(num>=0 && num<(int)SharedStrings.count())
321 { 321 {
322 return SharedStrings[num]; 322 return SharedStrings[num];
323 }; 323 };
324 return new QString(""); 324 return new QString("");
325}; 325};
326 326
327int ExcelBook::SeekBOF(void) 327int ExcelBook::SeekBOF(void)
328{ 328{
329 int opcode,version,streamtype,length,ret=0; 329 int opcode,version,streamtype,length,ret=0;
330 char *data; 330 char *data;
331 while(!feof(File)) 331 while(!feof(File))
332 { 332 {
333 opcode=Get2Bytes(); 333 opcode=Get2Bytes();
334 if(opcode==XL_BOF) 334 if(opcode==XL_BOF)
335 { 335 {
336 length=Get2Bytes(); 336 length=Get2Bytes();
337 data=Read(Position,length); 337 data=Read(Position,length);
338 version=Integer2Byte(data[0], data[1]); 338 version=Integer2Byte(data[0], data[1]);
339 streamtype=Integer2Byte(data[2], data[3]); 339 streamtype=Integer2Byte(data[2], data[3]);
340 printf("SEEKBOF:opcode=XLBOF, %d ,version %d\r\n",Position,version); 340 printf("SEEKBOF:opcode=XLBOF, %d ,version %d\r\n",Position,version);
341 delete data; data=NULL; 341 delete [] data; data=NULL;
342 if (version==BIFF8) ret=8; 342 if (version==BIFF8) ret=8;
343 else if(version==BIFF7) ret=7; 343 else if(version==BIFF7) ret=7;
344 printf("SEEKBOF:versionBIFF%d\r\n",ret); 344 printf("SEEKBOF:versionBIFF%d\r\n",ret);
345 if(streamtype==WBKGLOBAL) return ret *2; 345 if(streamtype==WBKGLOBAL) return ret *2;
346 else if(streamtype==WRKSHEET) return ret *1; 346 else if(streamtype==WRKSHEET) return ret *1;
347 return 1; 347 return 1;
348 }; 348 };
349 }; 349 };
350 return 0; 350 return 0;
351}; 351};
352 352
353ExcelBREC* ExcelBook::GetBREC(void) 353ExcelBREC* ExcelBook::GetBREC(void)
354{ 354{
355 ExcelBREC* rec; 355 ExcelBREC* rec;
356 rec= new ExcelBREC; 356 rec= new ExcelBREC;
357 if(FileEOF()) return NULL; 357 if(FileEOF()) return NULL;
358 rec->data=NULL; 358 rec->data=NULL;
359 rec->code=Get2Bytes(); 359 rec->code=Get2Bytes();
360 rec->length=Get2Bytes(); 360 rec->length=Get2Bytes();
361 rec->position=Position; 361 rec->position=Position;
362 SeekSkip(rec->length); 362 SeekSkip(rec->length);
363 return rec; 363 return rec;
364}; 364};
365 365
366ExcelBREC* ExcelBook::PeekBREC(void) 366ExcelBREC* ExcelBook::PeekBREC(void)
367{ 367{
368 int oldpos; 368 int oldpos;
369 ExcelBREC* NextRec; 369 ExcelBREC* NextRec;
370 oldpos=Position; 370 oldpos=Position;
371 NextRec=GetBREC(); 371 NextRec=GetBREC();
372 SeekPosition(oldpos); 372 SeekPosition(oldpos);
373 return NextRec; 373 return NextRec;
374}; 374};
375 375
376char* ExcelBook::GetDataOfBREC(ExcelBREC* record) 376char* ExcelBook::GetDataOfBREC(ExcelBREC* record)
377{ 377{
378 if(record->data==NULL) 378 if(record->data==NULL)
379 { 379 {
380 ConvertCharToArray(record,Read(record->position,record->length),record->length); 380 ConvertCharToArray(record,Read(record->position,record->length),record->length);
381 }; 381 };
382 return record->data;//new? 382 return record->data;//new?
383}; 383};
384 384
385void ExcelBook::ConvertCharToArray(ExcelBREC* record, char* chars, int length) 385void ExcelBook::ConvertCharToArray(ExcelBREC* record, char* chars, int length)
386{ 386{
387 record->data=new char[length]; 387 record->data=new char[length];
388 for(int w1=0;w1<=length-1;w1++) 388 for(int w1=0;w1<=length-1;w1++)
389 record->data[w1]=chars[w1]; 389 record->data[w1]=chars[w1];
diff --git a/noncore/apps/tinykate/libkate/document/katedocument.cpp b/noncore/apps/tinykate/libkate/document/katedocument.cpp
index 6dc4fd2..a70f3aa 100644
--- a/noncore/apps/tinykate/libkate/document/katedocument.cpp
+++ b/noncore/apps/tinykate/libkate/document/katedocument.cpp
@@ -2174,158 +2174,158 @@ void KateDocument::paintTextLine(QPainter &paint, int line, int y, int xStart, i
2174 paint.setFont(myFontBI); 2174 paint.setFont(myFontBI);
2175 else if (a->bold) 2175 else if (a->bold)
2176 paint.setFont(myFontBold); 2176 paint.setFont(myFontBold);
2177 else if (a->italic) 2177 else if (a->italic)
2178 paint.setFont(myFontItalic); 2178 paint.setFont(myFontItalic);
2179 else 2179 else
2180 paint.setFont(myFont); 2180 paint.setFont(myFont);
2181 } 2181 }
2182 } 2182 }
2183 z++; 2183 z++;
2184 } 2184 }
2185 if (z > zc) { 2185 if (z > zc) {
2186 QConstString str((QChar *) &s[zc], z - zc /*+1*/); 2186 QConstString str((QChar *) &s[zc], z - zc /*+1*/);
2187 paint.drawText(x - xStart, y, str.string()); 2187 paint.drawText(x - xStart, y, str.string());
2188 } 2188 }
2189} 2189}
2190 2190
2191// Applies the search context, and returns whether a match was found. If one is, 2191// Applies the search context, and returns whether a match was found. If one is,
2192// the length of the string matched is also returned. 2192// the length of the string matched is also returned.
2193bool KateDocument::doSearch(SConfig &sc, const QString &searchFor) { 2193bool KateDocument::doSearch(SConfig &sc, const QString &searchFor) {
2194 int line, col; 2194 int line, col;
2195 int searchEnd; 2195 int searchEnd;
2196 int bufLen, tlen; 2196 int bufLen, tlen;
2197 QChar *t; 2197 QChar *t;
2198 TextLine::Ptr textLine; 2198 TextLine::Ptr textLine;
2199 int pos, newPos; 2199 int pos, newPos;
2200 2200
2201 if (searchFor.isEmpty()) return false; 2201 if (searchFor.isEmpty()) return false;
2202 2202
2203 bufLen = 0; 2203 bufLen = 0;
2204 t = 0L; 2204 t = 0L;
2205 2205
2206 line = sc.cursor.y; 2206 line = sc.cursor.y;
2207 col = sc.cursor.x; 2207 col = sc.cursor.x;
2208 if (!(sc.flags & KateView::sfBackward)) { 2208 if (!(sc.flags & KateView::sfBackward)) {
2209 //forward search 2209 //forward search
2210 if (sc.flags & KateView::sfSelected) { 2210 if (sc.flags & KateView::sfSelected) {
2211 if (line < selectStart) { 2211 if (line < selectStart) {
2212 line = selectStart; 2212 line = selectStart;
2213 col = 0; 2213 col = 0;
2214 } 2214 }
2215 searchEnd = selectEnd; 2215 searchEnd = selectEnd;
2216 } else searchEnd = lastLine(); 2216 } else searchEnd = lastLine();
2217 2217
2218 while (line <= searchEnd) { 2218 while (line <= searchEnd) {
2219 textLine = getTextLine(line); 2219 textLine = getTextLine(line);
2220 tlen = textLine->length(); 2220 tlen = textLine->length();
2221 if (tlen > bufLen) { 2221 if (tlen > bufLen) {
2222 delete t; 2222 delete [] t;
2223 bufLen = (tlen + 255) & (~255); 2223 bufLen = (tlen + 255) & (~255);
2224 t = new QChar[bufLen]; 2224 t = new QChar[bufLen];
2225 } 2225 }
2226 memcpy(t, textLine->getText(), tlen*sizeof(QChar)); 2226 memcpy(t, textLine->getText(), tlen*sizeof(QChar));
2227 if (sc.flags & KateView::sfSelected) { 2227 if (sc.flags & KateView::sfSelected) {
2228 pos = 0; 2228 pos = 0;
2229 do { 2229 do {
2230 pos = textLine->findSelected(pos); 2230 pos = textLine->findSelected(pos);
2231 newPos = textLine->findUnselected(pos); 2231 newPos = textLine->findUnselected(pos);
2232 memset(&t[pos], 0, (newPos - pos)*sizeof(QChar)); 2232 memset(&t[pos], 0, (newPos - pos)*sizeof(QChar));
2233 pos = newPos; 2233 pos = newPos;
2234 } while (pos < tlen); 2234 } while (pos < tlen);
2235 } 2235 }
2236 2236
2237 QString text(t, tlen); 2237 QString text(t, tlen);
2238 if (sc.flags & KateView::sfWholeWords) { 2238 if (sc.flags & KateView::sfWholeWords) {
2239 // Until the end of the line... 2239 // Until the end of the line...
2240 while (col < tlen) { 2240 while (col < tlen) {
2241 // ...find the next match. 2241 // ...find the next match.
2242 col = sc.search(text, col); 2242 col = sc.search(text, col);
2243 if (col != -1) { 2243 if (col != -1) {
2244 // Is the match delimited correctly? 2244 // Is the match delimited correctly?
2245 if (((col == 0) || (!m_highlight->isInWord(t[col]))) && 2245 if (((col == 0) || (!m_highlight->isInWord(t[col]))) &&
2246 ((col + sc.matchedLength == tlen) || (!m_highlight->isInWord(t[col + sc.matchedLength])))) { 2246 ((col + sc.matchedLength == tlen) || (!m_highlight->isInWord(t[col + sc.matchedLength])))) {
2247 goto found; 2247 goto found;
2248 } 2248 }
2249 else { 2249 else {
2250 // Start again from the next character. 2250 // Start again from the next character.
2251 col++; 2251 col++;
2252 } 2252 }
2253 } 2253 }
2254 else { 2254 else {
2255 // No match. 2255 // No match.
2256 break; 2256 break;
2257 } 2257 }
2258 } 2258 }
2259 } 2259 }
2260 else { 2260 else {
2261 // Non-whole-word search. 2261 // Non-whole-word search.
2262 col = sc.search(text, col); 2262 col = sc.search(text, col);
2263 if (col != -1) 2263 if (col != -1)
2264 goto found; 2264 goto found;
2265 } 2265 }
2266 col = 0; 2266 col = 0;
2267 line++; 2267 line++;
2268 } 2268 }
2269 } else { 2269 } else {
2270 // backward search 2270 // backward search
2271 if (sc.flags & KateView::sfSelected) { 2271 if (sc.flags & KateView::sfSelected) {
2272 if (line > selectEnd) { 2272 if (line > selectEnd) {
2273 line = selectEnd; 2273 line = selectEnd;
2274 col = -1; 2274 col = -1;
2275 } 2275 }
2276 searchEnd = selectStart; 2276 searchEnd = selectStart;
2277 } else searchEnd = 0; 2277 } else searchEnd = 0;
2278 2278
2279 while (line >= searchEnd) { 2279 while (line >= searchEnd) {
2280 textLine = getTextLine(line); 2280 textLine = getTextLine(line);
2281 tlen = textLine->length(); 2281 tlen = textLine->length();
2282 if (tlen > bufLen) { 2282 if (tlen > bufLen) {
2283 delete t; 2283 delete [] t;
2284 bufLen = (tlen + 255) & (~255); 2284 bufLen = (tlen + 255) & (~255);
2285 t = new QChar[bufLen]; 2285 t = new QChar[bufLen];
2286 } 2286 }
2287 memcpy(t, textLine->getText(), tlen*sizeof(QChar)); 2287 memcpy(t, textLine->getText(), tlen*sizeof(QChar));
2288 if (sc.flags & KateView::sfSelected) { 2288 if (sc.flags & KateView::sfSelected) {
2289 pos = 0; 2289 pos = 0;
2290 do { 2290 do {
2291 pos = textLine->findSelected(pos); 2291 pos = textLine->findSelected(pos);
2292 newPos = textLine->findUnselected(pos); 2292 newPos = textLine->findUnselected(pos);
2293 memset(&t[pos], 0, (newPos - pos)*sizeof(QChar)); 2293 memset(&t[pos], 0, (newPos - pos)*sizeof(QChar));
2294 pos = newPos; 2294 pos = newPos;
2295 } while (pos < tlen); 2295 } while (pos < tlen);
2296 } 2296 }
2297 2297
2298 if (col < 0 || col > tlen) col = tlen; 2298 if (col < 0 || col > tlen) col = tlen;
2299 2299
2300 QString text(t, tlen); 2300 QString text(t, tlen);
2301 if (sc.flags & KateView::sfWholeWords) { 2301 if (sc.flags & KateView::sfWholeWords) {
2302 // Until the beginning of the line... 2302 // Until the beginning of the line...
2303 while (col >= 0) { 2303 while (col >= 0) {
2304 // ...find the next match. 2304 // ...find the next match.
2305 col = sc.search(text, col); 2305 col = sc.search(text, col);
2306 if (col != -1) { 2306 if (col != -1) {
2307 // Is the match delimited correctly? 2307 // Is the match delimited correctly?
2308 if (((col == 0) || (!m_highlight->isInWord(t[col]))) && 2308 if (((col == 0) || (!m_highlight->isInWord(t[col]))) &&
2309 ((col + sc.matchedLength == tlen) || (!m_highlight->isInWord(t[col + sc.matchedLength])))) { 2309 ((col + sc.matchedLength == tlen) || (!m_highlight->isInWord(t[col + sc.matchedLength])))) {
2310 goto found; 2310 goto found;
2311 } 2311 }
2312 else { 2312 else {
2313 // Start again from the previous character. 2313 // Start again from the previous character.
2314 col--; 2314 col--;
2315 } 2315 }
2316 } 2316 }
2317 else { 2317 else {
2318 // No match. 2318 // No match.
2319 break; 2319 break;
2320 } 2320 }
2321 } 2321 }
2322 } 2322 }
2323 else { 2323 else {
2324 // Non-whole-word search. 2324 // Non-whole-word search.
2325 col = sc.search(text, col); 2325 col = sc.search(text, col);
2326 if (col != -1) 2326 if (col != -1)
2327 goto found; 2327 goto found;
2328 } 2328 }
2329 col = -1; 2329 col = -1;
2330 line--; 2330 line--;
2331 } 2331 }
diff --git a/noncore/comm/keypebble/krfbdecoder.cpp b/noncore/comm/keypebble/krfbdecoder.cpp
index 837fcc5..27ae101 100644
--- a/noncore/comm/keypebble/krfbdecoder.cpp
+++ b/noncore/comm/keypebble/krfbdecoder.cpp
@@ -180,97 +180,97 @@ void KRFBDecoder::gotServerInit()
180 con->read( &(info->redShift), 1 ); 180 con->read( &(info->redShift), 1 );
181 con->read( &(info->greenShift), 1 ); 181 con->read( &(info->greenShift), 1 );
182 con->read( &(info->blueShift), 1 ); 182 con->read( &(info->blueShift), 1 );
183 183
184 con->read( info->padding, 3 ); 184 con->read( info->padding, 3 );
185 185
186 con->read( &(info->nameLength), 4 ); 186 con->read( &(info->nameLength), 4 );
187 info->nameLength = Swap32IfLE( info->nameLength ); 187 info->nameLength = Swap32IfLE( info->nameLength );
188 188
189 owarn << "Width = " << info->width << ", Height = " << info->height << "" << oendl; 189 owarn << "Width = " << info->width << ", Height = " << info->height << "" << oendl;
190 owarn << "Bpp = " << info->bpp << ", Depth = " << info->depth << ", Big = " << info->bigEndian 190 owarn << "Bpp = " << info->bpp << ", Depth = " << info->depth << ", Big = " << info->bigEndian
191 << ", True = " << info->trueColor << oendl; 191 << ", True = " << info->trueColor << oendl;
192 owarn << "RedMax = " << info->redMax << ", GreenMax = " << info->greenMax << ", BlueMax = " << info->blueMax << oendl; 192 owarn << "RedMax = " << info->redMax << ", GreenMax = " << info->greenMax << ", BlueMax = " << info->blueMax << oendl;
193 owarn << "RedShift = " << info->redShift << ", GreenShift = " << info->greenShift 193 owarn << "RedShift = " << info->redShift << ", GreenShift = " << info->greenShift
194 << ", BlueShift = " << info-> blueShift << oendl; 194 << ", BlueShift = " << info-> blueShift << oendl;
195 195
196 buf->resize( info->width/con->options()->scaleFactor, info->height /con->options()->scaleFactor); 196 buf->resize( info->width/con->options()->scaleFactor, info->height /con->options()->scaleFactor);
197 197
198 // Wait for desktop name 198 // Wait for desktop name
199 owarn << "Waiting for desktop name" << oendl; 199 owarn << "Waiting for desktop name" << oendl;
200 200
201 static QString statusMsg = tr( "Waiting for desktop name..." ); 201 static QString statusMsg = tr( "Waiting for desktop name..." );
202 emit status( statusMsg ); 202 emit status( statusMsg );
203 203
204 currentState = AwaitingDesktopName; 204 currentState = AwaitingDesktopName;
205 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotDesktopName() ) ); 205 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotDesktopName() ) );
206 con->waitForData( info->nameLength ); 206 con->waitForData( info->nameLength );
207} 207}
208 208
209void KRFBDecoder::gotDesktopName() 209void KRFBDecoder::gotDesktopName()
210{ 210{
211 assert( info ); 211 assert( info );
212 assert( currentState == AwaitingDesktopName ); 212 assert( currentState == AwaitingDesktopName );
213 213
214 owarn << "Got desktop name" << oendl; 214 owarn << "Got desktop name" << oendl;
215 215
216 disconnect( con, SIGNAL( gotEnoughData() ), 216 disconnect( con, SIGNAL( gotEnoughData() ),
217 this, SLOT( gotDesktopName() ) ); 217 this, SLOT( gotDesktopName() ) );
218 218
219 char *buf = new char[ info->nameLength + 1 ]; 219 char *buf = new char[ info->nameLength + 1 ];
220 CHECK_PTR( buf ); 220 CHECK_PTR( buf );
221 221
222 con->read( buf, info->nameLength ); 222 con->read( buf, info->nameLength );
223 buf[ info->nameLength ] = '\0'; 223 buf[ info->nameLength ] = '\0';
224 info->name = buf; 224 info->name = buf;
225 225
226 owarn << "Desktop: " << info->name.latin1() << "" << oendl; 226 owarn << "Desktop: " << info->name.latin1() << "" << oendl;
227 227
228 delete buf; 228 delete [] buf;
229 229
230 // Get the format we'll really use and tell the server 230 // Get the format we'll really use and tell the server
231 decidePixelFormat(); 231 decidePixelFormat();
232 sendPixelFormat(); 232 sendPixelFormat();
233 sendAllowedEncodings(); 233 sendAllowedEncodings();
234 currentState = Idle; 234 currentState = Idle;
235 235
236 QString msg; 236 QString msg;
237 msg = tr( "Connected to %1" ); 237 msg = tr( "Connected to %1" );
238 msg = msg.arg( info->name ); 238 msg = msg.arg( info->name );
239 emit status( msg ); 239 emit status( msg );
240 240
241 sendUpdateRequest( false ); 241 sendUpdateRequest( false );
242} 242}
243 243
244void KRFBDecoder::decidePixelFormat() 244void KRFBDecoder::decidePixelFormat()
245{ 245{
246 assert( info ); 246 assert( info );
247 247
248 if ( format ) 248 if ( format )
249 delete format; 249 delete format;
250 format = new KRFBPixelFormat; 250 format = new KRFBPixelFormat;
251 CHECK_PTR( format ); 251 CHECK_PTR( format );
252 252
253 // What depth do we want? 253 // What depth do we want?
254 // 254 //
255 // We'll use the minimum of the remote and local depths, UNLESS an 255 // We'll use the minimum of the remote and local depths, UNLESS an
256 // eight bit session has been specifically requested by the user. 256 // eight bit session has been specifically requested by the user.
257 int screenDepth = QPixmap::defaultDepth(); 257 int screenDepth = QPixmap::defaultDepth();
258 int bestDepth = ( screenDepth > info->depth ) ? info->depth : screenDepth; 258 int bestDepth = ( screenDepth > info->depth ) ? info->depth : screenDepth;
259 int chosenDepth; 259 int chosenDepth;
260 260
261 if ( con->options()->colors256 ) 261 if ( con->options()->colors256 )
262 chosenDepth = 8; 262 chosenDepth = 8;
263 else 263 else
264 chosenDepth = bestDepth; 264 chosenDepth = bestDepth;
265 265
266 owarn << "Screen depth=" << screenDepth << ", server depth=" << info->depth 266 owarn << "Screen depth=" << screenDepth << ", server depth=" << info->depth
267 << ", best depth=" << bestDepth << "eight bit " << con->options()->colors256 267 << ", best depth=" << bestDepth << "eight bit " << con->options()->colors256
268 << ", chosenDepth=" << chosenDepth << oendl; 268 << ", chosenDepth=" << chosenDepth << oendl;
269 269
270 format->depth = chosenDepth; 270 format->depth = chosenDepth;
271 271
272 // If we're using the servers native depth 272 // If we're using the servers native depth
273 if ( chosenDepth == info->depth ) { 273 if ( chosenDepth == info->depth ) {
274 // Use the servers native format 274 // Use the servers native format
275 format->bpp = info->bpp; 275 format->bpp = info->bpp;
276 // format->bigEndian = info->bigEndian; 276 // format->bigEndian = info->bigEndian;
@@ -490,97 +490,97 @@ void KRFBDecoder::handleRawRect()
490 // owarn << "Handling a raw rect chunk" << oendl; 490 // owarn << "Handling a raw rect chunk" << oendl;
491 491
492 // CARD32 lineCount = w * format->bpp / 8; 492 // CARD32 lineCount = w * format->bpp / 8;
493 493
494 if ( h > RectChunkSize ) { 494 if ( h > RectChunkSize ) {
495 // if ( con->sock->size() / lineCount ) { 495 // if ( con->sock->size() / lineCount ) {
496 // getRawRectChunk( con->sock->size() / lineCount ); 496 // getRawRectChunk( con->sock->size() / lineCount );
497 // } 497 // }
498 // else { 498 // else {
499 getRawRectChunk( RectChunkSize ); 499 getRawRectChunk( RectChunkSize );
500 // } 500 // }
501 } 501 }
502 else { 502 else {
503 getRawRectChunk( h ); 503 getRawRectChunk( h );
504 } 504 }
505} 505}
506 506
507void KRFBDecoder::getRawRectChunk( int lines ) 507void KRFBDecoder::getRawRectChunk( int lines )
508{ 508{
509 this->lines = lines; 509 this->lines = lines;
510 CARD32 count = lines * w * format->bpp / 8; 510 CARD32 count = lines * w * format->bpp / 8;
511 511
512 // Wait for server init 512 // Wait for server init
513 // owarn << "Waiting for raw rect chunk, " << count << "" << oendl; 513 // owarn << "Waiting for raw rect chunk, " << count << "" << oendl;
514 514
515 currentState = AwaitingRawRectChunk; 515 currentState = AwaitingRawRectChunk;
516 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotRawRectChunk() ) ); 516 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotRawRectChunk() ) );
517 con->waitForData( count ); 517 con->waitForData( count );
518} 518}
519 519
520void KRFBDecoder::gotRawRectChunk() 520void KRFBDecoder::gotRawRectChunk()
521{ 521{
522 assert( currentState == AwaitingRawRectChunk ); 522 assert( currentState == AwaitingRawRectChunk );
523 523
524 disconnect( con, SIGNAL( gotEnoughData() ), 524 disconnect( con, SIGNAL( gotEnoughData() ),
525 this, SLOT( gotRawRectChunk() ) ); 525 this, SLOT( gotRawRectChunk() ) );
526 526
527 // owarn << "Got raw rect chunk" << oendl; 527 // owarn << "Got raw rect chunk" << oendl;
528 528
529 // 529 //
530 // Read the rect data and copy it to the buffer. 530 // Read the rect data and copy it to the buffer.
531 // 531 //
532 532
533 // TODO: Replace this! 533 // TODO: Replace this!
534 int count = lines * w * format->bpp / 8; 534 int count = lines * w * format->bpp / 8;
535 char *hack = new char[ count ]; 535 char *hack = new char[ count ];
536 con->read( hack, count ); 536 con->read( hack, count );
537 buf->drawRawRectChunk( hack, x, y, w, lines ); 537 buf->drawRawRectChunk( hack, x, y, w, lines );
538 delete hack; 538 delete [] hack;
539 // /TODO: 539 // /TODO:
540 540
541 h = h - lines; 541 h = h - lines;
542 y = y + lines; 542 y = y + lines;
543 543
544 if ( h > 0 ) { 544 if ( h > 0 ) {
545 handleRawRect(); 545 handleRawRect();
546 } 546 }
547 else { 547 else {
548 noRects--; 548 noRects--;
549 549
550 // owarn << "There are " << noRects << " rects left" << oendl; 550 // owarn << "There are " << noRects << " rects left" << oendl;
551 551
552 if ( noRects ) { 552 if ( noRects ) {
553 currentState = AwaitingRectHeader; 553 currentState = AwaitingRectHeader;
554 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotRectHeader() ) ); 554 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotRectHeader() ) );
555 con->waitForData( RectHeaderLength ); 555 con->waitForData( RectHeaderLength );
556 } 556 }
557 else { 557 else {
558 // we are now ready for the next update - no need to wait for the timer 558 // we are now ready for the next update - no need to wait for the timer
559 currentState = Idle; 559 currentState = Idle;
560 sendUpdateRequest (1); 560 sendUpdateRequest (1);
561 } 561 }
562 } 562 }
563} 563}
564 564
565// 565//
566// Copy Rectangle Encoding 566// Copy Rectangle Encoding
567// 567//
568 568
569void KRFBDecoder::handleCopyRect() 569void KRFBDecoder::handleCopyRect()
570{ 570{
571 currentState = AwaitingCopyRectPos; 571 currentState = AwaitingCopyRectPos;
572 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotCopyRectPos() ) ); 572 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotCopyRectPos() ) );
573 con->waitForData( CopyRectPosLength ); 573 con->waitForData( CopyRectPosLength );
574} 574}
575 575
576void KRFBDecoder::gotCopyRectPos() 576void KRFBDecoder::gotCopyRectPos()
577{ 577{
578 disconnect( con, SIGNAL( gotEnoughData() ), 578 disconnect( con, SIGNAL( gotEnoughData() ),
579 this, SLOT( gotCopyRectPos() ) ); 579 this, SLOT( gotCopyRectPos() ) );
580 580
581 CARD16 srcX; 581 CARD16 srcX;
582 CARD16 srcY; 582 CARD16 srcY;
583 583
584 con->read( &srcX, 2 ); 584 con->read( &srcX, 2 );
585 con->read( &srcY, 2 ); 585 con->read( &srcY, 2 );
586 586
@@ -683,97 +683,97 @@ void KRFBDecoder::gotServerCut()
683 683
684void KRFBDecoder::gotServerCutLength() 684void KRFBDecoder::gotServerCutLength()
685{ 685{
686 assert( currentState = AwaitingServerCutLength ); 686 assert( currentState = AwaitingServerCutLength );
687 disconnect( con, SIGNAL( gotEnoughData() ), 687 disconnect( con, SIGNAL( gotEnoughData() ),
688 this, SLOT( gotServerCutLength() ) ); 688 this, SLOT( gotServerCutLength() ) );
689 689
690 CARD8 padding[3]; 690 CARD8 padding[3];
691 con->read( padding, 3 ); 691 con->read( padding, 3 );
692 692
693 con->read( &serverCutTextLen, 4 ); 693 con->read( &serverCutTextLen, 4 );
694 serverCutTextLen = Swap32IfLE( serverCutTextLen ); 694 serverCutTextLen = Swap32IfLE( serverCutTextLen );
695 695
696 currentState = AwaitingServerCutText; 696 currentState = AwaitingServerCutText;
697 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotServerCutText() ) ); 697 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotServerCutText() ) );
698 con->waitForData( serverCutTextLen ); 698 con->waitForData( serverCutTextLen );
699} 699}
700 700
701void KRFBDecoder::gotServerCutText() 701void KRFBDecoder::gotServerCutText()
702{ 702{
703 assert( currentState = AwaitingServerCutText ); 703 assert( currentState = AwaitingServerCutText );
704 704
705 disconnect( con, SIGNAL( gotEnoughData() ), 705 disconnect( con, SIGNAL( gotEnoughData() ),
706 this, SLOT( gotServerCutText() ) ); 706 this, SLOT( gotServerCutText() ) );
707 707
708 708
709 // 709 //
710 // Warning: There is a bug in the RFB protocol because there is no way to find 710 // Warning: There is a bug in the RFB protocol because there is no way to find
711 // out the codepage in use on the remote machine. This could be fixed by requiring 711 // out the codepage in use on the remote machine. This could be fixed by requiring
712 // the remote server to use utf8 etc. but for now we have to assume they're the 712 // the remote server to use utf8 etc. but for now we have to assume they're the
713 // same. I've reported this problem to the ORL guys, but they apparantly have no 713 // same. I've reported this problem to the ORL guys, but they apparantly have no
714 // immediate plans to fix the issue. :-( (rich) 714 // immediate plans to fix the issue. :-( (rich)
715 // 715 //
716 716
717 char *cutbuf = new char[ serverCutTextLen + 1 ]; 717 char *cutbuf = new char[ serverCutTextLen + 1 ];
718 CHECK_PTR( cutbuf ); 718 CHECK_PTR( cutbuf );
719 719
720 con->read( cutbuf, serverCutTextLen ); 720 con->read( cutbuf, serverCutTextLen );
721 cutbuf[ serverCutTextLen ] = '\0'; 721 cutbuf[ serverCutTextLen ] = '\0';
722 722
723 /* For some reason QApplication::clipboard()->setText() segfaults when called 723 /* For some reason QApplication::clipboard()->setText() segfaults when called
724 * from within keypebble's mass of signals and slots 724 * from within keypebble's mass of signals and slots
725 owarn << "Server cut: " << cutbuf << "" << oendl; 725 owarn << "Server cut: " << cutbuf << "" << oendl;
726 726
727 QString cutText( cutbuf ); // DANGER!! 727 QString cutText( cutbuf ); // DANGER!!
728 qApp->clipboard()->setText( cutText ); 728 qApp->clipboard()->setText( cutText );
729 */ 729 */
730 730
731 delete cutbuf; 731 delete [] cutbuf;
732 // Now wait for the update (again) 732 // Now wait for the update (again)
733 if ( oldState == AwaitingUpdate ) { 733 if ( oldState == AwaitingUpdate ) {
734 currentState = AwaitingUpdate; 734 currentState = AwaitingUpdate;
735 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotUpdateHeader() ) ); 735 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotUpdateHeader() ) );
736 con->waitForData( UpdateHeaderLength ); 736 con->waitForData( UpdateHeaderLength );
737 } 737 }
738 else if ( oldState == Idle ) { 738 else if ( oldState == Idle ) {
739 currentState = Idle; 739 currentState = Idle;
740 } 740 }
741 else { 741 else {
742 owarn << "Async handled in weird state" << oendl; 742 owarn << "Async handled in weird state" << oendl;
743 currentState = oldState; 743 currentState = oldState;
744 }; 744 };
745} 745}
746 746
747void KRFBDecoder::gotBell() 747void KRFBDecoder::gotBell()
748{ 748{
749 owarn << "Got server bell" << oendl; 749 owarn << "Got server bell" << oendl;
750 buf->soundBell(); 750 buf->soundBell();
751 751
752 // Now wait for the update (again) 752 // Now wait for the update (again)
753 if ( oldState == AwaitingUpdate ) { 753 if ( oldState == AwaitingUpdate ) {
754 currentState = AwaitingUpdate; 754 currentState = AwaitingUpdate;
755 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotUpdateHeader() ) ); 755 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotUpdateHeader() ) );
756 con->waitForData( UpdateHeaderLength ); 756 con->waitForData( UpdateHeaderLength );
757 } 757 }
758 else if ( oldState == Idle ) { 758 else if ( oldState == Idle ) {
759 currentState = Idle; 759 currentState = Idle;
760 } 760 }
761 else { 761 else {
762 owarn << "Async handled in weird state" << oendl; 762 owarn << "Async handled in weird state" << oendl;
763 currentState = oldState; 763 currentState = oldState;
764 }; 764 };
765} 765}
766 766
767void KRFBDecoder::sendKeyPressEvent( QKeyEvent *event ) 767void KRFBDecoder::sendKeyPressEvent( QKeyEvent *event )
768{ 768{
769 int key; 769 int key;
770 key = toKeySym( event ); 770 key = toKeySym( event );
771 if ( key ) { 771 if ( key ) {
772 key = Swap32IfLE( key ); 772 key = Swap32IfLE( key );
773 773
774 CARD8 mask = true; 774 CARD8 mask = true;
775 775
776 CARD16 padding = 0; 776 CARD16 padding = 0;
777 con->write( &KeyEventId, 1 ); 777 con->write( &KeyEventId, 1 );
778 con->write( &mask, 1 ); 778 con->write( &mask, 1 );
779 con->write( &padding, 2 ); 779 con->write( &padding, 2 );
diff --git a/noncore/games/sfcave/sfcave.cpp b/noncore/games/sfcave/sfcave.cpp
index a6c92a0..516dc93 100644
--- a/noncore/games/sfcave/sfcave.cpp
+++ b/noncore/games/sfcave/sfcave.cpp
@@ -953,97 +953,97 @@ void SFCave :: saveReplay()
953 fwrite( (const char *)val, 1, val.length(), out ); 953 fwrite( (const char *)val, 1, val.length(), out );
954 954
955 fclose( out ); 955 fclose( out );
956 956
957 printf( "Replay saved to %s\n", QFile::encodeName(replayFile).data() ); 957 printf( "Replay saved to %s\n", QFile::encodeName(replayFile).data() );
958 958
959} 959}
960 960
961void SFCave :: loadReplay() 961void SFCave :: loadReplay()
962{ 962{
963 FILE *in = fopen( QFile::encodeName(replayFile).data() , "r" ); 963 FILE *in = fopen( QFile::encodeName(replayFile).data() , "r" );
964 964
965 if ( in == 0 ) 965 if ( in == 0 )
966 { 966 {
967 printf( "Couldn't load replay file!\n" ); 967 printf( "Couldn't load replay file!\n" );
968 return; 968 return;
969 } 969 }
970 970
971 // Read next line - contains the size of the options 971 // Read next line - contains the size of the options
972 char line[10+1]; 972 char line[10+1];
973 fgets( line, 10, in ); 973 fgets( line, 10, in );
974 974
975 int length = -1; 975 int length = -1;
976 sscanf( line, "%d", &length ); 976 sscanf( line, "%d", &length );
977 char *data = new char[length+1]; 977 char *data = new char[length+1];
978 978
979 fread( data, 1, length, in ); 979 fread( data, 1, length, in );
980// printf( "data - %s", data ); 980// printf( "data - %s", data );
981 981
982 QString sep = " "; 982 QString sep = " ";
983 QStringList list = QStringList::split( sep, QString( data ) ); 983 QStringList list = QStringList::split( sep, QString( data ) );
984 984
985 // print it out 985 // print it out
986 QStringList::Iterator it = list.begin(); 986 QStringList::Iterator it = list.begin();
987 currentSeed = (*it).toInt(); 987 currentSeed = (*it).toInt();
988 ++it; 988 ++it;
989 currentGameType = (*it).toInt(); 989 currentGameType = (*it).toInt();
990 ++it; 990 ++it;
991 currentGameDifficulty = (*it).toInt(); 991 currentGameDifficulty = (*it).toInt();
992 ++it; 992 ++it;
993 993
994 replayList.clear(); 994 replayList.clear();
995 for ( ; it != list.end(); ++it ) 995 for ( ; it != list.end(); ++it )
996 { 996 {
997 int v = (*it).toInt(); 997 int v = (*it).toInt();
998 replayList.append( new int( v ) ); 998 replayList.append( new int( v ) );
999 } 999 }
1000 1000
1001 delete data; 1001 delete [] data;
1002 1002
1003 fclose( in ); 1003 fclose( in );
1004 1004
1005 printf( "Replay loaded from %s\n", QFile::encodeName(replayFile).data() ); 1005 printf( "Replay loaded from %s\n", QFile::encodeName(replayFile).data() );
1006} 1006}
1007 1007
1008 1008
1009//--------------- MENU CODE --------------------- 1009//--------------- MENU CODE ---------------------
1010void SFCave :: handleMenuKeys( QKeyEvent *e ) 1010void SFCave :: handleMenuKeys( QKeyEvent *e )
1011{ 1011{
1012 switch( e->key() ) 1012 switch( e->key() )
1013 { 1013 {
1014 case Qt::Key_Down: 1014 case Qt::Key_Down:
1015 currentMenuOption[currentMenuNr] ++; 1015 currentMenuOption[currentMenuNr] ++;
1016 if ( menuOptions[currentMenuNr][currentMenuOption[currentMenuNr]] == "" ) 1016 if ( menuOptions[currentMenuNr][currentMenuOption[currentMenuNr]] == "" )
1017 currentMenuOption[currentMenuNr] = 0; 1017 currentMenuOption[currentMenuNr] = 0;
1018 break; 1018 break;
1019 case Qt::Key_Up: 1019 case Qt::Key_Up:
1020 currentMenuOption[currentMenuNr] --; 1020 currentMenuOption[currentMenuNr] --;
1021 if ( currentMenuOption[currentMenuNr] < 0 ) 1021 if ( currentMenuOption[currentMenuNr] < 0 )
1022 currentMenuOption[currentMenuNr] = nrMenuOptions[currentMenuNr]-1; 1022 currentMenuOption[currentMenuNr] = nrMenuOptions[currentMenuNr]-1;
1023 break; 1023 break;
1024 1024
1025 case Qt::Key_Left: 1025 case Qt::Key_Left:
1026 if ( currentMenuNr == MENU_OPTIONS_MENU ) 1026 if ( currentMenuNr == MENU_OPTIONS_MENU )
1027 { 1027 {
1028 if ( currentMenuOption[currentMenuNr] == MENU_GAME_TYPE ) 1028 if ( currentMenuOption[currentMenuNr] == MENU_GAME_TYPE )
1029 { 1029 {
1030 currentGameType --; 1030 currentGameType --;
1031 if ( currentGameType < 0 ) 1031 if ( currentGameType < 0 )
1032 currentGameType = NR_GAME_TYPES - 1; 1032 currentGameType = NR_GAME_TYPES - 1;
1033 } 1033 }
1034 else if ( currentMenuOption[currentMenuNr] == MENU_GAME_DIFFICULTY ) 1034 else if ( currentMenuOption[currentMenuNr] == MENU_GAME_DIFFICULTY )
1035 { 1035 {
1036 currentGameDifficulty --; 1036 currentGameDifficulty --;
1037 if ( currentGameDifficulty < 0 ) 1037 if ( currentGameDifficulty < 0 )
1038 currentGameDifficulty = NR_GAME_DIFFICULTIES - 1; 1038 currentGameDifficulty = NR_GAME_DIFFICULTIES - 1;
1039 } 1039 }
1040 } 1040 }
1041 break; 1041 break;
1042 1042
1043 case Qt::Key_Right: 1043 case Qt::Key_Right:
1044 if ( currentMenuNr == MENU_OPTIONS_MENU ) 1044 if ( currentMenuNr == MENU_OPTIONS_MENU )
1045 { 1045 {
1046 if ( currentMenuOption[currentMenuNr] == MENU_GAME_TYPE ) 1046 if ( currentMenuOption[currentMenuNr] == MENU_GAME_TYPE )
1047 { 1047 {
1048 currentGameType ++; 1048 currentGameType ++;
1049 if ( currentGameType == NR_GAME_TYPES ) 1049 if ( currentGameType == NR_GAME_TYPES )
diff --git a/noncore/settings/aqpkg/settingsimpl.cpp b/noncore/settings/aqpkg/settingsimpl.cpp
index 7ffa1d6..0886e69 100644
--- a/noncore/settings/aqpkg/settingsimpl.cpp
+++ b/noncore/settings/aqpkg/settingsimpl.cpp
@@ -302,97 +302,97 @@ void SettingsImpl :: editServer( int sel )
302 } 302 }
303 else 303 else
304 { 304 {
305 serverName = ""; 305 serverName = "";
306 servername->setText( "" ); 306 servername->setText( "" );
307 serverurl->setText( "" ); 307 serverurl->setText( "" );
308 active->setChecked( false ); 308 active->setChecked( false );
309 } 309 }
310} 310}
311 311
312void SettingsImpl :: newServer() 312void SettingsImpl :: newServer()
313{ 313{
314 newserver = true; 314 newserver = true;
315 servername->setText( "" ); 315 servername->setText( "" );
316 serverurl->setText( "" ); 316 serverurl->setText( "" );
317 servername->setFocus(); 317 servername->setFocus();
318 active->setChecked( true ); 318 active->setChecked( true );
319} 319}
320 320
321void SettingsImpl :: removeServer() 321void SettingsImpl :: removeServer()
322{ 322{
323 changed = true; 323 changed = true;
324 Server *s = dataMgr->getServer( servers->currentText() ); 324 Server *s = dataMgr->getServer( servers->currentText() );
325 if ( s ) 325 if ( s )
326 { 326 {
327 dataMgr->getServerList().removeRef( s ); 327 dataMgr->getServerList().removeRef( s );
328 servers->removeItem( currentSelectedServer ); 328 servers->removeItem( currentSelectedServer );
329 } 329 }
330} 330}
331 331
332void SettingsImpl :: changeServerDetails() 332void SettingsImpl :: changeServerDetails()
333{ 333{
334 changed = true; 334 changed = true;
335 335
336 QString newName = servername->text(); 336 QString newName = servername->text();
337 337
338 // Convert any spaces to underscores 338 // Convert any spaces to underscores
339 char *tmpStr = new char[newName.length() + 1]; 339 char *tmpStr = new char[newName.length() + 1];
340 for ( unsigned int i = 0 ; i < newName.length() ; ++i ) 340 for ( unsigned int i = 0 ; i < newName.length() ; ++i )
341 { 341 {
342 if ( newName[i] == ' ' ) 342 if ( newName[i] == ' ' )
343 tmpStr[i] = '_'; 343 tmpStr[i] = '_';
344 else 344 else
345 tmpStr[i] = newName[i].latin1(); 345 tmpStr[i] = newName[i].latin1();
346 } 346 }
347 tmpStr[newName.length()] = '\0'; 347 tmpStr[newName.length()] = '\0';
348 348
349 newName = tmpStr; 349 newName = tmpStr;
350 delete tmpStr; 350 delete [] tmpStr;
351 351
352 if ( !newserver ) 352 if ( !newserver )
353 { 353 {
354 Server *s = dataMgr->getServer( servers->currentText() ); 354 Server *s = dataMgr->getServer( servers->currentText() );
355 if ( s ) 355 if ( s )
356 { 356 {
357 // Update url 357 // Update url
358 s->setServerUrl( serverurl->text() ); 358 s->setServerUrl( serverurl->text() );
359 s->setActive( active->isChecked() ); 359 s->setActive( active->isChecked() );
360 360
361 // Check if server name has changed, if it has then we need to replace the key in the map 361 // Check if server name has changed, if it has then we need to replace the key in the map
362 if ( serverName != newName ) 362 if ( serverName != newName )
363 { 363 {
364 // Update server name 364 // Update server name
365 s->setServerName( newName ); 365 s->setServerName( newName );
366 } 366 }
367 367
368 // Update list box 368 // Update list box
369 servers->changeItem( newName, currentSelectedServer ); 369 servers->changeItem( newName, currentSelectedServer );
370 } 370 }
371 } 371 }
372 else 372 else
373 { 373 {
374 Server s( newName, serverurl->text() ); 374 Server s( newName, serverurl->text() );
375 dataMgr->getServerList().append( new Server( newName, serverurl->text() ) ); 375 dataMgr->getServerList().append( new Server( newName, serverurl->text() ) );
376 dataMgr->getServerList().last()->setActive( active->isChecked() ); 376 dataMgr->getServerList().last()->setActive( active->isChecked() );
377 servers->insertItem( newName ); 377 servers->insertItem( newName );
378 servers->setCurrentItem( servers->count() ); 378 servers->setCurrentItem( servers->count() );
379 newserver = false; 379 newserver = false;
380 } 380 }
381} 381}
382 382
383//------------------ Destinations tab ---------------------- 383//------------------ Destinations tab ----------------------
384 384
385void SettingsImpl :: editDestination( int sel ) 385void SettingsImpl :: editDestination( int sel )
386{ 386{
387 currentSelectedDestination = sel; 387 currentSelectedDestination = sel;
388 Destination *d = dataMgr->getDestination( destinations->currentText() ); 388 Destination *d = dataMgr->getDestination( destinations->currentText() );
389 if ( d ) 389 if ( d )
390 { 390 {
391 destinationName = d->getDestinationName(); 391 destinationName = d->getDestinationName();
392 destinationname->setText( d->getDestinationName() ); 392 destinationname->setText( d->getDestinationName() );
393 destinationurl->setText( d->getDestinationPath() ); 393 destinationurl->setText( d->getDestinationPath() );
394 linkToRoot->setChecked( d->linkToRoot() ); 394 linkToRoot->setChecked( d->linkToRoot() );
395 } 395 }
396 else 396 else
397 { 397 {
398 destinationName = ""; 398 destinationName = "";
diff --git a/noncore/settings/aqpkg/version.cpp b/noncore/settings/aqpkg/version.cpp
index 59e6f3f..ce2de7b 100644
--- a/noncore/settings/aqpkg/version.cpp
+++ b/noncore/settings/aqpkg/version.cpp
@@ -1,89 +1,89 @@
1/* 1/*
2 * libdpkg - Debian packaging suite library routines 2 * libdpkg - Debian packaging suite library routines
3 * vercmp.c - comparison of version numbers 3 * vercmp.c - comparison of version numbers
4 * 4 *
5 * Copyright (C) 1995 Ian Jackson <iwj10@cus.cam.ac.uk> 5 * Copyright (C) 1995 Ian Jackson <iwj10@cus.cam.ac.uk>
6 * 6 *
7 * This is free software; you can redistribute it and/or modify 7 * This is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as 8 * it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2, 9 * published by the Free Software Foundation; either version 2,
10 * or (at your option) any later version. 10 * or (at your option) any later version.
11 * 11 *
12 * This is distributed in the hope that it will be useful, but 12 * This is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of 13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details. 15 * GNU General Public License for more details.
16 * 16 *
17 * You should have received a copy of the GNU General Public 17 * You should have received a copy of the GNU General Public
18 * License along with dpkg; if not, write to the Free Software 18 * License along with dpkg; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */ 20 */
21#include <stdio.h> 21#include <stdio.h>
22#include <stdlib.h> 22#include <stdlib.h>
23#include <ctype.h> 23#include <ctype.h>
24#include <string.h> 24#include <string.h>
25 25
26#include <qobject.h> 26#include <qobject.h>
27 27
28//# define _(Text) Text 28//# define _(Text) Text
29 29
30class versionrevision 30class versionrevision
31{ 31{
32public: 32public:
33 versionrevision() 33 versionrevision()
34 { 34 {
35 version = 0; 35 version = 0;
36 } 36 }
37 37
38 ~versionrevision() 38 ~versionrevision()
39 { 39 {
40 if ( version ) 40 if ( version )
41 delete version; 41 delete [] version;
42 } 42 }
43 43
44 void setVersion( const char *str ) 44 void setVersion( const char *str )
45 { 45 {
46 version = new char[(strlen(str)+1)]; 46 version = new char[(strlen(str)+1)];
47 strcpy( version, str ); 47 strcpy( version, str );
48 } 48 }
49 49
50 unsigned long epoch; 50 unsigned long epoch;
51 char *version; 51 char *version;
52 const char *revision; 52 const char *revision;
53 const char *familiar_revision; 53 const char *familiar_revision;
54}; 54};
55 55
56static int verrevcmp(const char *val, const char *ref) 56static int verrevcmp(const char *val, const char *ref)
57{ 57{
58 int vc, rc; 58 int vc, rc;
59 long vl, rl; 59 long vl, rl;
60 const char *vp, *rp; 60 const char *vp, *rp;
61 61
62 if (!val) val= ""; 62 if (!val) val= "";
63 if (!ref) ref= ""; 63 if (!ref) ref= "";
64 for (;;) { 64 for (;;) {
65 vp= val; while (*vp && !isdigit(*vp)) vp++; 65 vp= val; while (*vp && !isdigit(*vp)) vp++;
66 rp= ref; while (*rp && !isdigit(*rp)) rp++; 66 rp= ref; while (*rp && !isdigit(*rp)) rp++;
67 for (;;) { 67 for (;;) {
68 vc= val == vp ? 0 : *val++; 68 vc= val == vp ? 0 : *val++;
69 rc= ref == rp ? 0 : *ref++; 69 rc= ref == rp ? 0 : *ref++;
70 if (!rc && !vc) break; 70 if (!rc && !vc) break;
71 if (vc && !isalpha(vc)) vc += 256; /* assumes ASCII character set */ 71 if (vc && !isalpha(vc)) vc += 256; /* assumes ASCII character set */
72 if (rc && !isalpha(rc)) rc += 256; 72 if (rc && !isalpha(rc)) rc += 256;
73 if (vc != rc) return vc - rc; 73 if (vc != rc) return vc - rc;
74 } 74 }
75 val= vp; 75 val= vp;
76 ref= rp; 76 ref= rp;
77 vl=0; if (isdigit(*vp)) vl= strtol(val,(char**)&val,10); 77 vl=0; if (isdigit(*vp)) vl= strtol(val,(char**)&val,10);
78 rl=0; if (isdigit(*rp)) rl= strtol(ref,(char**)&ref,10); 78 rl=0; if (isdigit(*rp)) rl= strtol(ref,(char**)&ref,10);
79 if (vl != rl) return vl - rl; 79 if (vl != rl) return vl - rl;
80 if (!*val && !*ref) return 0; 80 if (!*val && !*ref) return 0;
81 if (!*val) return -1; 81 if (!*val) return -1;
82 if (!*ref) return +1; 82 if (!*ref) return +1;
83 } 83 }
84} 84}
85 85
86int versioncompare(const struct versionrevision *version, 86int versioncompare(const struct versionrevision *version,
87 const struct versionrevision *refversion) 87 const struct versionrevision *refversion)
88{ 88{
89 int r; 89 int r;