8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-24 06:03:02 +01:00

Fixed the bug in the binary search algorithm.

This commit is contained in:
dimitr 2008-03-17 17:59:37 +00:00
parent 36eb7f12fc
commit c8135d7dc2

View File

@ -2298,8 +2298,8 @@ void API_ROUTINE fb_sqlstate(char* sqlstate, const ISC_STATUS* status_vector)
// implement a binary search for array gds__sql_state[]
int first = 0;
int last = FB_NELEM(gds__sql_states);
while (first < last)
int last = FB_NELEM(gds__sql_states) - 1;
while (first <= last)
{
const int mid = (first + last) / 2;
const SLONG new_code = gds__sql_states[mid].gds_code;