summaryrefslogtreecommitdiffabout
path: root/kmicromail
Side-by-side diff
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
@@ -44,143 +44,143 @@
#include <unistd.h>
#include <sys/mman.h>
#include <string.h>
#include <stdlib.h>
#include "mailmime_content.h"
#include "charconv.h"
#include "mmapstring.h"
#include "mailimf.h"
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
static int mailmime_charset_parse(const char * message, size_t length,
size_t * index, char ** charset);
enum {
MAILMIME_ENCODING_B,
MAILMIME_ENCODING_Q
};
static int mailmime_encoding_parse(const char * message, size_t length,
size_t * index, int * result);
static int mailmime_etoken_parse(const char * message, size_t length,
size_t * index, char ** result);
static int
mailmime_non_encoded_word_parse(const char * message, size_t length,
size_t * index,
char ** result);
static int
mailmime_encoded_word_parse(const char * message, size_t length,
size_t * index,
struct mailmime_encoded_word ** result);
enum {
TYPE_ERROR,
TYPE_WORD,
TYPE_ENCODED_WORD,
};
int mailmime_encoded_phrase_parse(const char * default_fromcode,
const char * message, size_t length,
size_t * index, const char * tocode,
char ** result)
{
MMAPString * gphrase;
struct mailmime_encoded_word * word;
int first;
size_t cur_token;
int r;
int res;
char * str;
char * wordutf8;
int type;
-
+ int appendNewLine;
cur_token = * index;
gphrase = mmap_string_new("");
if (gphrase == NULL) {
res = MAILIMF_ERROR_MEMORY;
goto err;
}
first = TRUE;
type = TYPE_ERROR; /* XXX - removes a gcc warning */
- // LUTZ add
- int appendNewLine = FALSE;
- while (1) { //while
+ /* LUTZ add*/
+ appendNewLine = FALSE;
+ while (1) {
r = mailmime_encoded_word_parse(message, length, &cur_token, &word);
if (r == MAILIMF_NO_ERROR) {
if (!first) {
if (type != TYPE_ENCODED_WORD) {
if (mmap_string_append_c(gphrase, ' ') == NULL) {
mailmime_encoded_word_free(word);
res = MAILIMF_ERROR_MEMORY;
goto free;
}
}
}
type = TYPE_ENCODED_WORD;
wordutf8 = NULL;
r = charconv(tocode, word->wd_charset, word->wd_text,
strlen(word->wd_text), &wordutf8);
switch (r) {
case MAIL_CHARCONV_ERROR_MEMORY:
mailmime_encoded_word_free(word);
res = MAILIMF_ERROR_MEMORY;
goto free;
case MAIL_CHARCONV_ERROR_UNKNOWN_CHARSET:
case MAIL_CHARCONV_ERROR_CONV:
mailmime_encoded_word_free(word);
res = MAILIMF_ERROR_PARSE;
goto free;
}
if (wordutf8 != NULL) {
if (mmap_string_append(gphrase, wordutf8) == NULL) {
mailmime_encoded_word_free(word);
free(wordutf8);
res = MAILIMF_ERROR_MEMORY;
goto free;
}
free(wordutf8);
}
mailmime_encoded_word_free(word);
first = FALSE;
}
else if (r == MAILIMF_ERROR_PARSE) {
/* do nothing */
}
else {
res = r;
goto free;
}
if (r == MAILIMF_ERROR_PARSE) {
char * raw_word;
r = mailmime_non_encoded_word_parse(message, length,
&cur_token, &raw_word);
if (r == MAILIMF_NO_ERROR) {
if (!first) {
if (mmap_string_append_c(gphrase, ' ') == NULL) {
free(raw_word);
res = MAILIMF_ERROR_MEMORY;
goto free;
}
}
type = TYPE_WORD;