diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-05-30 15:15:30 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-05-30 15:15:30 +0100 |
| commit | a4114c49aeec1e24e0607814a88f0f6a2d6111f5 (patch) | |
| tree | ef2355f9438d2fd58e61a1a4917b40fae3a35d1e /src | |
| parent | d23fd4a0505279eafcc4ea50116d69ecec733a5b (diff) | |
Tidy ISO translator prototype.
Diffstat (limited to 'src')
| -rw-r--r-- | src/iso6937.cc | 9 | ||||
| -rw-r--r-- | src/iso6937.h | 2 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/iso6937.cc b/src/iso6937.cc index d6c1970..048fd84 100644 --- a/src/iso6937.cc +++ b/src/iso6937.cc @@ -28,7 +28,7 @@ using std::wstring; using namespace sub; wstring -sub::iso6937_to_utf16 (char const * s) +sub::iso6937_to_utf16 (string s) { if (iso6937::grave.empty ()) { make_iso6937_tables (); @@ -38,8 +38,9 @@ sub::iso6937_to_utf16 (char const * s) boost::optional<unsigned char> diacritical; - while (*s != '\0') { - unsigned char const u = static_cast<unsigned char> (*s); + int i = 0; + while (s[i] != '\0') { + unsigned char const u = static_cast<unsigned char> (s[i]); if (u >= 0xc1 && u <= 0xcf) { diacritical = u; } else if (diacritical) { @@ -90,7 +91,7 @@ sub::iso6937_to_utf16 (char const * s) o += iso6937::main[u]; } - ++s; + ++i; } return o; diff --git a/src/iso6937.h b/src/iso6937.h index 700602d..7b85edf 100644 --- a/src/iso6937.h +++ b/src/iso6937.h @@ -19,6 +19,6 @@ namespace sub { - extern std::wstring iso6937_to_utf16 (char const * s); +extern std::wstring iso6937_to_utf16 (std::string); }; |
