8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-02-02 09:20:39 +01:00
This commit is contained in:
asfernandes 2009-02-15 18:05:38 +00:00
parent 499f0b5a8f
commit 517f426392
8 changed files with 21 additions and 11 deletions

View File

@ -76,7 +76,7 @@ u_printf_pad_and_justify(void *context,
return written;
}
U_CAPI int32_t U_EXPORT2
U_CAPI int32_t U_EXPORT2
u_fprintf( UFILE *f,
const char *patternSpecification,
... )
@ -91,7 +91,7 @@ u_fprintf( UFILE *f,
return count;
}
U_CAPI int32_t U_EXPORT2
U_CAPI int32_t U_EXPORT2
u_fprintf_u( UFILE *f,
const UChar *patternSpecification,
... )

View File

@ -835,7 +835,7 @@ SINT64 query_performance_frequency()
void exactNumericToStr(SINT64 value, int scale, Firebird::string& target, bool append)
{
if (!value)
if (value == 0)
{
if (append)
target.append("0", 1);
@ -848,30 +848,39 @@ void exactNumericToStr(SINT64 value, int scale, Firebird::string& target, bool a
const int MAX_BUFFER = 50;
if (scale < -MAX_SCALE || scale > MAX_SCALE)
{
fb_assert(false);
return; // throw exception here?
}
const bool neg = value < 0;
const bool dot = scale < 0; // Need the decimal separator or not?
char buffer[MAX_BUFFER];
int iter = MAX_BUFFER;
buffer[--iter] = 0;
buffer[--iter] = '\0';
if (scale > 0)
{
while (scale-- > 0)
buffer[--iter] = '0';
}
bool dot_used = false;
FB_UINT64 uval = neg ? FB_UINT64(-(value + 1)) + 1 : value; // avoid problems with MIN_SINT64
while (uval)
while (uval != 0)
{
buffer[--iter] = static_cast<char>(uval % 10) + '0';
uval /= 10;
if (dot && !++scale)
{
buffer[--iter] = '.';
dot_used = true;
}
}
if (dot)
{
// if scale > 0 we have N.M
@ -888,10 +897,12 @@ void exactNumericToStr(SINT64 value, int scale, Firebird::string& target, bool a
else if (!scale)
buffer[--iter] = '0';
}
if (neg)
buffer[--iter] = '-';
const size_t len = MAX_BUFFER - iter - 1;
if (append)
target.append(buffer + iter, len);
else

View File

@ -289,8 +289,8 @@
#define isc_action_svc_trace_suspend 24 // Suspend trace session
#define isc_action_svc_trace_resume 25 // Resume trace session
#define isc_action_svc_trace_list 26 // List existing sessions
#define isc_action_svc_set_mapping 27 // Set auto admins mapping in sec. DB
#define isc_action_svc_drop_mapping 28 // Drop auto admins mapping in sec. DB
#define isc_action_svc_set_mapping 27 // Set auto admins mapping in security database
#define isc_action_svc_drop_mapping 28 // Drop auto admins mapping in security database
#define isc_action_svc_last 29 // keep it last !
/*****************************

View File

@ -2634,7 +2634,6 @@ static jrd_nod* convertNeqAllToNotAny(thread_db* tdbb, CompilerScratch* csb, jrd
tdbb, innerRse->rse_count + rse_delta + 2);
*newInnerRse = *innerRse;
newInnerRse->rse_count = innerRse->rse_count;
for (USHORT i = 0; i < innerRse->rse_count; ++i)
newInnerRse->rse_relation[i] = innerRse->rse_relation[i];

View File

@ -373,7 +373,7 @@ void callRemoteServiceManager(ISC_STATUS* status,
}
fb_assert((size_t)(spb - spb_buffer) <= sizeof(spb_buffer));
if (isc_service_start(status, &handle, 0, static_cast<USHORT>(spb - spb_buffer), spb_buffer))
if (isc_service_start(status, &handle, 0, static_cast<USHORT>(spb - spb_buffer), spb_buffer) != 0)
{
return;
}

View File

@ -628,6 +628,7 @@ static bool get_switches(Firebird::UtilSvc::ArgvType& argv,
{
Firebird::string val(string);
val.upper();
if (val == "SET")
{
user_data->operation = MAP_SET_OPER;

View File

@ -135,7 +135,7 @@ SSHORT SECURITY_exec_line(ISC_STATUS* isc_status,
sql.printf("ALTER ROLE RDB$ADMIN %s AUTO ADMIN MAPPING",
io_user_data->operation == MAP_SET_OPER ? "SET" : "DROP");
isc_dsql_execute_immediate(isc_status, &DB, &trans, sql.length(), sql.c_str(), 1, NULL);
if (isc_status[1])
if (isc_status[1] != 0)
{
ret = GsecMsg97;
}

View File

@ -578,7 +578,6 @@ void int_to_str(SINT64 value, int scale, string& str)
str.insert(str.length() - scale, ".");
}
}
} // namespace