[Scummvm-cvs-logs] scummvm master -> 7d5ec85cc40861198e61fda57988c720f212f6b1

eriktorbjorn eriktorbjorn at telia.com
Fri Aug 23 17:15:25 CEST 2013


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
7d5ec85cc4 AGOS: Use Common::strlcpy() instead of strncpy()


Commit: 7d5ec85cc40861198e61fda57988c720f212f6b1
    https://github.com/scummvm/scummvm/commit/7d5ec85cc40861198e61fda57988c720f212f6b1
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2013-08-23T08:13:52-07:00

Commit Message:
AGOS: Use Common::strlcpy() instead of strncpy()

As suggested by LordHoto.

Changed paths:
    engines/agos/script_pn.cpp



diff --git a/engines/agos/script_pn.cpp b/engines/agos/script_pn.cpp
index 61dce0b..bea83f1 100644
--- a/engines/agos/script_pn.cpp
+++ b/engines/agos/script_pn.cpp
@@ -381,8 +381,7 @@ void AGOSEngine_PN::opn_opcode31() {
 		case 0:
 			getFilename();
 			slot = matchSaveGame(_saveFile, countSaveGames());
-			strncpy(bf, genSaveName(slot), sizeof(bf));
-			bf[sizeof(bf) - 1] = 0;
+			Common::strlcpy(bf, genSaveName(slot), sizeof(bf));
 			break;
 		case 1:
 			strcpy(bf, "pn.sav");
@@ -420,10 +419,9 @@ void AGOSEngine_PN::opn_opcode32() {
 			getFilename();
 			slot = matchSaveGame(_saveFile, curSlot);
 			if (slot != -1)
-				strncpy(bf, genSaveName(slot), sizeof(bf));
+				Common::strlcpy(bf, genSaveName(slot), sizeof(bf));
 			else
-				strncpy(bf, genSaveName(curSlot), sizeof(bf));
-			bf[sizeof(bf) - 1] = 0;
+				Common::strlcpy(bf, genSaveName(curSlot), sizeof(bf));
 			break;
 		case 1:
 			strcpy(bf, "pn.sav");






More information about the Scummvm-git-logs mailing list