summaryrefslogtreecommitdiffabout
path: root/kmicromail
authorzautrix <zautrix>2004-11-08 23:23:02 (UTC)
committer zautrix <zautrix>2004-11-08 23:23:02 (UTC)
commitc20c85c383cb36c7ece87af9e3a60d14b36a9de5 (patch) (unidiff)
treeec1d983fbeb9b719f1871683b47862b528e50c0d /kmicromail
parentd92ceb39af0bf0c655b68cb166dfea44cd688f1c (diff)
downloadkdepimpi-c20c85c383cb36c7ece87af9e3a60d14b36a9de5.zip
kdepimpi-c20c85c383cb36c7ece87af9e3a60d14b36a9de5.tar.gz
kdepimpi-c20c85c383cb36c7ece87af9e3a60d14b36a9de5.tar.bz2
fixed orientation change in kapi
Diffstat (limited to 'kmicromail') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/libetpan/mime/mailmime_decode.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/kmicromail/libetpan/mime/mailmime_decode.c b/kmicromail/libetpan/mime/mailmime_decode.c
index b2ab0f7..bb7638e 100644
--- a/kmicromail/libetpan/mime/mailmime_decode.c
+++ b/kmicromail/libetpan/mime/mailmime_decode.c
@@ -60,111 +60,111 @@
60#define FALSE 0 60#define FALSE 0
61#endif 61#endif
62 62
63static int mailmime_charset_parse(const char * message, size_t length, 63static int mailmime_charset_parse(const char * message, size_t length,
64 size_t * index, char ** charset); 64 size_t * index, char ** charset);
65 65
66enum { 66enum {
67 MAILMIME_ENCODING_B, 67 MAILMIME_ENCODING_B,
68 MAILMIME_ENCODING_Q 68 MAILMIME_ENCODING_Q
69}; 69};
70 70
71static int mailmime_encoding_parse(const char * message, size_t length, 71static int mailmime_encoding_parse(const char * message, size_t length,
72 size_t * index, int * result); 72 size_t * index, int * result);
73 73
74static int mailmime_etoken_parse(const char * message, size_t length, 74static int mailmime_etoken_parse(const char * message, size_t length,
75 size_t * index, char ** result); 75 size_t * index, char ** result);
76 76
77static int 77static int
78mailmime_non_encoded_word_parse(const char * message, size_t length, 78mailmime_non_encoded_word_parse(const char * message, size_t length,
79 size_t * index, 79 size_t * index,
80 char ** result); 80 char ** result);
81 81
82static int 82static int
83mailmime_encoded_word_parse(const char * message, size_t length, 83mailmime_encoded_word_parse(const char * message, size_t length,
84 size_t * index, 84 size_t * index,
85 struct mailmime_encoded_word ** result); 85 struct mailmime_encoded_word ** result);
86 86
87 87
88enum { 88enum {
89 TYPE_ERROR, 89 TYPE_ERROR,
90 TYPE_WORD, 90 TYPE_WORD,
91 TYPE_ENCODED_WORD, 91 TYPE_ENCODED_WORD,
92}; 92};
93 93
94int mailmime_encoded_phrase_parse(const char * default_fromcode, 94int mailmime_encoded_phrase_parse(const char * default_fromcode,
95 const char * message, size_t length, 95 const char * message, size_t length,
96 size_t * index, const char * tocode, 96 size_t * index, const char * tocode,
97 char ** result) 97 char ** result)
98{ 98{
99 MMAPString * gphrase; 99 MMAPString * gphrase;
100 struct mailmime_encoded_word * word; 100 struct mailmime_encoded_word * word;
101 int first; 101 int first;
102 size_t cur_token; 102 size_t cur_token;
103 int r; 103 int r;
104 int res; 104 int res;
105 char * str; 105 char * str;
106 char * wordutf8; 106 char * wordutf8;
107 int type; 107 int type;
108 108 int appendNewLine;
109 cur_token = * index; 109 cur_token = * index;
110 110
111 gphrase = mmap_string_new(""); 111 gphrase = mmap_string_new("");
112 if (gphrase == NULL) { 112 if (gphrase == NULL) {
113 res = MAILIMF_ERROR_MEMORY; 113 res = MAILIMF_ERROR_MEMORY;
114 goto err; 114 goto err;
115 } 115 }
116 116
117 first = TRUE; 117 first = TRUE;
118 118
119 type = TYPE_ERROR; /* XXX - removes a gcc warning */ 119 type = TYPE_ERROR; /* XXX - removes a gcc warning */
120 // LUTZ add 120 /* LUTZ add*/
121 int appendNewLine = FALSE; 121 appendNewLine = FALSE;
122 while (1) { //while 122 while (1) {
123 123
124 r = mailmime_encoded_word_parse(message, length, &cur_token, &word); 124 r = mailmime_encoded_word_parse(message, length, &cur_token, &word);
125 if (r == MAILIMF_NO_ERROR) { 125 if (r == MAILIMF_NO_ERROR) {
126 if (!first) { 126 if (!first) {
127 if (type != TYPE_ENCODED_WORD) { 127 if (type != TYPE_ENCODED_WORD) {
128 if (mmap_string_append_c(gphrase, ' ') == NULL) { 128 if (mmap_string_append_c(gphrase, ' ') == NULL) {
129 mailmime_encoded_word_free(word); 129 mailmime_encoded_word_free(word);
130 res = MAILIMF_ERROR_MEMORY; 130 res = MAILIMF_ERROR_MEMORY;
131 goto free; 131 goto free;
132 } 132 }
133 } 133 }
134 } 134 }
135 type = TYPE_ENCODED_WORD; 135 type = TYPE_ENCODED_WORD;
136 wordutf8 = NULL; 136 wordutf8 = NULL;
137 r = charconv(tocode, word->wd_charset, word->wd_text, 137 r = charconv(tocode, word->wd_charset, word->wd_text,
138 strlen(word->wd_text), &wordutf8); 138 strlen(word->wd_text), &wordutf8);
139 switch (r) { 139 switch (r) {
140 case MAIL_CHARCONV_ERROR_MEMORY: 140 case MAIL_CHARCONV_ERROR_MEMORY:
141 mailmime_encoded_word_free(word); 141 mailmime_encoded_word_free(word);
142 res = MAILIMF_ERROR_MEMORY; 142 res = MAILIMF_ERROR_MEMORY;
143 goto free; 143 goto free;
144 144
145 case MAIL_CHARCONV_ERROR_UNKNOWN_CHARSET: 145 case MAIL_CHARCONV_ERROR_UNKNOWN_CHARSET:
146 case MAIL_CHARCONV_ERROR_CONV: 146 case MAIL_CHARCONV_ERROR_CONV:
147 mailmime_encoded_word_free(word); 147 mailmime_encoded_word_free(word);
148 res = MAILIMF_ERROR_PARSE; 148 res = MAILIMF_ERROR_PARSE;
149 goto free; 149 goto free;
150 } 150 }
151 151
152 if (wordutf8 != NULL) { 152 if (wordutf8 != NULL) {
153 if (mmap_string_append(gphrase, wordutf8) == NULL) { 153 if (mmap_string_append(gphrase, wordutf8) == NULL) {
154 mailmime_encoded_word_free(word); 154 mailmime_encoded_word_free(word);
155 free(wordutf8); 155 free(wordutf8);
156 res = MAILIMF_ERROR_MEMORY; 156 res = MAILIMF_ERROR_MEMORY;
157 goto free; 157 goto free;
158 } 158 }
159 free(wordutf8); 159 free(wordutf8);
160 } 160 }
161 mailmime_encoded_word_free(word); 161 mailmime_encoded_word_free(word);
162 first = FALSE; 162 first = FALSE;
163 } 163 }
164 else if (r == MAILIMF_ERROR_PARSE) { 164 else if (r == MAILIMF_ERROR_PARSE) {
165 /* do nothing */ 165 /* do nothing */
166 } 166 }
167 else { 167 else {
168 res = r; 168 res = r;
169 goto free; 169 goto free;
170 } 170 }