mirror of
https://github.com/nzp-team/glquake.git
synced 2024-11-22 12:01:11 +00:00
add some useful things
This commit is contained in:
parent
bdc677fc97
commit
dc2cbdf1be
2 changed files with 21 additions and 0 deletions
|
@ -132,6 +132,25 @@ void InsertLinkAfter (link_t *l, link_t *after)
|
|||
============================================================================
|
||||
*/
|
||||
|
||||
#define snprintf_func snprintf
|
||||
#define vsnprintf_func vsnprintf
|
||||
|
||||
int q_vsnprintf(char *str, size_t size, const char *format, va_list args)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = vsnprintf_func (str, size, format, args);
|
||||
|
||||
if (ret < 0)
|
||||
ret = (int)size;
|
||||
if (size == 0) /* no buffer */
|
||||
return ret;
|
||||
if ((size_t)ret >= size)
|
||||
str[size - 1] = '\0';
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int q_snprintf (char *str, size_t size, const char *format, ...)
|
||||
{
|
||||
int ret;
|
||||
|
|
|
@ -155,6 +155,8 @@ int Q_strcasecmp (char *s1, char *s2);
|
|||
int Q_strncasecmp (char *s1, char *s2, int n);
|
||||
int Q_atoi (char *str);
|
||||
float Q_atof (char *str);
|
||||
int q_snprintf (char *str, size_t size, const char *format, ...);
|
||||
int q_vsnprintf(char *str, size_t size, const char *format, va_list args);
|
||||
|
||||
//============================================================================
|
||||
|
||||
|
|
Loading…
Reference in a new issue