summaryrefslogtreecommitdiff
path: root/noncore/apps/tinykate
authorerik <erik>2007-01-29 21:53:48 (UTC)
committer erik <erik>2007-01-29 21:53:48 (UTC)
commit02ef45be75a3024df11365956e1cce6392d9103c (patch) (unidiff)
tree42fd5c909d67a473f57a607e01d32e01b3dd2511 /noncore/apps/tinykate
parentb2c306a99b8dc82c981390f02db859149fac8cf0 (diff)
downloadopie-02ef45be75a3024df11365956e1cce6392d9103c.zip
opie-02ef45be75a3024df11365956e1cce6392d9103c.tar.gz
opie-02ef45be75a3024df11365956e1cce6392d9103c.tar.bz2
Each file in this commit has an issue where the initial value of a variable
is assumed to be something but no initial value is given. This commit changes that by either assigning an initial value or removing the assumption on an initial value (usually the former).
Diffstat (limited to 'noncore/apps/tinykate') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/tinykate/libkate/document/katehighlight.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/noncore/apps/tinykate/libkate/document/katehighlight.cpp b/noncore/apps/tinykate/libkate/document/katehighlight.cpp
index 89024f7..ee6030f 100644
--- a/noncore/apps/tinykate/libkate/document/katehighlight.cpp
+++ b/noncore/apps/tinykate/libkate/document/katehighlight.cpp
@@ -1271,133 +1271,135 @@ HlManager *HlManager::self()
1271 1271
1272Highlight *HlManager::getHl(int n) { 1272Highlight *HlManager::getHl(int n) {
1273 if (n < 0 || n >= (int) hlList.count()) n = 0; 1273 if (n < 0 || n >= (int) hlList.count()) n = 0;
1274 return hlList.at(n); 1274 return hlList.at(n);
1275} 1275}
1276 1276
1277int HlManager::defaultHl() { 1277int HlManager::defaultHl() {
1278 KateConfig *config; 1278 KateConfig *config;
1279 config = KGlobal::config(); 1279 config = KGlobal::config();
1280 config->setGroup("General Options"); 1280 config->setGroup("General Options");
1281 1281
1282#warning fixme return nameFind(config->readEntry("Highlight")); 1282#warning fixme return nameFind(config->readEntry("Highlight"));
1283 1283
1284} 1284}
1285 1285
1286 1286
1287int HlManager::nameFind(const QString &name) { 1287int HlManager::nameFind(const QString &name) {
1288 int z; 1288 int z;
1289 1289
1290 for (z = hlList.count() - 1; z > 0; z--) { 1290 for (z = hlList.count() - 1; z > 0; z--) {
1291 if (hlList.at(z)->iName == name) break; 1291 if (hlList.at(z)->iName == name) break;
1292 } 1292 }
1293 return z; 1293 return z;
1294} 1294}
1295 1295
1296int HlManager::wildcardFind(const QString &fileName) { 1296int HlManager::wildcardFind(const QString &fileName) {
1297 Highlight *highlight; 1297 Highlight *highlight;
1298 int p1, p2; 1298 int p1, p2;
1299 QString w; 1299 QString w;
1300 for (highlight = hlList.first(); highlight != 0L; highlight = hlList.next()) { 1300 for (highlight = hlList.first(); highlight != 0L; highlight = hlList.next()) {
1301 p1 = 0; 1301 p1 = 0;
1302 w = highlight->getWildcards(); 1302 w = highlight->getWildcards();
1303 while (p1 < (int) w.length()) { 1303 while (p1 < (int) w.length()) {
1304 p2 = w.find(';',p1); 1304 p2 = w.find(';',p1);
1305 if (p2 == -1) p2 = w.length(); 1305 if (p2 == -1) p2 = w.length();
1306 if (p1 < p2) { 1306 if (p1 < p2) {
1307 QRegExp regExp(w.mid(p1,p2 - p1),true,true); 1307 QRegExp regExp(w.mid(p1,p2 - p1),true,true);
1308 if (regExp.match(fileName) == 0) return hlList.at(); 1308 if (regExp.match(fileName) == 0) return hlList.at();
1309 } 1309 }
1310 p1 = p2 + 1; 1310 p1 = p2 + 1;
1311 } 1311 }
1312 } 1312 }
1313 return -1; 1313 return -1;
1314} 1314}
1315 1315
1316 1316
1317int HlManager::makeAttribs(Highlight *highlight, Attribute *a, int maxAttribs) { 1317int HlManager::makeAttribs(Highlight *highlight, Attribute *a, int maxAttribs) {
1318 ItemStyleList defaultStyleList; 1318 ItemStyleList defaultStyleList;
1319 ItemStyle *defaultStyle; 1319 ItemStyle *defaultStyle = 0;
1320 ItemDataList itemDataList; 1320 ItemDataList itemDataList;
1321 ItemData *itemData; 1321 ItemData *itemData;
1322 int nAttribs, z; 1322 int nAttribs, z;
1323 1323
1324 odebug << "HlManager::makeAttribs" << oendl; 1324 odebug << "HlManager::makeAttribs" << oendl;
1325 1325
1326 defaultStyleList.setAutoDelete(true); 1326 defaultStyleList.setAutoDelete(true);
1327 getDefaults(defaultStyleList); 1327 getDefaults(defaultStyleList);
1328 1328
1329// itemDataList.setAutoDelete(true); 1329// itemDataList.setAutoDelete(true);
1330 highlight->getItemDataList(itemDataList); 1330 highlight->getItemDataList(itemDataList);
1331 nAttribs = itemDataList.count(); 1331 nAttribs = itemDataList.count();
1332 for (z = 0; z < nAttribs; z++) { 1332 for (z = 0; z < nAttribs; z++) {
1333 odebug << "HlManager::makeAttribs: createing one attribute definition" << oendl; 1333 odebug << "HlManager::makeAttribs: creating an attribute definition" << oendl;
1334 itemData = itemDataList.at(z); 1334 itemData = itemDataList.at(z);
1335 if (itemData->defStyle) { 1335 if (itemData->defStyle) {
1336 // default style 1336 // default style
1337 defaultStyle = defaultStyleList.at(itemData->defStyleNum); 1337 defaultStyle = defaultStyleList.at(itemData->defStyleNum);
1338 a[z].col = defaultStyle->col; 1338 a[z].col = defaultStyle->col;
1339 a[z].selCol = defaultStyle->selCol; 1339 a[z].selCol = defaultStyle->selCol;
1340 a[z].bold = defaultStyle->bold; 1340 a[z].bold = defaultStyle->bold;
1341 a[z].italic = defaultStyle->italic; 1341 a[z].italic = defaultStyle->italic;
1342 } else { 1342 } else {
1343 // custom style 1343 // custom style
1344 a[z].col = itemData->col; 1344 a[z].col = itemData->col;
1345 a[z].selCol = itemData->selCol; 1345 a[z].selCol = itemData->selCol;
1346 a[z].bold = itemData->bold; 1346 a[z].bold = itemData->bold;
1347 a[z].italic = itemData->italic; 1347 a[z].italic = itemData->italic;
1348 } 1348 }
1349 } 1349 }
1350 1350
1351 for (; z < maxAttribs; z++) { 1351 for (; z < maxAttribs; z++) {
1352 a[z].col = black; 1352 a[z].col = black;
1353 a[z].selCol = black; 1353 a[z].selCol = black;
1354 a[z].bold = defaultStyle->bold; 1354 if (defaultStyle) {
1355 a[z].italic = defaultStyle->italic; 1355 a[z].bold = defaultStyle->bold;
1356 a[z].italic = defaultStyle->italic;
1357 }
1356 } 1358 }
1357 return nAttribs; 1359 return nAttribs;
1358} 1360}
1359 1361
1360int HlManager::defaultStyles() { 1362int HlManager::defaultStyles() {
1361 return 10; 1363 return 10;
1362} 1364}
1363 1365
1364QString HlManager::defaultStyleName(int n) 1366QString HlManager::defaultStyleName(int n)
1365{ 1367{
1366 static QStringList names; 1368 static QStringList names;
1367 1369
1368 if (names.isEmpty()) 1370 if (names.isEmpty())
1369 { 1371 {
1370 names << i18n("Normal"); 1372 names << i18n("Normal");
1371 names << i18n("Keyword"); 1373 names << i18n("Keyword");
1372 names << i18n("Data Type"); 1374 names << i18n("Data Type");
1373 names << i18n("Decimal/Value"); 1375 names << i18n("Decimal/Value");
1374 names << i18n("Base-N Integer"); 1376 names << i18n("Base-N Integer");
1375 names << i18n("Floating Point"); 1377 names << i18n("Floating Point");
1376 names << i18n("Character"); 1378 names << i18n("Character");
1377 names << i18n("String"); 1379 names << i18n("String");
1378 names << i18n("Comment"); 1380 names << i18n("Comment");
1379 names << i18n("Others"); 1381 names << i18n("Others");
1380 } 1382 }
1381 1383
1382 return names[n]; 1384 return names[n];
1383} 1385}
1384 1386
1385void HlManager::getDefaults(ItemStyleList &list) { 1387void HlManager::getDefaults(ItemStyleList &list) {
1386 KateConfig *config; 1388 KateConfig *config;
1387 int z; 1389 int z;
1388 ItemStyle *i; 1390 ItemStyle *i;
1389 QString s; 1391 QString s;
1390 QRgb col, selCol; 1392 QRgb col, selCol;
1391 1393
1392 list.setAutoDelete(true); 1394 list.setAutoDelete(true);
1393 //ItemStyle(color, selected color, bold, italic) 1395 //ItemStyle(color, selected color, bold, italic)
1394 list.append(new ItemStyle(black,white,false,false)); //normal 1396 list.append(new ItemStyle(black,white,false,false)); //normal
1395 list.append(new ItemStyle(black,white,true,false)); //keyword 1397 list.append(new ItemStyle(black,white,true,false)); //keyword
1396 list.append(new ItemStyle(darkRed,white,false,false)); //datatype 1398 list.append(new ItemStyle(darkRed,white,false,false)); //datatype
1397 list.append(new ItemStyle(blue,cyan,false,false)); //decimal/value 1399 list.append(new ItemStyle(blue,cyan,false,false)); //decimal/value
1398 list.append(new ItemStyle(darkCyan,cyan,false,false)); //base n 1400 list.append(new ItemStyle(darkCyan,cyan,false,false)); //base n
1399 list.append(new ItemStyle(darkMagenta,cyan,false,false));//float 1401 list.append(new ItemStyle(darkMagenta,cyan,false,false));//float
1400 list.append(new ItemStyle(magenta,magenta,false,false)); //char 1402 list.append(new ItemStyle(magenta,magenta,false,false)); //char
1401 list.append(new ItemStyle(red,red,false,false)); //string 1403 list.append(new ItemStyle(red,red,false,false)); //string
1402 list.append(new ItemStyle(darkGray,gray,false,true)); //comment 1404 list.append(new ItemStyle(darkGray,gray,false,true)); //comment
1403 list.append(new ItemStyle(darkGreen,green,false,false)); //others 1405 list.append(new ItemStyle(darkGreen,green,false,false)); //others