Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
DISCONTINUED:openSUSE:11.1:Update
mc
00-70-utf8-common.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 00-70-utf8-common.patch of Package mc
Some common stuff used by other UTF-8 patches. ================================================================================ --- mc-4.6.2-pre1/src/util.c +++ mc-4.6.2-pre1/src/util.c @@ -140,6 +140,30 @@ return strlen (str); } +int +columns_to_bytes (const char *str, int col) +{ + int bytes = 0; + int columns = 0; + int i; +#ifdef UTF8 + if (SLsmg_Is_Unicode) { + static mbstate_t s; + while (columns < col) { + memset (&s, 0, sizeof (s)); + i = mbrlen (str + bytes, -1, &s); + if (i <= 0) { + return col + bytes - columns; + } + bytes += i; + columns ++; + } + return col + bytes - columns; + } else +#endif + return col; +} + #ifdef UTF8 void --- mc-4.6.2-pre1/src/util.h +++ mc-4.6.2-pre1/src/util.h @@ -105,6 +105,7 @@ void fix_utf8(char *str); size_t mbstrlen (const char *); +int columns_to_bytes (const char *, int); wchar_t *mbstr_to_wchar (const char *); char *wchar_to_mbstr (const wchar_t *); char *utf8_to_local(char *str);
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