Browse Source

Added controlled conversions to char* instead of automatic

ascii conversions. Removed unnecessary conversions to char*.
The definition of -UTQT_NO_ASCII_CAST is no longer needed.

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/1/head
Slávek Banko 2 years ago
parent
commit
40420b140d
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668
  1. 2
      CMakeLists.txt
  2. 2
      kpacman/bitfont.cpp
  3. 6
      kpacman/board.cpp
  4. 16
      kpacman/keys.cpp
  5. 2
      kpacman/kpacmanview.cpp
  6. 24
      kpacman/painter.cpp
  7. 18
      kpacman/referee.cpp
  8. 10
      kpacman/score.cpp
  9. 11
      kpacman/status.cpp

2
CMakeLists.txt

@ -59,7 +59,7 @@ include( ConfigureChecks.cmake )
###### global compiler settings
add_definitions( -DHAVE_CONFIG_H -UTQT_NO_ASCII_CAST )
add_definitions( -DHAVE_CONFIG_H )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TQT_CXX_FLAGS}" )
set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined" )

2
kpacman/bitfont.cpp

@ -26,7 +26,7 @@ TQPixmap Bitfont::text(TQString str, TQColor fg, TQColor bg)
TQPixmap FG(str.length()*fontWidth, fontHeight);
TQBitmap MASK(str.length()*fontWidth, fontHeight, TRUE);
const uchar *s = (const uchar *) str.local8Bit().data();
const uchar *s = str.latin1();
for (uint i = 0; i < str.length(); i++) {
if (font.width() == font.height())
bitBlt(&MASK, i*fontWidth, 0, &font,

6
kpacman/board.cpp

@ -58,7 +58,7 @@ void Board::init(Image image, TQString levelName)
"or could not be opened for reading.");
msg.replace(TQRegExp("@LEVELNAME@"), levelName);
// TQMessageBox::information(0, i18n("Initialization Error"), msg);
printf("%s\n", msg.local8Bit());
printf("%s\n", msg.local8Bit().data());
} else {
map.fill(' ', BoardHeight*BoardWidth);
int height = 0;
@ -75,7 +75,7 @@ void Board::init(Image image, TQString levelName)
map.replace(height*BoardWidth,
(line.length() > BoardWidth) ? BoardWidth : line.length(),
line.local8Bit());
line.latin1());
height++;
}
@ -93,7 +93,7 @@ void Board::init(Image image, TQString levelName)
break;
case Level : setup(demo_bits);
break;
case File : setup((uchar *) map.local8Bit().data());
case File : setup(map.latin1());
break;
default : break;
}

16
kpacman/keys.cpp

@ -162,28 +162,28 @@ void PKeys::defaults()
void PKeys::init()
{
TQString up("Up");
up = kapp->config()->readEntry("upKey", (const char*) up);
up = kapp->config()->readEntry("upKey", up);
labels[0]->setText(up);
TQString down("Down");
down = kapp->config()->readEntry("downKey", (const char*) down);
down = kapp->config()->readEntry("downKey", down);
labels[1]->setText(down);
TQString left("Left");
left = kapp->config()->readEntry("leftKey", (const char*) left);
left = kapp->config()->readEntry("leftKey", left);
labels[2]->setText(left);
TQString right("Right");
right = kapp->config()->readEntry("rightKey", (const char*) right);
right = kapp->config()->readEntry("rightKey", right);
labels[3]->setText(right);
}
void PKeys::ok()
{
kapp->config()->writeEntry("upKey", (const char*) labels[0]->text() );
kapp->config()->writeEntry("downKey", (const char*) labels[1]->text() );
kapp->config()->writeEntry("leftKey", (const char*) labels[2]->text() );
kapp->config()->writeEntry("rightKey",(const char*) labels[3]->text() );
kapp->config()->writeEntry("upKey", labels[0]->text() );
kapp->config()->writeEntry("downKey", labels[1]->text() );
kapp->config()->writeEntry("leftKey", labels[2]->text() );
kapp->config()->writeEntry("rightKey", labels[3]->text() );
kapp->config()->sync();
accept();

2
kpacman/kpacmanview.cpp

@ -120,7 +120,7 @@ void KpacmanView::confScheme()
"or is of an unknown format.");
msg.replace(TQRegExp("@FONTNAME@"), fontName);
// TQMessageBox::critical(this, i18n("Initialization Error"), msg);
printf("%s\n", msg.local8Bit());
printf("%s\n", msg.local8Bit().data());
}
}

24
kpacman/painter.cpp

