fix types conversion

This commit is contained in:
Stas Degteff 2005-08-29 19:49:00 +00:00
parent 453fe2783e
commit 1f2fc4b132
2 changed files with 74 additions and 74 deletions

View File

@ -138,7 +138,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',
@ -165,11 +165,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'
};
@ -245,7 +245,7 @@ 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 = (unsigned char *) uuestr_itemp;
@ -283,7 +283,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));
@ -296,7 +296,7 @@ UUEncodeStream (FILE *outfile, FILE *infile, int encoding, long linperfile, crc3
*/
if (count > 0 && itemp[count-1] == '\n') {
itemp[--count] = '\0';
if (fwrite (itemp, 1, count, outfile) != count ||
if (fwrite (itemp, 1, count, outfile) != (unsigned)count ||
fwrite ((char *) eolstring, 1,
strlen((char *) eolstring), outfile) != strlen ((char *) eolstring)) {
return UURET_IOERR;
@ -389,13 +389,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((char *) eolstring), outfile) != strlen ((char *) eolstring)) {
return UURET_IOERR;
}
optr = otemp;
llen = 0;
}
@ -436,7 +436,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));
@ -566,7 +566,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++ = '=';
@ -582,7 +582,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];
@ -633,7 +633,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&&
@ -720,7 +720,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),
(char *) eolstring);
}
else if (encoding == YENC_ENCODED) {
@ -728,13 +728,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),
(char *) eolstring);
}
else {
fprintf (outfile, "=ybegin line=128 size=%ld name=%s%s",
progress.fsize,
UUFNameFilter ((outfname)?outfname:infname),
UUFNameFilter ((outfname)?outfname:infname),
(char *) eolstring);
}
}
@ -751,8 +751,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],
(char *) eolstring);
fprintf (outfile, "end%s", (char *) eolstring);
}
@ -835,7 +835,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]));
@ -905,7 +905,7 @@ UUEncodePartial (FILE *outfile, FILE *infile,
}
fprintf (outfile, "%s", (char *) eolstring);
/*
* for the first part of UU or XX messages, print a begin line
*/
@ -923,33 +923,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),
(char *) 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),
(char *) eolstring);
}
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,
(char *) eolstring);
}
else {
if (progress.totsize == -1) {
fprintf (outfile, "=ybegin line=128 name=%s%s",
UUFNameFilter ((outfname)?outfname:infname),
UUFNameFilter ((outfname)?outfname:infname),
(char *) eolstring);
}
else {
fprintf (outfile, "=ybegin line=128 size=%ld name=%s%s",
progress.totsize,
UUFNameFilter ((outfname)?outfname:infname),
UUFNameFilter ((outfname)?outfname:infname),
(char *) eolstring);
}
}
@ -993,15 +993,15 @@ 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],
(char *) eolstring);
fprintf (outfile, "end%s", (char *) eolstring);
}
else if (encoding == YENC_ENCODED) {
if (numparts != 1) {
fprintf (outfile, "=yend size=%ld part=%d pcrc32=%08lx",
(partno*linperfile*128) < progress.totsize ?
(partno*linperfile*128) < progress.totsize ?
linperfile*128 : (progress.totsize-(partno-1)*linperfile*128),
partno,
pcrc);
@ -1115,7 +1115,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),
(char *) eolstring);
}
else if (encoding == YENC_ENCODED) {
@ -1123,13 +1123,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),
(char *) eolstring);
}
else {
fprintf (outfile, "=ybegin line=128 size=%ld name=%s%s",
progress.fsize,
UUFNameFilter ((outfname)?outfname:infname),
UUFNameFilter ((outfname)?outfname:infname),
(char *) eolstring);
}
}
@ -1138,7 +1138,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;
@ -1146,8 +1146,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],
(char *) eolstring);
fprintf (outfile, "end%s", (char *) eolstring);
}
@ -1215,7 +1215,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) {
@ -1227,7 +1227,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;
@ -1237,7 +1237,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);
}
@ -1278,7 +1278,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]));
@ -1316,7 +1316,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);
/*
@ -1383,7 +1383,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),
(char *) eolstring);
}
else if (encoding == YENC_ENCODED) {
@ -1397,33 +1397,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),
(char *) 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),
(char *) eolstring);
}
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,
(char *) eolstring);
}
else {
if (progress.totsize == -1) {
fprintf (outfile, "=ybegin line=128 name=%s%s",
UUFNameFilter ((outfname)?outfname:infname),
UUFNameFilter ((outfname)?outfname:infname),
(char *) eolstring);
}
else {
fprintf (outfile, "=ybegin line=128 size=%ld name=%s%s",
progress.totsize,
UUFNameFilter ((outfname)?outfname:infname),
UUFNameFilter ((outfname)?outfname:infname),
(char *) eolstring);
}
}
@ -1434,7 +1434,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);
@ -1447,15 +1447,15 @@ 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],
(char *) eolstring);
fprintf (outfile, "end%s", (char *) eolstring);
}
else if (encoding == YENC_ENCODED) {
if (numparts != 1) {
fprintf (outfile, "=yend size=%ld part=%d pcrc32=%08lx",
(part*linperfile*128) < progress.totsize ?
(part*linperfile*128) < progress.totsize ?
linperfile*128 : (progress.totsize-(part-1)*linperfile*128),
part,
pcrc);
@ -1465,7 +1465,7 @@ UUEncodeToFile (FILE *infile, char *infname, int encoding,
progress.totsize);
}
if (feof (theifile))
fprintf (outfile, " crc32=%08lx", crc);
fprintf (outfile, " crc32=%08lx", crc);
fprintf (outfile, "%s", (char *) eolstring);
}
@ -1588,7 +1588,7 @@ UUE_PrepSingleExt (FILE *outfile, FILE *infile,
res = UUEncodeToStream (outfile, infile, infname, encoding,
outfname, filemode);
_FP_free (subline);
return res;
}
@ -1660,7 +1660,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]));
@ -1741,7 +1741,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)",
@ -1771,7 +1771,7 @@ UUE_PrepPartialExt (FILE *outfile, FILE *infile,
fprintf (outfile, "\tid=\"%s\"%s",
mimeid, (char *) eolstring);
}
fprintf (outfile, "%s", (char *) eolstring);
res = UUEncodePartial (outfile, theifile,

View File

@ -225,7 +225,7 @@ UUBrokenByNetscape (char *string)
* Try to repair a Netscape-corrupted line of data.
* This must only be called on corrupted lines, since non-Netscape
* data may even _get_ corrupted by this procedure.
*
*
* Some checks are included multiply to speed up the procedure. For
* example: (*p1!='<' || strnicmp(p1,"</a>",4)). If the first expression
* becomes true, the costly function isn't called :-)
@ -265,7 +265,7 @@ UUNetscapeCollapse (char *string)
while (*p1) {
if (*p1 == '<') {
if ((_FP_strnicmp (p1, "<ahref=", 7) == 0 ||
_FP_strnicmp (p1, "<a href=",8) == 0) &&
_FP_strnicmp (p1, "<a href=",8) == 0) &&
(_FP_strstr (p1, "</a>") != 0 || _FP_strstr (p1, "</A>") != 0)) {
while (*p1 && *p1!='>') p1++;
if (*p1=='\0' || *(p1+1)!='<') return 0;
@ -635,20 +635,20 @@ UUDecodeLine (char *s, char *d, int method)
if(i-- > 0)
d[count++] = c;
cc <<= 4;
c = table[ACAST(*s++)];
cc |= (c >> 2);
if(i-- > 0)
d[count++] = cc;
c <<= 6;
c |= table[ACAST(*s++)];
if(i-- > 0)
d[count++] = c;
j -= 4;
}
}
@ -748,7 +748,7 @@ UUDecodeQP (FILE *datain, FILE *dataout, int *state,
uulboundary = -1;
while (!feof (datain) &&
while (!feof (datain) &&
(ftell(datain)<maxpos || flags&FL_TOEND ||
(!(flags&FL_PROPER) && uu_fast_scanning))) {
if (_FP_fgets (line, 255, datain) == NULL)
@ -822,7 +822,7 @@ UUDecodeQP (FILE *datain, FILE *dataout, int *state,
* encapsulation line is conceptually attached to the boundary.
* So if the part ends here, don't print a line break"
*/
if (val && (!feof (datain) &&
if (val && (!feof (datain) &&
(ftell(datain)<maxpos || flags&FL_TOEND ||
(!(flags&FL_PROPER) && uu_fast_scanning))))
fprintf (dataout, "%s\n", p1);
@ -845,7 +845,7 @@ UUDecodePT (FILE *datain, FILE *dataout, int *state,
uulboundary = -1;
while (!feof (datain) &&
while (!feof (datain) &&
(ftell(datain)<maxpos || flags&FL_TOEND ||
(!(flags&FL_PROPER) && uu_fast_scanning))) {
if (_FP_fgets (line, 255, datain) == NULL)
@ -941,7 +941,7 @@ UUDecodePart (FILE *datain, FILE *dataout, int *state,
*state = BEGIN;
}
while (!feof (datain) && *state != DONE &&
while (!feof (datain) && *state != DONE &&
(ftell(datain)<maxpos || flags&FL_TOEND || maxpos==-1 ||
(!(flags&FL_PROPER) && uu_fast_scanning))) {
if (_FP_fgets (line, 299, datain) == NULL)
@ -971,7 +971,7 @@ UUDecodePart (FILE *datain, FILE *dataout, int *state,
vlc = 0;
continue;
}
/*
* Busy Polls
*/
@ -1061,7 +1061,7 @@ UUDecodePart (FILE *datain, FILE *dataout, int *state,
if ((ptr = _FP_strstr (line, " end=")) == NULL) {
break;
}
yepartends = atoi (ptr + 5);
}
tf = 1;
@ -1070,7 +1070,7 @@ UUDecodePart (FILE *datain, FILE *dataout, int *state,
else {
continue;
}
tc = tf = vlc = 0;
lc[0] = lc[1] = 0;
}
@ -1111,7 +1111,7 @@ UUDecodePart (FILE *datain, FILE *dataout, int *state,
{
size_t size = atol(ptr + 6);
if (size != yepartsize && yefilesize != -1) {
if (size != yefilesize)
if (size != (size_t)yefilesize)
UUMessage (uunconc_id, __LINE__, UUMSG_WARNING,
uustring (S_PSIZE_MISMATCH), progress.curfile,
progress.partno, yepartsize, size);
@ -1226,7 +1226,7 @@ UUDecodePart (FILE *datain, FILE *dataout, int *state,
if (*state == DONE ||
(*state == DATA && method == B64ENCODED &&
vflag == B64ENCODED && (flags&FL_PROPER || haddh))) {
for (tf=0; tf<tc; tf++)
for (tf=0; tf<tc; tf++)
count += UUDecodeLine (save[tf], oline + count, method);
if (count) {
if (method == BH_ENCODED) {
@ -1345,7 +1345,7 @@ UUDecode (uulist *data)
progress.numparts = (iter->partno)?iter->partno:1;
iter = iter->NEXT;
}
/*
* let's rock!
*/
@ -1411,7 +1411,7 @@ UUDecode (uulist *data)
iter = iter->NEXT;
}
if (state == DATA &&
if (state == DATA &&
(data->uudet == B64ENCODED || data->uudet == QP_ENCODED ||
data->uudet == PT_ENCODED))
state = DONE; /* assume we're done */