String class usage cleanup

svn-id: r23582
This commit is contained in:
Max Horn 2006-07-23 15:08:48 +00:00
parent 602548cea3
commit 4fcdbb9349
6 changed files with 9 additions and 12 deletions

View file

@ -57,21 +57,16 @@ namespace Common {
uint hashit(const char *p) {
uint hash = 0;
byte c;
hash = 0;
while ((c = *p++))
hash = (hash * 31 + c);
return hash;
}
uint hashit_lower(const char *p) {
uint hash = 0;
byte c;
while ((c = *p++))
hash = (hash * 31 + tolower(c));
return hash;
}

View file

@ -47,6 +47,8 @@
#include "gob/util.h"
#include "gob/music.h"
#include "sound/mididrv.h"
namespace Gob {
enum {
@ -228,7 +230,7 @@ int GobEngine::init() {
else
error("GobEngine::init(): Unknown version of game engine");
if ((_features & Gob::GF_MAC) || (_features & Gob::GF_GOB1) || (_features & Gob::GF_GOB2)) {
if (ConfMan.get("music_driver") == "null")
if (MidiDriver::parseMusicDriver(ConfMan.get("music_driver")) == MD_NULL)
_music = new Music_Dummy(this);
else
_music = new Music(this);

View file

@ -373,12 +373,12 @@ uint32 PAKFile::getFileSize(const char* file) {
bool PAKFile::openFile(Common::File &filehandle) {
filehandle.close();
if (!filehandle.open(_physfile == "" ? _filename : _physfile)) {
if (!filehandle.open(_physfile.empty() ? _filename : _physfile)) {
debug(3, "couldn't open pakfile '%s'\n", _filename.c_str());
return false;
}
if (_physfile != "") {
if (!_physfile.empty()) {
filehandle.seek(_physOffset, SEEK_CUR);
}

View file

@ -296,7 +296,7 @@ void ThemeClassic::drawPopUpWidget(const Common::Rect &r, const Common::String &
_screen.drawLine(p0.x, p1.y, p1.x, p1.y, color);
}
if (sel != "") {
if (!sel.empty()) {
Common::Rect text(r.left + 2, r.top + 3, r.right - 4, r.top + 3 + _font->getFontHeight());
_font->drawString(&_screen, sel, text.left, text.top, text.width(), color, convertAligment(align), deltax, false);
}

View file

@ -1309,7 +1309,7 @@ const Graphics::Font *ThemeNew::loadFont(const char *filename) {
Common::String cacheFilename = genCacheFilename(filename);
Common::File fontFile;
if (cacheFilename != "") {
if (!cacheFilename.empty()) {
if (fontFile.open(cacheFilename))
font = Graphics::NewFont::loadFromCache(fontFile);
if (font)
@ -1368,7 +1368,7 @@ const Graphics::Font *ThemeNew::loadFont(const char *filename) {
#endif
if (font) {
if (cacheFilename != "") {
if (!cacheFilename.empty()) {
if (!Graphics::NewFont::cacheFontData(*font, cacheFilename)) {
warning("Couldn't create cache file for font '%s'", filename);
}

View file

@ -60,7 +60,7 @@ GuiObject::GuiObject(const Common::String &name) : _firstWidget(0) {
}
void GuiObject::handleScreenChanged() {
if (_name != "") {
if (!_name.empty()) {
if ((_x = g_gui.evaluator()->getVar(_name + ".x")) == EVAL_UNDEF_VAR)
error("Undefined variable %s.x", _name.c_str());
if ((_y = g_gui.evaluator()->getVar(_name + ".y")) == EVAL_UNDEF_VAR)