[Ttssh2-commit] [8825] ttcstd.hを追加

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2020年 7月 3日 (金) 23:43:19 JST


Revision: 8825
          https://osdn.net/projects/ttssh2/scm/svn/commits/8825
Author:   zmatsuo
Date:     2020-07-03 23:43:19 +0900 (Fri, 03 Jul 2020)
Log Message:
-----------
ttcstd.hを追加

- C/C++のコンパイラごとの標準準拠差を吸収

Modified Paths:
--------------
    trunk/teraterm/common/codeconv.cpp
    trunk/teraterm/common/codeconv.h
    trunk/teraterm/teraterm/buffer.c

Added Paths:
-----------
    trunk/teraterm/common/ttcstd.h

-------------- next part --------------
Modified: trunk/teraterm/common/codeconv.cpp
===================================================================
--- trunk/teraterm/common/codeconv.cpp	2020-07-03 14:43:08 UTC (rev 8824)
+++ trunk/teraterm/common/codeconv.cpp	2020-07-03 14:43:19 UTC (rev 8825)
@@ -41,16 +41,11 @@
 #endif
 #include "codemap.h"
 #include "codeconv.h"
+#include "ttcstd.h"
 
 // cp932\x95ϊ\xB7\x8E\x9E\x81AWindows API \x82\xE6\x82\xE8 Tera Term \x82̕ϊ\xB7\x83e\x81[\x83u\x83\x8B\x82\xF0\x97D\x90悷\x82\xE9
 //#define PRIORITY_CP932_TABLE
 
-#if defined(_MSC_VER) && (_MSC_VER < 1600)
-typedef unsigned char	uint8_t;
-typedef unsigned short  uint16_t;
-typedef unsigned int	uint32_t;
-#endif
-
 /*
  *	\x8C\xA9\x82‚\xA9\x82\xE7\x82Ȃ\xA2\x8Fꍇ\x82\xCD 0 \x82\xF0\x95Ԃ\xB7
  */

Modified: trunk/teraterm/common/codeconv.h
===================================================================
--- trunk/teraterm/common/codeconv.h	2020-07-03 14:43:08 UTC (rev 8824)
+++ trunk/teraterm/common/codeconv.h	2020-07-03 14:43:19 UTC (rev 8825)
@@ -29,6 +29,7 @@
 #pragma once
 
 #include <tchar.h>
+#include "ttcstd.h"
 
 #ifdef __cplusplus
 extern "C" {

Added: trunk/teraterm/common/ttcstd.h
===================================================================
--- trunk/teraterm/common/ttcstd.h	                        (rev 0)
+++ trunk/teraterm/common/ttcstd.h	2020-07-03 14:43:19 UTC (rev 8825)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2020 TeraTerm Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+// stdint.h
+#if defined(_MSC_VER) && (_MSC_VER < 1600)
+typedef unsigned char	uint8_t;
+typedef unsigned short  uint16_t;
+typedef unsigned int	uint32_t;
+#endif
+
+// unicode
+#if !defined(__cplusplus) || (defined(_MSC_VER) && (_MSC_VER < 1926))
+typedef unsigned long char32_t;		// C++11 for UTF-32
+typedef wchar_t char16_t;			// C++11 for UTF-16
+#endif
+typedef unsigned char char8_t;		// C++20 for UTF-8

Modified: trunk/teraterm/teraterm/buffer.c
===================================================================
--- trunk/teraterm/teraterm/buffer.c	2020-07-03 14:43:08 UTC (rev 8824)
+++ trunk/teraterm/teraterm/buffer.c	2020-07-03 14:43:19 UTC (rev 8825)
@@ -48,9 +48,8 @@
 #include "buffer.h"
 #include "unicode_test.h"
 #include "asprintf.h"
+#include "ttcstd.h"
 
-typedef unsigned long char32_t;		// C++11
-
 // \x83o\x83b\x83t\x83@\x93\xE0\x82̔\xBC\x8Ap1\x95\xB6\x8E\x9A\x95\xAA\x82̏\xEE\x95\xF1
 typedef struct {
 	char32_t u32;


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