[Scummvm-cvs-logs] scummvm master -> 7827dbd3545a4dd6058e3e1e7f421f710521cd0c
bluegr
bluegr at gmail.com
Mon Dec 22 23:42:28 CET 2014
This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
cfd00ad6af AGI: use Common::String::format when possible
e8fd25e22f DRASCULA: use Common::String::format when possible
f29b3658b0 AGI: use shorter sizes for buffers
7827dbd354 Merge pull request #552 from pinotree/reduce-maxpathlen
Commit: cfd00ad6afc09ca6990ce905b1a8db4ea1ad1602
https://github.com/scummvm/scummvm/commit/cfd00ad6afc09ca6990ce905b1a8db4ea1ad1602
Author: Pino Toscano (toscano.pino at tiscali.it)
Date: 2014-12-22T23:10:31+01:00
Commit Message:
AGI: use Common::String::format when possible
Use Common::String::format instead of a MAXPATHLEN-sized char[] buffer.
Changed paths:
engines/agi/detection.cpp
engines/agi/loader_v2.cpp
engines/agi/loader_v3.cpp
diff --git a/engines/agi/detection.cpp b/engines/agi/detection.cpp
index e7285d8..3230b4e 100644
--- a/engines/agi/detection.cpp
+++ b/engines/agi/detection.cpp
@@ -276,15 +276,13 @@ SaveStateList AgiMetaEngine::listSaves(const char *target) const {
int AgiMetaEngine::getMaximumSaveSlot() const { return 999; }
void AgiMetaEngine::removeSaveState(const char *target, int slot) const {
- char fileName[MAXPATHLEN];
- sprintf(fileName, "%s.%03d", target, slot);
+ Common::String fileName = Common::String::format("%s.%03d", target, slot);
g_system->getSavefileManager()->removeSavefile(fileName);
}
SaveStateDescriptor AgiMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
const uint32 AGIflag = MKTAG('A','G','I',':');
- char fileName[MAXPATHLEN];
- sprintf(fileName, "%s.%03d", target, slot);
+ Common::String fileName = Common::String::format("%s.%03d", target, slot);
Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(fileName);
diff --git a/engines/agi/loader_v2.cpp b/engines/agi/loader_v2.cpp
index 787eeaa..3f164b7 100644
--- a/engines/agi/loader_v2.cpp
+++ b/engines/agi/loader_v2.cpp
@@ -135,13 +135,13 @@ int AgiLoader_v2::unloadResource(int t, int n) {
*/
uint8 *AgiLoader_v2::loadVolRes(struct AgiDir *agid) {
uint8 *data = NULL;
- char x[MAXPATHLEN], *path;
+ char x[MAXPATHLEN];
Common::File fp;
unsigned int sig;
+ Common::String path;
- sprintf(x, "vol.%i", agid->volume);
- path = x;
- debugC(3, kDebugLevelResources, "Vol res: path = %s", path);
+ path = Common::String::format("vol.%i", agid->volume);
+ debugC(3, kDebugLevelResources, "Vol res: path = %s", path.c_str());
if (agid->offset != _EMPTY && fp.open(path)) {
debugC(3, kDebugLevelResources, "loading resource at offset %d", agid->offset);
diff --git a/engines/agi/loader_v3.cpp b/engines/agi/loader_v3.cpp
index fa135e5..b90c17a 100644
--- a/engines/agi/loader_v3.cpp
+++ b/engines/agi/loader_v3.cpp
@@ -204,8 +204,7 @@ uint8 *AgiLoader_v3::loadVolRes(AgiDir *agid) {
Common::String path;
debugC(3, kDebugLevelResources, "(%p)", (void *)agid);
- sprintf(x, "vol.%i", agid->volume);
- path = Common::String(_vm->_game.name) + x;
+ path = Common::String::format("%svol.%i", _vm->_game.name, agid->volume);
if (agid->offset != _EMPTY && fp.open(path)) {
fp.seek(agid->offset, SEEK_SET);
Commit: e8fd25e22f4bce6f6df1a49115ece58bc76bdda3
https://github.com/scummvm/scummvm/commit/e8fd25e22f4bce6f6df1a49115ece58bc76bdda3
Author: Pino Toscano (toscano.pino at tiscali.it)
Date: 2014-12-22T23:10:31+01:00
Commit Message:
DRASCULA: use Common::String::format when possible
Use Common::String::format instead of a MAXPATHLEN-sized char[] buffer.
Changed paths:
engines/drascula/detection.cpp
diff --git a/engines/drascula/detection.cpp b/engines/drascula/detection.cpp
index 8333636..a84bd11 100644
--- a/engines/drascula/detection.cpp
+++ b/engines/drascula/detection.cpp
@@ -382,8 +382,7 @@ SaveStateList DrasculaMetaEngine::listSaves(const char *target) const {
}
SaveStateDescriptor DrasculaMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
- char fileName[MAXPATHLEN];
- sprintf(fileName, "%s.%03d", target, slot);
+ Common::String fileName = Common::String::format("%s.%03d", target, slot);
Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(fileName);
Commit: f29b3658b0caa7af2a3972de09069b9ba80eb494
https://github.com/scummvm/scummvm/commit/f29b3658b0caa7af2a3972de09069b9ba80eb494
Author: Pino Toscano (toscano.pino at tiscali.it)
Date: 2014-12-22T23:10:31+01:00
Commit Message:
AGI: use shorter sizes for buffers
Instead of allocate them with MAXPATHLEN as size, just give them the
size for the data that are going to be written on them.
Changed paths:
engines/agi/loader_v2.cpp
engines/agi/loader_v3.cpp
diff --git a/engines/agi/loader_v2.cpp b/engines/agi/loader_v2.cpp
index 3f164b7..693c53c 100644
--- a/engines/agi/loader_v2.cpp
+++ b/engines/agi/loader_v2.cpp
@@ -135,7 +135,7 @@ int AgiLoader_v2::unloadResource(int t, int n) {
*/
uint8 *AgiLoader_v2::loadVolRes(struct AgiDir *agid) {
uint8 *data = NULL;
- char x[MAXPATHLEN];
+ char x[6];
Common::File fp;
unsigned int sig;
Common::String path;
diff --git a/engines/agi/loader_v3.cpp b/engines/agi/loader_v3.cpp
index b90c17a..39759b4 100644
--- a/engines/agi/loader_v3.cpp
+++ b/engines/agi/loader_v3.cpp
@@ -198,7 +198,7 @@ int AgiLoader_v3::unloadResource(int t, int n) {
* NULL is returned if unsucsessful.
*/
uint8 *AgiLoader_v3::loadVolRes(AgiDir *agid) {
- char x[MAXPATHLEN];
+ char x[8];
uint8 *data = NULL, *compBuffer;
Common::File fp;
Common::String path;
Commit: 7827dbd3545a4dd6058e3e1e7f421f710521cd0c
https://github.com/scummvm/scummvm/commit/7827dbd3545a4dd6058e3e1e7f421f710521cd0c
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2014-12-23T00:41:34+02:00
Commit Message:
Merge pull request #552 from pinotree/reduce-maxpathlen
Reduce MAXPATHLEN usage
Changed paths:
engines/agi/detection.cpp
engines/agi/loader_v2.cpp
engines/agi/loader_v3.cpp
engines/drascula/detection.cpp
More information about the Scummvm-git-logs
mailing list