Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP4:GA
pyzy
pyzy-opencc-1_0_2-build.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File pyzy-opencc-1_0_2-build.patch of Package pyzy
diff -Nur pyzy-1.0git20120805/src/SimpTradConverter.cc pyzy-1.0git20120805-new/src/SimpTradConverter.cc --- pyzy-1.0git20120805/src/SimpTradConverter.cc 2012-08-03 10:36:31.000000000 +0800 +++ pyzy-1.0git20120805-new/src/SimpTradConverter.cc 2015-02-26 09:40:41.243684651 +0800 @@ -40,7 +40,6 @@ #ifdef HAVE_OPENCC class opencc { - static const int BUFFER_SIZE = 64; public: opencc (void) { @@ -55,29 +54,13 @@ void convert (const char *in, String &out) { - long n_char; - unichar *in_ucs4 = g_utf8_to_ucs4_fast (in, -1, &n_char); - - ucs4_t *pinbuf = (ucs4_t *)in_ucs4; - size_t inbuf_left = n_char; - while (inbuf_left != 0) { - ucs4_t *poutbuf = (ucs4_t *)m_buffer; - size_t outbuf_left = BUFFER_SIZE; - size_t retval = opencc_convert(m_od, &pinbuf, &inbuf_left, &poutbuf, &outbuf_left); - if (retval == (size_t) -1) { - /* append left chars in pinbuf */ - g_warning ("opencc_convert return failed"); - out << (unichar *) pinbuf; - break; - } - *poutbuf = L'\0'; - out << m_buffer; - } - g_free (in_ucs4); + char * converted = opencc_convert_utf8 (m_od, in, -1); + g_assert (converted != NULL); + out = converted; + opencc_convert_utf8_free (converted); } private: opencc_t m_od; - unichar m_buffer[BUFFER_SIZE + 1]; }; void
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor