OSDN Git Service

should not add signed operand to unsigned
authorKoji Arai <jca02266@gmail.com>
Wed, 21 May 2008 14:30:42 +0000 (23:30 +0900)
committerKoji Arai <jca02266@gmail.com>
Wed, 21 May 2008 14:30:42 +0000 (23:30 +0900)
ar.c
randtest/randtest.rb

diff --git a/ar.c b/ar.c
index e7ad621..cfb6ab3 100644 (file)
--- a/ar.c
+++ b/ar.c
@@ -193,7 +193,7 @@ get_header(char *buf, int *i, int size)
 
     s = 0;
     for (n = size-1; n >= 0; n--) {
-        s = (s << 8) + buf[*i + n];   /* little endian */
+        s = (s << 8) + (unsigned char)buf[*i + n];   /* little endian */
     }
     *i += size;
     return s;
@@ -494,7 +494,7 @@ read_header_lv1(FILE *fp, char *buf, struct lzh_header *h)
 
     while (ext_headersize != 0) {
         char extbuf[4096];
-       uchar ext_type;
+        uchar ext_type;
         int extpos = 0;
 
         h->compsize -= ext_headersize;
@@ -509,7 +509,7 @@ read_header_lv1(FILE *fp, char *buf, struct lzh_header *h)
             h->mtime = get_header(extbuf, &extpos, 4);
             break;
         default:
-           break;
+            break;
         }
         extpos = ext_headersize - 2;
         ext_headersize = get_header(extbuf, &extpos, 2);
index 15025df..0e1b594 100644 (file)
@@ -7,6 +7,7 @@ begin
       lzh  = "rand#{v}k.lzh"
       system("cat seq.bin rand#{v}k.bin seq.bin > #{file}")
 
+      puts "creating..."
       case :olha7
       when :jlha5 then system("jlha a -o5 #{lzh} #{file}")
       when :jlha6 then system("jlha a -o6 #{lzh} #{file}")
@@ -20,13 +21,17 @@ begin
       else raise
       end
 
+      puts "testing..."
       system("lha t #{lzh} > /dev/null")
       raise "error #{"%x" % $?.to_i}" if $?.to_i > 0
       system("lha vvq #{lzh} >> tmp")
 
+      puts "extracting..."
       File.rename(file, file + ".tmp")
       system("olha x #{lzh}")
       raise "error #{"%x" % $?.to_i}" if $?.to_i > 0
+
+      puts "comparing..."
       system("cmp %s %s" % [file, file + ".tmp"])
       raise if $?.to_i > 0