2015-11-29 10:30:52 +01:00
# ifndef HELPERS_H
# define HELPERS_H
# ifndef CONFIG
# define CONFIG "config.h"
# endif // CONFIG
# include CONFIG
# include <stdint.h>
# include "types.h"
2016-10-31 13:59:15 +01:00
# if __ANDROID__
# include <sys/syscall.h>
# endif // __ANDROID__
2015-11-29 10:30:52 +01:00
# define GUID_LE 0
# define GUID_BE 1
# define GUID_SWAP 2
BOOL stringToInt ( const char * const szValue , const unsigned int min , const unsigned int max , unsigned int * const value ) ;
unsigned int getOptionArgumentInt ( const char o , const unsigned int min , const unsigned int max ) ;
void optReset ( void ) ;
char * win_strerror ( const int message ) ;
int ucs2_to_utf8_char ( const WCHAR ucs2_le , char * utf8 ) ;
size_t utf8_to_ucs2 ( WCHAR * const ucs2_le , const char * const utf8 , const size_t maxucs2 , const size_t maxutf8 ) ;
WCHAR utf8_to_ucs2_char ( const unsigned char * input , const unsigned char * * end_ptr ) ;
BOOL ucs2_to_utf8 ( const WCHAR * const ucs2_le , char * utf8 , size_t maxucs2 , size_t maxutf8 ) ;
int_fast8_t string2Uuid ( const char * const restrict input , GUID * const restrict guid ) ;
void randomNumberInit ( ) ;
void LEGUID ( GUID * const restrict result , const GUID * const restrict guid ) ;
void parseAddress ( char * const addr , char * * szHost , char * * szPort ) ;
__noreturn void OutOfMemory ( void ) ;
void * vlmcsd_malloc ( size_t len ) ;
void hex2bin ( BYTE * const bin , const char * hex , const size_t maxbin ) ;
__pure BOOL getArgumentBool ( int_fast8_t * result , const char * const argument ) ;
2016-10-24 15:32:24 +02:00
__pure int IsEqualGuidLE ( const GUID * const restrict first , const GUID * const restrict second ) ;
2015-11-29 10:30:52 +01:00
2016-10-31 13:59:15 +01:00
# if __ANDROID__ && !defined(USE_THREADS) // Bionic does not wrap these syscalls (intentionally because Google fears, developers don't know how to use it)
int shmget ( key_t key , size_t size , int shmflg ) ;
void * shmat ( int shmid , const void * shmaddr , int shmflg ) ;
int shmdt ( const void * shmaddr ) ;
int shmctl ( int shmid , int cmd , /*struct shmid_ds*/ void * buf ) ;
# endif // __ANDROID__ && !defined(USE_THREADS)
2015-11-29 10:30:52 +01:00
# endif // HELPERS_H