@ -70,7 +70,7 @@ TQPtrList<TQPixmap> *Painter::loadPixmap(TQWidget *parent, TQString pixmapName,
"or is of an unknown format.");
msg.replace(TQRegExp("@PIXMAPNAME@"), pixmapName);
// TQMessageBox::critical(parent, i18n("Initialization Error"), msg);
printf("%s\n", msg.local8Bit());
printf("%s\n", msg.local8Bit().data());
return 0;
}
@ -389,8 +389,8 @@ void Painter::initPixmaps()
}
if (lastFruitScorePixmapName != fruitScorePixmapName.at(level) ||
(const char *) *fruitScorePixmapName.at(level) == '\0') {
if ((const char *) *fruitScorePixmapName.at(level) == '\0') {
*fruitScorePixmapName.at(level) == '\0') {
if (*fruitScorePixmapName.at(level) == '\0') {
fruitScorePix = textPixmap(fruitScoreString, fruitScorePix, PINK);
} else {
fruitScorePix = loadPixmap(w, fruitScorePixmapName.at(level),
@ -400,8 +400,8 @@ void Painter::initPixmaps()
}
if (lastMonsterScorePixmapName != monsterScorePixmapName.at(level) ||
(const char *) *monsterScorePixmapName.at(level) == '\0') {
if ((const char *) *monsterScorePixmapName.at(level) == '\0') {
*monsterScorePixmapName.at(level) == '\0') {
if (*monsterScorePixmapName.at(level) == '\0') {
monsterScorePix = textPixmap(monsterScoreString, monsterScorePix, CYAN);
} else {
monsterScorePix = loadPixmap(w, monsterScorePixmapName.at(level),
@ -654,7 +654,7 @@ TQString Painter::decodeHexOctString(TQString s)
c = '\0';
len = 0;
value = s.mid(pos+leadin, 3);
ptr = (const char *) value;
ptr = value.latin1();
while (*ptr != '\0' && (v = valids.find(*ptr++, 0, FALSE)) != -1) {
c = (c * valids.length()) + v;
@ -692,7 +692,7 @@ void Painter::fillScoreString(TQStrList &list, TQMemArray<int> &values)
s.insert(0, char (values[i] / 1000 + 0x10));
}
list.append(s.local8Bit());
list.append(s.latin1());
}
}
@ -739,7 +739,7 @@ void Painter::fillStrList(TQStrList &list, TQString values, int max)
}
if (!value.isEmpty())
last = decodeHexOctString(value);
list.append(last);
list.append(last.latin1());
}
}
@ -763,8 +763,8 @@ void Painter::fillPixmapName(TQStrList &pixmapName)
fileInfo.setFile(pixmap);
if (!fileInfo.isReadable() || !fileInfo.isFile())
pixmap = "";
pixmapName.append(pixmap);
pixmapName.append(pixmap.utf8());
}
}
@ -897,9 +897,9 @@ void Painter::confScheme()
confScoring(FALSE);
}
if ((const char *) *fruitScoreString.at(0) == '\0')
if (*fruitScoreString.at(0) == '\0')
fillScoreString(fruitScoreString, fruitScore);
if ((const char *) *monsterScoreString.at(0) == '\0')
if (*monsterScoreString.at(0) == '\0')
fillScoreString(monsterScoreString, monsterScore);
fillPixmapName(pointPixmapName);

18
kpacman/referee.cpp

