SCI: Avoid using perror (it's not portable)

svn-id: r42866
This commit is contained in:
Max Horn 2009-07-28 22:28:40 +00:00
parent 972cbb4b57
commit 50cd2750cc
3 changed files with 6 additions and 22 deletions

View file

@ -169,7 +169,9 @@ int SegManager::initialiseScript(Script &scr, EngineState *s, int script_nr) {
setScriptSize(scr, s, script_nr); setScriptSize(scr, s, script_nr);
scr.buf = (byte *)malloc(scr.buf_size); scr.buf = (byte *)malloc(scr.buf_size);
dbgPrint("scr.buf ", scr.buf); #ifdef DEBUG_SEG_MANAGER
printf("scr.buf = %p ", scr.buf);
#endif
if (!scr.buf) { if (!scr.buf) {
scr.freeScript(); scr.freeScript();
warning("SegManager: Not enough memory space for script size"); warning("SegManager: Not enough memory space for script size");
@ -864,14 +866,5 @@ int SegManager::freeDynmem(reg_t addr) {
return 0; // OK return 0; // OK
} }
void SegManager::dbgPrint(const char* msg, void *i) {
#ifdef DEBUG_SEG_MANAGER
char buf[1000];
sprintf(buf, "%s = [0x%x], dec:[%d]", msg, i, i);
perror(buf);
#endif
}
} // End of namespace Sci } // End of namespace Sci

View file

@ -362,13 +362,6 @@ private:
* 'seg' is a valid segment * 'seg' is a valid segment
*/ */
bool check(SegmentId seg); bool check(SegmentId seg);
void dbgPrint(const char* msg, void *i); // for debug only
// Perform garbage collection
// Parameters: (EngineState *) s: The state to operate on
// Effects : Unreachable objects in 's' are deallocated
//void sm_gc(EngineState *s);
}; };
} // End of namespace Sci } // End of namespace Sci

View file

@ -882,7 +882,7 @@ void ResourceManager::processPatch(ResourceSource *source, ResourceType restype,
if (resnumber == -1) if (resnumber == -1)
return; return;
if (!file.open(source->location_name)) { if (!file.open(source->location_name)) {
perror("""__FILE__"": (""__LINE__""): failed to open"); warning("ResourceManager::processPatch(): failed to open %s", source->location_name.c_str());
return; return;
} }
fsize = file.size(); fsize = file.size();
@ -1007,8 +1007,7 @@ int ResourceManager::readResourceMapSCI0(ResourceSource *map) {
offset = file.readUint32LE(); offset = file.readUint32LE();
if (file.ioFailed()) { if (file.ioFailed()) {
warning("Error while reading %s: ", map->location_name.c_str()); warning("Error while reading %s", map->location_name.c_str());
perror("");
return SCI_ERROR_RESMAP_NOT_FOUND; return SCI_ERROR_RESMAP_NOT_FOUND;
} }
if (offset == 0xFFFFFFFF) if (offset == 0xFFFFFFFF)
@ -1079,8 +1078,7 @@ int ResourceManager::readResourceMapSCI1(ResourceSource *map) {
} }
} }
if (file.ioFailed()) { if (file.ioFailed()) {
warning("Error while reading %s: ", map->location_name.c_str()); warning("Error while reading %s", map->location_name.c_str());
perror("");
return SCI_ERROR_RESMAP_NOT_FOUND; return SCI_ERROR_RESMAP_NOT_FOUND;
} }
resId = ResourceId((ResourceType)type, number); resId = ResourceId((ResourceType)type, number);