~ubuntu-branches/ubuntu/vivid/dovecot/vivid

« back to all changes in this revision

Viewing changes to src/lib-charset/charset-iconv.c

  • Committer: Bazaar Package Importer
  • Author(s): Jaldhar H. Vyas
  • Date: 2005-11-05 23:19:19 UTC
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20051105231919-ydujs4y7687fpor2
Tags: upstream-1.0.alpha4
ImportĀ upstreamĀ versionĀ 1.0.alpha4

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 
27
27
        if (strcasecmp(charset, "us-ascii") == 0 ||
28
28
            strcasecmp(charset, "ascii") == 0) {
29
 
                cd = NULL;
 
29
                cd = (iconv_t)-1;
30
30
                ascii = TRUE;
31
31
        } else if (strcasecmp(charset, "UTF-8") == 0 ||
32
32
                   strcasecmp(charset, "UTF8") == 0) {
33
 
                cd = NULL;
 
33
                cd = (iconv_t)-1;
34
34
                ascii = FALSE;
35
35
        } else {
36
36
                ascii = FALSE;
50
50
 
51
51
void charset_to_utf8_end(struct charset_translation *t)
52
52
{
53
 
        if (t->cd != NULL)
 
53
        if (t->cd != (iconv_t)-1)
54
54
                iconv_close(t->cd);
55
55
        i_free(t);
56
56
}
57
57
 
58
58
void charset_to_utf8_reset(struct charset_translation *t)
59
59
{
60
 
        if (t->cd != NULL)
 
60
        if (t->cd != (iconv_t)-1)
61
61
                (void)iconv(t->cd, NULL, NULL, NULL, NULL);
62
62
}
63
63
 
74
74
        destpos = buffer_get_used_size(dest);
75
75
        destleft = buffer_get_size(dest) - destpos;
76
76
 
77
 
        if (t->cd == NULL) {
 
77
        if (t->cd == (iconv_t)-1) {
78
78
                /* no translation needed - just copy it to outbuf uppercased */
79
79
                if (*src_size > destleft)
80
80
                        *src_size = destleft;