mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-19 08:25:35 +00:00
SCI: Rename strcpy function to prepare for forbidden name
Even though strcpy in SegManager isn't a problem, our forbidden symbols list being defined at preprocessor level, we won't be able to use this name anymore.
This commit is contained in:
parent
80ee3dddd7
commit
0b918a5352
@ -595,7 +595,7 @@ reg_t DirSeeker::nextFile(SegManager *segMan) {
|
||||
}
|
||||
if (string.size() > 12)
|
||||
string = Common::String(string.c_str(), 12);
|
||||
segMan->strcpy(_outbuffer, string.c_str());
|
||||
segMan->strcpy_(_outbuffer, string.c_str());
|
||||
|
||||
// Return the result and advance the list iterator :)
|
||||
++_iter;
|
||||
|
@ -56,7 +56,7 @@ reg_t kGetCWD(EngineState *s, int argc, reg_t *argv) {
|
||||
// We do not let the scripts see the file system, instead pretending
|
||||
// we are always in the same directory.
|
||||
// TODO/FIXME: Is "/" a good value? Maybe "" or "." or "C:\" are better?
|
||||
s->_segMan->strcpy(argv[0], "/");
|
||||
s->_segMan->strcpy_(argv[0], "/");
|
||||
|
||||
debugC(kDebugLevelFile, "kGetCWD() -> %s", "/");
|
||||
|
||||
@ -78,7 +78,7 @@ reg_t kDeviceInfo(EngineState *s, int argc, reg_t *argv) {
|
||||
// WORKAROUND: The fan game script library calls kDeviceInfo with one parameter.
|
||||
// According to the scripts, it wants to call CurDevice. However, it fails to
|
||||
// provide the subop to the function.
|
||||
s->_segMan->strcpy(argv[0], "/");
|
||||
s->_segMan->strcpy_(argv[0], "/");
|
||||
return s->r_acc;
|
||||
}
|
||||
|
||||
@ -88,12 +88,12 @@ reg_t kDeviceInfo(EngineState *s, int argc, reg_t *argv) {
|
||||
case K_DEVICE_INFO_GET_DEVICE: {
|
||||
Common::String input_str = s->_segMan->getString(argv[1]);
|
||||
|
||||
s->_segMan->strcpy(argv[2], "/");
|
||||
s->_segMan->strcpy_(argv[2], "/");
|
||||
debug(3, "K_DEVICE_INFO_GET_DEVICE(%s) -> %s", input_str.c_str(), "/");
|
||||
break;
|
||||
}
|
||||
case K_DEVICE_INFO_GET_CURRENT_DEVICE:
|
||||
s->_segMan->strcpy(argv[1], "/");
|
||||
s->_segMan->strcpy_(argv[1], "/");
|
||||
debug(3, "K_DEVICE_INFO_GET_CURRENT_DEVICE() -> %s", "/");
|
||||
break;
|
||||
|
||||
@ -122,7 +122,7 @@ reg_t kDeviceInfo(EngineState *s, int argc, reg_t *argv) {
|
||||
*/
|
||||
case K_DEVICE_INFO_GET_SAVECAT_NAME: {
|
||||
Common::String game_prefix = s->_segMan->getString(argv[2]);
|
||||
s->_segMan->strcpy(argv[1], "__throwaway");
|
||||
s->_segMan->strcpy_(argv[1], "__throwaway");
|
||||
debug(3, "K_DEVICE_INFO_GET_SAVECAT_NAME(%s) -> %s", game_prefix.c_str(), "__throwaway");
|
||||
}
|
||||
|
||||
@ -130,7 +130,7 @@ reg_t kDeviceInfo(EngineState *s, int argc, reg_t *argv) {
|
||||
case K_DEVICE_INFO_GET_SAVEFILE_NAME: {
|
||||
Common::String game_prefix = s->_segMan->getString(argv[2]);
|
||||
uint virtualId = argv[3].toUint16();
|
||||
s->_segMan->strcpy(argv[1], "__throwaway");
|
||||
s->_segMan->strcpy_(argv[1], "__throwaway");
|
||||
debug(3, "K_DEVICE_INFO_GET_SAVEFILE_NAME(%s,%d) -> %s", game_prefix.c_str(), virtualId, "__throwaway");
|
||||
if ((virtualId < SAVEGAMEID_OFFICIALRANGE_START) || (virtualId > SAVEGAMEID_OFFICIALRANGE_END))
|
||||
error("kDeviceInfo(deleteSave): invalid savegame ID specified");
|
||||
|
@ -375,7 +375,7 @@ reg_t kTextSize(EngineState *s, int argc, reg_t *argv) {
|
||||
warning("kTextSize: string would be too big to fit on screen. Trimming it");
|
||||
text.trim();
|
||||
// Copy over the trimmed string...
|
||||
s->_segMan->strcpy(argv[1], text.c_str());
|
||||
s->_segMan->strcpy_(argv[1], text.c_str());
|
||||
// ...and recalculate bounding box dimensions
|
||||
g_sci->_gfxText16->kernelTextSize(splitText.c_str(), languageSplitter, font, maxWidth, &textWidth, &textHeight);
|
||||
}
|
||||
@ -1044,7 +1044,7 @@ reg_t kDrawControl(EngineState *s, int argc, reg_t *argv) {
|
||||
// The french version of Quest For Glory 3 uses "gloire3.sauv". It seems a translator translated the filename.
|
||||
text.deleteChar(0);
|
||||
text.deleteChar(0);
|
||||
s->_segMan->strcpy(textReference, text.c_str());
|
||||
s->_segMan->strcpy_(textReference, text.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -434,26 +434,26 @@ reg_t kGetConfig(EngineState *s, int argc, reg_t *argv) {
|
||||
setting.toLowercase();
|
||||
|
||||
if (setting == "videospeed") {
|
||||
s->_segMan->strcpy(data, "500");
|
||||
s->_segMan->strcpy_(data, "500");
|
||||
} else if (setting == "cpu") {
|
||||
// We always return the fastest CPU setting that CPUID can detect
|
||||
// (i.e. 586).
|
||||
s->_segMan->strcpy(data, "586");
|
||||
s->_segMan->strcpy_(data, "586");
|
||||
} else if (setting == "cpuspeed") {
|
||||
s->_segMan->strcpy(data, "500");
|
||||
s->_segMan->strcpy_(data, "500");
|
||||
} else if (setting == "language") {
|
||||
Common::String languageId = Common::String::format("%d", g_sci->getSciLanguage());
|
||||
s->_segMan->strcpy(data, languageId.c_str());
|
||||
s->_segMan->strcpy_(data, languageId.c_str());
|
||||
} else if (setting == "torindebug") {
|
||||
// Used to enable the debug mode in Torin's Passage (French).
|
||||
// If true, the debug mode is enabled.
|
||||
s->_segMan->strcpy(data, "");
|
||||
s->_segMan->strcpy_(data, "");
|
||||
} else if (setting == "leakdump") {
|
||||
// An unknown setting in LSL7. Likely used for debugging.
|
||||
s->_segMan->strcpy(data, "");
|
||||
s->_segMan->strcpy_(data, "");
|
||||
} else if (setting == "startroom") {
|
||||
// Debug setting in LSL7, specifies the room to start from.
|
||||
s->_segMan->strcpy(data, "");
|
||||
s->_segMan->strcpy_(data, "");
|
||||
} else if (setting == "game") {
|
||||
// Hoyle 5 startup, specifies the number of the game to start.
|
||||
if (g_sci->getGameId() == GID_HOYLE5 &&
|
||||
@ -461,25 +461,25 @@ reg_t kGetConfig(EngineState *s, int argc, reg_t *argv) {
|
||||
g_sci->getResMan()->testResource(ResourceId(kResourceTypeScript, 700))) {
|
||||
// Special case for Hoyle 5 Bridge: only one game is included (Bridge),
|
||||
// so mimic the setting in 700.cfg and set the starting room number to 700.
|
||||
s->_segMan->strcpy(data, "700");
|
||||
s->_segMan->strcpy_(data, "700");
|
||||
} else {
|
||||
s->_segMan->strcpy(data, "");
|
||||
s->_segMan->strcpy_(data, "");
|
||||
}
|
||||
} else if (setting == "laptop") {
|
||||
// Hoyle 5 startup.
|
||||
s->_segMan->strcpy(data, "");
|
||||
s->_segMan->strcpy_(data, "");
|
||||
} else if (setting == "jumpto") {
|
||||
// Hoyle 5 startup.
|
||||
s->_segMan->strcpy(data, "");
|
||||
s->_segMan->strcpy_(data, "");
|
||||
} else if (setting == "klonchtsee") {
|
||||
// Hoyle 5 - starting Solitaire.
|
||||
s->_segMan->strcpy(data, "");
|
||||
s->_segMan->strcpy_(data, "");
|
||||
} else if (setting == "klonchtarr") {
|
||||
// Hoyle 5 - starting Solitaire.
|
||||
s->_segMan->strcpy(data, "");
|
||||
s->_segMan->strcpy_(data, "");
|
||||
} else if (setting == "deflang") {
|
||||
// MGDX 4-language startup.
|
||||
s->_segMan->strcpy(data, "");
|
||||
s->_segMan->strcpy_(data, "");
|
||||
} else {
|
||||
error("GetConfig: Unknown configuration setting %s", setting.c_str());
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ reg_t kParse(EngineState *s, int argc, reg_t *argv) {
|
||||
writeSelectorValue(segMan, event, SELECTOR(claimed), 1);
|
||||
|
||||
if (error) {
|
||||
s->_segMan->strcpy(s->_segMan->getParserPtr(), error);
|
||||
s->_segMan->strcpy_(s->_segMan->getParserPtr(), error);
|
||||
debugC(kDebugLevelParser, "Word unknown: %s", error);
|
||||
/* Issue warning: */
|
||||
|
||||
|
@ -53,7 +53,7 @@ reg_t kStrCat(EngineState *s, int argc, reg_t *argv) {
|
||||
}
|
||||
|
||||
s1 += s2;
|
||||
s->_segMan->strcpy(argv[0], s1.c_str());
|
||||
s->_segMan->strcpy_(argv[0], s1.c_str());
|
||||
return argv[0];
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ reg_t kStrCpy(EngineState *s, int argc, reg_t *argv) {
|
||||
else
|
||||
s->_segMan->memcpy(argv[0], argv[1], -length);
|
||||
} else {
|
||||
s->_segMan->strcpy(argv[0], argv[1]);
|
||||
s->_segMan->strcpy_(argv[0], argv[1]);
|
||||
}
|
||||
|
||||
return argv[0];
|
||||
@ -430,7 +430,7 @@ reg_t kFormat(EngineState *s, int argc, reg_t *argv) {
|
||||
|
||||
*target = 0; /* Terminate string */
|
||||
|
||||
s->_segMan->strcpy(dest, targetbuf);
|
||||
s->_segMan->strcpy_(dest, targetbuf);
|
||||
|
||||
return dest; /* Return target addr */
|
||||
}
|
||||
@ -451,7 +451,7 @@ reg_t kGetFarText(EngineState *s, int argc, reg_t *argv) {
|
||||
if (argv[2] == NULL_REG)
|
||||
s->_segMan->allocDynmem(text.size() + 1, "Mac FarText", &argv[2]);
|
||||
|
||||
s->_segMan->strcpy(argv[2], text.c_str()); // Copy the string and get return value
|
||||
s->_segMan->strcpy_(argv[2], text.c_str()); // Copy the string and get return value
|
||||
return argv[2];
|
||||
}
|
||||
|
||||
@ -603,7 +603,7 @@ reg_t kStrSplit(EngineState *s, int argc, reg_t *argv) {
|
||||
PRINT_REG(argv[0]), str.size() + 1, str.c_str());
|
||||
return NULL_REG;
|
||||
}
|
||||
s->_segMan->strcpy(argv[0], str.c_str());
|
||||
s->_segMan->strcpy_(argv[0], str.c_str());
|
||||
return argv[0];
|
||||
}
|
||||
|
||||
@ -819,14 +819,14 @@ reg_t kStringTrim(EngineState *s, int argc, reg_t *argv) {
|
||||
reg_t kStringToUpperCase(EngineState *s, int argc, reg_t *argv) {
|
||||
Common::String string = s->_segMan->getString(argv[0]);
|
||||
string.toUppercase();
|
||||
s->_segMan->strcpy(argv[0], string.c_str());
|
||||
s->_segMan->strcpy_(argv[0], string.c_str());
|
||||
return argv[0];
|
||||
}
|
||||
|
||||
reg_t kStringToLowerCase(EngineState *s, int argc, reg_t *argv) {
|
||||
Common::String string = s->_segMan->getString(argv[0]);
|
||||
string.toLowercase();
|
||||
s->_segMan->strcpy(argv[0], string.c_str());
|
||||
s->_segMan->strcpy_(argv[0], string.c_str());
|
||||
return argv[0];
|
||||
}
|
||||
|
||||
|
@ -498,7 +498,7 @@ void MessageState::outputString(reg_t buf, const Common::String &str) {
|
||||
SegmentRef buffer_r = _segMan->dereference(buf);
|
||||
|
||||
if ((unsigned)buffer_r.maxSize >= str.size() + 1) {
|
||||
_segMan->strcpy(buf, str.c_str());
|
||||
_segMan->strcpy_(buf, str.c_str());
|
||||
} else {
|
||||
// LSL6 sets an exit text here, but the buffer size allocated
|
||||
// is too small. Don't display a warning in this case, as we
|
||||
@ -511,7 +511,7 @@ void MessageState::outputString(reg_t buf, const Common::String &str) {
|
||||
|
||||
// Set buffer to empty string if possible
|
||||
if (buffer_r.maxSize > 0)
|
||||
_segMan->strcpy(buf, "");
|
||||
_segMan->strcpy_(buf, "");
|
||||
}
|
||||
#ifdef ENABLE_SCI32
|
||||
}
|
||||
|
@ -710,7 +710,7 @@ void SegManager::strncpy(reg_t dest, reg_t src, size_t n) {
|
||||
if (src.isNull()) {
|
||||
// Clear target string instead.
|
||||
if (n > 0)
|
||||
strcpy(dest, "");
|
||||
strcpy_(dest, "");
|
||||
|
||||
return; // empty text
|
||||
}
|
||||
@ -722,7 +722,7 @@ void SegManager::strncpy(reg_t dest, reg_t src, size_t n) {
|
||||
|
||||
// Clear target string instead.
|
||||
if (n > 0)
|
||||
strcpy(dest, "");
|
||||
strcpy_(dest, "");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -754,11 +754,11 @@ void SegManager::strncpy(reg_t dest, reg_t src, size_t n) {
|
||||
}
|
||||
}
|
||||
|
||||
void SegManager::strcpy(reg_t dest, const char* src) {
|
||||
void SegManager::strcpy_(reg_t dest, const char* src) {
|
||||
strncpy(dest, src, 0xFFFFFFFFU);
|
||||
}
|
||||
|
||||
void SegManager::strcpy(reg_t dest, reg_t src) {
|
||||
void SegManager::strcpy_(reg_t dest, reg_t src) {
|
||||
strncpy(dest, src, 0xFFFFFFFFU);
|
||||
}
|
||||
|
||||
|
@ -316,14 +316,14 @@ public:
|
||||
* src and dest can point to raw and non-raw segments.
|
||||
* Conversion is performed as required.
|
||||
*/
|
||||
void strcpy(reg_t dest, reg_t src);
|
||||
void strcpy_(reg_t dest, reg_t src);
|
||||
|
||||
/**
|
||||
* Copies a string from src to dest.
|
||||
* dest can point to a raw or non-raw segment.
|
||||
* Conversion is performed as required.
|
||||
*/
|
||||
void strcpy(reg_t dest, const char *src);
|
||||
void strcpy_(reg_t dest, const char *src);
|
||||
|
||||
/**
|
||||
* Copies a string from src to dest.
|
||||
|
@ -292,7 +292,7 @@ void GfxControls16::kernelTexteditChange(reg_t controlObject, reg_t eventObject)
|
||||
texteditCursorDraw(rect, text.c_str(), cursorPos);
|
||||
_text16->SetFont(oldFontId);
|
||||
// Write back string
|
||||
_segMan->strcpy(textReference, text.c_str());
|
||||
_segMan->strcpy_(textReference, text.c_str());
|
||||
} else {
|
||||
if (g_system->getMillis() >= _texteditBlinkTime) {
|
||||
_paint16->invertRect(_texteditCursorRect);
|
||||
|
Loading…
x
Reference in New Issue
Block a user