On 8/19/07, cfinck(a)svn.reactos.org <cfinck(a)svn.reactos.org> wrote:
> - Always include "wine/unicode.h" before all other headers, when we need the wchar_t type.
Please stop changing the header order. If you need to do this then
something is wrong. The Wine headers are mostly correct as far as the
PSDK/WDK goes and if you build Wine on MSVC you DO NOT have to make
these invasive changes to the source even when using the SDK headers.
Fix the ROS headers or work around system limitations some other way.
--
Steven Edwards
"There is one thing stronger than all the armies in the world, and
that is an idea whose time has come." - Victor Hugo
Author: cfinck
Date: Sun Aug 19 19:38:21 2007
New Revision: 28423
URL: http://svn.reactos.org/svn/reactos?rev=28423&view=rev
Log:
- Always include "wine/unicode.h" before all other headers, when we need the wchar_t type.
unicode.h includes windef.h, which includes winnt.h, which has the handling for the wchar_t type. As it's the first included header, no other wchar_t type will be defined before.
- Remove the wchar_t definition from the Makefile as the winnt.h header will define it as "unsigned short" automatically.
Modified:
trunk/reactos/tools/unicode/cptable.c
trunk/reactos/tools/unicode/mbtowc.c
trunk/reactos/tools/unicode/string.c
trunk/reactos/tools/unicode/unicode.mak
trunk/reactos/tools/unicode/utf8.c
trunk/reactos/tools/unicode/wctomb.c
Modified: trunk/reactos/tools/unicode/cptable.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/unicode/cptable.c?re…
==============================================================================
--- trunk/reactos/tools/unicode/cptable.c (original)
+++ trunk/reactos/tools/unicode/cptable.c Sun Aug 19 19:38:21 2007
@@ -18,10 +18,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
-#include <windef.h>
+#include "wine/unicode.h"
#include <stdlib.h>
-
-#include "wine/unicode.h"
/* Everything below this line is generated automatically by cpmap.pl */
/* ### cpmap begin ### */
Modified: trunk/reactos/tools/unicode/mbtowc.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/unicode/mbtowc.c?rev…
==============================================================================
--- trunk/reactos/tools/unicode/mbtowc.c (original)
+++ trunk/reactos/tools/unicode/mbtowc.c Sun Aug 19 19:38:21 2007
@@ -18,9 +18,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
+#include "wine/unicode.h"
#include <string.h>
-
-#include "wine/unicode.h"
/* get the decomposition of a Unicode char */
static int get_decomposition( WCHAR src, WCHAR *dst, unsigned int dstlen )
Modified: trunk/reactos/tools/unicode/string.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/unicode/string.c?rev…
==============================================================================
--- trunk/reactos/tools/unicode/string.c (original)
+++ trunk/reactos/tools/unicode/string.c Sun Aug 19 19:38:21 2007
@@ -18,10 +18,9 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
+#include "wine/unicode.h"
#include <limits.h>
#include <stdio.h>
-
-#include "wine/unicode.h"
extern const WCHAR wine_casemap_lower[];
extern const WCHAR wine_casemap_upper[];
Modified: trunk/reactos/tools/unicode/unicode.mak
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/unicode/unicode.mak?…
==============================================================================
--- trunk/reactos/tools/unicode/unicode.mak (original)
+++ trunk/reactos/tools/unicode/unicode.mak Sun Aug 19 19:38:21 2007
@@ -96,7 +96,6 @@
UNICODE_HOST_CFLAGS = \
-D__USE_W32API -DWINVER=0x501 -DWINE_UNICODE_API= \
- -Dwchar_t="unsigned short" -D_WCHAR_T_DEFINED \
-I$(UNICODE_BASE) -Iinclude/reactos/wine -Iinclude -Iinclude/psdk \
$(TOOLS_CFLAGS)
Modified: trunk/reactos/tools/unicode/utf8.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/unicode/utf8.c?rev=2…
==============================================================================
--- trunk/reactos/tools/unicode/utf8.c (original)
+++ trunk/reactos/tools/unicode/utf8.c Sun Aug 19 19:38:21 2007
@@ -18,9 +18,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
+#include "wine/unicode.h"
#include <string.h>
-
-#include "wine/unicode.h"
/* number of following bytes in sequence based on first byte value (for bytes above 0x7f) */
static const char utf8_length[128] =
Modified: trunk/reactos/tools/unicode/wctomb.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/unicode/wctomb.c?rev…
==============================================================================
--- trunk/reactos/tools/unicode/wctomb.c (original)
+++ trunk/reactos/tools/unicode/wctomb.c Sun Aug 19 19:38:21 2007
@@ -18,9 +18,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
+#include "wine/unicode.h"
#include <string.h>
-
-#include "wine/unicode.h"
/* search for a character in the unicode_compose_table; helper for compose() */
static inline int binary_search( WCHAR ch, int low, int high )
Author: cfinck
Date: Sun Aug 19 18:04:20 2007
New Revision: 28422
URL: http://svn.reactos.org/svn/reactos?rev=28422&view=rev
Log:
Change the wchar_t logic once more to make it a bit simplier.
A host can only have one special wchar_t definition, so we don't need to define all. Also _WCHAR_T_DEFINED is the only definition used for overriding the wchar_t setting by applications.
So use the previous logic to check and define the wchar_t definitions for the host and at the end check for _WCHAR_T_DEFINED. In all cases, define _WCHAR_T_DEFINED.
Additionally, __need_wchar_t has to be undefined after including "ctype.h" as "ctype.h" defines it.
Modified:
trunk/reactos/include/psdk/winnt.h
Modified: trunk/reactos/include/psdk/winnt.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/winnt.h?rev=2…
==============================================================================
--- trunk/reactos/include/psdk/winnt.h (original)
+++ trunk/reactos/include/psdk/winnt.h Sun Aug 19 18:04:20 2007
@@ -52,11 +52,13 @@
/* wchar_t checks
* First check if wchar_t has already been defined by any host/OS */
-#ifndef _WCHAR_T_DEFINED
#ifndef _WCHAR_T_DECLARED /* for FreeBSD 5 and later */
+#define _WCHAR_T_DECLARED
#ifndef _WCHAR_T /* for Mac OS X */
+#define _WCHAR_T
#ifndef _WCHAR_T_
-#undef __need_wchar_t
+#define _WCHAR_T_
+#ifndef _WCHAR_T_DEFINED /* If you want to override the wchar_t setting, define this */
#ifndef __cplusplus
typedef unsigned short wchar_t;
#endif
@@ -65,25 +67,14 @@
#endif
#endif
-/* Now report that it has been defined to all known hosts/operating systems */
+/* Set _WCHAR_T_DEFINED for the case that this is checked later */
#ifndef _WCHAR_T_DEFINED
#define _WCHAR_T_DEFINED
#endif
-#ifndef _WCHAR_T_DECLARED
-#define _WCHAR_T_DECLARED
-#endif
-
-#ifndef _WCHAR_T
-#define _WCHAR_T
-#endif
-
-#ifndef _WCHAR_T_
-#define _WCHAR_T_
-#endif
-
-
#include <ctype.h>
+#undef __need_wchar_t
+
#include <winerror.h>
#include <stddef.h>
#include <sdkddkver.h>