revert breaks some stupid old compilers
[oscam.git] / oscam-string.h
blob3fd3c5a05a9ce119d2c66249bdd7cc206ee94621
1 #ifndef OSCAM_STRING_H_
2 #define OSCAM_STRING_H_
4 bool cs_malloc(void *result, size_t size) MUST_CHECK_RESULT;
5 bool cs_realloc(void *result, size_t size) MUST_CHECK_RESULT;
6 char *cs_strdup(const char *str);
8 void cs_strncpy(char *destination, const char *source, size_t num);
9 char *strtolower(char *txt);
10 char *strtoupper(char *txt);
11 char *trim(char *txt);
12 char *trim2(char *txt);
13 char *remove_white_chars(char *txt);
14 bool streq(const char *s1, const char *s2);
16 char *cs_hexdump(int32_t m, const uchar *buf, int32_t n, char *target, int32_t len);
18 int32_t gethexval(char c);
20 int32_t cs_atob(uchar *buf, char *asc, int32_t n);
21 uint32_t cs_atoi(char *asc, int32_t l, int32_t val_on_err);
22 int32_t byte_atob(char *asc);
23 int32_t word_atob(char *asc);
24 int32_t dyn_word_atob(char *asc);
25 int32_t key_atob_l(char *asc, uchar *bin, int32_t l);
26 uint32_t b2i(int32_t n, const uchar *b);
27 uint64_t b2ll(int32_t n, uchar *b);
28 uchar *i2b_buf(int32_t n, uint32_t i, uchar *b);
29 void ull2b_buf(uint64_t i, uchar *b);
30 uint32_t a2i(char *asc, int32_t bytes);
32 int32_t boundary(int32_t exp, int32_t n);
34 int32_t array_has_nonzero_byte(uchar *value, int32_t length);
36 void get_random_bytes_init(void);
37 void get_random_bytes(uint8_t *dst, uint32_t dst_len);
39 uint32_t crc32(uint32_t crc, const uint8_t *buf, uint32_t len);
40 uint16_t ccitt_crc(uint8_t *data, size_t length, uint16_t seed, uint16_t final);
41 uint32_t jhash(const char *key, size_t len);
43 char to_hex(char code);
44 void char_to_hex(const unsigned char *p_array, uint32_t p_array_len, unsigned char *result);
46 #define BASE64_LENGTH(inlen) ((((inlen) + 2) / 3) * 4)
47 void base64_encode(const char *in, size_t inlen, char *out, size_t outlen);
48 size_t b64encode(const char *in, size_t inlen, char **out);
50 void b64prepare(void);
51 int32_t b64decode(unsigned char *result);
53 #ifdef READ_SDT_CHARSETS
54 size_t ISO6937toUTF8( const unsigned char **inbuf, size_t *inbytesleft,
55 unsigned char **outbuf, size_t *outbytesleft );
56 size_t ISO8859toUTF8(int8_t iso_table_number, const unsigned char **inbuf, size_t *inbytesleft,
57 unsigned char **outbuf, size_t *outbytesleft );
58 #endif
60 size_t UnicodetoUTF8(const unsigned char **inbuf, size_t *inbytesleft,
61 unsigned char **outbuf, size_t *outbytesleft);
63 #endif