summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPeng Huang <shawn.p.huang@gmail.com>2010-04-14 11:19:09 +0800
committerPeng Huang <shawn.p.huang@gmail.com>2010-04-14 11:26:08 +0800
commitb3ea7266a0b491dfe727e1ebfa3cedc70da30276 (patch)
treea8fe5239ad2df43d37b85dccab96eaba9c784e31 /src
parentb113c8be8ca9b8d5f4b44ee991012d1513e29236 (diff)
downloadibus-libpinyin-b3ea7266a0b491dfe727e1ebfa3cedc70da30276.tar.gz
ibus-libpinyin-b3ea7266a0b491dfe727e1ebfa3cedc70da30276.tar.xz
ibus-libpinyin-b3ea7266a0b491dfe727e1ebfa3cedc70da30276.zip
Use cheaders
Diffstat (limited to 'src')
-rw-r--r--src/Database.cc8
-rw-r--r--src/Engine.cc2
-rw-r--r--src/Phrase.h1
-rw-r--r--src/PinyinEngine.cc3
-rw-r--r--src/PinyinParser.cc16
-rw-r--r--src/SimpTradConverter.cc12
6 files changed, 20 insertions, 22 deletions
diff --git a/src/Database.cc b/src/Database.cc
index ba18e1b..cd35874 100644
--- a/src/Database.cc
+++ b/src/Database.cc
@@ -1,10 +1,10 @@
/* vim:set et sts=4: */
-#include <string.h>
+#include <cstring>
+#include <cstdio>
+#include <cstdlib>
+#include <cstdarg>
#include <glib.h>
#include <sqlite3.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
#include "Database.h"
#include "Util.h"
diff --git a/src/Engine.cc b/src/Engine.cc
index f7e8851..5c16028 100644
--- a/src/Engine.cc
+++ b/src/Engine.cc
@@ -1,7 +1,7 @@
/* vim:set et sts=4: */
+#include <cstring>
#include <ibus.h>
-#include <string.h>
#include "Engine.h"
#include "PinyinEngine.h"
diff --git a/src/Phrase.h b/src/Phrase.h
index 02f091f..1f1f067 100644
--- a/src/Phrase.h
+++ b/src/Phrase.h
@@ -2,7 +2,6 @@
#ifndef __PY_PHRASE_H_
#define __PY_PHRASE_H_
-#include <string.h>
#include "Types.h"
namespace PY {
diff --git a/src/PinyinEngine.cc b/src/PinyinEngine.cc
index 27b2f8d..dd6d562 100644
--- a/src/PinyinEngine.cc
+++ b/src/PinyinEngine.cc
@@ -1,8 +1,7 @@
/* vim:set et sts=4: */
-#include <ibus.h>
-#include <string.h>
#include <libintl.h>
+#include <ibus.h>
#include "RawEditor.h"
#include "ExtEditor.h"
#include "FullPinyinEditor.h"
diff --git a/src/PinyinParser.cc b/src/PinyinParser.cc
index a28cb32..8d269c0 100644
--- a/src/PinyinParser.cc
+++ b/src/PinyinParser.cc
@@ -1,6 +1,6 @@
/* vim:set et sts=4: */
-#include <string.h>
-#include <stdlib.h>
+#include <cstring>
+#include <cstdlib>
#include <glib.h>
#include "PinyinParser.h"
@@ -31,7 +31,7 @@ py_cmp (const void *p1, const void *p2)
const gchar *str = (const gchar *) p1;
const Pinyin *py = (const Pinyin *) p2;
- return strcmp (str, py->text);
+ return std::strcmp (str, py->text);
}
static const Pinyin *
@@ -50,9 +50,9 @@ is_pinyin (const gchar *p,
return NULL;
if (G_LIKELY (len > 0)) {
- strncpy (buf, p, len);
+ std::strncpy (buf, p, len);
buf[len] = 0;
- result = (const Pinyin *) bsearch (buf, pinyin_table, G_N_ELEMENTS (pinyin_table),
+ result = (const Pinyin *) std::bsearch (buf, pinyin_table, G_N_ELEMENTS (pinyin_table),
sizeof (Pinyin), py_cmp);
if (check_flags (result, option))
return result;
@@ -61,11 +61,11 @@ is_pinyin (const gchar *p,
/* len < 0 */
len = MIN (6, end - p);
- strncpy (buf, p, len);
+ std::strncpy (buf, p, len);
for (; len > 0; len --) {
buf[len] = 0;
- result = (const Pinyin *) bsearch (buf, pinyin_table, G_N_ELEMENTS (pinyin_table),
+ result = (const Pinyin *) std::bsearch (buf, pinyin_table, G_N_ELEMENTS (pinyin_table),
sizeof (Pinyin), py_cmp);
if (G_UNLIKELY (check_flags (result, option))) {
return result;
@@ -95,7 +95,7 @@ need_resplit(const Pinyin *p1,
{
const Pinyin * pys[] = {p1, p2};
- return (const Pinyin **) bsearch (pys, special_table, G_N_ELEMENTS (special_table),
+ return (const Pinyin **) std::bsearch (pys, special_table, G_N_ELEMENTS (special_table),
sizeof (special_table[0]), sp_cmp);
}
diff --git a/src/SimpTradConverter.cc b/src/SimpTradConverter.cc
index c470afd..0bbb1e8 100644
--- a/src/SimpTradConverter.cc
+++ b/src/SimpTradConverter.cc
@@ -1,5 +1,5 @@
-#include <stdlib.h>
-#include <wchar.h>
+#include <cstdlib>
+#include <cwchar>
#include <glib.h>
#include <glib-object.h>
#include "SimpTradConverter.h"
@@ -12,7 +12,7 @@ static int _cmp (const void *p1, const void *p2)
const wchar_t *s1 = (const wchar_t *) p1;
const wchar_t **s2 = (const wchar_t **) p2;
- return wcscmp (s1, s2[0]);
+ return std::wcscmp (s1, s2[0]);
}
void
@@ -37,9 +37,9 @@ SimpTradConverter::simpToTrad (const gchar *in, String &out)
}
for (; i > 0; i--) {
buf[i] = 0;
- result = (const gunichar **) bsearch (buf, simp_to_trad,
- G_N_ELEMENTS (simp_to_trad), sizeof (simp_to_trad[0]),
- _cmp);
+ result = (const gunichar **) std::bsearch (buf, simp_to_trad,
+ G_N_ELEMENTS (simp_to_trad), sizeof (simp_to_trad[0]),
+ _cmp);
if (G_UNLIKELY (result != NULL))
break;
}