OSDN Git Service

untabify
[lha/olha.git] / encode.c
index aac32c9..ec26683 100644 (file)
--- a/encode.c
+++ b/encode.c
@@ -326,7 +326,8 @@ get_next_match(struct lzh_ostream *wp, FILE *rfp, struct match_t *match)
     remainder--;
     if (++pos == DICSIZ * 2) {
         memmove(&text[0], &text[DICSIZ], DICSIZ + MAXMATCH);
-        n = fread_crc(&text[DICSIZ + MAXMATCH], DICSIZ, rfp);
+        n = fread_crc(&text[DICSIZ + MAXMATCH], DICSIZ, rfp, &wp->crc);
+        wp->origsize += n;
         remainder += n;
         pos = DICSIZ;
         if (wp->fp != stdout && opts.quiet < 1) {
@@ -344,8 +345,9 @@ encode(struct lzh_ostream *wp, FILE *rfp)
 
     allocate_memory();
     init_slide();
-    huf_encode_start(opts.method);
-    remainder = fread_crc(&text[DICSIZ], DICSIZ + MAXMATCH, rfp);
+    huf_encode_start(wp, opts.method);
+    remainder = fread_crc(&text[DICSIZ], DICSIZ + MAXMATCH, rfp, &wp->crc);
+    wp->origsize += remainder;
 
     if (wp->fp != stdout && opts.quiet < 1) {
         putc('.', stdout);
@@ -355,7 +357,7 @@ encode(struct lzh_ostream *wp, FILE *rfp)
     insert_node(&match);
     if (match.len > remainder)
         match.len = remainder;
-    while (remainder > 0 && !unpackable) {
+    while (remainder > 0 && !wp->unpackable) {
         lastmatch = match;
         get_next_match(wp, rfp, &match);
         if (match.len > remainder)