ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Convert-UUlib/uulib/uunconc.c
(Generate patch)

Comparing Convert-UUlib/uulib/uunconc.c (file contents):
Revision 1.7 by root, Fri Apr 5 21:56:57 2002 UTC vs.
Revision 1.8 by root, Sat Apr 6 01:53:30 2002 UTC

52#include <uudeview.h> 52#include <uudeview.h>
53#include <uuint.h> 53#include <uuint.h>
54#include <fptools.h> 54#include <fptools.h>
55#include <uustring.h> 55#include <uustring.h>
56 56
57char * uunconc_id = "$Id: uunconc.c,v 1.7 2002/04/05 21:56:57 root Exp $"; 57char * uunconc_id = "$Id: uunconc.c,v 1.8 2002/04/06 01:53:30 root Exp $";
58 58
59/* for braindead systems */ 59/* for braindead systems */
60#ifndef SEEK_SET 60#ifndef SEEK_SET
61#ifdef L_BEGIN 61#ifdef L_BEGIN
62#define SEEK_SET L_BEGIN 62#define SEEK_SET L_BEGIN
606 606
607 if (s == NULL || d == NULL) { 607 if (s == NULL || d == NULL) {
608 leftover = 0; 608 leftover = 0;
609 return 0; 609 return 0;
610 } 610 }
611
612 /* optionally skip .. */
613 if (*s == '.' && uu_dotdot)
614 s++;
611 615
612 /* 616 /*
613 * To shut up gcc -Wall 617 * To shut up gcc -Wall
614 */ 618 */
615 z1 = z2 = z3 = z4 = 0; 619 z1 = z2 = z3 = z4 = 0;
647 j -= 4; 651 j -= 4;
648 } 652 }
649 } 653 }
650 else if (method == B64ENCODED) { 654 else if (method == B64ENCODED) {
651 if (leftover) { 655 if (leftover) {
656 int len = strlen (s);
657
658 if (len > 1200 - 1 - leftover)
659 len = 1200 - 1 - leftover;
660
652 strncpy (uuncdl_fulline+leftover, s, 1200 - leftover); 661 memcpy (uuncdl_fulline + leftover, s, len);
653 uuncdl_fulline[1200 - 1] = 0; 662 uuncdl_fulline[leftover + len] = 0;
654 663
655 leftover = 0; 664 leftover = 0;
656 s = uuncdl_fulline; 665 s = uuncdl_fulline;
657 } 666 }
658 667
679 while (B64xlat[ACAST(*s)] != -1) 688 while (B64xlat[ACAST(*s)] != -1)
680 uuncdl_fulline[leftover++] = *s++; 689 uuncdl_fulline[leftover++] = *s++;
681 } 690 }
682 else if (method == BH_ENCODED) { 691 else if (method == BH_ENCODED) {
683 if (leftover) { 692 if (leftover) {
693 int len = strlen (s);
694
695 if (len > 1200 - 1 - leftover)
696 len = 1200 - 1 - leftover;
697
684 strncpy (uuncdl_fulline+leftover, s, 1200 - leftover); 698 memcpy (uuncdl_fulline + leftover, s, len);
685 uuncdl_fulline[1200 - 1] = 0; 699 uuncdl_fulline[leftover + len] = 0;
700
686 leftover = 0; 701 leftover = 0;
687 s = uuncdl_fulline; 702 s = uuncdl_fulline;
688 } 703 }
689 else if (*s == ':') 704 else if (*s == ':')
690 s++; 705 s++;
718 if (*++s != '\0') { 733 if (*++s != '\0') {
719 d[count++] = (char) ((int) *s - 64 - 42); 734 d[count++] = (char) ((int) *s - 64 - 42);
720 s++; 735 s++;
721 } 736 }
722 } 737 }
723 else if (*s == '\t' || *s == '\n' || *s == '\r') { 738 else if (*s == '\n' || *s == '\r') {
724 s++; /* ignore */ 739 s++; /* ignore */
725 } 740 }
726 else { 741 else {
727 d[count++] = (char) ((int) *s++ - 42); 742 d[count++] = (char) ((int) *s++ - 42);
728 } 743 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines