8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 20:43:03 +01:00

Reworked Alex's solution for modern compilers (GCC 5/6)

This commit is contained in:
Dmitry Yemanov 2019-01-16 12:14:52 +03:00
parent c2de91fa38
commit 60ed79f6b0

View File

@ -2820,63 +2820,62 @@ static void gen_request(const gpre_req* request)
printa(0, "static %sshort\n isc_%dl = %d;", printa(0, "static %sshort\n isc_%dl = %d;",
(request->req_flags & REQ_extend_dpb) ? "" : CONST_STR, (request->req_flags & REQ_extend_dpb) ? "" : CONST_STR,
request->req_ident, request->req_length); request->req_ident, request->req_length);
printa(0, "static %sunsigned char\n isc_%d [] = {", CONST_STR, request->req_ident);
const TEXT* string_type = "blr"; const TEXT* string_type = "blr";
if (gpreGlob.sw_raw) bool is_blr = true;
{
gen_raw(request->req_blr, request->req_length);
switch (request->req_type) switch (request->req_type)
{ {
case REQ_create_database: case REQ_create_database:
case REQ_ready: case REQ_ready:
string_type = "dpb"; string_type = "dpb";
is_blr = false;
break; break;
case REQ_ddl: case REQ_ddl:
string_type = "dyn"; string_type = "dyn";
break; is_blr = false;
case REQ_slice:
string_type = "sdl";
break; break;
default: case REQ_slice:
string_type = "blr"; string_type = "sdl";
is_blr = false;
break;
} }
if (is_blr)
printa(0, "static %sunsigned char\n isc_%d [] = {", CONST_STR, request->req_ident);
else
printa(0, "static %schar\n isc_%d [] = {", CONST_STR, request->req_ident);
if (gpreGlob.sw_raw)
{
gen_raw(request->req_blr, request->req_length);
} }
else else
switch (request->req_type) switch (request->req_type)
{ {
case REQ_create_database: case REQ_create_database:
case REQ_ready: case REQ_ready:
string_type = "dpb";
if (PRETTY_print_cdb(request->req_blr, gen_blr, 0, 0)) if (PRETTY_print_cdb(request->req_blr, gen_blr, 0, 0))
{
CPR_error("internal error during parameter generation"); CPR_error("internal error during parameter generation");
}
break; break;
case REQ_ddl: case REQ_ddl:
string_type = "dyn";
if (PRETTY_print_dyn(request->req_blr, gen_blr, 0, 0)) if (PRETTY_print_dyn(request->req_blr, gen_blr, 0, 0))
{
CPR_error("internal error during dynamic DDL generation"); CPR_error("internal error during dynamic DDL generation");
}
break; break;
case REQ_slice: case REQ_slice:
string_type = "sdl";
if (PRETTY_print_sdl(request->req_blr, gen_blr, 0, 0)) if (PRETTY_print_sdl(request->req_blr, gen_blr, 0, 0))
{
CPR_error("internal error during SDL generation"); CPR_error("internal error during SDL generation");
}
break; break;
default: default:
string_type = "blr";
if (fb_print_blr(request->req_blr, request->req_length, gen_blr, 0, 0)) if (fb_print_blr(request->req_blr, request->req_length, gen_blr, 0, 0))
CPR_error("internal error during BLR generation"); CPR_error("internal error during BLR generation");
} }
printa(INDENT, "};\t/* end of %s string for request isc_%d */\n", printa(INDENT, "};\t/* end of %s string for request isc_%d */\n",
string_type, request->req_ident); string_type, request->req_ident);
} }
@ -3827,7 +3826,7 @@ static void make_ready(const gpre_dbb* db,
// generate the attach database itself // generate the attach database itself
const TEXT* dpb_size_ptr = "0"; const TEXT* dpb_size_ptr = "(short) 0";
const TEXT* dpb_ptr = "(char*) 0"; const TEXT* dpb_ptr = "(char*) 0";
align(column); align(column);