the notes of ZIP workshop 1

introduction

i attended a ZIP workshop. i'll make the notes of it and split it into several entries.

what i did

i made a zip analysis tool with the zip format information i learned at workshop. it shows included files.

example

% zip hoge.zip ./*
% ./zip_analysis.o ./hoge.zip
this zip file includes 17 files.
- judge.c         1232 (450) bytes
- Makefile        488 (163) bytes
- zip.h           1180 (322) bytes
- zip_analysis.c  1890 (638) bytes
- zip_analysis.o  25803 (7051) bytes
- analysis.c      19423 (2635) bytes
- analysis.o      34995 (9464) bytes
- analysis.txt    6705 (1147) bytes
- binary_edit.c   2657 (912) bytes
- binary_edit.o   30087 (9588) bytes
- binary_view.c   2863 (954) bytes
- binary_view.o   30439 (9663) bytes
- convert2.c      949 (411) bytes
- convert.c       840 (377) bytes
- dump.c          1587 (627) bytes
- dump.o          29177 (9283) bytes
- judge2.c        1120 (427) bytes


i verified it with using "unzip -l". the results are same.

source code

you can get the source code at googlecode.

memorandum

  • i had a hard time to handle the extra data which exists after included filename. i had forgotten zip header has its length.
  • i use "#define" to get memory size of my own struct data instead of using sizeof( ). until using it, my tool didn't work well. i hadn't known some compilers adds a padding into struct data.

conclusion

i made a tool with using only zip format information. i'm going to do something with compression algorithm next time.