Use uint64_t for block size

This commit is contained in:
Sebastian Messmer 2016-03-09 00:20:04 +01:00
parent 08c1d206af
commit 1ee3a8df86
2 changed files with 7 additions and 7 deletions

View File

@ -33,7 +33,7 @@ CryConfig CryConfig::load(const Data &data) {
cfg._encKey = pt.get("cryfs.key", ""); cfg._encKey = pt.get("cryfs.key", "");
cfg._cipher = pt.get("cryfs.cipher", ""); cfg._cipher = pt.get("cryfs.cipher", "");
cfg._version = pt.get("cryfs.version", "0.8"); // CryFS 0.8 didn't specify this field, so if the field doesn't exist, it's 0.8. cfg._version = pt.get("cryfs.version", "0.8"); // CryFS 0.8 didn't specify this field, so if the field doesn't exist, it's 0.8.
cfg._blocksizeBytes = pt.get<uint32_t>("cryfs.blocksizeBytes", 32 * 1024); // TODO Put here the actual block size value of earlier CryFS versions cfg._blocksizeBytes = pt.get<uint64_t>("cryfs.blocksizeBytes", 32 * 1024); // CryFS <= 0.9.1 used a 32KB block size.
return cfg; return cfg;
} }
@ -44,7 +44,7 @@ Data CryConfig::save() const {
pt.put("cryfs.key", _encKey); pt.put("cryfs.key", _encKey);
pt.put("cryfs.cipher", _cipher); pt.put("cryfs.cipher", _cipher);
pt.put("cryfs.version", _version); pt.put("cryfs.version", _version);
pt.put<uint32_t>("cryfs.blocksizeBytes", _blocksizeBytes); pt.put<uint64_t>("cryfs.blocksizeBytes", _blocksizeBytes);
stringstream stream; stringstream stream;
write_json(stream, pt); write_json(stream, pt);
@ -83,11 +83,11 @@ void CryConfig::SetVersion(const std::string &value) {
_version = value; _version = value;
} }
uint32_t CryConfig::BlocksizeBytes() const { uint64_t CryConfig::BlocksizeBytes() const {
return _blocksizeBytes; return _blocksizeBytes;
} }
void CryConfig::SetBlocksizeBytes(uint32_t value) { void CryConfig::SetBlocksizeBytes(uint64_t value) {
_blocksizeBytes = value; _blocksizeBytes = value;
} }

View File

@ -27,8 +27,8 @@ public:
const std::string &Version() const; const std::string &Version() const;
void SetVersion(const std::string &value); void SetVersion(const std::string &value);
uint32_t BlocksizeBytes() const; uint64_t BlocksizeBytes() const;
void SetBlocksizeBytes(uint32_t value); void SetBlocksizeBytes(uint64_t value);
static CryConfig load(const cpputils::Data &data); static CryConfig load(const cpputils::Data &data);
cpputils::Data save() const; cpputils::Data save() const;
@ -38,7 +38,7 @@ private:
std::string _encKey; std::string _encKey;
std::string _cipher; std::string _cipher;
std::string _version; std::string _version;
uint32_t _blocksizeBytes; uint64_t _blocksizeBytes;
DISALLOW_COPY_AND_ASSIGN(CryConfig); DISALLOW_COPY_AND_ASSIGN(CryConfig);
}; };