comparison util.h @ 1783:eda8df5bc74c

Minor cleanup
author Michael Pavone <pavone@retrodev.com>
date Mon, 11 Mar 2019 00:04:48 -0700
parents 7121daaa48c2
children 52a47611a273
comparison
equal deleted inserted replaced
1782:b2bffd98063d 1783:eda8df5bc74c
30 long file_size(FILE * f); 30 long file_size(FILE * f);
31 //Strips whitespace and non-printable characters from the beginning and end of a string 31 //Strips whitespace and non-printable characters from the beginning and end of a string
32 char * strip_ws(char * text); 32 char * strip_ws(char * text);
33 //Inserts a null after the first word, returns a pointer to the second word 33 //Inserts a null after the first word, returns a pointer to the second word
34 char * split_keyval(char * text); 34 char * split_keyval(char * text);
35 //Checks if haystack starts with prefix
36 uint8_t startswith(const char *haystack, const char *prefix);
35 //Takes a binary byte buffer and produces a lowercase hex string 37 //Takes a binary byte buffer and produces a lowercase hex string
36 void bin_to_hex(uint8_t *output, uint8_t *input, uint64_t size); 38 void bin_to_hex(uint8_t *output, uint8_t *input, uint64_t size);
37 //Takes an (optionally) null-terminated UTF16-BE string and converts a maximum of max_size code-units to UTF-8 39 //Takes an (optionally) null-terminated UTF16-BE string and converts a maximum of max_size code-units to UTF-8
38 char *utf16be_to_utf8(uint8_t *buf, uint32_t max_size); 40 char *utf16be_to_utf8(uint8_t *buf, uint32_t max_size);
39 //Returns the next Unicode codepoint from a utf-8 string 41 //Returns the next Unicode codepoint from a utf-8 string