Ticket #1809 (invalid length of nonprintable chars)
[kaloumi3.git] / src / glibcompat.c
blob6bbf7bc91bbfec567e44e3e91dfcc5f3592a99fc
1 /* GLIB - Library of useful routines for C programming
2 Copyright (C) 2009
3 Free Software Foundation, Inc.
5 Written by:
6 Slava Zanko <slavazanko@gmail.com>, 2009.
8 This file is part of the Midnight Commander.
10 The Midnight Commander is free software; you can redistribute it
11 and/or modify it under the terms of the GNU General Public License as
12 published by the Free Software Foundation; either version 2 of the
13 License, or (at your option) any later version.
15 The Midnight Commander is distributed in the hope that it will be
16 useful, but WITHOUT ANY WARRANTY; without even the implied warranty
17 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
23 MA 02110-1301, USA.
26 /** \file glibcompat.c
27 * \brief Source: compatibility with older versions of glib
29 * Following code was copied from glib to GNU Midnight Commander to
30 * provide compatibility with older versions of glib.
33 #include <config.h>
35 #include "global.h"
36 #include "glibcompat.h"
38 /*** global variables ****************************************************************************/
40 /*** file scope macro definitions ****************************************************************/
42 /*** file scope type declarations ****************************************************************/
44 /*** file scope variables ************************************************************************/
46 /*** file scope functions ************************************************************************/
48 /*** public functions ****************************************************************************/
49 /* --------------------------------------------------------------------------------------------- */
51 #if ! GLIB_CHECK_VERSION (2, 13, 0)
53 This is incomplete copy of same glib-function.
54 For older glib (less than 2.13) functional is enought.
55 For full version of glib welcome to glib update.
57 gboolean
58 g_unichar_iszerowidth (gunichar c)
60 if (G_UNLIKELY (c == 0x00AD))
61 return FALSE;
63 if (G_UNLIKELY ((c >= 0x1160 && c < 0x1200) || c == 0x200B))
64 return TRUE;
66 return FALSE;
68 #endif /* ! GLIB_CHECK_VERSION (2, 13, 0) */
70 /* --------------------------------------------------------------------------------------------- */
72 #if ! GLIB_CHECK_VERSION (2, 7, 0)
73 gboolean
74 g_file_set_contents (const gchar * filename, const gchar * contents, gssize length, GError ** error)
76 return g_file_replace (filename, contents, length, error);
78 #endif /* ! GLIB_CHECK_VERSION (2, 7, 0) */