/rusxmms/librcc

To get this branch, use:
bzr branch http://suren.me/webbzr/rusxmms/librcc

« back to all changes in this revision

Viewing changes to src/rcciconv.c

  • Committer: Suren A. Chilingaryan
  • Date: 2005-07-29 03:26:28 UTC
  • Revision ID: Arch-1:ds@dside.dyndns.org--darksoft-2004%librcc--main--0.1--patch-23
Translation
    - Language Translation using libtranslate is implemented
    - Autoengine sets current charset (option)

Show diffs side-by-side

added added

removed removed

Lines of Context:
92
92
    return outsize - out_left;
93
93
}
94
94
 
95
 
size_t rccIConv(rcc_context ctx, rcc_iconv icnv, const char *buf, size_t len) {
 
95
char *rccIConv(rcc_iconv icnv, const char *buf, size_t len, size_t *rlen) {
 
96
    char *res;
 
97
    size_t size;
 
98
    char tmpbuffer[RCC_MAX_STRING_CHARS+1];
 
99
 
 
100
    size = rccIConvRecode(icnv, tmpbuffer, RCC_MAX_STRING_CHARS, buf, len);
 
101
    if (size != (size_t)-1) {
 
102
        res = (char*)malloc((size+1)*sizeof(char));
 
103
        if (!res) return res;
 
104
        
 
105
        if (rlen) *rlen = size;
 
106
        memcpy(res, tmpbuffer, size);
 
107
        res[size] = 0;
 
108
 
 
109
        return res;
 
110
    }
 
111
 
 
112
    return NULL;
 
113
}
 
114
 
 
115
size_t rccIConvInternal(rcc_context ctx, rcc_iconv icnv, const char *buf, size_t len) {
96
116
    if (!ctx) return (size_t)-1;
97
117
    return rccIConvRecode(icnv, ctx->tmpbuffer, RCC_MAX_STRING_CHARS, buf, len);
98
118
}
 
119