safec 3.9
Safe C Library - ISO TR24731 Bounds Checking Interface
Loading...
Searching...
No Matches
vsnprintf_s.c File Reference
#include "safe_str_lib.h"
#include <stdbool.h>
#include <stdint.h>
#include <float.h>
#include <math.h>
+ Include dependency graph for vsnprintf_s.c:

Macros

#define PRINTF_NTOA_BUFFER_SIZE   32U
 
#define PRINTF_FTOA_BUFFER_SIZE   32U
 
#define PRINTF_SUPPORT_FLOAT
 
#define PRINTF_SUPPORT_EXPONENTIAL
 
#define PRINTF_DEFAULT_FLOAT_PRECISION   6U
 
#define PRINTF_MAX_FLOAT   1e9
 
#define PRINTF_SUPPORT_PTRDIFF_T
 
#define FLAGS_ZEROPAD   (1U << 0U)
 
#define FLAGS_LEFT   (1U << 1U)
 
#define FLAGS_PLUS   (1U << 2U)
 
#define FLAGS_SPACE   (1U << 3U)
 
#define FLAGS_HASH   (1U << 4U)
 
#define FLAGS_UPPERCASE   (1U << 5U)
 
#define FLAGS_CHAR   (1U << 6U)
 
#define FLAGS_SHORT   (1U << 7U)
 
#define FLAGS_LONG   (1U << 8U)
 
#define FLAGS_LONG_LONG   (1U << 9U)
 
#define FLAGS_PRECISION   (1U << 10U)
 
#define FLAGS_ADAPT_EXP   (1U << 11U)
 
#define FLAGS_LONG_DOUBLE   (1U << 12U)
 

Functions

static unsigned int safec_strnlen_s (const char *str, size_t maxsize)
 
static bool safec_is_digit (char ch)
 
static unsigned int safec_atoi (const char **str)
 
static size_t safec_out_rev (out_fct_type out, char *buffer, size_t idx, size_t maxlen, const char *buf, size_t len, unsigned int width, unsigned int flags)
 
static size_t safec_ntoa_format (out_fct_type out, const char *funcname, char *buffer, size_t idx, size_t maxlen, char *buf, size_t len, bool negative, unsigned int base, unsigned int prec, unsigned int width, unsigned int flags)
 
static size_t safec_ntoa_long (out_fct_type out, const char *funcname, char *buffer, size_t idx, size_t maxlen, unsigned long value, bool negative, unsigned long base, unsigned int prec, unsigned int width, unsigned int flags)
 
static size_t safec_etoa (out_fct_type out, const char *funcname, char *buffer, size_t idx, size_t maxlen, double value, unsigned int prec, unsigned int width, unsigned int flags)
 
static size_t safec_ftoa (out_fct_type out, const char *funcname, char *buffer, size_t idx, size_t maxlen, double value, unsigned int prec, unsigned int width, unsigned int flags)
 
static size_t safec_atoa (out_fct_type out, const char *funcname, char *buffer, size_t idx, size_t maxlen, double value, unsigned int prec, unsigned int width, unsigned int flags, const char *format)
 
int safec_vsnprintf_s (out_fct_type out, const char *funcname, char *buffer, const size_t bufsize, const char *format, va_list va)
 
int vsnprintf_s (char *restrict dest, rsize_t dmax, const char *restrict fmt, va_list ap)
 

Macro Definition Documentation

◆ PRINTF_NTOA_BUFFER_SIZE

#define PRINTF_NTOA_BUFFER_SIZE   32U

◆ PRINTF_FTOA_BUFFER_SIZE

#define PRINTF_FTOA_BUFFER_SIZE   32U

◆ PRINTF_SUPPORT_FLOAT

#define PRINTF_SUPPORT_FLOAT

◆ PRINTF_SUPPORT_EXPONENTIAL

#define PRINTF_SUPPORT_EXPONENTIAL

