Calculate crc of sections.

Close #1.
This commit is contained in:
James Benton 2016-01-05 15:44:55 -08:00
parent 9f6e28ea92
commit 9cd1940bc8
3 changed files with 5 additions and 4 deletions

View File

@ -10,7 +10,7 @@ CFILES := $(foreach dir,$(SOURCE),$(wildcard $(dir)/*.cpp))
INCLUDES := $(foreach dir,$(INCLUDE),-I$(dir))
CFLAGS := -O2 -Wall --std=c++14
LDFLAGS :=
LDFLAGS := -lz
all: $(TARGET)

View File

@ -5,6 +5,7 @@
#include <string>
#include <vector>
#include <memory>
#include <zlib.h>
#include "elf.h"
#pragma pack(push, 1)
@ -896,8 +897,8 @@ write(ElfFile &file, const std::string &filename)
auto crc = 0u;
if (!section->data.empty()) {
// TODO: Calculate crc of section->data
crc = 0xBEEFB00B;
crc = crc32(0, Z_NULL, 0);
crc = crc32(crc, reinterpret_cast<Bytef *>(section->data.data()), section->data.size());
}
sectionCRCs.push_back(crc);

View File

@ -2,7 +2,7 @@ WUT_ROOT := $(CURDIR)/../..
TARGET := readrpl
SOURCE := .
INCLUDE := ../common ../ext/cppformat ../ext/zlib
INCLUDE := ../common ../ext/cppformat
CXX := g++