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