GRIM: Use const references for strings

This commit is contained in:
Joel Teichroeb 2013-07-07 20:52:54 -07:00
parent 3ffdd399f8
commit 4eb508cb61
21 changed files with 27 additions and 27 deletions

View File

@ -41,7 +41,7 @@ AIFFTrack::~AIFFTrack() {
delete _handle;
}
bool AIFFTrack::openSound(Common::String soundName, Common::SeekableReadStream *file) {
bool AIFFTrack::openSound(const Common::String &soundName, Common::SeekableReadStream *file) {
if (!file) {
warning("Stream for %s not open", soundName.c_str());
return false;

View File

@ -38,7 +38,7 @@ class AIFFTrack : public SoundTrack {
public:
AIFFTrack(Audio::Mixer::SoundType soundType, DisposeAfterUse::Flag disposeOfStream = DisposeAfterUse::YES);
~AIFFTrack();
bool openSound(Common::String soundName, Common::SeekableReadStream *file);
bool openSound(const Common::String &soundName, Common::SeekableReadStream *file);
bool isPlaying() { return true; }
bool isStreamOpen() { return _stream != NULL; }
void setLooping(bool looping);

View File

@ -67,7 +67,7 @@ int32 EMISound::getFreeChannel() {
return -1;
}
int32 EMISound::getChannelByName(Common::String name) {
int32 EMISound::getChannelByName(const Common::String &name) {
for (int i = 0; i < NUM_CHANNELS; i++) {
if (_channels[i] && _channels[i]->getSoundName() == name)
return i;
@ -169,7 +169,7 @@ uint32 EMISound::getMsPos(int stateId) {
return g_system->getMixer()->getSoundElapsedTime(*_music->getHandle());
}
MusicEntry *initMusicTableDemo(Common::String filename) {
MusicEntry *initMusicTableDemo(const Common::String &filename) {
Common::SeekableReadStream *data = g_resourceloader->openNewStreamFile(filename);
if (!data)
@ -204,7 +204,7 @@ MusicEntry *initMusicTableDemo(Common::String filename) {
return musicTable;
}
MusicEntry *initMusicTableRetail(Common::String filename) {
MusicEntry *initMusicTableRetail(const Common::String &filename) {
Common::SeekableReadStream *data = g_resourceloader->openNewStreamFile(filename);
// Remember to check, in case we forgot to copy over those files from the CDs.

View File

@ -53,7 +53,7 @@ class EMISound {
void removeItem(SoundTrack* item);
int32 getFreeChannel();
int32 getChannelByName(Common::String name);
int32 getChannelByName(const Common::String &name);
void freeChannel(int32 channel);
void initMusicTable();
public:

View File

@ -63,7 +63,7 @@ MP3Track::~MP3Track() {
delete _handle;
}
bool MP3Track::openSound(Common::String soundName, Common::SeekableReadStream *file) {
bool MP3Track::openSound(const Common::String &soundName, Common::SeekableReadStream *file) {
#ifndef USE_MAD
return false;
#else

View File

@ -45,7 +45,7 @@ class MP3Track : public SoundTrack {
public:
MP3Track(Audio::Mixer::SoundType soundType);
~MP3Track();
bool openSound(Common::String soundName, Common::SeekableReadStream *file);
bool openSound(const Common::String &soundName, Common::SeekableReadStream *file);
bool isPlaying() { return !_endFlag; }
};

View File

@ -38,7 +38,7 @@ SCXTrack::~SCXTrack() {
stop();
}
bool SCXTrack::openSound(Common::String soundName, Common::SeekableReadStream *file) {
bool SCXTrack::openSound(const Common::String &soundName, Common::SeekableReadStream *file) {
_soundName = soundName;
Audio::RewindableAudioStream *scxStream = makeSCXStream(file, DisposeAfterUse::YES);
if (_soundType == Audio::Mixer::kMusicSoundType)

View File

@ -38,7 +38,7 @@ class SCXTrack : public SoundTrack {
public:
SCXTrack(Audio::Mixer::SoundType soundType);
~SCXTrack();
bool openSound(Common::String soundName, Common::SeekableReadStream *file);
bool openSound(const Common::String &soundName, Common::SeekableReadStream *file);
bool isPlaying() { return true; }
};

View File

@ -48,7 +48,7 @@ Common::String SoundTrack::getSoundName() {
return _soundName;
}
void SoundTrack::setSoundName(Common::String name) {
void SoundTrack::setSoundName(const Common::String &name) {
_soundName = name;
}

View File

@ -50,14 +50,14 @@ protected:
public:
SoundTrack();
virtual ~SoundTrack();
virtual bool openSound(Common::String voiceName, Common::SeekableReadStream *file) = 0;
virtual bool openSound(const Common::String &voiceName, Common::SeekableReadStream *file) = 0;
virtual bool isPlaying() = 0;
virtual bool play();
virtual void pause();
virtual void stop();
Audio::SoundHandle *getHandle() { return _handle; }
Common::String getSoundName();
void setSoundName(Common::String);
void setSoundName(const Common::String &name);
};
}

View File

@ -63,7 +63,7 @@ bool VimaTrack::isPlaying() {
return true;
}
bool VimaTrack::openSound(Common::String voiceName, Common::SeekableReadStream *file) {
bool VimaTrack::openSound(const Common::String &voiceName, Common::SeekableReadStream *file) {
_soundName = voiceName;
_mcmp = new McmpMgr();
_desc = new SoundDesc();
@ -200,7 +200,7 @@ void VimaTrack::playTrack() {
}
}
VimaTrack::VimaTrack(Common::String soundName) {
VimaTrack::VimaTrack(const Common::String &soundName) {
_soundType = Audio::Mixer::kSpeechSoundType;
_handle = new Audio::SoundHandle();
_file = NULL;

View File

@ -41,11 +41,11 @@ class VimaTrack : public SoundTrack {
void parseSoundHeader(SoundDesc *sound, int &headerSize);
int32 getDataFromRegion(SoundDesc *sound, int region, byte **buf, int32 offset, int32 size);
public:
VimaTrack(Common::String soundName);
VimaTrack(const Common::String &soundName);
virtual ~VimaTrack();
bool isPlaying();
bool openSound(Common::String voiceName, Common::SeekableReadStream *file);
bool openSound(const Common::String &voiceName, Common::SeekableReadStream *file);
void playTrack();
SoundDesc *_desc;
McmpMgr *_mcmp;

View File

@ -40,7 +40,7 @@ BinkPlayer::BinkPlayer(bool demo) : MoviePlayer(), _demo(demo) {
_videoDecoder = new Video::BinkDecoder();
}
bool BinkPlayer::loadFile(Common::String filename) {
bool BinkPlayer::loadFile(const Common::String &filename) {
_fname = filename;
if (_demo) {

View File

@ -33,7 +33,7 @@ class BinkPlayer : public MoviePlayer {
public:
BinkPlayer(bool demo);
private:
bool loadFile(Common::String filename);
bool loadFile(const Common::String &filename);
bool _demo;
};

View File

@ -149,7 +149,7 @@ void MoviePlayer::deinit() {
_videoFinished = true;
}
bool MoviePlayer::play(Common::String filename, bool looping, int x, int y, bool start) {
bool MoviePlayer::play(const Common::String &filename, bool looping, int x, int y, bool start) {
Common::StackLock lock(_frameMutex);
deinit();
_x = x;

View File

@ -66,7 +66,7 @@ public:
* @see init
* @see stop
*/
virtual bool play(Common::String filename, bool looping, int x, int y, bool start = true);
virtual bool play(const Common::String &filename, bool looping, int x, int y, bool start = true);
virtual void stop();
virtual void pause(bool p);
virtual bool isPlaying() { return !_videoFinished; }

View File

@ -39,7 +39,7 @@ MpegPlayer::MpegPlayer() : MoviePlayer() {
_videoDecoder = new Video::MPEGPSDecoder();
}
bool MpegPlayer::loadFile(Common::String filename) {
bool MpegPlayer::loadFile(const Common::String &filename) {
_fname = Common::String("Video/") + filename + ".pss";
Common::SeekableReadStream *stream = SearchMan.createReadStreamForMember(_fname);

View File

@ -33,7 +33,7 @@ namespace Grim {
public:
MpegPlayer();
private:
bool loadFile(Common::String filename);
bool loadFile(const Common::String &filename);
bool _demo;
};

View File

@ -38,7 +38,7 @@ SmushPlayer::SmushPlayer(bool demo) : MoviePlayer(), _demo(demo) {
//_smushDecoder->setDemo(_demo);
}
bool SmushPlayer::loadFile(Common::String filename) {
bool SmushPlayer::loadFile(const Common::String &filename) {
if (!_demo)
return _videoDecoder->loadStream(g_resourceloader->openNewStreamFile(filename.c_str()));
else

View File

@ -36,7 +36,7 @@ public:
void restore(SaveGame *state);
private:
bool loadFile(Common::String filename);
bool loadFile(const Common::String &filename);
void handleFrame();
void postHandleFrame();
void init();

View File

@ -36,7 +36,7 @@ public:
PatchedFile();
virtual ~PatchedFile();
bool load(Common::SeekableReadStream *file, Common::String patchName);
bool load(Common::SeekableReadStream *file, const Common::String &patchName);
// Common::ReadStream implementation
virtual bool eos() const;
@ -102,7 +102,7 @@ PatchedFile::~PatchedFile() {
delete _extra;
}
bool PatchedFile::load(Common::SeekableReadStream *file, Common::String patchName) {
bool PatchedFile::load(Common::SeekableReadStream *file, const Common::String &patchName) {
uint8 md5_p[16], md5_f[16];
uint32 zctrllen, zdatalen, zextralen;
Common::File patch;