summaryrefslogtreecommitdiffstats
path: root/src/storage/pinyin_base.cpp
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2010-08-26 11:05:46 +0800
committerPeng Wu <alexepico@gmail.com>2010-08-26 11:05:46 +0800
commitb601fb3a3e0799d744f3eff61449d79ffbb6417d (patch)
tree9e0b7653d2f5d0dec1a411c6adf1562a1fea1f8d /src/storage/pinyin_base.cpp
parentc7232e9e4545596913892f478405b8e8febc6e4b (diff)
downloadlibpinyin-b601fb3a3e0799d744f3eff61449d79ffbb6417d.tar.gz
libpinyin-b601fb3a3e0799d744f3eff61449d79ffbb6417d.tar.xz
libpinyin-b601fb3a3e0799d744f3eff61449d79ffbb6417d.zip
re-factor pinyin phrase
Diffstat (limited to 'src/storage/pinyin_base.cpp')
-rw-r--r--src/storage/pinyin_base.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/storage/pinyin_base.cpp b/src/storage/pinyin_base.cpp
index 90a0baa..66587f0 100644
--- a/src/storage/pinyin_base.cpp
+++ b/src/storage/pinyin_base.cpp
@@ -1384,8 +1384,7 @@ int pinyin_compare_initial (const PinyinCustomSettings &custom,
(lhs == PINYIN_He && rhs == PINYIN_Fo)))
)
return 0;
- else if (lhs < rhs) return -1;
- return 1;
+ else return (lhs - rhs);
}
int pinyin_compare_final (const PinyinCustomSettings &custom,
@@ -1407,8 +1406,7 @@ int pinyin_compare_final (const PinyinCustomSettings &custom,
return 0;
else if (custom.use_incomplete && (lhs == PINYIN_ZeroFinal || rhs == PINYIN_ZeroFinal))
return 0;
- else if (lhs < rhs) return -1;
- return 1;
+ else return (lhs - rhs);
}
int pinyin_compare_tone (const PinyinCustomSettings &custom,
@@ -1417,8 +1415,7 @@ int pinyin_compare_tone (const PinyinCustomSettings &custom,
{
if(lhs == rhs || !lhs || !rhs)
return 0;
- else if (lhs < rhs) return -1;
- return 1;
+ else return (lhs - rhs);
}
};