[Ttssh2-commit] [3268] ボーレートの定義が、あちこちに重複していたため、Tttypes . h ヘッダに集約させた。

svnno****@sourc***** svnno****@sourc*****
2009年 4月 1日 (水) 19:55:13 JST


Revision: 3268
          http://svn.sourceforge.jp/view?root=ttssh2&view=rev&rev=3268
Author:   yutakapon
Date:     2009-04-01 19:55:13 +0900 (Wed, 01 Apr 2009)

Log Message:
-----------
ボーレートの定義が、あちこちに重複していたため、Tttypes.h ヘッダに集約させた。

Modified Paths:
--------------
    trunk/teraterm/common/tttypes.h
    trunk/teraterm/teraterm/commlib.c
    trunk/teraterm/ttpdlg/ttdlg.c
    trunk/teraterm/ttpset/ttset.c


-------------- next part --------------
Modified: trunk/teraterm/common/tttypes.h
===================================================================
--- trunk/teraterm/common/tttypes.h	2009-04-01 10:49:50 UTC (rev 3267)
+++ trunk/teraterm/common/tttypes.h	2009-04-01 10:55:13 UTC (rev 3268)
@@ -543,6 +543,12 @@
 #define IdBaud460800 14
 #define IdBaud921600 15
 
+// index + 1 == IdBaudXXX ‚ƂȂ邱‚ƁB
+static PCHAR far BaudList[] =
+	{"110","300","600","1200","2400","4800","9600",
+	 "14400","19200","38400","57600","115200",
+	 "230400", "460800", "921600", NULL};
+
   /* Parity ID */
 #define IdParityEven 1
 #define IdParityOdd  2

Modified: trunk/teraterm/teraterm/commlib.c
===================================================================
--- trunk/teraterm/teraterm/commlib.c	2009-04-01 10:49:50 UTC (rev 3267)
+++ trunk/teraterm/teraterm/commlib.c	2009-04-01 10:55:13 UTC (rev 3268)
@@ -1011,31 +1011,13 @@
 
 int GetCommSerialBaudRate(int id)
 {
-	switch (id) {
-		case IdBaud110:
-			return 110;
-		case IdBaud300:
-		case IdBaud600:
-		case IdBaud1200:
-		case IdBaud2400:
-		case IdBaud4800:
-		case IdBaud9600:
-			return 300 << (id - IdBaud110 -1);
-		case IdBaud14400:
-			return 14400;
-		case IdBaud19200:
-			return 19200;
-		case IdBaud38400:
-			return 38400;
-		case IdBaud57600:
-		case IdBaud115200:
-		case IdBaud230400:
-		case IdBaud460800:
-		case IdBaud921600:
-			return 57600 << (id - IdBaud38400 -1);
-	}
+	char *ch;
+	int val;
 
-	return 0;
+	// id-1‚ªƒŠƒXƒg‚Ìindex‚Æ‚È‚éB
+	ch = BaudList[id - 1];
+	val = atoi(ch);
+	return (val);
 }
 
 BOOL PrnOpen(PCHAR DevName)

Modified: trunk/teraterm/ttpdlg/ttdlg.c
===================================================================
--- trunk/teraterm/ttpdlg/ttdlg.c	2009-04-01 10:49:50 UTC (rev 3267)
+++ trunk/teraterm/ttpdlg/ttdlg.c	2009-04-01 10:55:13 UTC (rev 3268)
@@ -1188,11 +1188,6 @@
 	return FALSE;
 }
 
-// ƒ{[ƒŒ[ƒg‚̏ãŒÀ‚ðŠg’£‚µ‚½ (2005.11.30 yutaka)
-static PCHAR far BaudList[] =
-	{"110","300","600","1200","2400","4800","9600",
-	 "14400","19200","38400","57600","115200",
-	 "230400", "460800", "921600", NULL};
 static PCHAR far DataList[] = {"7 bit","8 bit",NULL};
 static PCHAR far ParityList[] = {"even","odd","none",NULL};
 static PCHAR far StopList[] = {"1 bit","2 bit",NULL};

Modified: trunk/teraterm/ttpset/ttset.c
===================================================================
--- trunk/teraterm/ttpset/ttset.c	2009-04-01 10:49:50 UTC (rev 3267)
+++ trunk/teraterm/ttpset/ttset.c	2009-04-01 10:55:13 UTC (rev 3268)
@@ -23,12 +23,6 @@
 static PCHAR far TermList[] =
 	{ "VT100", "VT100J", "VT101", "VT102", "VT102J", "VT220J", "VT282",
 	"VT320", "VT382", NULL };
-// expansion (2005.11.30 yutaka)
-static PCHAR BaudList[] =
-	{ "110", "300", "600", "1200", "2400", "4800", "9600",
-	"14400", "19200", "38400", "57600", "115200",
-	"230400", "460800", "921600", NULL
-};
 
 static PCHAR far RussList[] =
 	{ "Windows", "KOI8-R", "CP-866", "ISO-8859-5", NULL };



Ttssh2-commit メーリングリストの案内