diff options
author | wawaka <wawaka@yandex-team.ru> | 2022-02-10 16:47:48 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:48 +0300 |
commit | ed524783c88c81047033c5d6e5543db3a2251ad5 (patch) | |
tree | 5c595c0ac1b14fbb70e7e71df44b52e47f850387 /contrib/libs/libxml/yencoding.cpp | |
parent | 11ec0273ab97c87692cd0004865c7f24d14f9902 (diff) | |
download | ydb-ed524783c88c81047033c5d6e5543db3a2251ad5.tar.gz |
Restoring authorship annotation for <wawaka@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/libxml/yencoding.cpp')
-rw-r--r-- | contrib/libs/libxml/yencoding.cpp | 92 |
1 files changed, 46 insertions, 46 deletions
diff --git a/contrib/libs/libxml/yencoding.cpp b/contrib/libs/libxml/yencoding.cpp index 8092bbfb1c..141388e004 100644 --- a/contrib/libs/libxml/yencoding.cpp +++ b/contrib/libs/libxml/yencoding.cpp @@ -1,48 +1,48 @@ - -#include "yencoding.h" - + +#include "yencoding.h" + #include <library/cpp/charset/codepage.h> #include <library/cpp/charset/recyr.hh> - - -int -win1251ToUTF8(unsigned char* out, int *outlen, - const unsigned char* in, int *inlen) { - size_t in_readed, out_writed; - RECODE_RESULT res = Recode(CODES_WIN, CODES_UTF8, (const char*)in, (char*)out, (size_t)*inlen, (size_t)*outlen, in_readed, out_writed); - *inlen = (int)in_readed; - *outlen = (int)out_writed; - return (res == RECODE_OK)? 0 : -1; -} - -int -UTF8Towin1251(unsigned char* out, int *outlen, - const unsigned char* in, int *inlen) { - size_t in_readed, out_writed; - RECODE_RESULT res = Recode(CODES_UTF8, CODES_WIN, (const char*)in, (char*)out, (size_t)*inlen, (size_t)*outlen, in_readed, out_writed); - *inlen = (int)in_readed; - *outlen = (int)out_writed; - return (res == RECODE_OK)? 0 : -1; -} - - -int -koi8ToUTF8(unsigned char* out, int *outlen, - const unsigned char* in, int *inlen) { - size_t in_readed, out_writed; - RECODE_RESULT res = Recode(CODES_KOI8, CODES_UTF8, (const char*)in, (char*)out, (size_t)*inlen, (size_t)*outlen, in_readed, out_writed); - *inlen = (int)in_readed; - *outlen = (int)out_writed; - return (res == RECODE_OK)? 0 : -1; -} - -int -UTF8Tokoi8(unsigned char* out, int *outlen, - const unsigned char* in, int *inlen) { - size_t in_readed, out_writed; - RECODE_RESULT res = Recode(CODES_UTF8, CODES_KOI8, (const char*)in, (char*)out, (size_t)*inlen, (size_t)*outlen, in_readed, out_writed); - *inlen = (int)in_readed; - *outlen = (int)out_writed; - return (res == RECODE_OK)? 0 : -1; -} - + + +int +win1251ToUTF8(unsigned char* out, int *outlen, + const unsigned char* in, int *inlen) { + size_t in_readed, out_writed; + RECODE_RESULT res = Recode(CODES_WIN, CODES_UTF8, (const char*)in, (char*)out, (size_t)*inlen, (size_t)*outlen, in_readed, out_writed); + *inlen = (int)in_readed; + *outlen = (int)out_writed; + return (res == RECODE_OK)? 0 : -1; +} + +int +UTF8Towin1251(unsigned char* out, int *outlen, + const unsigned char* in, int *inlen) { + size_t in_readed, out_writed; + RECODE_RESULT res = Recode(CODES_UTF8, CODES_WIN, (const char*)in, (char*)out, (size_t)*inlen, (size_t)*outlen, in_readed, out_writed); + *inlen = (int)in_readed; + *outlen = (int)out_writed; + return (res == RECODE_OK)? 0 : -1; +} + + +int +koi8ToUTF8(unsigned char* out, int *outlen, + const unsigned char* in, int *inlen) { + size_t in_readed, out_writed; + RECODE_RESULT res = Recode(CODES_KOI8, CODES_UTF8, (const char*)in, (char*)out, (size_t)*inlen, (size_t)*outlen, in_readed, out_writed); + *inlen = (int)in_readed; + *outlen = (int)out_writed; + return (res == RECODE_OK)? 0 : -1; +} + +int +UTF8Tokoi8(unsigned char* out, int *outlen, + const unsigned char* in, int *inlen) { + size_t in_readed, out_writed; + RECODE_RESULT res = Recode(CODES_UTF8, CODES_KOI8, (const char*)in, (char*)out, (size_t)*inlen, (size_t)*outlen, in_readed, out_writed); + *inlen = (int)in_readed; + *outlen = (int)out_writed; + return (res == RECODE_OK)? 0 : -1; +} + |