2014-11-19 00:25:21 +08:00
|
|
|
|
#pragma once
|
|
|
|
|
#include "acl_cpp/acl_cpp_define.hpp"
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
|
|
namespace acl {
|
|
|
|
|
|
2015-01-04 22:51:01 +08:00
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD> C snprintf API <EFBFBD><EFBFBD>װ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD>֤<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD>Ϊ '\0'
|
|
|
|
|
* @param buf {char*} <EFBFBD>洢<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param size {size_t} buf <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param fmt {const char*} <EFBFBD><EFBFBD><EFBFBD>θ<EFBFBD>ʽ<EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȹ<EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD>ʿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD>ȣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:
|
|
|
|
|
* 1) UNIX/LINUX ƽ̨<EFBFBD>·<EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>Ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȳ<EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|
|
|
|
* >= size<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫע<EFBFBD><EFBFBD><EFBFBD>÷<EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD>ĺ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> WIN32 <EFBFBD>µIJ<EFBFBD>ͬ
|
|
|
|
|
* 2) WIN32 ƽ̨<EFBFBD>·<EFBFBD><EFBFBD><EFBFBD> -1
|
|
|
|
|
*/
|
|
|
|
|
ACL_CPP_API int ACL_CPP_PRINTF(3, 4) safe_snprintf(char *buf, size_t size,
|
|
|
|
|
const char *fmt, ...);
|
2014-11-19 00:25:21 +08:00
|
|
|
|
|
2015-01-04 22:51:01 +08:00
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD> C snprintf API <EFBFBD><EFBFBD>װ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD>֤<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD>Ϊ '\0'
|
|
|
|
|
* @param buf {char*} <EFBFBD>洢<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param size {size_t} buf <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param fmt {const char*} <EFBFBD><EFBFBD><EFBFBD>θ<EFBFBD>ʽ<EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param ap {va_list} <EFBFBD><EFBFBD><EFBFBD>α<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȹ<EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD>ʿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD>ȣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:
|
|
|
|
|
* 1) UNIX/LINUX ƽ̨<EFBFBD>·<EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>Ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȳ<EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|
|
|
|
* >= size<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫע<EFBFBD><EFBFBD><EFBFBD>÷<EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD>ĺ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> WIN32 <EFBFBD>µIJ<EFBFBD>ͬ
|
|
|
|
|
* 2) WIN32 ƽ̨<EFBFBD>·<EFBFBD><EFBFBD><EFBFBD> -1
|
|
|
|
|
*/
|
|
|
|
|
ACL_CPP_API int safe_vsnprintf(char *buf, size_t size, const char *fmt, va_list ap);
|
2014-11-19 00:25:21 +08:00
|
|
|
|
|
2015-01-04 22:51:01 +08:00
|
|
|
|
} // namespace acl
|