[pan2/testing: 41/279] ...
- From: Heinrich MÃller <henmull src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pan2/testing: 41/279] ...
- Date: Sat, 3 Dec 2011 22:27:59 +0000 (UTC)
commit 5f85f2d57d82628c7ca6da1385decd6a3c69e5c0
Author: Heinrich MÃller <sphemuel stud informatik uni-erlangen de>
Date: Wed May 25 07:45:26 2011 +0200
...
uulib/uuencode.c | 148 +++++++++++++++++++++++++++---------------------------
1 files changed, 74 insertions(+), 74 deletions(-)
---
diff --git a/uulib/uuencode.c b/uulib/uuencode.c
index 73dbbc2..a629073 100644
--- a/uulib/uuencode.c
+++ b/uulib/uuencode.c
@@ -57,7 +57,7 @@
#endif
#endif
-char * uuencode_id = "$Id: uuencode.c,v 1.22 2002/04/02 10:04:52 fp Exp $";
+char * uuencode_id = "$Id$";
#if 0
/*
@@ -135,7 +135,7 @@ unsigned char UUEncodeTable[64] = {
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
'X', 'Y', 'Z', '[', '\\',']', '^', '_'
};
-
+
unsigned char B64EncodeTable[64] = {
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
@@ -162,11 +162,11 @@ unsigned char XXEncodeTable[64] = {
unsigned char BHEncodeTable[64] = {
'!', '"', '#', '$', '%', '&', '\'', '(',
')', '*', '+', ',', '-', '0', '1', '2',
- '3', '4', '5', '6', '8', '9', '@', 'A',
- 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
- 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R',
- 'S', 'T', 'U', 'V', 'X', 'Y', 'Z', '[',
- '`', 'a', 'b', 'c', 'd', 'e', 'f', 'h',
+ '3', '4', '5', '6', '8', '9', '@', 'A',
+ 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
+ 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R',
+ 'S', 'T', 'U', 'V', 'X', 'Y', 'Z', '[',
+ '`', 'a', 'b', 'c', 'd', 'e', 'f', 'h',
'i', 'j', 'k', 'l', 'm', 'p', 'q', 'r'
};
@@ -242,11 +242,11 @@ char *uuestr_otemp;
* Encode one part of the data stream
*/
-static int
+static int
UUEncodeStream (FILE *outfile, FILE *infile, int encoding, long linperfile, crc32_t *crc, crc32_t *pcrc)
{
- unsigned char *itemp = (char *) uuestr_itemp;
- unsigned char *otemp = (char *) uuestr_otemp;
+ unsigned char *itemp = (unsigned char *) uuestr_itemp;
+ unsigned char *otemp = (unsigned char *) uuestr_otemp;
unsigned char *optr, *table, *tptr;
int index, count;
long line=0;
@@ -267,12 +267,12 @@ UUEncodeStream (FILE *outfile, FILE *infile, int encoding, long linperfile, crc3
if (encoding == PT_ENCODED || encoding == QP_ENCODED) {
while (!feof (infile) && (linperfile <= 0 || line < linperfile)) {
- if (_FP_fgets (itemp, 255, infile) == NULL) {
+ if (_FP_fgets ((char*)itemp, 255, infile) == NULL) {
break;
}
itemp[255] = '\0';
- count = strlen (itemp);
+ count = strlen ((char*)itemp);
llen = 0;
optr = otemp;
@@ -280,7 +280,7 @@ UUEncodeStream (FILE *outfile, FILE *infile, int encoding, long linperfile, crc3
/*
* Busy Callback
*/
-
+
if (UUBUSYPOLL(ftell(infile)-progress.foffset,progress.fsize)) {
UUMessage (uuencode_id, __LINE__, UUMSG_NOTE,
uustring (S_ENCODE_CANCEL));
@@ -292,10 +292,10 @@ UUEncodeStream (FILE *outfile, FILE *infile, int encoding, long linperfile, crc3
* If there is a line feed, replace by eolstring
*/
if (count > 0 && itemp[count-1] == '\n') {
+ const size_t n = strlen ((char*) eolstring);
itemp[--count] = '\0';
if (fwrite (itemp, 1, count, outfile) != count ||
- fwrite ((char *) eolstring, 1,
- strlen(eolstring), outfile) != strlen (eolstring)) {
+ fwrite ((char *) eolstring, 1, n, outfile) != n) {
return UURET_IOERR;
}
}
@@ -341,7 +341,7 @@ UUEncodeStream (FILE *outfile, FILE *infile, int encoding, long linperfile, crc3
if (fwrite (otemp, 1, llen, outfile) != llen ||
fwrite ((char *) eolstring, 1,
- strlen(eolstring), outfile) != strlen (eolstring)) {
+ strlen((char*)eolstring), outfile) != strlen ((char*)eolstring)) {
return UURET_IOERR;
}
@@ -357,7 +357,7 @@ UUEncodeStream (FILE *outfile, FILE *infile, int encoding, long linperfile, crc3
if (fwrite (otemp, 1, 3, outfile) != 3 ||
fwrite ((char *) eolstring, 1,
- strlen(eolstring), outfile) != strlen (eolstring)) {
+ strlen((char*)eolstring), outfile) != strlen ((char*)eolstring)) {
return UURET_IOERR;
}
}
@@ -386,13 +386,13 @@ UUEncodeStream (FILE *outfile, FILE *infile, int encoding, long linperfile, crc3
*optr++ = '=';
llen++;
-
+
if (fwrite (otemp, 1, llen, outfile) != llen ||
fwrite ((char *) eolstring, 1,
- strlen(eolstring), outfile) != strlen (eolstring)) {
+ strlen((char*)eolstring), outfile) != strlen ((char*)eolstring)) {
return UURET_IOERR;
}
-
+
optr = otemp;
llen = 0;
}
@@ -433,7 +433,7 @@ UUEncodeStream (FILE *outfile, FILE *infile, int encoding, long linperfile, crc3
/*
* Busy Callback
*/
-
+
if (UUBUSYPOLL(ftell(infile)-progress.foffset,progress.fsize)) {
UUMessage (uuencode_id, __LINE__, UUMSG_NOTE,
uustring (S_ENCODE_CANCEL));
@@ -444,7 +444,7 @@ UUEncodeStream (FILE *outfile, FILE *infile, int encoding, long linperfile, crc3
if (llen > 127) {
if (fwrite (otemp, 1, llen, outfile) != llen ||
fwrite ((char *) eolstring, 1,
- strlen(eolstring), outfile) != strlen (eolstring)) {
+ strlen((char*)eolstring), outfile) != strlen ((char*)eolstring)) {
return UURET_IOERR;
}
llen = 0;
@@ -490,7 +490,7 @@ UUEncodeStream (FILE *outfile, FILE *infile, int encoding, long linperfile, crc3
if (llen) {
if (fwrite (otemp, 1, llen, outfile) != llen ||
fwrite ((char *) eolstring, 1,
- strlen(eolstring), outfile) != strlen (eolstring)) {
+ strlen((char*)eolstring), outfile) != strlen ((char*)eolstring)) {
return UURET_IOERR;
}
}
@@ -563,7 +563,7 @@ UUEncodeStream (FILE *outfile, FILE *infile, int encoding, long linperfile, crc3
if (encoding == B64ENCODED) {
if (count - index == 2) {
*optr++ = table[itemp[index] >> 2];
- *optr++ = table[((itemp[index ] & 0x03) << 4) |
+ *optr++ = table[((itemp[index ] & 0x03) << 4) |
((itemp[index+1] & 0xf0) >> 4)];
*optr++ = table[((itemp[index+1] & 0x0f) << 2)];
*optr++ = '=';
@@ -579,7 +579,7 @@ UUEncodeStream (FILE *outfile, FILE *infile, int encoding, long linperfile, crc3
else if (encoding == UU_ENCODED || encoding == XX_ENCODED) {
if (count - index == 2) {
*optr++ = table[itemp[index] >> 2];
- *optr++ = table[((itemp[index ] & 0x03) << 4) |
+ *optr++ = table[((itemp[index ] & 0x03) << 4) |
( itemp[index+1] >> 4)];
*optr++ = table[((itemp[index+1] & 0x0f) << 2)];
*optr++ = table[0];
@@ -630,7 +630,7 @@ UUEncodeMulti (FILE *outfile, FILE *infile, char *infname, int encoding,
crc32_t crc;
crc32_t *crcptr=NULL;
- if (outfile==NULL ||
+ if (outfile==NULL ||
(infile == NULL && infname==NULL) ||
(outfname==NULL && infname==NULL) ||
(encoding!=UU_ENCODED&&encoding!=XX_ENCODED&&encoding!=B64ENCODED&&
@@ -717,7 +717,7 @@ UUEncodeMulti (FILE *outfile, FILE *infile, char *infname, int encoding,
if (encoding == UU_ENCODED || encoding == XX_ENCODED) {
fprintf (outfile, "begin %o %s%s",
(themode) ? themode : 0644,
- UUFNameFilter ((outfname)?outfname:infname),
+ UUFNameFilter ((outfname)?outfname:infname),
eolstring);
}
else if (encoding == YENC_ENCODED) {
@@ -725,13 +725,13 @@ UUEncodeMulti (FILE *outfile, FILE *infile, char *infname, int encoding,
crcptr = &crc;
if (progress.fsize == -1) {
fprintf (outfile, "=ybegin line=128 name=%s%s",
- UUFNameFilter ((outfname)?outfname:infname),
+ UUFNameFilter ((outfname)?outfname:infname),
eolstring);
}
else {
fprintf (outfile, "=ybegin line=128 size=%ld name=%s%s",
progress.fsize,
- UUFNameFilter ((outfname)?outfname:infname),
+ UUFNameFilter ((outfname)?outfname:infname),
eolstring);
}
}
@@ -748,8 +748,8 @@ UUEncodeMulti (FILE *outfile, FILE *infile, char *infname, int encoding,
}
if (encoding == UU_ENCODED || encoding == XX_ENCODED) {
- fprintf (outfile, "%c%s",
- (encoding==UU_ENCODED) ? UUEncodeTable[0] : XXEncodeTable[0],
+ fprintf (outfile, "%c%s",
+ (encoding==UU_ENCODED) ? UUEncodeTable[0] : XXEncodeTable[0],
eolstring);
fprintf (outfile, "end%s", eolstring);
}
@@ -793,7 +793,7 @@ UUEncodePartial (FILE *outfile, FILE *infile,
{
mimemap *miter=mimetable;
static FILE *theifile;
- int themode, numparts;
+ int themode, numparts=1;
struct stat finfo;
long thesize;
char *ptr;
@@ -832,7 +832,7 @@ UUEncodePartial (FILE *outfile, FILE *infile,
}
if (linperfile <= 0)
numparts = 1;
- else
+ else
numparts = (int) (((long)finfo.st_size+(linperfile*bpl[encoding]-1))/
(linperfile*bpl[encoding]));
@@ -902,7 +902,7 @@ UUEncodePartial (FILE *outfile, FILE *infile,
}
fprintf (outfile, "%s", eolstring);
-
+
/*
* for the first part of UU or XX messages, print a begin line
*/
@@ -920,33 +920,33 @@ UUEncodePartial (FILE *outfile, FILE *infile,
if (progress.totsize == -1) {
fprintf (outfile, "=ybegin part=%d line=128 name=%s%s",
partno,
- UUFNameFilter ((outfname)?outfname:infname),
+ UUFNameFilter ((outfname)?outfname:infname),
eolstring);
}
else {
fprintf (outfile, "=ybegin part=%d line=128 size=%ld name=%s%s",
partno,
progress.totsize,
- UUFNameFilter ((outfname)?outfname:infname),
+ UUFNameFilter ((outfname)?outfname:infname),
eolstring);
}
- fprintf (outfile, "=ypart begin=%d end=%d%s",
+ fprintf (outfile, "=ypart begin=%ld end=%ld%s",
(partno-1)*linperfile*128+1,
- (partno*linperfile*128) < progress.totsize ?
+ (partno*linperfile*128) < progress.totsize ?
(partno*linperfile*128) : progress.totsize,
eolstring);
}
else {
if (progress.totsize == -1) {
fprintf (outfile, "=ybegin line=128 name=%s%s",
- UUFNameFilter ((outfname)?outfname:infname),
+ UUFNameFilter ((outfname)?outfname:infname),
eolstring);
}
else {
fprintf (outfile, "=ybegin line=128 size=%ld name=%s%s",
progress.totsize,
- UUFNameFilter ((outfname)?outfname:infname),
+ UUFNameFilter ((outfname)?outfname:infname),
eolstring);
}
}
@@ -990,21 +990,21 @@ UUEncodePartial (FILE *outfile, FILE *infile,
if (feof (theifile) &&
(encoding == UU_ENCODED || encoding == XX_ENCODED)) {
- fprintf (outfile, "%c%s",
- (encoding==UU_ENCODED) ? UUEncodeTable[0] : XXEncodeTable[0],
+ fprintf (outfile, "%c%s",
+ (encoding==UU_ENCODED) ? UUEncodeTable[0] : XXEncodeTable[0],
eolstring);
fprintf (outfile, "end%s", eolstring);
}
else if (encoding == YENC_ENCODED) {
if (numparts != 1) {
- fprintf (outfile, "=yend size=%d part=%d pcrc32=%08lx",
- (partno*linperfile*128) < progress.totsize ?
+ fprintf (outfile, "=yend size=%ld part=%d pcrc32=%08lx",
+ (partno*linperfile*128) < progress.totsize ?
linperfile*128 : (progress.totsize-(partno-1)*linperfile*128),
partno,
pcrc);
}
else {
- fprintf (outfile, "=yend size=%d",
+ fprintf (outfile, "=yend size=%ld",
progress.totsize);
}
if (feof (theifile))
@@ -1112,7 +1112,7 @@ UUEncodeToStream (FILE *outfile, FILE *infile,
if (encoding == UU_ENCODED || encoding == XX_ENCODED) {
fprintf (outfile, "begin %o %s%s",
(themode) ? themode : 0644,
- UUFNameFilter ((outfname)?outfname:infname),
+ UUFNameFilter ((outfname)?outfname:infname),
eolstring);
}
else if (encoding == YENC_ENCODED) {
@@ -1120,13 +1120,13 @@ UUEncodeToStream (FILE *outfile, FILE *infile,
crcptr = &crc;
if (progress.fsize == -1) {
fprintf (outfile, "=ybegin line=128 name=%s%s",
- UUFNameFilter ((outfname)?outfname:infname),
+ UUFNameFilter ((outfname)?outfname:infname),
eolstring);
}
else {
fprintf (outfile, "=ybegin line=128 size=%ld name=%s%s",
progress.fsize,
- UUFNameFilter ((outfname)?outfname:infname),
+ UUFNameFilter ((outfname)?outfname:infname),
eolstring);
}
}
@@ -1135,7 +1135,7 @@ UUEncodeToStream (FILE *outfile, FILE *infile,
if (res != UURET_CANCEL) {
UUMessage (uuencode_id, __LINE__, UUMSG_ERROR,
uustring (S_ERR_ENCODING),
- UUFNameFilter ((infname)?infname:outfname),
+ UUFNameFilter ((infname)?infname:outfname),
(res==UURET_IOERR)?strerror(uu_errno):UUstrerror (res));
}
progress.action = 0;
@@ -1143,8 +1143,8 @@ UUEncodeToStream (FILE *outfile, FILE *infile,
}
if (encoding == UU_ENCODED || encoding == XX_ENCODED) {
- fprintf (outfile, "%c%s",
- (encoding==UU_ENCODED) ? UUEncodeTable[0] : XXEncodeTable[0],
+ fprintf (outfile, "%c%s",
+ (encoding==UU_ENCODED) ? UUEncodeTable[0] : XXEncodeTable[0],
eolstring);
fprintf (outfile, "end%s", eolstring);
}
@@ -1212,7 +1212,7 @@ UUEncodeToFile (FILE *infile, char *infname, int encoding,
sprintf (oname, "%s", diskname);
}
else {
- len = ((uusavepath)?strlen(uusavepath):0) + strlen (diskname)
+ len = ((uusavepath)?strlen(uusavepath):0) + strlen (diskname)
+ ((uuencodeext)?strlen(uuencodeext):0) + 5;
if ((oname = malloc (len)) == NULL) {
@@ -1224,7 +1224,7 @@ UUEncodeToFile (FILE *infile, char *infname, int encoding,
}
}
else {
- len = ((uusavepath) ? strlen (uusavepath) : 0) +
+ len = ((uusavepath) ? strlen (uusavepath) : 0) +
strlen(UUFNameFilter(infname)) +
((uuencodeext)?strlen(uuencodeext):0) + 5;
@@ -1234,7 +1234,7 @@ UUEncodeToFile (FILE *infile, char *infname, int encoding,
return UURET_NOMEM;
}
optr = UUFNameFilter (infname);
- sprintf (oname, "%s%s",
+ sprintf (oname, "%s%s",
(uusavepath)?uusavepath:"",
(*optr=='.')?optr+1:optr);
}
@@ -1275,7 +1275,7 @@ UUEncodeToFile (FILE *infile, char *infname, int encoding,
}
if (linperfile <= 0)
numparts = 1;
- else
+ else
numparts = (int) (((long)finfo.st_size + (linperfile*bpl[encoding]-1)) /
(linperfile*bpl[encoding]));
@@ -1313,7 +1313,7 @@ UUEncodeToFile (FILE *infile, char *infname, int encoding,
*/
if (progress.numparts==1 && progress.totsize!=-1 && uuencodeext!=NULL)
strcpy (optr, uuencodeext);
- else
+ else
sprintf (optr, "%03d", part);
/*
@@ -1380,7 +1380,7 @@ UUEncodeToFile (FILE *infile, char *infname, int encoding,
if (part==1 && (encoding == UU_ENCODED || encoding == XX_ENCODED)) {
fprintf (outfile, "begin %o %s%s",
(filemode)?filemode : 0644,
- UUFNameFilter ((outfname)?outfname:infname),
+ UUFNameFilter ((outfname)?outfname:infname),
eolstring);
}
else if (encoding == YENC_ENCODED) {
@@ -1394,33 +1394,33 @@ UUEncodeToFile (FILE *infile, char *infname, int encoding,
if (progress.totsize == -1) {
fprintf (outfile, "=ybegin part=%d line=128 name=%s%s",
part,
- UUFNameFilter ((outfname)?outfname:infname),
+ UUFNameFilter ((outfname)?outfname:infname),
eolstring);
}
else {
fprintf (outfile, "=ybegin part=%d line=128 size=%ld name=%s%s",
part,
progress.totsize,
- UUFNameFilter ((outfname)?outfname:infname),
+ UUFNameFilter ((outfname)?outfname:infname),
eolstring);
}
- fprintf (outfile, "=ypart begin=%d end=%d%s",
+ fprintf (outfile, "=ypart begin=%ld end=%ld%s",
(part-1)*linperfile*128+1,
- (part*linperfile*128) < progress.totsize ?
+ (part*linperfile*128) < progress.totsize ?
(part*linperfile*128) : progress.totsize,
eolstring);
}
else {
if (progress.totsize == -1) {
fprintf (outfile, "=ybegin line=128 name=%s%s",
- UUFNameFilter ((outfname)?outfname:infname),
+ UUFNameFilter ((outfname)?outfname:infname),
eolstring);
}
else {
fprintf (outfile, "=ybegin line=128 size=%ld name=%s%s",
progress.totsize,
- UUFNameFilter ((outfname)?outfname:infname),
+ UUFNameFilter ((outfname)?outfname:infname),
eolstring);
}
}
@@ -1431,7 +1431,7 @@ UUEncodeToFile (FILE *infile, char *infname, int encoding,
if (res != UURET_CANCEL) {
UUMessage (uuencode_id, __LINE__, UUMSG_ERROR,
uustring (S_ERR_ENCODING),
- UUFNameFilter ((infname)?infname:outfname),
+ UUFNameFilter ((infname)?infname:outfname),
(res==UURET_IOERR)?strerror(uu_errno):UUstrerror (res));
}
if (infile==NULL) fclose (theifile);
@@ -1444,25 +1444,25 @@ UUEncodeToFile (FILE *infile, char *infname, int encoding,
if (feof (theifile) &&
(encoding == UU_ENCODED || encoding == XX_ENCODED)) {
- fprintf (outfile, "%c%s",
- (encoding==UU_ENCODED) ? UUEncodeTable[0] : XXEncodeTable[0],
+ fprintf (outfile, "%c%s",
+ (encoding==UU_ENCODED) ? UUEncodeTable[0] : XXEncodeTable[0],
eolstring);
fprintf (outfile, "end%s", eolstring);
}
else if (encoding == YENC_ENCODED) {
if (numparts != 1) {
- fprintf (outfile, "=yend size=%d part=%d pcrc32=%08lx",
- (part*linperfile*128) < progress.totsize ?
+ fprintf (outfile, "=yend size=%ld part=%d pcrc32=%08lx",
+ (part*linperfile*128) < progress.totsize ?
linperfile*128 : (progress.totsize-(part-1)*linperfile*128),
part,
pcrc);
}
else {
- fprintf (outfile, "=yend size=%d",
+ fprintf (outfile, "=yend size=%ld",
progress.totsize);
}
if (feof (theifile))
- fprintf (outfile, " crc32=%08lx", crc);
+ fprintf (outfile, " crc32=%08lx", crc);
fprintf (outfile, "%s", eolstring);
}
@@ -1585,7 +1585,7 @@ UUE_PrepSingleExt (FILE *outfile, FILE *infile,
res = UUEncodeToStream (outfile, infile, infname, encoding,
outfname, filemode);
-
+
_FP_free (subline);
return res;
}
@@ -1657,7 +1657,7 @@ UUE_PrepPartialExt (FILE *outfile, FILE *infile,
}
if (linperfile <= 0)
numparts = 1;
- else
+ else
numparts = (int) (((long)finfo.st_size+(linperfile*bpl[encoding]-1))/
(linperfile*bpl[encoding]));
@@ -1738,7 +1738,7 @@ UUE_PrepPartialExt (FILE *outfile, FILE *infile,
}
else {
if (subject)
- sprintf (subline, "%s (%03d/%03d) - [ %s ]",
+ sprintf (subline, "%s (%03d/%03d) - [ %s ]",
subject, partno, numparts, oname);
else
sprintf (subline, "[ %s ] (%03d/%03d)",
@@ -1768,7 +1768,7 @@ UUE_PrepPartialExt (FILE *outfile, FILE *infile,
fprintf (outfile, "\tid=\"%s\"%s",
mimeid, eolstring);
}
-
+
fprintf (outfile, "%s", eolstring);
res = UUEncodePartial (outfile, theifile,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]