MCPcopy Create free account
hub / github.com/bailey27/cppcryptfs / adjust_file_offset_up_truncate_zero

Function adjust_file_offset_up_truncate_zero

libcppcryptfs/util/fileutil.cpp:119–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

117}
118
119bool
120adjust_file_offset_up_truncate_zero(LARGE_INTEGER& l)
121{
122 long long offset = l.QuadPart;
123
124 if (offset < 0)
125 return false;
126
127 if (offset == 0) // truncate zero-length file to 0 bytes
128 return true;
129
130 long long blocks = (offset + PLAIN_BS - 1) / PLAIN_BS;
131 offset += blocks*CIPHER_BLOCK_OVERHEAD + CIPHER_FILE_OVERHEAD;
132
133 l.QuadPart = offset;
134
135 return true;
136}
137
138#ifdef _WIN32
139static bool

Callers 1

SetEndOfFileMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected