Commit 7941a5d4 7941a5d4b0f64e68a9d649dd2f38f61d4b094804 by Alain Magloire

transcode was superceded by trans_stream.

1 parent fb8b9d9f
......@@ -17,5 +17,4 @@ pkginclude_HEADERS = \
observer.h \
registrar.h \
stream.h \
transcode.h \
url.h
......
/* GNU mailutils - a suite of utilities for electronic mail
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Library Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef _MAILUTILS_TRANSCODE_H
#define _MAILUTILS_TRANSCODE_H
#include <sys/types.h>
#ifndef __P
# ifdef __STDC__
# define __P(args) args
# else
# define __P(args) ()
# endif
#endif /* __P */
#ifdef _cplusplus
extern "C" {
#endif
/* forward declaration */
struct _transcoder;
typedef struct _transcoder *transcoder_t;
struct _transcoder
{
stream_t ustream; /* user reads/writes decoded/encoded data from here */
stream_t stream; /* encoder/decoder read/writes data to here */
void (*destroy)(transcoder_t tc);
void *tcdata;
};
extern int transcode_create __P ((transcoder_t *, char *encoding));
extern void transcode_destroy __P ((transcoder_t *));
extern int transcode_get_stream __P ((transcoder_t tc, stream_t *pis));
extern int transcode_set_stream __P ((transcoder_t tc, stream_t is));
#ifdef _cplusplus
}
#endif
#endif /* _MAILUTILS_TRANSCODE_H */
......@@ -42,7 +42,6 @@ smtp.c \
stream.c \
tcp.c \
trans_stream.c \
transcode.c \
url.c \
url_file.c \
url_mbox.c \
......
......@@ -100,7 +100,7 @@ header_parse (header_t header, const char *blurb, int len)
return 0;
header->blurb_len = len;
header->blurb = calloc (header->blurb_len + 1, 1);
header->blurb = calloc (header->blurb_len + 1, sizeof(char));
if (header->blurb == NULL)
return ENOMEM;
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)
strncasecmp (header->hdr[i].fn, fn, fn_len) == 0)
{
blurb = header->blurb;
memmove (header->hdr[i].fn, header->hdr[i + 1].fn,
header->hdr[header->hdr_count - 1].fv_end
- header->hdr[i + 1].fn + 1 + 1);
if ((i + 1) < header->hdr_count)
{
memmove (header->hdr[i].fn, header->hdr[i + 1].fn,
header->hdr[header->hdr_count - 1].fv_end
- header->hdr[i + 1].fn + 3);
}
else
{
header->hdr[i].fn[0] = '\n';
header->hdr[i].fn[1] = '\0';
}
/* readjust the pointers if move */
len -= fn_len + fv_len + 2;
len -= fn_len + fv_len + 3; /* :<sp>\n */
i--;
blurb = header->blurb;
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,
mime->flags |= MIME_INSERT_BOUNDARY;
mime->cur_part++;
}
} while( ret == 0 && part_nbytes == 0 );
} while( ret == 0 && part_nbytes == 0 && mime->cur_part < mime->nmtp_parts );
}
return ret;
}
......
......@@ -151,7 +151,7 @@ int encoder_stream_create(stream_t *stream, stream_t iostream, const char *encod
if ( i == NUM_TRANSCODERS )
return ENOTSUP;
if ( ( ret = stream_create(stream, MU_STREAM_RDWR, ts) ) != 0 )
if ( ( ret = stream_create(stream, MU_STREAM_RDWR |MU_STREAM_NO_CHECK, ts) ) != 0 )
return ret;
ts->transcoder = tslist[i].encode;
stream_set_read(*stream, _trans_read, ts );
......@@ -178,7 +178,7 @@ int decoder_stream_create(stream_t *stream, stream_t iostream, const char *encod
if ( i == NUM_TRANSCODERS )
return ENOTSUP;
if ( ( ret = stream_create(stream, MU_STREAM_RDWR, ts) ) != 0 )
if ( ( ret = stream_create(stream, MU_STREAM_RDWR |MU_STREAM_NO_CHECK, ts) ) != 0 )
return ret;
ts->transcoder = tslist[i].decode;
stream_set_read(*stream, _trans_read, ts );
......