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

Function adjust_file_offset_down

libcppcryptfs/util/fileutil.cpp:69–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67#endif // _WIN32
68
69bool
70adjust_file_offset_down(LARGE_INTEGER& l)
71{
72 long long offset = l.QuadPart;
73
74 if (offset < 0)
75 return false;
76
77 if (offset == 0)
78 return true;
79
80 long long blocks = (offset - CIPHER_FILE_OVERHEAD + CIPHER_BS - 1) / CIPHER_BS;
81 offset -= (blocks*CIPHER_BLOCK_OVERHEAD + CIPHER_FILE_OVERHEAD);
82 if (offset < 0)
83 return false;
84
85 l.QuadPart = offset;
86
87 return true;
88}
89
90bool
91adjust_file_offset_up(LARGE_INTEGER& l)

Callers 3

WriteMethod · 0.85
SetEndOfFileMethod · 0.85
adjust_file_size_downFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected