[gtk+] Remove GdkWChar deprecated code



commit 3c8a54b2f7526392632dc8f53177c3bfaa170b3e
Author: Javier Jardón <jjardon gnome org>
Date:   Sat Jun 19 23:01:14 2010 +0200

    Remove GdkWChar deprecated code

 docs/reference/gdk/gdk3-sections.txt |    5 -
 docs/reference/gdk/tmpl/fonts.sgml   |   73 +----------
 gdk/directfb/gdkim-directfb.c        |  259 ----------------------------------
 gdk/gdk.h                            |    9 --
 gdk/gdk.symbols                      |    4 -
 gdk/gdktypes.h                       |    7 -
 gdk/quartz/gdkim-quartz.c            |   31 ----
 gdk/win32/gdkim-win32.c              |   31 ----
 gdk/x11/gdkim-x11.c                  |  133 -----------------
 gtk/gtkspinbutton.c                  |    4 +-
 10 files changed, 3 insertions(+), 553 deletions(-)
---
diff --git a/docs/reference/gdk/gdk3-sections.txt b/docs/reference/gdk/gdk3-sections.txt
index 3f629e4..3da4afb 100644
--- a/docs/reference/gdk/gdk3-sections.txt
+++ b/docs/reference/gdk/gdk3-sections.txt
@@ -411,11 +411,6 @@ gdk_font_unref
 gdk_font_id
 gdk_font_equal
 
-<SUBSECTION>
-GdkWChar
-gdk_wcstombs
-gdk_mbstowcs
-
 <SUBSECTION Standard>
 GDK_TYPE_FONT
 GDK_TYPE_FONT_TYPE
diff --git a/docs/reference/gdk/tmpl/fonts.sgml b/docs/reference/gdk/tmpl/fonts.sgml
index 57fc1d6..a96238b 100644
--- a/docs/reference/gdk/tmpl/fonts.sgml
+++ b/docs/reference/gdk/tmpl/fonts.sgml
@@ -185,27 +185,11 @@ of forms of string input:
     encoded according to the current locale. (A multibyte
     string is one in which each character may consist
     of one or more bytes, with different lengths for different
-    characters in the string). They can be converted to and
-    from wide character strings (see below) using
-    gdk_wcstombs() and gdk_mbstowcs().) The string will
+    characters in the string). The string will
     be rendered using one or more different fonts from
     the fontset.
     </para></listitem>
   </varlistentry>
-  <varlistentry>
-    <term>Wide character string</term>
-    <listitem><para>
-    For a number of the text-measuring functions, GDK
-    provides a variant which
-    takes a <type>GdkWChar *</type> instead of a 
-    <type>gchar *</type>. The input is then taken to
-    be a wide character string in the encoding of the
-    current locale. (A wide character string is a string
-    in which each character consists of several bytes,
-    and the width of each character in the string is 
-    constant.)
-    </para></listitem>
-  </varlistentry>
 </variablelist>
 </para>
 
@@ -385,58 +369,3 @@ are currently:
 @fonta: 
 @fontb: 
 @Returns: 
-
-
-<!-- ##### TYPEDEF GdkWChar ##### -->
-<para>
-Specifies a wide character type, used to represent character codes.
-This is needed since some native languages have character sets which have
-more than 256 characters (Japanese and Chinese, for example).
-</para>
-<para>
-Wide character values between 0 and 127 are always identical in meaning to
-the ASCII character codes. The wide character value 0 is often used to
-terminate strings of wide characters in a similar way to normal strings
-using the char type.
-</para>
-<para>
-An alternative to wide characters is multi-byte characters, which extend
-normal char strings to cope with larger character sets. As the name suggests,
-multi-byte characters use a different number of bytes to store different
-character codes. For example codes 0-127 (i.e. the ASCII codes) often
-use just one byte of memory, while other codes may use 2, 3 or even 4 bytes.
-Multi-byte characters have the advantage that they can often be used in an
-application with little change, since strings are still represented as arrays
-of char values. However multi-byte strings are much easier to manipulate since
-the character are all of the same size.
-</para>
-<para>
-Applications typically use wide characters to represent character codes
-internally, and multi-byte strings when saving the characters to a file.
-The gdk_wcstombs() and gdk_mbstowcs() functions can be used to convert from
-one representation to the other.
-</para>
-<para>
-See the 'Extended Characters' section of the GNU C Library Reference Manual
-for more detailed information on wide and multi-byte characters.
-</para>
-
-
-<!-- ##### FUNCTION gdk_wcstombs ##### -->
-<para>
-</para>
-
- src: 
- Returns: 
-
-
-<!-- ##### FUNCTION gdk_mbstowcs ##### -->
-<para>
-</para>
-
- dest: 
- src: 
- dest_max: 
- Returns: 
-
-
diff --git a/gdk/directfb/gdkim-directfb.c b/gdk/directfb/gdkim-directfb.c
index e27680c..53a8eea 100644
--- a/gdk/directfb/gdkim-directfb.c
+++ b/gdk/directfb/gdkim-directfb.c
@@ -58,262 +58,3 @@ gdk_set_locale (void)
 
   return setlocale (LC_ALL, NULL);
 }
