encode.py: improve error message when segment lengths come out wrong

This commit is contained in:
Brian Warner 2008-01-24 21:51:09 -07:00
parent 46fe024612
commit 081d27a65d
1 changed files with 5 additions and 1 deletions

View File

@ -352,7 +352,11 @@ class Encoder(object):
encrypted_pieces.append('\x00' * pad_size)
else:
# non-tail segments should be the full segment size
assert length == input_chunk_size
log.msg("non-tail segment should be full segment size: %d!=%d"
% (length, input_chunk_size), level=log.BAD)
precondition(length == input_chunk_size,
"length=%d != input_chunk_size=%d" %
(length, input_chunk_size))
encrypted_piece = "".join(encrypted_pieces)
return previous_chunks + [encrypted_piece]