lha_input_stream.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. Copyright (c) 2011, 2012, Simon Howard
  3. Permission to use, copy, modify, and/or distribute this software
  4. for any purpose with or without fee is hereby granted, provided
  5. that the above copyright notice and this permission notice appear
  6. in all copies.
  7. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  8. WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  9. WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  10. AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
  11. CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  12. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
  13. NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  14. CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #ifndef LHASA_LHA_INPUT_STREAM_H
  17. #define LHASA_LHA_INPUT_STREAM_H
  18. #include <inttypes.h>
  19. #include "public/lha_input_stream.h"
  20. /**
  21. * Read a block of data from the LHA stream, of the specified number
  22. * of bytes.
  23. *
  24. * @param stream The input stream.
  25. * @param buf Pointer to buffer in which to store read data.
  26. * @param buf_len Size of buffer, in bytes.
  27. * @return Non-zero if buffer was filled, or zero if an
  28. * error occurred, or end of file was reached.
  29. */
  30. int lha_input_stream_read(LHAInputStream *stream, void *buf, size_t buf_len);
  31. /**
  32. * Skip over the specified number of bytes.
  33. *
  34. * @param stream The input stream.
  35. * @param bytes Number of bytes to skip.
  36. * @return Non-zero for success, zero for failure.
  37. */
  38. int lha_input_stream_skip(LHAInputStream *stream, size_t bytes);
  39. #endif /* #ifndef LHASA_LHA_INPUT_STREAM_H */