3
0

data_align.c 505 B

12345678910111213141516171819202122
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
  4. */
  5. #include <sys/types.h>
  6. #include <errno.h>
  7. #include <unistd.h>
  8. #include "libbb.h"
  9. #include "unarchive.h"
  10. void data_align(archive_handle_t *archive_handle, const unsigned short boundary)
  11. {
  12. const unsigned short skip_amount = (boundary - (archive_handle->offset % boundary)) % boundary;
  13. archive_handle->seek(archive_handle, skip_amount);
  14. archive_handle->offset += skip_amount;
  15. return;
  16. }