فهرست منبع

* Modified npc_parsesrcfile to read the file as binary and let sv_parse handle LF/CRLF line endings.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@12059 54d463be-8e91-2dee-dedb-b68131a5f0ec
FlavioJS 17 سال پیش
والد
کامیت
4b4a7ef2a0
2فایلهای تغییر یافته به همراه3 افزوده شده و 2 حذف شده
  1. 1 0
      Changelog-Trunk.txt
  2. 2 2
      src/map/npc.c

+ 1 - 0
Changelog-Trunk.txt

@@ -4,6 +4,7 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 2008/01/12
+	* Modified npc_parsesrcfile to read the file as binary and let sv_parse handle LF/CRLF line endings.
 	* Possible fix to ers/status_change crashing. [FlavioJS]
 	- this patch is untested. Didn't find anyone willing to test it and I can't 
 	  reproduce the crash so can't test the patch.

+ 2 - 2
src/map/npc.c

@@ -2523,7 +2523,7 @@ void npc_parsesrcfile(const char* filepath)
 	const char* p;
 
 	// read whole file to buffer
-	fp = fopen(filepath, "rt");
+	fp = fopen(filepath, "rb");
 	if( fp == NULL )
 	{
 		ShowError("npc_parsesrcfile: File not found '%s'.\n", filepath);
@@ -2553,7 +2553,7 @@ void npc_parsesrcfile(const char* filepath)
 		lines++;
 
 		// w1<TAB>w2<TAB>w3<TAB>w4
-		count = sv_parse(p, len+buffer-p, 0, '\t', pos, ARRAYLENGTH(pos), SV_TERMINATE_LF);
+		count = sv_parse(p, len+buffer-p, 0, '\t', pos, ARRAYLENGTH(pos), SV_TERMINATE_LF|SV_TERMINATE_CRLF);
 		if( count < 0 )
 		{
 			ShowError("npc_parsesrcfile: Parse error in file '%s', line '%d'. Stopping...\n", filepath, strline(buffer,p-buffer));