|
@@ -5,7 +5,6 @@
|
|
|
|
|
|
int uuencode_line(const struct sprog_data *d, char *dst, int *offset, int *checksum) {
|
|
|
char srcbuf[64];
|
|
|
- unsigned char sum;
|
|
|
char *dstd;
|
|
|
int b;
|
|
|
int n;
|
|
@@ -13,12 +12,10 @@ int uuencode_line(const struct sprog_data *d, char *dst, int *offset, int *check
|
|
|
|
|
|
b = d->size - *offset;
|
|
|
if(b>45) b = 45;
|
|
|
-
|
|
|
- sum = 0;
|
|
|
+
|
|
|
for(i=0; i<b; i++) {
|
|
|
srcbuf[i] = d->data[*offset + i];
|
|
|
- sum += srcbuf[i];
|
|
|
- *checksum += srcbuf[i];
|
|
|
+ *checksum += (unsigned char) srcbuf[i];
|
|
|
}
|
|
|
|
|
|
for(i=0; i<3; i++)
|
|
@@ -30,17 +27,16 @@ int uuencode_line(const struct sprog_data *d, char *dst, int *offset, int *check
|
|
|
|
|
|
n = 0;
|
|
|
for(i=0; i<b; i+=3) {
|
|
|
- dstd[0] = srcbuf[i]>>2;
|
|
|
- dstd[1] = srcbuf[i]<<4 | srcbuf[i+1]>>4;
|
|
|
- dstd[2] = srcbuf[i+1]<<2 | srcbuf[i+2]>>6;
|
|
|
- dstd[3] = srcbuf[i+2];
|
|
|
+ dstd[0] = (srcbuf[i]>>2) & 0x3f;
|
|
|
+ dstd[1] = (srcbuf[i]<<4 & 0x30) | (srcbuf[i+1]>>4 & 0x0f);
|
|
|
+ dstd[2] = (srcbuf[i+1]<<2 &0x3c) | (srcbuf[i+2]>>6 & 0x03);
|
|
|
+ dstd[3] = srcbuf[i+2] & 0x3f;
|
|
|
dstd += 4;
|
|
|
n += 4;
|
|
|
}
|
|
|
|
|
|
|
|
|
for(i=0; i<n+1; i++) {
|
|
|
- dst[i] &= 0x3f;
|
|
|
if(dst[i])
|
|
|
dst[i] += ' ';
|
|
|
else
|