shithub: cstory

Download patch

ref: cb87f050576d749d19f7b1f86c3a43505a22394c
parent: bac98f74021dab81ad76f8a84343087f3bdbcffe
parent: f96b7fa56607e73e80019c031a7095b9d02f9463
author: Clownacy <Clownacy@users.noreply.github.com>
date: Sat Nov 9 09:05:04 EST 2019

Merge pull request #77 from GabrielRavier/cmpUnclear

Make cmp usage clearer

--- a/src/Config.cpp
+++ b/src/Config.cpp
@@ -31,7 +31,7 @@
 	fclose(fp);
 
 	// Check if version is not correct, and return if it failed
-	if (fread_result != 1 || strcmp(conf->proof, config_magic))
+	if (fread_result != 1 || strcmp(conf->proof, config_magic) != 0)
 	{
 		memset(conf, 0, sizeof(CONFIG));
 		return FALSE;
--- a/src/Map.cpp
+++ b/src/Map.cpp
@@ -41,7 +41,7 @@
 	char check[3];
 	fread(check, 1, 3, fp);
 
-	if (memcmp(check, code_pxma, 3))
+	if (memcmp(check, code_pxma, 3) != 0)
 	{
 		fclose(fp);
 		return FALSE;
--- a/src/NpChar.cpp
+++ b/src/NpChar.cpp
@@ -68,7 +68,7 @@
 	// Read "PXE" check
 	char code[4];
 	fread(code, 1, 4, fp);
-	if (memcmp(code, gPassPixEve, 3))
+	if (memcmp(code, gPassPixEve, 3) != 0)
 	{
 #ifdef FIX_BUGS
 		// The original game forgot to close the file here
--- a/src/Profile.cpp
+++ b/src/Profile.cpp
@@ -104,7 +104,7 @@
 
 	// Check header code
 	fread(profile.code, 8, 1, fp);
-	if (memcmp(profile.code, gProfileCode, 8))
+	if (memcmp(profile.code, gProfileCode, 8) != 0)
 	{
 #ifdef FIX_BUGS
 		fclose(fp);	// The original game forgets to close the file