| 117 | } |
| 118 | |
| 119 | bool |
| 120 | adjust_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 |
| 139 | static bool |