-/*
- * gdk_wcstombs
- *
- * Returns a multi-byte string converted from the specified array
- * of wide characters. The string is newly allocated. The array of
- * wide characters must be null-terminated. If the conversion is
- * failed, it returns NULL.
- *
- * On Win32, we always use UTF-8.
- */
-gchar *
-gdk_wcstombs (const GdkWChar *src)
-{
-  gint len;
-  const GdkWChar *wcp;
-  guchar *mbstr, *bp;
-
-  wcp = src;
-  len = 0;
-  while (*wcp)
-    {
-      const GdkWChar c = *wcp++;
-
-      if (c < 0x80)
-        len += 1;
-      else if (c < 0x800)
-        len += 2;
-      else if (c < 0x10000)
-        len += 3;
-      else if (c < 0x200000)
-        len += 4;
-      else if (c < 0x4000000)
-        len += 5;
-      else
-        len += 6;
-    }
-
-  mbstr = g_malloc (len + 1);
-
-  wcp = src;
-  bp = mbstr;
-  while (*wcp)
-    {
-      int first;
-      GdkWChar c = *wcp++;
-
-      if (c < 0x80)
-        {
-          first = 0;
-          len = 1;
-        }
-      else if (c < 0x800)
-        {
-          first = 0xc0;
-          len = 2;
-        }
-      else if (c < 0x10000)
-        {
-          first = 0xe0;
-          len = 3;
-        }
-      else if (c < 0x200000)
-        {
-          first = 0xf0;
-          len = 4;
-        }
-      else if (c < 0x4000000)
-        {
-          first = 0xf8;
-          len = 5;
-        }
-      else
-        {
-          first = 0xfc;
-          len = 6;
-        }
-
-      /* Woo-hoo! */
-      switch (len)
-        {
-        case 6: bp[5] = (c & 0x3f) | 0x80; c >>= 6; /* Fall through */
-        case 5: bp[4] = (c & 0x3f) | 0x80; c >>= 6; /* Fall through */
-        case 4: bp[3] = (c & 0x3f) | 0x80; c >>= 6; /* Fall through */
-        case 3: bp[2] = (c & 0x3f) | 0x80; c >>= 6; /* Fall through */
-        case 2: bp[1] = (c & 0x3f) | 0x80; c >>= 6; /* Fall through */
-        case 1: bp[0] = c | first;
-        }
-
-      bp += len;
-    }
-
-  *bp = 0;
-
-  return (gchar*)mbstr;
-}
-
-
-/*
- * gdk_mbstowcs
- *
- * Converts the specified string into GDK wide characters, and,
- * returns the number of wide characters written. The string 'src'
- * must be null-terminated. If the conversion is failed, it returns
- * -1.
- *
- * On Win32, the string is assumed to be in UTF-8.  Also note that
- * GdkWChar is 32 bits, while wchar_t, and the wide characters the
- * Windows API uses, are 16 bits!
- */
-
-/* First a helper function for not zero-terminated strings */
-gint
-gdk_nmbstowcs (GdkWChar    *dest,
-               const gchar *src,
-               gint         src_len,
-               gint         dest_max)
-{
-  guchar *cp, *end;
-  gint n;
-
-  cp = (guchar *) src;
-  end = cp + src_len;
-  n = 0;
-  while (cp != end && dest != dest + dest_max)
-    {
-      gint i, mask = 0, len;
-      guchar c = *cp;
-
-      if (c < 0x80)
-        {
-          len = 1;
-          mask = 0x7f;
-        }
-      else if ((c & 0xe0) == 0xc0)
-        {
-          len = 2;
-          mask = 0x1f;
-        }
-      else if ((c & 0xf0) == 0xe0)
-        {
-          len = 3;
-          mask = 0x0f;
-        }
-      else if ((c & 0xf8) == 0xf0)
-        {
-          len = 4;
-          mask = 0x07;
-        }
-      else if ((c & 0xfc) == 0xf8)
-        {
-          len = 5;
-          mask = 0x03;
-        }
-      else if ((c & 0xfc) == 0xfc)
-        {
-          len = 6;
-          mask = 0x01;
-        }
-      else
-        return -1;
-
-      if (cp + len > end)
-        return -1;
-
-      *dest = (cp[0] & mask);
-      for (i = 1; i < len; i++)
-        {
-          if ((cp[i] & 0xc0) != 0x80)
-            return -1;
-          *dest <<= 6;
-          *dest |= (cp[i] & 0x3f);
-        }
-
-      if (*dest == -1)
-        return -1;
-
-      cp += len;
-      dest++;
-      n++;
-    }
-
-  if (cp != end)
-    return -1;
-
-  return n;
-}
-
-gint
-gdk_mbstowcs (GdkWChar    *dest,
-              const gchar *src,
-              gint         dest_max)
-{
-  return gdk_nmbstowcs (dest, src, strlen (src), dest_max);
-}
-
-
-/* A version that converts to wchar_t wide chars */
-
-gint
-gdk_nmbstowchar_ts (wchar_t     *dest,
-                    const gchar *src,
-                    gint         src_len,
-                    gint         dest_max)
-{
-  wchar_t *wcp;
-  guchar *cp, *end;
-  gint n;
-
-  wcp = dest;
-  cp = (guchar *) src;
-  end = cp + src_len;
-  n = 0;
-  while (cp != end && wcp != dest + dest_max)
-    {
-      gint i, mask = 0, len;
-      guchar c = *cp;
-
-      if (c < 0x80)
-        {
-          len = 1;
-          mask = 0x7f;
-        }
-      else if ((c & 0xe0) == 0xc0)
-        {
-          len = 2;
-          mask = 0x1f;
-        }
-      else if ((c & 0xf0) == 0xe0)
-        {
-          len = 3;
-          mask = 0x0f;
-        }
-      else /* Other lengths are not possible with 16-bit wchar_t! */
-        return -1;
-
-      if (cp + len > end)
-        return -1;
-
-      *wcp = (cp[0] & mask);
-      for (i = 1; i < len; i++)
-        {
-          if ((cp[i] & 0xc0) != 0x80)
-            return -1;
-          *wcp <<= 6;
-          *wcp |= (cp[i] & 0x3f);
-        }
-      if (*wcp == 0xFFFF)
-        return -1;
-
-      cp += len;
-      wcp++;
-      n++;
-    }
-
-  if (cp != end)
-    return -1;
-
-  return n;
-}
diff --git a/gdk/gdk.h b/gdk/gdk.h
index 89a9a8b..c41ed02 100644
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -155,15 +155,6 @@ GType gdk_rectangle_get_type (void) G_GNUC_CONST;
 
 #define GDK_TYPE_RECTANGLE (gdk_rectangle_get_type ())
 
-/* Conversion functions between wide char and multibyte strings. 
- */
-#ifndef GDK_DISABLE_DEPRECATED
-gchar     *gdk_wcstombs          (const GdkWChar   *src);
-gint       gdk_mbstowcs          (GdkWChar         *dest,
-				  const gchar      *src,
-				  gint              dest_max);
-#endif
-
 /* Miscellaneous */
 #ifndef GDK_MULTIHEAD_SAFE
 gboolean gdk_event_send_client_message      (GdkEvent       *event,
diff --git a/gdk/gdk.symbols b/gdk/gdk.symbols
index b667c5c..7deef6c 100644
--- a/gdk/gdk.symbols
+++ b/gdk/gdk.symbols
@@ -140,10 +140,6 @@ gdk_display_pointer_is_grabbed
 
 #if IN_HEADER(__GDK_H__)
 #if IN_FILE(__GDK_IM_X11_C__)
-#ifndef GDK_DISABLE_DEPRECATED
-gdk_mbstowcs
-gdk_wcstombs
-#endif
 gdk_set_locale
 #endif
 #endif
diff --git a/gdk/gdktypes.h b/gdk/gdktypes.h
index f2a1ff4..1329062 100644
--- a/gdk/gdktypes.h
+++ b/gdk/gdktypes.h
@@ -77,13 +77,6 @@ typedef struct _GdkRectangle	      GdkRectangle;
 typedef struct _GdkSegment	      GdkSegment;
 typedef struct _GdkSpan	              GdkSpan;
 
-/*
- * Note that on some platforms the wchar_t type
- * is not the same as GdkWChar. For instance
- * on Win32, wchar_t is unsigned short.
- */
-typedef guint32			    GdkWChar;
-
 typedef struct _GdkAtom            *GdkAtom;
 
 #define GDK_ATOM_TO_POINTER(atom) (atom)
diff --git a/gdk/quartz/gdkim-quartz.c b/gdk/quartz/gdkim-quartz.c
index a338244..621bda9 100644
--- a/gdk/quartz/gdkim-quartz.c
+++ b/gdk/quartz/gdkim-quartz.c
@@ -39,34 +39,3 @@ gdk_set_locale (void)
   
   return setlocale (LC_ALL, NULL);
 }
-
-gchar *
-gdk_wcstombs (const GdkWChar *src)
-{
-  gchar *mbstr;
-
-  gint length = 0;
-  gint i;
-
-  while (src[length] != 0)
-    length++;
-  
-  mbstr = g_new (gchar, length + 1);
-  
-  for (i = 0; i < length + 1; i++)
-    mbstr[i] = src[i];
-
-  return mbstr;
-}
-
-gint
-gdk_mbstowcs (GdkWChar *dest, const gchar *src, gint dest_max)
-{
-  gint i;
-  
-  for (i = 0; i < dest_max && src[i]; i++)
-    dest[i] = src[i];
-
-  return i;
-}
-
diff --git a/gdk/win32/gdkim-win32.c b/gdk/win32/gdkim-win32.c
index 3f038e0..128d7b8 100644
--- a/gdk/win32/gdkim-win32.c
+++ b/gdk/win32/gdkim-win32.c
@@ -43,34 +43,3 @@ gdk_set_locale (void)
   
   return g_win32_getlocale ();
 }
-
-gchar *
-gdk_wcstombs (const GdkWChar *src)
-{
-  const gchar *charset;
-
-  g_get_charset (&charset);
-  return g_convert ((char *) src, -1, charset, "UCS-4LE", NULL, NULL, NULL);
-}
-
-gint
-gdk_mbstowcs (GdkWChar    *dest,
-	      const gchar *src,
-	      gint         dest_max)
-{
-  gint retval;
-  gsize nwritten;
-  gint n_ucs4;
-  gunichar *ucs4;
-  const gchar *charset;
-
-  g_get_charset (&charset);
-  ucs4 = (gunichar *) g_convert (src, -1, "UCS-4LE", charset, NULL, &nwritten, NULL);
-  n_ucs4 = nwritten * sizeof (GdkWChar);
-
-  retval = MIN (dest_max, n_ucs4);
-  memmove (dest, ucs4, retval * sizeof (GdkWChar));
-  g_free (ucs4);
-
-  return retval;
-}
diff --git a/gdk/x11/gdkim-x11.c b/gdk/x11/gdkim-x11.c
index bbd9ac1..cb72370 100644
--- a/gdk/x11/gdkim-x11.c
+++ b/gdk/x11/gdkim-x11.c
@@ -115,138 +115,5 @@ find_a_display (void)
   return display;
 }
 