◆ PRINTF_DEFAULT_FLOAT_PRECISION

#define PRINTF_DEFAULT_FLOAT_PRECISION   6U

◆ PRINTF_MAX_FLOAT

#define PRINTF_MAX_FLOAT   1e9

◆ PRINTF_SUPPORT_PTRDIFF_T

#define PRINTF_SUPPORT_PTRDIFF_T

◆ FLAGS_ZEROPAD

#define FLAGS_ZEROPAD   (1U << 0U)

◆ FLAGS_LEFT

#define FLAGS_LEFT   (1U << 1U)

◆ FLAGS_PLUS

#define FLAGS_PLUS   (1U << 2U)

◆ FLAGS_SPACE

#define FLAGS_SPACE   (1U << 3U)

◆ FLAGS_HASH

#define FLAGS_HASH   (1U << 4U)

◆ FLAGS_UPPERCASE

#define FLAGS_UPPERCASE   (1U << 5U)

◆ FLAGS_CHAR

#define FLAGS_CHAR   (1U << 6U)

◆ FLAGS_SHORT

#define FLAGS_SHORT   (1U << 7U)

◆ FLAGS_LONG

#define FLAGS_LONG   (1U << 8U)

◆ FLAGS_LONG_LONG

#define FLAGS_LONG_LONG   (1U << 9U)

◆ FLAGS_PRECISION

#define FLAGS_PRECISION   (1U << 10U)

◆ FLAGS_ADAPT_EXP

#define FLAGS_ADAPT_EXP   (1U << 11U)

◆ FLAGS_LONG_DOUBLE

#define FLAGS_LONG_DOUBLE   (1U << 12U)

Function Documentation

◆ safec_strnlen_s()

static unsigned int safec_strnlen_s ( const char * str,
size_t maxsize )
inlinestatic

◆ safec_is_digit()

static bool safec_is_digit ( char ch)
inlinestatic

◆ safec_atoi()

static unsigned int safec_atoi ( const char ** str)
static

◆ safec_out_rev()

static size_t safec_out_rev ( out_fct_type out,
char * buffer,
size_t idx,
size_t maxlen,
const char * buf,
size_t len,
unsigned int width,
unsigned int flags )
static

◆ safec_ntoa_format()

static size_t safec_ntoa_format ( out_fct_type out,
const char * funcname,
char * buffer,
size_t idx,
size_t maxlen,
char * buf,
size_t len,
bool negative,
unsigned int base,
unsigned int prec,
unsigned int width,
unsigned int flags )
static

◆ safec_ntoa_long()

static size_t safec_ntoa_long ( out_fct_type out,
const char * funcname,
char * buffer,
size_t idx,
size_t maxlen,
unsigned long value,
bool negative,
unsigned long base,
unsigned int prec,
unsigned int width,
unsigned int flags )
static

◆ safec_etoa()

static size_t safec_etoa ( out_fct_type out,
const char * funcname,
char * buffer,
size_t idx,
size_t maxlen,
double value,
unsigned int prec,
unsigned int width,
unsigned int flags )
static

◆ safec_ftoa()

static size_t safec_ftoa ( out_fct_type out,
const char * funcname,
char * buffer,
size_t idx,
size_t maxlen,
double value,
unsigned int prec,
unsigned int width,
unsigned int flags )
static

◆ safec_atoa()

static size_t safec_atoa ( out_fct_type out,
const char * funcname,
char * buffer,
size_t idx,
size_t maxlen,
double value,
unsigned int prec,
unsigned int width,
unsigned int flags,
const char * format )
inlinestatic

◆ safec_vsnprintf_s()

int safec_vsnprintf_s ( out_fct_type out,
const char * funcname,
char * buffer,
const size_t bufsize,
const char * format,
va_list va )

◆ vsnprintf_s()

int vsnprintf_s ( char *restrict dest,
rsize_t dmax,
const char *restrict fmt,
va_list ap )