[Ttssh2-commit] [6706] ・バッファの拡張時に使用する値が複数個所に有るためマクロ化した

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2017年 5月 9日 (火) 23:22:32 JST


Revision: 6706
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/6706
Author:   doda
Date:     2017-05-09 23:22:32 +0900 (Tue, 09 May 2017)
Log Message:
-----------
・バッファの拡張時に使用する値が複数個所に有るためマクロ化した
・コメントの間違いを修正
・バッファの上限をきりのよい値に変更 (10MB -> 16MB)

Modified Paths:
--------------
    trunk/ttssh2/ttxssh/buffer.c
    trunk/ttssh2/ttxssh/buffer.h

-------------- next part --------------
Modified: trunk/ttssh2/ttxssh/buffer.c
===================================================================
--- trunk/ttssh2/ttxssh/buffer.c	2017-05-09 11:52:28 UTC (rev 6705)
+++ trunk/ttssh2/ttxssh/buffer.c	2017-05-09 14:22:32 UTC (rev 6706)
@@ -72,8 +72,8 @@
 		// 
 	} else {
 		// \x83o\x83b\x83t\x83@\x82\xAA\x91\xAB\x82\xE8\x82Ȃ\xA2\x82̂ŕ\xE2\x8F[\x82\xB7\x82\xE9\x81B(2005.7.2 yutaka)
-		newlen = buf->maxlen + size + 32*1024;
-		if (newlen > 0xa00000) { // 1MB over is not supported
+		newlen = buf->maxlen + size + BUFFER_INCREASE_MARGIN;
+		if (newlen > BUFFER_SIZE_MAX) {
 			goto panic;
 		}
 		buf->buf = realloc(buf->buf, newlen);
@@ -113,8 +113,8 @@
 
 		} else {
 			// \x83o\x83b\x83t\x83@\x82\xAA\x91\xAB\x82\xE8\x82Ȃ\xA2\x82̂ŕ\xE2\x8F[\x82\xB7\x82\xE9\x81B(2005.7.2 yutaka)
-			newlen = buf->maxlen + size + 32*1024;
-			if (newlen > 0xa00000) { // 1MB over is not supported
+			newlen = buf->maxlen + size + BUFFER_INCREASE_MARGIN;
+			if (newlen > BUFFER_SIZE_MAX) {
 				goto panic;
 			}
 			buf->buf = realloc(buf->buf, newlen);

Modified: trunk/ttssh2/ttxssh/buffer.h
===================================================================
--- trunk/ttssh2/ttxssh/buffer.h	2017-05-09 11:52:28 UTC (rev 6705)
+++ trunk/ttssh2/ttxssh/buffer.h	2017-05-09 14:22:32 UTC (rev 6706)
@@ -12,6 +12,11 @@
 	int len;        /* \x83o\x83b\x83t\x83@\x82Ɋ܂܂\xEA\x82\xE9\x97L\x8C\xF8\x82ȃf\x81[\x83^\x83T\x83C\x83Y */
 } buffer_t;
 
+/* buffer_t.buf \x82̊g\x92\xA3\x82̏\xE3\x8C\xC0\x92l (16MB) */
+#define BUFFER_SIZE_MAX 0x1000000
+/* buffer_t.buf \x82̊g\x92\xA3\x8E\x9E\x82ɒlj\xC1\x82Ŋm\x95ۂ\xB7\x82\xE9\x97\xCA (32KB) */
+#define BUFFER_INCREASE_MARGIN (32*1024)
+
 void buffer_clear(buffer_t *buf);
 buffer_t *buffer_init(void);
 void buffer_free(buffer_t *buf);



Ttssh2-commit メーリングリストの案内
Back to archive index