blob: 81594d87c8706e3110d3b721a01ad7cc2217e27e [file] [log] [blame]
"Robert P. J. Day"63fc1a92006-07-02 19:47:05 +00001/* vi: set sw=4 ts=4: */
Glenn L McGrath237ae422002-11-03 14:05:15 +00002/*
"Robert P. J. Day"801ab142006-07-12 07:56:04 +00003 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
Glenn L McGrath237ae422002-11-03 14:05:15 +00004 */
5
Glenn L McGrath7ca04f32002-09-25 02:47:48 +00006#include <sys/types.h>
Glenn L McGrath237ae422002-11-03 14:05:15 +00007
8#include <errno.h>
Glenn L McGrath7ca04f32002-09-25 02:47:48 +00009#include <unistd.h>
Glenn L McGrath237ae422002-11-03 14:05:15 +000010
Glenn L McGrath7ca04f32002-09-25 02:47:48 +000011#include "libbb.h"
Glenn L McGrath237ae422002-11-03 14:05:15 +000012#include "unarchive.h"
Glenn L McGrath7ca04f32002-09-25 02:47:48 +000013
Rob Landleydfba7412006-03-06 20:47:33 +000014void data_align(archive_handle_t *archive_handle, const unsigned short boundary)
Glenn L McGrath7ca04f32002-09-25 02:47:48 +000015{
Glenn L McGrath237ae422002-11-03 14:05:15 +000016 const unsigned short skip_amount = (boundary - (archive_handle->offset % boundary)) % boundary;
Glenn L McGrath7ca04f32002-09-25 02:47:48 +000017
Glenn L McGrath237ae422002-11-03 14:05:15 +000018 archive_handle->seek(archive_handle, skip_amount);
Glenn L McGrath237ae422002-11-03 14:05:15 +000019 archive_handle->offset += skip_amount;
20
21 return;
Glenn L McGrath7ca04f32002-09-25 02:47:48 +000022}