diff --git a/CRC.h b/CRC.h index 48d9682..4885d48 100644 --- a/CRC.h +++ b/CRC.h @@ -5,7 +5,7 @@ // Table 형식. // 모든 입력 값 256개 (0x00 ~ 0xFF) 에 대한 결과를 저장한 테이블. -// 기준값 : 0xEDB88320 +// 기준값 : 0xED B8 83 20 // 기준 비트 순서 : LSB -> MSB static const uint32_t crcTable[256] = { 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, diff --git a/ZipDefine.h b/ZipDefine.h index d98814e..ad3d53f 100644 --- a/ZipDefine.h +++ b/ZipDefine.h @@ -58,8 +58,8 @@ constexpr int LOCAL_FILE_HEADER_BYTE = 30; uint16_t versionNeededToExtract; uint16_t generalBitFlag; uint16_t compressionMethod; // no compression == 0 - uint16_t lastModTime; // 압축 시점의 시간 (1980년 기준 시간) - uint16_t lastModDate; // 압축 시점의 날짜 (1980년 기준 연도) + uint16_t lastModTime; // 압축 시점의 시간 (1980년 기준 시간, DOS TIME) + uint16_t lastModDate; // 압축 시점의 날짜 (1980년 기준 연도, DOS TIME) uint32_t crc32; uint32_t sizeOfCompressed; // same as unCompression (cuz no compreesion) uint32_t sizeOfUncompressed; diff --git a/main.cpp b/main.cpp index f6f9f70..af0d090 100644 --- a/main.cpp +++ b/main.cpp @@ -18,6 +18,8 @@ int main() int iRet = 0; // Zip Format define check + // 생성자를 만들어서, 생성되면서 사이즈 검사? + size_t iSizeTest = sizeof(LocalFileHeader); if (LOCAL_FILE_HEADER_BYTE != iSizeTest) { @@ -46,6 +48,7 @@ int main() } } + std::printf("==================== Good Bye Zip! ====================\r\n"); return iRet; } @@ -151,6 +154,7 @@ bool ZipArchiver() { // 1. Local File Header, file name (var), extra field (var) CentDir.offsetLocalFileHeader = fileOut.tellp(); + // TODO : sizeof 의 값이 스펙과 정확히 일치한다는 보장 필요 (현재는 compiler 에 종속적) fileOut.write(reinterpret_cast(&LFHeader), sizeof(LFHeader)); fileOut.write(INPUT_FILE_NAME, LFHeader.lengthOfFileName); //fileOut.write(NOT_USED, LFHeader.LFHeader.lengthOfExtraField); @@ -160,10 +164,12 @@ bool ZipArchiver() // 3. CentralDirectory, file name (var) EOCDR.offsetCentralDir = fileOut.tellp(); + // TODO : sizeof 의 값이 스펙과 정확히 일치한다는 보장 필요 (현재는 compiler 에 종속적) fileOut.write(reinterpret_cast(&CentDir), sizeof(CentDir)); fileOut.write(INPUT_FILE_NAME, CentDir.lengthOfFileName); // 4. End of CentralDirectory Record + // TODO : sizeof 의 값이 스펙과 정확히 일치한다는 보장 필요 (현재는 compiler 에 종속적) fileOut.write(reinterpret_cast(&EOCDR), sizeof(EOCDR)); fileOut.close();