aboutsummaryrefslogtreecommitdiff
path: root/engines/toon/anim.cpp
diff options
context:
space:
mode:
authorD G Turner2019-09-15 18:15:19 +0100
committerD G Turner2019-09-15 18:15:19 +0100
commit28fe02eb305d3de8e3e2da5791b0f7c74d68c255 (patch)
tree2d6b5dc929b3bb0d4faec67fd4ced43bdae2324a /engines/toon/anim.cpp
parent04242ce829bd55f03e084b85a23055b23e598fb6 (diff)
downloadscummvm-rg350-28fe02eb305d3de8e3e2da5791b0f7c74d68c255.tar.gz
scummvm-rg350-28fe02eb305d3de8e3e2da5791b0f7c74d68c255.tar.bz2
scummvm-rg350-28fe02eb305d3de8e3e2da5791b0f7c74d68c255.zip
TOON: Replace Various String Functions with Common String Usage
This removes the dependency on the unsafe strcpy and strcat string functions with usage of Common::String instead.
Diffstat (limited to 'engines/toon/anim.cpp')
-rw-r--r--engines/toon/anim.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/engines/toon/anim.cpp b/engines/toon/anim.cpp
index c0f0638740..4cb7d6fb47 100644
--- a/engines/toon/anim.cpp
+++ b/engines/toon/anim.cpp
@@ -37,11 +37,11 @@ bool Animation::loadAnimation(const Common::String &file) {
if (!fileData)
return false;
- strcpy(_name, "not_loaded");
- if (strncmp((char *)fileData, "KevinAguilar", 12))
+ Common::strlcpy(_name, "not_loaded", sizeof(_name));
+ if (!Common::String((char *)fileData, 12).equals("KevinAguilar"))
return false;
- Common::strlcpy(_name, file.c_str(), 32);
+ Common::strlcpy(_name, file.c_str(), sizeof(_name));
uint32 headerSize = READ_LE_UINT32(fileData + 16);
uint32 uncompressedBytes = READ_LE_UINT32(fileData + 20);
@@ -245,9 +245,7 @@ void Animation::drawFrameWithMaskAndScale(Graphics::Surface &surface, int32 fram
uint8 *curRow = (uint8 *)surface.getPixels();
uint8 *curRowMask = mask->getDataPtr();
- bool shadowFlag = false;
- if (strstr(_name, "SHADOW"))
- shadowFlag = true;
+ bool shadowFlag = Common::String(_name).contains("SHADOW");
for (int16 y = yy1; y < yy2; y++) {
for (int16 x = xx1; x < xx2; x++) {