[Ttssh2-commit] [6886] ループ内で毎回データをコピーするのは無駄なので、ループの前にデータを準備するように変更。

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2017年 7月 26日 (水) 12:47:51 JST


Revision: 6886
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/6886
Author:   doda
Date:     2017-07-26 12:47:51 +0900 (Wed, 26 Jul 2017)
Log Message:
-----------
ループ内で毎回データをコピーするのは無駄なので、ループの前にデータを準備するように変更。

Modified Paths:
--------------
    trunk/teraterm/teraterm/vtwin.cpp

-------------- next part --------------
Modified: trunk/teraterm/teraterm/vtwin.cpp
===================================================================
--- trunk/teraterm/teraterm/vtwin.cpp	2017-07-26 03:47:48 UTC (rev 6885)
+++ trunk/teraterm/teraterm/vtwin.cpp	2017-07-26 03:47:51 UTC (rev 6886)
@@ -5591,6 +5591,11 @@
 	HWND hd;
 	COPYDATASTRUCT cds;
 
+	ZeroMemory(&cds, sizeof(cds));
+	cds.dwData = IPC_BROADCAST_COMMAND;
+	cds.cbData = buflen;
+	cds.lpData = buf;
+
 	// \x82\xB7\x82ׂĂ\xCCTera Term\x82Ƀ\x81\x83b\x83Z\x81[\x83W\x82ƃf\x81[\x83^\x82𑗂\xE9
 	count = SendMessage(BroadcastWindowList, LB_GETCOUNT, 0, 0);
 	for (i = 0 ; i < count ; i++) {
@@ -5608,11 +5613,6 @@
 			continue;
 		}
 
-		ZeroMemory(&cds, sizeof(cds));
-		cds.dwData = IPC_BROADCAST_COMMAND;
-		cds.cbData = buflen;
-		cds.lpData = buf;
-
 		// WM_COPYDATA\x82\xF0\x8Eg\x82\xC1\x82āA\x83v\x83\x8D\x83Z\x83X\x8AԒʐM\x82\xF0\x8Ds\x82\xA4\x81B
 		SendMessage(hd, WM_COPYDATA, (WPARAM)HVTWin, (LPARAM)&cds);
 	}
@@ -5651,6 +5651,11 @@
 	strcpy_s(msg, msglen, name);
 	memcpy(msg + nlen, buf, buflen);
 
+	ZeroMemory(&cds, sizeof(cds));
+	cds.dwData = IPC_MULTICAST_COMMAND;
+	cds.cbData = msglen;
+	cds.lpData = msg;
+
 	// \x82\xB7\x82ׂĂ\xCCTera Term\x82Ƀ\x81\x83b\x83Z\x81[\x83W\x82ƃf\x81[\x83^\x82𑗂\xE9
 	for (i = 0 ; i < MAXNWIN ; i++) {
 		hd = GetNthWin(i);
@@ -5658,11 +5663,6 @@
 			break;
 		}
 
-		ZeroMemory(&cds, sizeof(cds));
-		cds.dwData = IPC_MULTICAST_COMMAND;
-		cds.cbData = msglen;
-		cds.lpData = msg;
-
 		// WM_COPYDATA\x82\xF0\x8Eg\x82\xC1\x82āA\x83v\x83\x8D\x83Z\x83X\x8AԒʐM\x82\xF0\x8Ds\x82\xA4\x81B
 		SendMessage(hd, WM_COPYDATA, (WPARAM)HVTWin, (LPARAM)&cds);
 	}



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