[o2on-svn] [79] FIX: EUC-JPなdatに未対応

Zurück zum Archiv-Index

o2on svn commit o2on-****@lists*****
2008年 4月 23日 (水) 11:36:37 JST


Revision: 79
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=o2on&view=rev&rev=79
Author:   electrolysis
Date:     2008-04-23 11:36:37 +0900 (Wed, 23 Apr 2008)

Log Message:
-----------
FIX: EUC-JPなdatに未対応

Modified Paths:
--------------
    branches/BRANCH_0043/o2on/src.o2on/O2DatIO.cpp
    branches/BRANCH_0043/o2on/src.o2on/O2DatIO.h

Modified: branches/BRANCH_0043/o2on/src.o2on/O2DatIO.cpp
===================================================================
--- branches/BRANCH_0043/o2on/src.o2on/O2DatIO.cpp	2008-04-22 03:38:02 UTC (rev 78)
+++ branches/BRANCH_0043/o2on/src.o2on/O2DatIO.cpp	2008-04-23 02:36:37 UTC (rev 79)
@@ -154,12 +154,12 @@
 	if (p == NULL)
 		return false;
 
-	return (KakoHantei(p, mf.size()));
+	return (KakoHantei(p, mf.size(), datpath.is_be()));
 }
 
 bool
 O2DatIO::
-KakoHantei(const char *dat, uint64 len)
+KakoHantei(const char *dat, uint64 len, bool is_be)
 {
 	int lf = 0;
 	const char *p[2] = {NULL};
@@ -175,25 +175,40 @@
 	p[1]++;
 	size_t linelen = p[0] - p[1];
 
+	string encoding;
+	if (is_be)
+		sjis_or_euc(string(dat), encoding);
+	if (encoding.empty())
+		encoding = "shift_jis";
+
+	string over1000 = "‚P‚O‚O‚P<><>Over 1000 Thread";
+	string stop = "<>’âŽ~‚µ‚½‚æB";
+	string rula = "<>ˆÚ“]";
+	if (encoding == "euc-jp"){
+		sjis2euc(over1000);
+		sjis2euc(stop);
+		sjis2euc(rula);
+	}
+
 	// -----------------------------------------------------------------------
 	//	1000: “Še“ú‚ªuOver 1000 Threadv
 	//	ex) ‚P‚O‚O‚P<><>Over 1000 Thread<>‚±‚̃XƒŒƒbƒh‚Í‚P‚O‚O‚O‚ð’´‚¦‚Ü‚µ‚½B <br> ‚à‚¤‘‚¯‚È‚¢‚̂ŁAV‚µ‚¢ƒXƒŒƒbƒh‚𗧂ĂĂ­‚¾‚³‚¢‚Å‚·BBB <>
 	// -----------------------------------------------------------------------
-	if (linelen >= 28 && strncmp(p[1], "‚P‚O‚O‚P<><>Over 1000 Thread", 28) == 0)
+	if (linelen >= 28 && strncmp(p[1], over1000.c_str(), 28) == 0)
 		return true;
 	
 	// -----------------------------------------------------------------------
 	//	ƒXƒŒƒXƒg: s––‚ªu<>’âŽ~‚µ‚½‚æBv
 	//	ex) ’âŽ~‚µ‚Ü‚µ‚½BBB<>’âŽ~<>’âŽ~<>^EƒXƒŒƒbƒhƒXƒgƒbƒp[BBB(P[P)ÆÔد<>’âŽ~‚µ‚½‚æB
 	// -----------------------------------------------------------------------
-	if (linelen >= 14 && strncmp(p[0]-14, "<>’âŽ~‚µ‚½‚æB", 14) == 0)
+	if (linelen >= 14 && strncmp(p[0]-14, stop.c_str(), 14) == 0)
 		return true;
 
 	// -----------------------------------------------------------------------
 	//	”ò‚΂µ: s––‚ªu<>ˆÚ“]v
 	//	ex) –Ï‘z‘°ƒÕƒÕƒÕ š<>sage<>ˆÚ“]•’âŽ~<> <br> –Ï‘z‘°ƒÕƒÕƒÕ š ‚³‚ñ‚ª”ò‚΂µ‚Ü‚µ‚½B(P[P)ÆÔد <br> <br> BE ƒ|ƒCƒ“ƒg = 4780 ‚©‚ç 20 Á”‚Ü‚µ‚½B<br> <>ˆÚ“]
 	// -----------------------------------------------------------------------
-	if (linelen >= 6 && strncmp(p[0]-6, "<>ˆÚ“]", 6) == 0)
+	if (linelen >= 6 && strncmp(p[0]-6, rula.c_str(), 6) == 0)
 		return true;
 
 	return false;

Modified: branches/BRANCH_0043/o2on/src.o2on/O2DatIO.h
===================================================================
--- branches/BRANCH_0043/o2on/src.o2on/O2DatIO.h	2008-04-22 03:38:02 UTC (rev 78)
+++ branches/BRANCH_0043/o2on/src.o2on/O2DatIO.h	2008-04-23 02:36:37 UTC (rev 79)
@@ -58,7 +58,7 @@
 	void SetEmergencyHaltCallbackMsg(HWND hwnd, UINT msg);
 
 	bool KakoHantei(const O2DatPath &datpath);
-	bool KakoHantei(const char *dat, uint64 len);
+	bool KakoHantei(const char *dat, uint64 len, bool is_be);
 	bool CheckDat(const char *in, uint64 inlen);
 	bool GetTitle(O2DatPath &datpath);
 	uint64 GetSize(const O2DatPath &datpath);




o2on-svn メーリングリストの案内
Zurück zum Archiv-Index