[Ttssh2-commit] [9227] gcc で警告が出ないよう修正

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2021年 4月 28日 (水) 01:10:55 JST


Revision: 9227
          https://osdn.net/projects/ttssh2/scm/svn/commits/9227
Author:   zmatsuo
Date:     2021-04-28 01:10:55 +0900 (Wed, 28 Apr 2021)
Log Message:
-----------
gcc で警告が出ないよう修正

- GetProcAddress() から変数の代入時
  - warning: cast between incompatible function types from 'FARPROC' {aka 'long long int (*)()'} to 'BOOL (*)(WORD,  TTXExports *)' {aka 'int (*)(short unsigned int,  TTXExports *)'}
- winsock2.h を最初にinclude
  - warning: #warning Please include winsock2.h before windows.h [-Wcpp]

Modified Paths:
--------------
    trunk/teraterm/teraterm/ttplug.c

-------------- next part --------------
Modified: trunk/teraterm/teraterm/ttplug.c
===================================================================
--- trunk/teraterm/teraterm/ttplug.c	2021-04-27 16:10:42 UTC (rev 9226)
+++ trunk/teraterm/teraterm/ttplug.c	2021-04-27 16:10:55 UTC (rev 9227)
@@ -27,6 +27,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
+#include <winsock2.h>
 #include "teraterm.h"
 #include "tttypes.h"
 #include "ttlib.h"
@@ -68,15 +69,16 @@
 	hPlugin = LoadLibraryW(fileName);
 	if (hPlugin != NULL) {
 		TTXBindProc bind = NULL;
+		FARPROC *pbind = (FARPROC *)&bind;
 #if defined(_MSC_VER)
 		if (bind == NULL)
-			bind = (TTXBindProc)GetProcAddress(hPlugin, "_TTXBind @ 8");
+			*pbind = GetProcAddress(hPlugin, "_TTXBind @ 8");
 #else
 		if (bind == NULL)
-			bind = (TTXBindProc)GetProcAddress(hPlugin, "TTXBind @ 8");
+			*pbind = GetProcAddress(hPlugin, "TTXBind @ 8");
 #endif
 		if (bind == NULL)
-			bind = (TTXBindProc)GetProcAddress(hPlugin, "TTXBind");
+			*pbind = GetProcAddress(hPlugin, "TTXBind");
 		if (bind != NULL) {
 			TTXExports * exports = (TTXExports *)malloc(sizeof(TTXExports));
 			if (exports == NULL) {


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