~ubuntu-branches/ubuntu/vivid/tin/vivid

« back to all changes in this revision

Viewing changes to src/rfc2046.c

  • Committer: Package Import Robot
  • Author(s): Marco d'Itri
  • Date: 2012-01-06 15:04:11 UTC
  • mfrom: (1.2.17)
  • Revision ID: package-import@ubuntu.com-20120106150411-vftxaked1sscxt1t
Tags: 1:2.1.0-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 *  Module    : rfc2046.c
4
4
 *  Author    : Jason Faultless <jason@altarstone.com>
5
5
 *  Created   : 2000-02-18
6
 
 *  Updated   : 2011-01-29
 
6
 *  Updated   : 2011-11-06
7
7
 *  Notes     : RFC 2046 MIME article parsing
8
8
 *
9
 
 * Copyright (c) 2000-2011 Jason Faultless <jason@altarstone.com>
 
9
 * Copyright (c) 2000-2012 Jason Faultless <jason@altarstone.com>
10
10
 * All rights reserved.
11
11
 *
12
12
 * Redistribution and use in source and binary forms, with or without
95
95
{
96
96
        int i;
97
97
 
98
 
        for (i = 0; i < NUM_CONTENT_TYPES; ++i) {
 
98
        for (i = 0; content_types[i] != NULL; ++i) {
99
99
                if (strcasecmp(type, content_types[i]) == 0)
100
100
                        return i;
101
101
        }
389
389
         */
390
390
        if ((params = strtok(NULL, "\n")) != NULL) {
391
391
#ifndef CHARSET_CONVERSION
392
 
                char defparms[] = CT_DEFPARMS;  /* must be writeable */
 
392
                char defparms[] = CT_DEFPARMS;  /* must be writable */
393
393
#endif /* !CHARSET_CONVERSION */
394
394
 
395
395
                free_list(content->params);
407
407
                                parse_params(charsetheader, content);
408
408
                                free(charsetheader);
409
409
                        } else {
410
 
                                char defparms[] = CT_DEFPARMS;  /* must be writeable */
 
410
                                char defparms[] = CT_DEFPARMS;  /* must be writable */
411
411
 
412
412
                                parse_params(defparms, content);
413
413
                        }
423
423
{
424
424
        unsigned int i;
425
425
 
426
 
        for (i = 0; i < NUM_ENCODINGS; ++i) {
 
426
        for (i = 0; content_encodings[i] != NULL; ++i) {
427
427
                if (strcasecmp(encoding, content_encodings[i]) == 0)
428
428
                return i;
429
429
        }
472
472
        t_part *p;
473
473
        t_part *ptr = my_malloc(sizeof(t_part));
474
474
#ifndef CHARSET_CONVERSION
475
 
        char defparms[] = CT_DEFPARMS;  /* must be writeable */
 
475
        char defparms[] = CT_DEFPARMS;  /* must be writable */
476
476
#endif /* !CHARSET_CONVERSION */
477
477
 
478
478
        ptr->type = TYPE_TEXT;                                  /* Defaults per RFC */
492
492
                parse_params(charsetheader, ptr);
493
493
                free(charsetheader);
494
494
        } else {
495
 
                char defparms[] = CT_DEFPARMS;  /* must be writeable */
 
495
                char defparms[] = CT_DEFPARMS;  /* must be writable */
496
496
 
497
497
                parse_params(defparms, ptr);
498
498
        }
1160
1160
FILE *
1161
1161
open_art_fp(
1162
1162
        struct t_group *group,
1163
 
        long art)
 
1163
        t_artnum art)
1164
1164
{
1165
1165
        FILE *art_fp;
1166
1166
 
1167
1167
#ifdef NNTP_ABLE
1168
1168
        if (read_news_via_nntp && group->type == GROUP_TYPE_NEWS) {
1169
1169
                char buf[NNTP_STRLEN];
1170
 
                snprintf(buf, sizeof(buf), "ARTICLE %ld", art);
 
1170
                snprintf(buf, sizeof(buf), "ARTICLE %"T_ARTNUM_PFMT, art);
1171
1171
                art_fp = nntp_command(buf, OK_ARTICLE, NULL, 0);
1172
1172
        } else {
1173
1173
#endif /* NNTP_ABLE */
1178
1178
 
1179
1179
                make_group_path(group->name, group_path);
1180
1180
                joinpath(buf, sizeof(buf), group->spooldir, group_path);
1181
 
                snprintf(fbuf, sizeof(fbuf), "%ld", art);
 
1181
                snprintf(fbuf, sizeof(fbuf), "%"T_ARTNUM_PFMT, art);
1182
1182
                joinpath(pbuf, sizeof(pbuf), buf, fbuf);
1183
1183
 
1184
1184
                art_fp = fopen(pbuf, "r");