summaryrefslogtreecommitdiffstats
path: root/src/pinyin.cpp
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2012-06-26 11:18:23 +0800
committerPeng Wu <alexepico@gmail.com>2012-06-26 11:18:23 +0800
commitddb8803e219bf4189f9a0105af7189b8c31c5d06 (patch)
tree0810988399a207f9e595b9e5b4283b151a26c5f3 /src/pinyin.cpp
parent8ea792e62bcdcbf8625fb41fee6088caa1aa0f02 (diff)
downloadlibpinyin-ddb8803e219bf4189f9a0105af7189b8c31c5d06.tar.gz
libpinyin-ddb8803e219bf4189f9a0105af7189b8c31c5d06.tar.xz
libpinyin-ddb8803e219bf4189f9a0105af7189b8c31c5d06.zip
fixes a typo
Diffstat (limited to 'src/pinyin.cpp')
-rw-r--r--src/pinyin.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/pinyin.cpp b/src/pinyin.cpp
index c115137..3b5eaa9 100644
--- a/src/pinyin.cpp
+++ b/src/pinyin.cpp
@@ -86,7 +86,7 @@ static bool check_format(const char * userdir){
filename = g_build_filename
(userdir, "user.db", NULL);
- g_unlink(filename);
+ unlink(filename);
g_free(filename);
return exists;
@@ -205,7 +205,7 @@ bool pinyin_load_phrase_library(pinyin_context_t * context,
const char * userfilename = table_info->m_user_filename;
gchar * chunkfilename = g_build_filename(context->m_user_dir,
- userfilename, NULL);
+ userfilename, NULL);
/* check bin file exists. if not, create a new one. */
if (chunk->load(chunkfilename)) {
@@ -286,8 +286,8 @@ bool pinyin_save(pinyin_context_t * context){
userfilename, NULL);
log->save(tmppathname);
rename(tmppathname, chunkpathname);
- g_free(tmppathname);
g_free(chunkpathname);
+ g_free(tmppathname);
delete log;
}
@@ -298,12 +298,13 @@ bool pinyin_save(pinyin_context_t * context){
const char * userfilename = table_info->m_user_filename;
gchar * tmpfilename = g_strdup_printf("%s.tmp", userfilename);
- gchar * chunkpathname = g_build_filename(context->m_user_dir,
- userfilename, NULL);
gchar * tmppathname = g_build_filename(context->m_user_dir,
tmpfilename, NULL);
g_free(tmpfilename);
+ gchar * chunkpathname = g_build_filename(context->m_user_dir,
+ userfilename, NULL);
+
chunk->save(tmppathname);
rename(tmppathname, chunkpathname);
g_free(chunkpathname);