-/**
- * gdk_wcstombs:
- * @src: a wide character string.
- * 
- * Converts a wide character string to a multi-byte string.
- * (The function name comes from an acronym of 'Wide Character String TO
- * Multi-Byte String').
- * 
- * Return value: the multi-byte string corresponding to @src, or %NULL if the
- * conversion failed. The returned string should be freed with g_free() when no
- * longer needed.
- **/
-gchar *
-gdk_wcstombs (const GdkWChar *src)
-{
-  gchar *mbstr;
-
-  if (gdk_use_mb)
-    {
-      GdkDisplay *display = find_a_display ();
-      Display *xdisplay = GDK_DISPLAY_XDISPLAY (display);
-      XTextProperty tpr;
-
-      if (sizeof(wchar_t) != sizeof(GdkWChar))
-	{
-	  gint i;
-	  wchar_t *src_alt;
-	  for (i=0; src[i]; i++);
-	  src_alt = g_new (wchar_t, i+1);
-	  for (; i>=0; i--)
-	    src_alt[i] = src[i];
-	  if (XwcTextListToTextProperty (xdisplay, &src_alt, 1, XTextStyle, &tpr)
-	      != Success)
-	    {
-	      g_free (src_alt);
-	      return NULL;
-	    }
-	  g_free (src_alt);
-	}
-      else
-	{
-	  wchar_t *tmp;
-	  
-	  if (XwcTextListToTextProperty (xdisplay, &tmp, 1,
-					 XTextStyle, &tpr) != Success)
-	    {
-	      return NULL;
-	    }
-	  
-	  src = (GdkWChar *)tmp;
-	}
-      /*
-       * We must copy the string into an area allocated by glib, because
-       * the string 'tpr.value' must be freed by XFree().
-       */
-      mbstr = g_strdup((gchar *)tpr.value);
-      XFree (tpr.value);
-    }
-  else
-    {
-      gint length = 0;
-      gint i;
-
-      while (src[length] != 0)
-	length++;
-      
-      mbstr = g_new (gchar, length + 1);
-
-      for (i=0; i<length+1; i++)
-	mbstr[i] = src[i];
-    }
-
-  return mbstr;
-}
-/**
- * gdk_mbstowcs:
- * @dest: the space to place the converted wide character string into.
- * @src: the multi-byte string to convert, which must be nul-terminated.
- * @dest_max: the maximum number of wide characters to place in @dest.
- * 
- * Converts a multi-byte string to a wide character string.
- * (The function name comes from an acronym of 'Multi-Byte String TO Wide
- * Character String').
- * 
- * Return value: the number of wide characters written into @dest, or -1 if 
- *   the conversion failed.
- **/
-  
-gint
-gdk_mbstowcs (GdkWChar *dest, const gchar *src, gint dest_max)
-{
-  if (gdk_use_mb)
-    {
-      GdkDisplay *display = find_a_display ();
-      Display *xdisplay = GDK_DISPLAY_XDISPLAY (display);
-      XTextProperty tpr;
-      wchar_t **wstrs, *wstr_src;
-      gint num_wstrs;
-      gint len_cpy;
-      if (XmbTextListToTextProperty (xdisplay, (char **)&src, 1, XTextStyle,
-				     &tpr)
-	  != Success)
-	{
-	  /* NoMem or LocaleNotSupp */
-	  return -1;
-	}
-      if (XwcTextPropertyToTextList (xdisplay, &tpr, &wstrs, &num_wstrs)
-	  != Success)
-	{
-	  /* InvalidChar */
-	  XFree(tpr.value);
-	  return -1;
-	}
-      XFree(tpr.value);
-      if (num_wstrs == 0)
-	return 0;
-      wstr_src = wstrs[0];
-      for (len_cpy=0; len_cpy<dest_max && wstr_src[len_cpy]; len_cpy++)
-	dest[len_cpy] = wstr_src[len_cpy];
-      XwcFreeStringList (wstrs);
-      return len_cpy;
-    }
-  else
-    {
-      gint i;
-
-      for (i=0; i<dest_max && src[i]; i++)
-	dest[i] = src[i];
-
-      return i;
-    }
-}
-
 #define __GDK_IM_X11_C__
 #include "gdkaliasdef.c"
diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c
index 71d7934..7d1280a 100644
--- a/gtk/gtkspinbutton.c
+++ b/gtk/gtkspinbutton.c
@@ -1426,8 +1426,8 @@ gtk_spin_button_insert_text (GtkEditable *editable,
       gboolean sign;
       gint dotpos = -1;
       gint i;
-      GdkWChar pos_sign;
-      GdkWChar neg_sign;
+      guint32 pos_sign;
+      guint32 neg_sign;
       gint entry_length;
       const gchar *entry_text;
 



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