| 1 |
/* 'checkit_tiff' is a conformance checker for baseline TIFFs |
| 2 |
* |
| 3 |
* author: Andreas Romeyke, 2015-2022 |
| 4 |
* licensed under conditions of libtiff |
| 5 |
* (see http://libtiff.maptools.org/misc.html) |
| 6 |
* |
| 7 |
*/ |
| 8 |
|
| 9 |
#ifndef CHECKIT_TIFF_STRING |
| 10 |
#define CHECKIT_TIFF_STRING |
| 11 |
#include <string.h> |
| 12 |
#include <stdbool.h> |
| 13 |
|
| 14 |
typedef struct string_s { |
| 15 |
bool is_const:1; |
| 16 |
size_t len: 31; |
| 17 |
char * string; |
| 18 |
} string_t; |
| 19 |
|
| 20 |
#define INITIAL_STRINGBUFF_SIZE 4096 |
| 21 |
#define STRINGBUF_SIZE (65536*100) |
| 22 |
typedef struct stringbuf_s { |
| 23 |
size_t bufsize; |
| 24 |
size_t pos; |
| 25 |
string_t * strings; |
| 26 |
} stringbuf_t; |
| 27 |
|
| 28 |
string_t str(const char *); |
| 29 |
string_t const_str(const char *); |
| 30 |
string_t empty_str(void); |
| 31 |
size_t strlen_of_str (string_t); |
| 32 |
const char * cstr_of_str (string_t); |
| 33 |
stringbuf_t secstrcat_string (stringbuf_t dest, string_t src); |
| 34 |
stringbuf_t secstrcat_cstr (stringbuf_t dest, const char * src); |
| 35 |
stringbuf_t empty_stringbuf(void); |
| 36 |
/* DEBUG double free error |
| 37 |
#define clean_str(s) \ |
| 38 |
fprintf(stderr, "_clean_str caller is %s, %d\n", __FILE__, __LINE__); \ |
| 39 |
_clean_str(s); |
| 40 |
*/ |
| 41 |
#define clean_str(s) \ |
| 42 |
_clean_str(s); |
| 43 |
void _clean_str(string_t * s); |
| 44 |
void clean_stringbuf(stringbuf_t * buf); |
| 45 |
void clean_stringbuf_with_all_strings(stringbuf_t * buf); |
| 46 |
|
| 47 |
#endif |