Skip to content
Extraits de code Groupes Projets
Sélectionner une révision Git
  • ab18a046b3061ec9a2d6c3987f2e345ee1a82785
  • master par défaut
  • script
  • new-devel
  • devel
  • timingView-edit
  • fix-mpv
7 résultats

CRTPSubDocument.hh

Blame
  • common.h 1,15 Kio
    #pragma once
    
    #include <common/macro.h>
    #include <unistd.h>
    #include <stdint.h>
    
    #define not_implemented() __not_implemented(__func__,__FILE__,__LINE__)
    extern void __not_implemented(const char *func, char *file, int line);
    
    #define UNUSED(...) __unused((void *) __VA_ARGS__)
    void __unused(void *, ...);
    
    long get_mtime(const char *path);
    
    void *safe_malloc(size_t size);
    
    int is_utf8(const char *string);
    
    /* Read `bytes` as the big endian representation of a 32-bit unsigned integer.
       `n` is the number of bytes in `bytes`
       Returns 0 if n is 0.
       Restriction: n <= 4 */
    uint32_t be_uint32_t(const uint8_t bytes[], size_t n);
    
    /* Same as `be_uint32_t` but for 64-bit unsigned integers.
       Restriction: n <= 8 */
    uint64_t be_uint64_t(const uint8_t bytes[], size_t n);
    
    /* Trim the string `str` of the char `c` from the right and the left.
       The string may not be null terminated.
       Returns a pointer to the the trimmed string
       Restrictions: the len of the string must be `len`. */
    char *trim(char *str, size_t len, char c);
    
    /* Get a line from stdin safely. */
    int get_stdin_line(const char *prompt, char *buf, size_t len);
    
    int read_self_exe(char *path, size_t len);