Fixed error messages of: g_(filename|locale)_(from|to)_utf8()
[captive.git] / src / client / cmdline / utf8.c
1 /* $Id$
2  * client cmdline interface GnomeVFSFileInfo utils for libcaptive
3  * Copyright (C) 2003 Jan Kratochvil <project-captive@jankratochvil.net>
4  * 
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; exactly version 2 of June 1991 is required
8  * 
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  * 
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  */
18
19
20 #include "config.h"
21
22 #include <glib/gmessages.h>
23 #include <glib/gerror.h>
24
25
26 #include "utf8.h"       /* self */
27
28
29 gchar *cmd_utf8_macro_malloc_errorchecking(
30                 gchar *(*func)(const gchar *string,gssize len,gsize *bytes_read,gsize *bytes_written,GError **error),
31                 const gchar *func_name,
32                 const gchar *string)
33 {
34 GError *error;
35 gchar *r;
36
37         g_return_val_if_fail(func!=NULL,NULL);
38         g_return_val_if_fail(string!=NULL,NULL);
39
40         error=NULL;
41         r=(*func)(
42                         string, /* opsysstring/utf8string */
43                         -1,     /* len; '\0'-terminated */
44                         NULL,   /* bytes_read */
45                         NULL,   /* bytes_written */
46                         &error);        /* error */
47         if (error) {
48                 g_log(G_LOG_DOMAIN,G_LOG_LEVEL_WARNING,"captivefs %s(): name=\"%s\": %s",
49                                 func_name,string,error->message);
50                 g_clear_error(&error);
51                 }
52         return r;
53 }