From 231b4bd5d6ccad777c04b594ffb3aad0290ad52c Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Sat, 27 Jan 2007 02:55:55 +0000 Subject: [PATCH] *** empty log message *** --- ase/awk/jni.c | 11 +---------- ase/utl/printf.c | 29 ++++++++++++++++++++++++++++- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/ase/awk/jni.c b/ase/awk/jni.c index 1034fcdc..12d9bd6d 100644 --- a/ase/awk/jni.c +++ b/ase/awk/jni.c @@ -1,5 +1,5 @@ /* - * $Id: jni.c,v 1.56 2007-01-26 16:15:54 bacon Exp $ + * $Id: jni.c,v 1.57 2007-01-27 02:55:55 bacon Exp $ */ #include @@ -129,16 +129,7 @@ static int awk_sprintf ( va_list ap; va_start (ap, fmt); -#if defined(_WIN32) - n = _vsntprintf (buf, len, fmt, ap); - if (n < 0 || (ase_size_t)n >= len) - { - if (len > 0) buf[len-1] = ASE_T('\0'); - n = -1; - } -#else n = ase_vsprintf (buf, len, fmt, ap); -#endif va_end (ap); return n; } diff --git a/ase/utl/printf.c b/ase/utl/printf.c index 22c07880..7120695c 100644 --- a/ase/utl/printf.c +++ b/ase/utl/printf.c @@ -1,5 +1,5 @@ /* - * $Id: printf.c,v 1.5 2007-01-26 16:15:54 bacon Exp $ + * $Id: printf.c,v 1.6 2007-01-27 02:55:55 bacon Exp $ */ #include @@ -16,6 +16,33 @@ #define ase_vprintf _vtprintf #define ase_fprintf _ftprintf #define ase_vfprintf _vftprintf + + +int ase_vsprintf (ase_char_t* buf, size_t size, const ase_char_t* fmt, va_list ap) +{ + int n; + + n = _vsntprintf (buf, size, fmt, ap); + if (n < 0 || (size_t)n >= size) + { + if (size > 0) buf[size-1] = ASE_T('\0'); + n = -1; + } + + return n; +} + +int ase_sprintf (ase_char_t* buf, size_t size, const ase_char_t* fmt, ...) +{ + int n; + va_list ap; + + va_start (ap, fmt); + n = ase_vsprintf (buf, size, fmt, ap); + va_end (ap); + return n; +} + #else #if defined(ASE_CHAR_IS_MCHAR)