#include "c4groupheader.h" #include #include void C4GroupHeader_init(C4GroupHeader* const this) { // id is not cleared because the id string exactly fits the size strcpy(this->id, C4GroupId); memset(this->Reserved1, 0, sizeof(this->Reserved1)); memset(this->Reserved2, 0, sizeof(this->Reserved2)); memset(this->Password, 0, sizeof(this->Password)); this->Ver1 = 1; this->Ver2 = 2; this->Entries = 0; C4GroupHeader_setMaker(this, "New C4Group"); this->Maker[C4GroupMaxMaker + 1] = '\0'; C4GroupHeader_setCreation(this, time(NULL)); C4GroupHeader_setOfficial(this, false); } void C4GroupHeader_setMaker(C4GroupHeader* const this, const char* const maker) { strncpy(this->Maker, maker, C4GroupMaxMaker + 1); } void C4GroupHeader_setCreation(C4GroupHeader* const this, int32_t const creation) { this->Creation = creation; } void C4GroupHeader_setOfficial(C4GroupHeader* const this, const bool official) { this->Official = official ? C4GroupOfficial : 0; } bool C4GroupHeader_isOfficial(const C4GroupHeader* const this) { return this->Official == C4GroupOfficial; }