transcode was superceded by trans_stream.
Showing
7 changed files
with
14 additions
and
64 deletions
include/mailutils/transcode.h
deleted
100644 → 0
1 | /* GNU mailutils - a suite of utilities for electronic mail | ||
2 | Copyright (C) 1999, 2000 Free Software Foundation, Inc. | ||
3 | |||
4 | This program is free software; you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Library Public License as published by | ||
6 | the Free Software Foundation; either version 2, or (at your option) | ||
7 | any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU Library General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU Library General Public License | ||
15 | along with this program; if not, write to the Free Software | ||
16 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | ||
17 | |||
18 | #ifndef _MAILUTILS_TRANSCODE_H | ||
19 | #define _MAILUTILS_TRANSCODE_H | ||
20 | |||
21 | #include <sys/types.h> | ||
22 | |||
23 | #ifndef __P | ||
24 | # ifdef __STDC__ | ||
25 | # define __P(args) args | ||
26 | # else | ||
27 | # define __P(args) () | ||
28 | # endif | ||
29 | #endif /* __P */ | ||
30 | |||
31 | #ifdef _cplusplus | ||
32 | extern "C" { | ||
33 | #endif | ||
34 | |||
35 | /* forward declaration */ | ||
36 | struct _transcoder; | ||
37 | typedef struct _transcoder *transcoder_t; | ||
38 | |||
39 | struct _transcoder | ||
40 | { | ||
41 | stream_t ustream; /* user reads/writes decoded/encoded data from here */ | ||
42 | stream_t stream; /* encoder/decoder read/writes data to here */ | ||
43 | void (*destroy)(transcoder_t tc); | ||
44 | void *tcdata; | ||
45 | }; | ||
46 | |||
47 | extern int transcode_create __P ((transcoder_t *, char *encoding)); | ||
48 | extern void transcode_destroy __P ((transcoder_t *)); | ||
49 | extern int transcode_get_stream __P ((transcoder_t tc, stream_t *pis)); | ||
50 | extern int transcode_set_stream __P ((transcoder_t tc, stream_t is)); | ||
51 | |||
52 | #ifdef _cplusplus | ||
53 | } | ||
54 | #endif | ||
55 | |||
56 | #endif /* _MAILUTILS_TRANSCODE_H */ |
... | @@ -100,7 +100,7 @@ header_parse (header_t header, const char *blurb, int len) | ... | @@ -100,7 +100,7 @@ header_parse (header_t header, const char *blurb, int len) |
100 | return 0; | 100 | return 0; |
101 | 101 | ||
102 | header->blurb_len = len; | 102 | header->blurb_len = len; |
103 | header->blurb = calloc (header->blurb_len + 1, 1); | 103 | header->blurb = calloc (header->blurb_len + 1, sizeof(char)); |
104 | if (header->blurb == NULL) | 104 | if (header->blurb == NULL) |
105 | return ENOMEM; | 105 | return ENOMEM; |
106 | memcpy (header->blurb, blurb, header->blurb_len); | 106 | memcpy (header->blurb, blurb, header->blurb_len); |
... | @@ -236,11 +236,19 @@ header_set_value (header_t header, const char *fn, const char *fv, int replace) | ... | @@ -236,11 +236,19 @@ header_set_value (header_t header, const char *fn, const char *fv, int replace) |
236 | strncasecmp (header->hdr[i].fn, fn, fn_len) == 0) | 236 | strncasecmp (header->hdr[i].fn, fn, fn_len) == 0) |
237 | { | 237 | { |
238 | blurb = header->blurb; | 238 | blurb = header->blurb; |
239 | if ((i + 1) < header->hdr_count) | ||
240 | { | ||
239 | memmove (header->hdr[i].fn, header->hdr[i + 1].fn, | 241 | memmove (header->hdr[i].fn, header->hdr[i + 1].fn, |
240 | header->hdr[header->hdr_count - 1].fv_end | 242 | header->hdr[header->hdr_count - 1].fv_end |
241 | - header->hdr[i + 1].fn + 1 + 1); | 243 | - header->hdr[i + 1].fn + 3); |
244 | } | ||
245 | else | ||
246 | { | ||
247 | header->hdr[i].fn[0] = '\n'; | ||
248 | header->hdr[i].fn[1] = '\0'; | ||
249 | } | ||
242 | /* readjust the pointers if move */ | 250 | /* readjust the pointers if move */ |
243 | len -= fn_len + fv_len + 2; | 251 | len -= fn_len + fv_len + 3; /* :<sp>\n */ |
244 | i--; | 252 | i--; |
245 | blurb = header->blurb; | 253 | blurb = header->blurb; |
246 | header_parse (header, blurb, len); | 254 | header_parse (header, blurb, len); | ... | ... |
... | @@ -477,7 +477,7 @@ static int _mime_body_read(stream_t stream, char *buf, size_t buflen, off_t off, | ... | @@ -477,7 +477,7 @@ static int _mime_body_read(stream_t stream, char *buf, size_t buflen, off_t off, |
477 | mime->flags |= MIME_INSERT_BOUNDARY; | 477 | mime->flags |= MIME_INSERT_BOUNDARY; |
478 | mime->cur_part++; | 478 | mime->cur_part++; |
479 | } | 479 | } |
480 | } while( ret == 0 && part_nbytes == 0 ); | 480 | } while( ret == 0 && part_nbytes == 0 && mime->cur_part < mime->nmtp_parts ); |
481 | } | 481 | } |
482 | return ret; | 482 | return ret; |
483 | } | 483 | } | ... | ... |
... | @@ -151,7 +151,7 @@ int encoder_stream_create(stream_t *stream, stream_t iostream, const char *encod | ... | @@ -151,7 +151,7 @@ int encoder_stream_create(stream_t *stream, stream_t iostream, const char *encod |
151 | if ( i == NUM_TRANSCODERS ) | 151 | if ( i == NUM_TRANSCODERS ) |
152 | return ENOTSUP; | 152 | return ENOTSUP; |
153 | 153 | ||
154 | if ( ( ret = stream_create(stream, MU_STREAM_RDWR, ts) ) != 0 ) | 154 | if ( ( ret = stream_create(stream, MU_STREAM_RDWR |MU_STREAM_NO_CHECK, ts) ) != 0 ) |
155 | return ret; | 155 | return ret; |
156 | ts->transcoder = tslist[i].encode; | 156 | ts->transcoder = tslist[i].encode; |
157 | stream_set_read(*stream, _trans_read, ts ); | 157 | stream_set_read(*stream, _trans_read, ts ); |
... | @@ -178,7 +178,7 @@ int decoder_stream_create(stream_t *stream, stream_t iostream, const char *encod | ... | @@ -178,7 +178,7 @@ int decoder_stream_create(stream_t *stream, stream_t iostream, const char *encod |
178 | if ( i == NUM_TRANSCODERS ) | 178 | if ( i == NUM_TRANSCODERS ) |
179 | return ENOTSUP; | 179 | return ENOTSUP; |
180 | 180 | ||
181 | if ( ( ret = stream_create(stream, MU_STREAM_RDWR, ts) ) != 0 ) | 181 | if ( ( ret = stream_create(stream, MU_STREAM_RDWR |MU_STREAM_NO_CHECK, ts) ) != 0 ) |
182 | return ret; | 182 | return ret; |
183 | ts->transcoder = tslist[i].decode; | 183 | ts->transcoder = tslist[i].decode; |
184 | stream_set_read(*stream, _trans_read, ts ); | 184 | stream_set_read(*stream, _trans_read, ts ); | ... | ... |
mailbox/transcode.c
deleted
100644 → 0
This diff is collapsed.
Click to expand it.
-
Please register or sign in to post a comment