?? codeset.c
字號(hào):
#include <errno.h>#include <glib.h>#include "common.h"#define IPMSG_INTERNAL_CODE "UTF-8"#define IPMSG_PROTO_CODE "CP932"intconvert_string_internal(const char *string,const gchar **to_string){ int rc=0; gchar *converted_string; gsize read_len; gsize write_len; GError *error_info=NULL; if ( (!string) || (!to_string) ) return -EINVAL; converted_string=g_convert((const gchar *)string, -1, /* ヌルターミネート */ IPMSG_INTERNAL_CODE, IPMSG_PROTO_CODE, &read_len, &write_len, &error_info); rc=-EINVAL; if (!converted_string) { if (error_info) { err_out("%s\n",error_info->message); rc=error_info->code; g_error_free(error_info); } if (rc>0) rc=-rc; return rc; } *to_string=converted_string; return 0;}intconvert_string_ipmsg_proto(const char *string,const gchar **to_string){ int rc=0; gchar *converted_string; gsize read_len; gsize write_len; GError *error_info=NULL; if ( (!string) || (!to_string) ) return -EINVAL; converted_string=g_convert((const gchar *)string, -1, /* ヌルターミネート */ IPMSG_PROTO_CODE, IPMSG_INTERNAL_CODE, &read_len, &write_len, &error_info); rc=-EINVAL; if (!converted_string) { if (error_info) { err_out("%s\n",error_info->message); rc=error_info->code; g_error_free(error_info); } if (rc>0) rc=-rc; return rc; } *to_string=converted_string; return 0;}intconvert_string_ipmsg_locale(const char *string,const gchar **to_string){ int rc=0; gchar *converted_string; gsize read_len; gsize write_len; GError *error_info=NULL; if ( (!string) || (!to_string) ) return -EINVAL; converted_string=g_locale_from_utf8((const gchar *)string, -1, /* ヌルターミネート */ &read_len, &write_len, &error_info); if (!converted_string) { if (error_info) { err_out("%s\n",error_info->message); rc=error_info->code; g_error_free(error_info); } if (rc>0) rc=-rc; return rc; } *to_string=converted_string; return 0;}intconvert_string_ipmsg_filename(const char *string,const gchar **to_string){ int rc=0; gchar *converted_string; gsize read_len; gsize write_len; GError *error_info=NULL; if ( (!string) || (!to_string) ) return -EINVAL; converted_string=g_filename_from_utf8((const gchar *)string, -1, /* ヌルターミネート */ &read_len, &write_len, &error_info); rc=-EINVAL; if (!converted_string) { if (error_info) { err_out("%s\n",error_info->message); rc=error_info->code; g_error_free(error_info); } if (rc>0) rc=-rc; return rc; } *to_string=converted_string; return 0;}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -