File: zbinbuf.h

package info (click to toggle)
libzia 4.36-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 3,320 kB
  • sloc: ansic: 24,172; sh: 4,408; makefile: 211
file content (42 lines) | stat: -rw-r--r-- 1,380 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
    zbinbuf - Binary buffer
    Copyright (C) 2011-2012 Ladislav Vaiz <ok1zia@nagano.cz>

    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
    version 2 as published by the Free Software Foundation.

*/

#ifndef __ZBINBUF_H
#define __ZBINBUF_H

#include <libziaint.h>

#include <stdint.h>

struct zbinbuf{
    int size, len, increment;
    char *buf;
};

struct zbinbuf *zbinbuf_init(void);
void zbinbuf_free(struct zbinbuf *zbb);
void zbinbuf_append_bin(struct zbinbuf *zbb, const void *data, int len);
void zbinbuf_append(struct zbinbuf *zbb, const char *str);
int zbinbuf_sprintf(struct zbinbuf *zbb, char *fmt, ...);
int zbinbuf_sprintfa(struct zbinbuf *zbb, char *fmt, ...);
void zbinbuf_prepend(struct zbinbuf *zbb, void *data, int len);
void zbinbuf_erase(struct zbinbuf *zbb, int pos, int len);
void zbinbuf_truncate(struct zbinbuf *zbb, int len);

void zbinbuf_getstr(struct zbinbuf *zbb, int pos, char *str, int maxlen);
void zbinbuf_getline(struct zbinbuf *zbb, int *pos, char *str, int maxlen);

int zbinbuf_append_file(struct zbinbuf *zbb, const char *filename);
int zbinbuf_write_to_file(struct zbinbuf *zbb, const char *filename, int offset, int len);

void zbinbuf_append_le_s16(struct zbinbuf *zbb, int16_t a);
void zbinbuf_append_le_s32(struct zbinbuf *zbb, int32_t a);

#endif