1 /* GDK - The GIMP Drawing Kit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3 * Copyright (C) 1998-2004 Tor Lillqvist
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
22 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
23 * file for a list of people on the GTK+ Team. See the ChangeLog
24 * files for a list of changes. These files are distributed with
25 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
34 #include "gdkpixmap.h"
35 #include "gdkinternals.h"
42 if (!setlocale (LC_ALL, ""))
43 g_warning ("locale not supported by C library");
45 return g_win32_getlocale ();
49 gdk_wcstombs (const GdkWChar *src)
53 g_get_charset (&charset);
54 return g_convert ((char *) src, -1, charset, "UCS-4LE", NULL, NULL, NULL);
58 gdk_mbstowcs (GdkWChar *dest,
68 g_get_charset (&charset);
69 ucs4 = (gunichar *) g_convert (src, -1, "UCS-4LE", charset, NULL, &nwritten, NULL);
70 n_ucs4 = nwritten * sizeof (GdkWChar);
72 retval = MIN (dest_max, n_ucs4);
73 memmove (dest, ucs4, retval * sizeof (GdkWChar));