@ -408,19 +408,19 @@ void Referee::repaintFigures()
void Referee::initKeys()
{
TQString up("Up");
up = kapp->config()->readEntry("upKey", (const char*) up);
up = kapp->config()->readEntry("upKey", up);
UpKey = TDEAccel::stringToKey(up);
TQString down("Down");
down = kapp->config()->readEntry("downKey", (const char*) down);
down = kapp->config()->readEntry("downKey", down);
DownKey = TDEAccel::stringToKey(down);
TQString left("Left");
left = kapp->config()->readEntry("leftKey", (const char*) left);
left = kapp->config()->readEntry("leftKey", left);
LeftKey = TDEAccel::stringToKey(left);
TQString right("Right");
right = kapp->config()->readEntry("rightKey", (const char*) right);
right = kapp->config()->readEntry("rightKey", right);
RightKey = TDEAccel::stringToKey(right);
}
@ -471,7 +471,7 @@ void Referee::fillStrList(TQStrList &list, TQString values, int max)
if (!value.isEmpty())
last = value;
list.append(last);
list.append(last.latin1());
}
}
@ -495,8 +495,8 @@ void Referee::fillMapName()
fileInfo.setFile(map);
if (!fileInfo.isReadable())
map = "";
mapName.append(map);
mapName.append(map.utf8());
}
}
@ -901,10 +901,10 @@ void Referee::introPaint(int t)
case 12 : repaint(pix->draw(38, 28, RoomPix, i18n("\"CLYDE\""), ORANGE, TQColor(), AlignLeft), FALSE);
break;
case 13 : pts.sprintf("%d", pointScore);
repaint(pix->draw(28, 44, RoomPix, pts.local8Bit(), WHITE, TQColor(), AlignRight), FALSE);
repaint(pix->draw(28, 44, RoomPix, pts, WHITE, TQColor(), AlignRight), FALSE);
repaint(pix->draw(31, 44, RoomPix, "\x1C\x1D\x1E", WHITE, TQColor(), AlignLeft), FALSE);
pts.sprintf("%d", energizerScore);
repaint(pix->draw(28, 48, RoomPix, pts.local8Bit(), WHITE, TQColor(), AlignRight), FALSE);
repaint(pix->draw(28, 48, RoomPix, pts, WHITE, TQColor(), AlignRight), FALSE);
repaint(pix->draw(31, 48, RoomPix, "\x1C\x1D\x1E", WHITE, TQColor(), AlignLeft), FALSE);
break;
case 14 : // "@ 1980 MIDWAY MFG.CO."

10
kpacman/score.cpp

@ -128,7 +128,7 @@ void Score::paintEvent( TQPaintEvent *e)
for (int i = 0; i < 10; i++) {
s.sprintf("%2d%9d %-3.3s %-8.8s",
i+1, hallOfFame[i].points, hallOfFame[i].name.utf8().data(),
formatDate(hallOfFame[i].moment.date()).utf8());
formatDate(hallOfFame[i].moment.date()).utf8().data());
if (rect(1, (11+i)*1.25, s).intersects(e->rect())) {
TQPixmap pix = bitfont->text(s, (i == lastScore) ? YELLOW : WHITE, BLACK);
bitBlt(this, x(1), y((11+i)*1.25), &pix);
@ -250,19 +250,19 @@ void Score::keyPressEvent(TQKeyEvent *k)
void Score::initKeys()
{
TQString up("Up");
up = kapp->config()->readEntry("upKey", (const char*) up);
up = kapp->config()->readEntry("upKey", up);
UpKey = TDEAccel::stringToKey(up);
TQString down("Down");
down = kapp->config()->readEntry("downKey", (const char*) down);
down = kapp->config()->readEntry("downKey", down);
DownKey = TDEAccel::stringToKey(down);
TQString left("Left");
left = kapp->config()->readEntry("leftKey", (const char*) left);
left = kapp->config()->readEntry("leftKey", left);
LeftKey = TDEAccel::stringToKey(left);
TQString right("Right");
right = kapp->config()->readEntry("rightKey", (const char*) right);
right = kapp->config()->readEntry("rightKey", right);
RightKey = TDEAccel::stringToKey(right);
}

11
kpacman/status.cpp

@ -42,8 +42,7 @@ TQPtrList<TQPixmap> *Status::loadPixmap(TQWidget *parent, TQString pixmapName,
"The file '@PIXMAPNAME@' does not exist,\n"
"or is of an unknown format.");
msg.replace(TQRegExp("@PIXMAPNAME@"), pixmapName);
TQMessageBox::information(parent, i18n("Initialization Error"),
(const char *) msg);
TQMessageBox::information(parent, i18n("Initialization Error"), msg);
return 0;
}
@ -122,7 +121,7 @@ TQString Status::decodeHexOctString(TQString s)
c = '\0';
len = 0;
value = s.mid(pos+leadin, 3);
ptr = (const char *) value;
ptr = value.latin1();
while (*ptr != '\0' && (v = valids.find(*ptr++, 0, FALSE)) != -1) {
c = (c * valids.length()) + v;
@ -179,7 +178,7 @@ void Status::fillStrList(TQStrList &list, TQString values, int max)
}
if (!value.isEmpty())
last = decodeHexOctString(value);
list.append(last);
list.append(last.latin1());
}
}
@ -203,8 +202,8 @@ void Status::fillPixmapName(TQStrList &pixmapName)
fileInfo.setFile(pixmap);
if (!fileInfo.isReadable() || !fileInfo.isFile())
pixmap = "";
pixmapName.append(pixmap);
pixmapName.append(pixmap.utf8());
}
}

Loading…
Cancel
Save