/* vim:set et sts=4: */
-#include <string.h>
-#include <stdlib.h>
+#include <cstring>
+#include <cstdlib>
#include <glib.h>
#include "PinyinParser.h"
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 *
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;
/* 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;
{
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);
}
-#include <stdlib.h>
-#include <wchar.h>
+#include <cstdlib>
+#include <cwchar>
#include <glib.h>
#include <glib-object.h>
#include "SimpTradConverter.h"
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
}
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;
}