Fixed UUE and BASE64 encoding.

This commit is contained in:
Ianos Gnatiuc 2006-04-30 06:57:51 +00:00
parent 1c507bbd23
commit c45e6f7f35
2 changed files with 14 additions and 14 deletions

View File

@ -1042,7 +1042,7 @@ void IEclass::editimport(Line* __line, char* __filename, bool imptxt) {
char ibuf[80]; char ibuf[80];
char* iptr = ibuf; char* iptr = ibuf;
char* optr = _parabuf; char* optr = _parabuf;
int n = fp.Fread(ibuf, 45); int n = fp.Fread(ibuf, 1, 45);
if (n < 45) memset(ibuf+n, 0, 45-n); if (n < 45) memset(ibuf+n, 0, 45-n);
*optr++ = uuencode_enc(n); *optr++ = uuencode_enc(n);
@ -1084,7 +1084,7 @@ void IEclass::editimport(Line* __line, char* __filename, bool imptxt) {
{ {
char ibuf[80]; char ibuf[80];
char* optr = _parabuf; char* optr = _parabuf;
int n = fp.Fread(ibuf, 54); int n = fp.Fread(ibuf, 1, 54);
optr = b64.encode(optr, ibuf, n); optr = b64.encode(optr, ibuf, n);
*optr++ = '\n'; *optr++ = '\n';
*optr = NUL; *optr = NUL;

View File

@ -665,19 +665,19 @@ UUDecodeLine (char *s, char *d, int method)
if ((z3 = B64xlat[ACAST(*(s+2))]) == -1) break; if ((z3 = B64xlat[ACAST(*(s+2))]) == -1) break;
if ((z4 = B64xlat[ACAST(*(s+3))]) == -1) break; if ((z4 = B64xlat[ACAST(*(s+3))]) == -1) break;
d[count++] = (z1 << 2) | (z2 >> 4); d[count++] = (char)(((z1 << 2) | (z2 >> 4)) & 0xFF);
d[count++] = (z2 << 4) | (z3 >> 2); d[count++] = (char)(((z2 << 4) | (z3 >> 2)) & 0xFF);
d[count++] = (z3 << 6) | (z4); d[count++] = (char)(((z3 << 6) | (z4)) & 0xFF);
s += 4; s += 4;
} }
if (z1 != -1 && z2 != -1 && *(s+2) == '=') { if (z1 != -1 && z2 != -1 && *(s+2) == '=') {
d[count++] = (z1 << 2) | (z2 >> 4); d[count++] = (char)(((z1 << 2) | (z2 >> 4)) & 0xFF);
s+=2; s+=2;
} }
else if (z1 != -1 && z2 != -1 && z3 != -1 && *(s+3) == '=') { else if (z1 != -1 && z2 != -1 && z3 != -1 && *(s+3) == '=') {
d[count++] = (z1 << 2) | (z2 >> 4); d[count++] = (char)(((z1 << 2) | (z2 >> 4)) & 0xFF);
d[count++] = (z2 << 4) | (z3 >> 2); d[count++] = (char)(((z2 << 4) | (z3 >> 2)) & 0xFF);
s+=3; s+=3;
} }
while (B64xlat[ACAST(*s)] != -1) while (B64xlat[ACAST(*s)] != -1)
@ -697,19 +697,19 @@ UUDecodeLine (char *s, char *d, int method)
if ((z3 = BHxlat[ACAST(*(s+2))]) == -1) break; if ((z3 = BHxlat[ACAST(*(s+2))]) == -1) break;
if ((z4 = BHxlat[ACAST(*(s+3))]) == -1) break; if ((z4 = BHxlat[ACAST(*(s+3))]) == -1) break;
d[count++] = (z1 << 2) | (z2 >> 4); d[count++] = (char)(((z1 << 2) | (z2 >> 4)) & 0xFF);
d[count++] = (z2 << 4) | (z3 >> 2); d[count++] = (char)(((z2 << 4) | (z3 >> 2)) & 0xFF);
d[count++] = (z3 << 6) | (z4); d[count++] = (char)(((z3 << 6) | (z4)) & 0xFF);
s += 4; s += 4;
} }
if (z1 != -1 && z2 != -1 && *(s+2) == ':') { if (z1 != -1 && z2 != -1 && *(s+2) == ':') {
d[count++] = (z1 << 2) | (z2 >> 4); d[count++] = (char)(((z1 << 2) | (z2 >> 4)) & 0xFF);
s+=2; s+=2;
} }
else if (z1 != -1 && z2 != -1 && z3 != -1 && *(s+3) == ':') { else if (z1 != -1 && z2 != -1 && z3 != -1 && *(s+3) == ':') {
d[count++] = (z1 << 2) | (z2 >> 4); d[count++] = (char)(((z1 << 2) | (z2 >> 4)) & 0xFF);
d[count++] = (z2 << 4) | (z3 >> 2); d[count++] = (char)(((z2 << 4) | (z3 >> 2)) & 0xFF);
s+=3; s+=3;
} }
while (BHxlat[ACAST(*s)] != -1) while (BHxlat[ACAST(*s)] != -1)