[Ttssh2-commit] [8549] Hashtableの使用をやめた

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2020年 2月 20日 (木) 00:37:40 JST


Revision: 8549
          https://osdn.net/projects/ttssh2/scm/svn/commits/8549
Author:   zmatsuo
Date:     2020-02-20 00:37:40 +0900 (Thu, 20 Feb 2020)
Log Message:
-----------
Hashtableの使用をやめた

Modified Paths:
--------------
    trunk/TTProxy/YCL/include/YCL/Dialog.h

-------------- next part --------------
Modified: trunk/TTProxy/YCL/include/YCL/Dialog.h
===================================================================
--- trunk/TTProxy/YCL/include/YCL/Dialog.h	2020-02-19 15:20:44 UTC (rev 8548)
+++ trunk/TTProxy/YCL/include/YCL/Dialog.h	2020-02-19 15:37:40 UTC (rev 8549)
@@ -12,7 +12,6 @@
 #include <YCL/common.h>
 
 #include <YCL/Window.h>
-#include <YCL/Hashtable.h>
 
 #include "dlglib.h"
 
@@ -20,11 +19,6 @@
 
 class Dialog : virtual public Window {
 protected:
-	typedef Hashtable<HWND, Dialog*> Map;
-	static Map& getMap() {
-		static Map map;
-		return map;
-	}
 	static Dialog* prepareOpen(Dialog* next) {
 		static Dialog* initializeing = NULL;
 		Dialog* prev = initializeing;
@@ -32,18 +26,16 @@
 		return prev;
 	}
 	static INT_PTR CALLBACK DialogProc(HWND dialog, UINT message, WPARAM wParam, LPARAM lParam) {
-		Map& map = getMap();
-		Dialog* target = map.get(dialog);
+		Dialog* target = (Dialog *)::GetWindowLongPtr(dialog, GWLP_USERDATA);
 		if (target == NULL) {
 			target = prepareOpen(NULL);
 			if (target != NULL) {
 				*target <<= dialog;
-				map.put(dialog, target);
+				::SetWindowLongPtr(dialog, GWLP_USERDATA, (LONG_PTR)target);
 			}
 		}
 		BOOL result = target != NULL ? target->dispatch(message, wParam, lParam) : FALSE;
 		if (message == WM_NCDESTROY) {
-			map.remove(dialog);
 			if (target != NULL)
 				*target <<= NULL;
 		}


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