Strophe: snprintf.c File Reference

Strophe 0.9 XMPP client library

Macros | Functions
snprintf.c File Reference

A snprintf implementation. More...

## Macros
#define | VA_LOCAL_DECL va_list ap
#define | VA_START(f) va_start(ap, f)
#define | VA_END va_end(ap)
#define | LDOUBLE double
#define | DP_S_DEFAULT 0
#define | DP_S_FLAGS 1
#define | DP_S_MIN 2
#define | DP_S_DOT 3
#define | DP_S_MAX 4
#define | DP_S_MOD 5
#define | DP_S_CONV 6
#define | DP_S_DONE 7
#define | DP_F_MINUS (1 << 0)
#define | DP_F_PLUS (1 << 1)
#define | DP_F_SPACE (1 << 2)
#define | DP_F_NUM (1 << 3)
#define | DP_F_ZERO (1 << 4)
#define | DP_F_UP (1 << 5)
#define | DP_F_UNSIGNED (1 << 6)
#define | DP_C_SHORT 1
#define | DP_C_LONG 2
#define | DP_C_LDOUBLE 3
#define | char_to_int(p) (p - '0')
#define | MAX(p, q) ((p >= q) ? p : q)
#define | MIN(p, q) ((p <= q) ? p : q)

## Functions
static int | dopr (char *buffer, size_t maxlen, const char *format, va_list args)
static int | fmtstr (char *buffer, size_t *currlen, size_t maxlen, char *value, int flags, int min, int max)
static int | fmtint (char *buffer, size_t *currlen, size_t maxlen, long value, int base, int min, int max, int flags)
static int | fmtfp (char *buffer, size_t *currlen, size_t maxlen, LDOUBLE fvalue, int min, int max, int flags)
static int | dopr_outch (char *buffer, size_t *currlen, size_t maxlen, char c)
static LDOUBLE | abs_val (LDOUBLE value)
static LDOUBLE | _snp_pow10 (int exp)
static long | _snp_round (LDOUBLE value)
int | xmpp_vsnprintf (char *str, size_t count, const char *fmt, va_list args)
int | xmpp_snprintf (char *str, size_t count, const char *fmt,...)

## Detailed Description

A snprintf implementation.

## Macro Definition Documentation

## ◆ VA_LOCAL_DECL

#define VA_LOCAL_DECL va_list ap

## ◆ VA_START

#define VA_START | ( |  | f | ) | va_start(ap, f)

## ◆ VA_END

#define VA_END va_end(ap)

## ◆ LDOUBLE

#define LDOUBLE double

## ◆ DP_S_DEFAULT

#define DP_S_DEFAULT 0

## ◆ DP_S_FLAGS

#define DP_S_FLAGS 1

## ◆ DP_S_MIN

#define DP_S_MIN 2

## ◆ DP_S_DOT

#define DP_S_DOT 3

## ◆ DP_S_MAX

#define DP_S_MAX 4

## ◆ DP_S_MOD

#define DP_S_MOD 5

## ◆ DP_S_CONV

#define DP_S_CONV 6

## ◆ DP_S_DONE

#define DP_S_DONE 7

## ◆ DP_F_MINUS

#define DP_F_MINUS (1 << 0)

## ◆ DP_F_PLUS

#define DP_F_PLUS (1 << 1)

## ◆ DP_F_SPACE

#define DP_F_SPACE (1 << 2)

## ◆ DP_F_NUM

#define DP_F_NUM (1 << 3)

## ◆ DP_F_ZERO

#define DP_F_ZERO (1 << 4)

## ◆ DP_F_UP

#define DP_F_UP (1 << 5)

## ◆ DP_F_UNSIGNED

#define DP_F_UNSIGNED (1 << 6)

## ◆ DP_C_SHORT

#define DP_C_SHORT 1

## ◆ DP_C_LONG

#define DP_C_LONG 2

## ◆ DP_C_LDOUBLE

#define DP_C_LDOUBLE 3

## ◆ char_to_int

#define char_to_int | ( |  | p | ) | (p - '0')

## ◆ MAX

#define MAX | ( |  | p,
|  |  | q
| ) |  | ((p >= q) ? p : q)

## ◆ MIN

#define MIN | ( |  | p,
|  |  | q
| ) |  | ((p <= q) ? p : q)

## Function Documentation

## ◆ dopr()

static int dopr | ( | char * | buffer,
|  | size_t | maxlen,
|  | const char * | format,
|  | va_list | args
| ) |  |
| static

## ◆ fmtstr()

static int fmtstr | ( | char * | buffer,
|  | size_t * | currlen,
|  | size_t | maxlen,
|  | char * | value,
|  | int | flags,
|  | int | min,
|  | int | max
| ) |  |
| static

## ◆ fmtint()

static int fmtint | ( | char * | buffer,
|  | size_t * | currlen,
|  | size_t | maxlen,
|  | long | value,
|  | int | base,
|  | int | min,
|  | int | max,
|  | int | flags
| ) |  |
| static

## ◆ fmtfp()

static int fmtfp | ( | char * | buffer,
|  | size_t * | currlen,
|  | size_t | maxlen,
|  | LDOUBLE | fvalue,
|  | int | min,
|  | int | max,
|  | int | flags
| ) |  |
| static

## ◆ dopr_outch()

static int dopr_outch | ( | char * | buffer,
|  | size_t * | currlen,
|  | size_t | maxlen,
|  | char | c
| ) |  |
| static

## ◆ abs_val()

static LDOUBLE abs_val | ( | LDOUBLE | value | ) |
| static

## ◆ _snp_pow10()

static LDOUBLE _snp_pow10 | ( | int | exp | ) |
| static

## ◆ _snp_round()

static long _snp_round | ( | LDOUBLE | value | ) |
| static

## ◆ xmpp_vsnprintf()

int xmpp_vsnprintf | ( | char * | str,
|  | size_t | count,
|  | const char * | fmt,
|  | va_list | args
| ) |  |

## ◆ xmpp_snprintf()

int xmpp_snprintf | ( | char * | str,
|  | size_t | count,
|  | const char * | fmt,
|  |  | ...
| ) |  |