mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-24 03:23:03 +01:00
Implement vprintf routine in Firebird::string class
This commit is contained in:
parent
6e12599ebf
commit
71c2c14bb9
@ -363,6 +363,13 @@ extern "C" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AbstractString::printf(const char* format,...) {
|
void AbstractString::printf(const char* format,...) {
|
||||||
|
va_list params;
|
||||||
|
va_start(params, format);
|
||||||
|
vprintf(format, params);
|
||||||
|
va_end(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AbstractString::vprintf(const char* format, va_list params) {
|
||||||
#ifndef HAVE_VSNPRINTF
|
#ifndef HAVE_VSNPRINTF
|
||||||
#error NS: I'm lazy to implement version of this routine based on plain vsprintf.
|
#error NS: I'm lazy to implement version of this routine based on plain vsprintf.
|
||||||
#error Please find an implementation of vsnprintf function for your platform.
|
#error Please find an implementation of vsnprintf function for your platform.
|
||||||
@ -371,8 +378,6 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
enum {tempsize = 256};
|
enum {tempsize = 256};
|
||||||
char temp[tempsize];
|
char temp[tempsize];
|
||||||
va_list params;
|
|
||||||
va_start(params, format);
|
|
||||||
int l = VSNPRINTF(temp, tempsize, format, params);
|
int l = VSNPRINTF(temp, tempsize, format, params);
|
||||||
if (l < 0) {
|
if (l < 0) {
|
||||||
size_type n = sizeof(temp);
|
size_type n = sizeof(temp);
|
||||||
@ -399,7 +404,6 @@ extern "C" {
|
|||||||
resize(l);
|
resize(l);
|
||||||
VSNPRINTF(begin(), l + 1, format, params);
|
VSNPRINTF(begin(), l + 1, format, params);
|
||||||
}
|
}
|
||||||
va_end(params);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int PathNameComparator::compare(AbstractString::const_pointer s1, AbstractString::const_pointer s2, AbstractString::size_type n) {
|
int PathNameComparator::compare(AbstractString::const_pointer s1, AbstractString::const_pointer s2, AbstractString::size_type n) {
|
||||||
|
@ -347,6 +347,7 @@ namespace Firebird
|
|||||||
baseTrim(TrimBoth, ToTrim);
|
baseTrim(TrimBoth, ToTrim);
|
||||||
}
|
}
|
||||||
bool LoadFromFile(FILE *file);
|
bool LoadFromFile(FILE *file);
|
||||||
|
void vprintf(const char* Format, va_list params);
|
||||||
void printf(const char* Format, ...);
|
void printf(const char* Format, ...);
|
||||||
inline ~AbstractString() {
|
inline ~AbstractString() {
|
||||||
if (stringBuffer != inlineBuffer)
|
if (stringBuffer != inlineBuffer)
|
||||||
|
Loading…
Reference in New Issue
Block a user