No writable strings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I know,

Another (potentially) controversial patch. But this is a very hacky,
unwarranted extension. Using this hack is very error prone, and requires
large source modifications. Moreover, gcc has supported 16bit wchar_t 
for a long time now, this is no longer an issue.

As such, I feel this practice should not be promoted by the Wine code.
If special projects really require the use of an antiquated gcc (why?!?),
they can add this locally, it's simple and small. No need to pollute the
official code with it, and confuse folks by having it in the first place.

ChangeLog
  Remove writable-strings support.

Index: include/winnt.h
===================================================================
RCS file: /var/cvs/wine/include/winnt.h,v
retrieving revision 1.152
diff -u -r1.152 winnt.h
--- include/winnt.h	24 Jan 2003 00:49:32 -0000	1.152
+++ include/winnt.h	28 Jan 2003 21:54:11 -0000
@@ -337,49 +337,11 @@
  * macro which only exists in the user's code.
  */
 #ifndef __WINESRC__
-# ifdef WINE_UNICODE_REWRITE
-
-/* Use this if your compiler does not provide a 16bit wchar_t type.
- * Note that you will need to specify -fwritable-strings or an option
- * to this effect.
- * In C++ both WINE_UNICODE_TEXT('c') and WINE_UNICODE_TEXT("str") are
- * supported, but only the string form can be supported in C.
- */
-EXTERN_C unsigned short* wine_rewrite_s4tos2(const wchar_t* str4);
-#  ifdef __cplusplus
-inline WCHAR* wine_unicode_text(const wchar_t* str4)
-{
-  return (WCHAR*)wine_rewrite_s4tos2(str4);
-}
-inline WCHAR wine_unicode_text(wchar_t chr4)
-{
-  return (WCHAR)chr4;
-}
-#   define WINE_UNICODE_TEXT(x)       wine_unicode_text(L##x)
-#  else  /* __cplusplus */
-#   define WINE_UNICODE_TEXT(x)       ((WCHAR*)wine_rewrite_s4tos2(L##x))
-#  endif  /* __cplusplus */
-
-# else  /* WINE_UNICODE_REWRITE */
-
-/* Define WINE_UNICODE_NATIVE if:
- * - your compiler provides a 16bit wchar_t type, e.g. gcc >= 2.96 with
- *   -fshort-wchar option
- * - or if you decide to use the native 32bit Unix wchar_t type. Be aware
- *   though that the Wine APIs only support 16bit WCHAR characters for
- *   binary compatibility reasons.
- * - or define nothing at all if you don't use Unicode, and blissfully
- *   ignore the issue :-)
- */
-#  define WINE_UNICODE_TEXT(string)   L##string
-
-# endif  /* WINE_UNICODE_REWRITE */
-
 # ifdef UNICODE
 typedef WCHAR           TCHAR,      *PTCHAR;
 typedef LPWSTR          PTSTR,       LPTSTR;
 typedef LPCWSTR         PCTSTR,      LPCTSTR;
-#  define __TEXT(string) WINE_UNICODE_TEXT(string)
+#  define __TEXT(string) L##string
 # else  /* UNICODE */
 typedef CHAR            TCHAR,      *PTCHAR;
 typedef LPSTR           PTSTR,       LPTSTR;
Index: library/port.c
===================================================================
RCS file: /var/cvs/wine/library/port.c,v
retrieving revision 1.39
diff -u -r1.39 port.c
--- library/port.c	13 Dec 2002 23:30:54 -0000	1.39
+++ library/port.c	28 Jan 2003 21:50:54 -0000
@@ -588,37 +588,6 @@
 #endif
 }
 
-/***********************************************************************
- *		wine_rewrite_s4tos2
- *
- * Convert 4 byte Unicode strings to 2 byte Unicode strings in-place.
- * This is only practical if literal strings are writable.
- */
-unsigned short* wine_rewrite_s4tos2(const wchar_t* str4 )
-{
-    unsigned short *str2,*s2;
-
-    if (str4==NULL)
-      return NULL;
-
-    if ((*str4 & 0xffff0000) != 0) {
-        /* This string has already been converted. Return it as is */
-        return (unsigned short*)str4;
-    }
-
-    /* Note that we can also end up here if the string has a single
-     * character. In such a case we will convert the string over and
-     * over again. But this is harmless.
-     */
-    str2=s2=(unsigned short*)str4;
-    do {
-        *s2=(unsigned short)*str4;
-	s2++;
-    } while (*str4++ != L'\0');
-
-    return str2;
-}
-
 #ifndef HAVE_ECVT
 /***********************************************************************
  *		ecvt


-- 
Dimi.



[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux