From 21b23ef28d19ef93cb39f227e48429149ef11473 Mon Sep 17 00:00:00 2001 From: asfernandes Date: Fri, 28 Jun 2013 02:03:10 +0000 Subject: [PATCH] Misc. --- examples/interfaces/01.create.cpp | 2 +- examples/interfaces/02.update.cpp | 12 +++---- examples/interfaces/03.select.cpp | 2 +- examples/interfaces/04.print_table.cpp | 12 +++---- .../SecureRemotePassword/client/SrpClient.cpp | 3 +- src/extlib/fbudf/fbudf.cpp | 2 +- src/isql/extract.epp | 2 +- src/isql/show.epp | 6 ++-- src/msgs/facilities2.sql | 2 +- src/remote/client/interface.cpp | 34 ++++++++++++------- src/remote/server/server.cpp | 14 +++++--- 11 files changed, 53 insertions(+), 38 deletions(-) diff --git a/examples/interfaces/01.create.cpp b/examples/interfaces/01.create.cpp index f642a9fc51..ec5504352d 100644 --- a/examples/interfaces/01.create.cpp +++ b/examples/interfaces/01.create.cpp @@ -135,7 +135,7 @@ int main() check(st, "detach"); att = NULL; } - catch(const char* text) + catch (const char* text) { // handle error rc = 1; diff --git a/examples/interfaces/02.update.cpp b/examples/interfaces/02.update.cpp index 341936b8db..6f6e15d3bc 100644 --- a/examples/interfaces/02.update.cpp +++ b/examples/interfaces/02.update.cpp @@ -46,8 +46,8 @@ using namespace Firebird; static IMaster* master = fb_get_master_interface(); -int get_input (char* , double*); -static const char *Dept_data[] = +int get_input(char*, double*); +static const char* Dept_data[] = {"622", "100", "116", "900", 0}; static double Percent_data[] = {0.05, 1.00, 0.075, 0.10, 0}; @@ -82,7 +82,7 @@ int main() // Interface makes it possible to change format of data or define it yourself IMetadataBuilder* builder = NULL; - const char *updstr = + const char* updstr = "UPDATE department SET budget = ? * budget + budget WHERE dept_no = ?"; try @@ -133,14 +133,14 @@ int main() // locations of parameters in input message char* dept_no = &buffer[meta->getOffset(st, 1)]; check(st, "getOffset"); - double* percent_inc = (double*)&buffer[meta->getOffset(st, 0)]; + double* percent_inc = (double*) &buffer[meta->getOffset(st, 0)]; check(st, "getOffset"); // null IDs (set to NOT NULL) short* flag = (short*)&buffer[meta->getNullOffset(st, 0)]; check(st, "getNullOffset"); *flag = 0; - flag = (short*)&buffer[meta->getNullOffset(st, 1)]; + flag = (short*) &buffer[meta->getNullOffset(st, 1)]; check(st, "getNullOffset"); *flag = 0; @@ -192,7 +192,7 @@ int main() check(st, "detach"); att = NULL; } - catch(const char* text) + catch (const char* text) { // handle error rc = 1; diff --git a/examples/interfaces/03.select.cpp b/examples/interfaces/03.select.cpp index e2601645a4..3bccc6da6b 100644 --- a/examples/interfaces/03.select.cpp +++ b/examples/interfaces/03.select.cpp @@ -190,7 +190,7 @@ int main() check(st, "detach"); att = NULL; } - catch(const char* text) + catch (const char* text) { // handle error rc = 1; diff --git a/examples/interfaces/04.print_table.cpp b/examples/interfaces/04.print_table.cpp index 1720e46ccf..c2c0f6c6a7 100644 --- a/examples/interfaces/04.print_table.cpp +++ b/examples/interfaces/04.print_table.cpp @@ -60,6 +60,7 @@ struct MyField int main() { int rc = 0; + char s[100]; setenv("ISC_USER", "sysdba", 0); setenv("ISC_PASSWORD", "masterkey", 0); @@ -112,7 +113,7 @@ int main() unsigned sub = meta->getSubType(st, j); check(st, "getSubType"); - switch(t) + switch (t) { case SQL_BLOB: if (sub != 1) @@ -127,7 +128,6 @@ int main() default: { - char s[100]; sprintf(s, "Unknown type %d for %s", t, meta->getField(st, j)); throw s; } @@ -183,7 +183,7 @@ int main() check(st, "detach"); att = NULL; } - catch(const char* text) + catch (const char* text) { rc = 1; @@ -229,7 +229,7 @@ void MyField::print(IStatus* st, IAttachment* att, ITransaction* tra, unsigned c // IBlob makes it possible to read/write BLOB data IBlob* blob = NULL; - switch(type) + switch (type) { // text fields case SQL_TEXT: @@ -257,7 +257,7 @@ void MyField::print(IStatus* st, IAttachment* att, ITransaction* tra, unsigned c try { // use attachment's method to access BLOB object - blob = att->openBlob(st, tra, (ISC_QUAD*)(buf + offset)); + blob = att->openBlob(st, tra, (ISC_QUAD*) (buf + offset)); check(st, "openBlob"); char segbuf[16]; @@ -279,7 +279,7 @@ void MyField::print(IStatus* st, IAttachment* att, ITransaction* tra, unsigned c blob = NULL; printf("\n"); } - catch(...) + catch (...) { if (blob) blob->release(); diff --git a/src/auth/SecureRemotePassword/client/SrpClient.cpp b/src/auth/SecureRemotePassword/client/SrpClient.cpp index 04ccf8439c..6eea93ef4d 100644 --- a/src/auth/SecureRemotePassword/client/SrpClient.cpp +++ b/src/auth/SecureRemotePassword/client/SrpClient.cpp @@ -64,7 +64,8 @@ int SrpClient::authenticate(IStatus* status, IClientBlock* cb) if (!client) { - HANDSHAKE_DEBUG(fprintf(stderr, "Cli: SRP phase1: login=%s password=%s\n", cb->getLogin(), cb->getPassword())); + HANDSHAKE_DEBUG(fprintf(stderr, "Cli: SRP phase1: login=%s password=%s\n", + cb->getLogin(), cb->getPassword())); if (!(cb->getLogin() && cb->getPassword())) { return AUTH_CONTINUE; diff --git a/src/extlib/fbudf/fbudf.cpp b/src/extlib/fbudf/fbudf.cpp index 263cedcb4b..a042daf641 100644 --- a/src/extlib/fbudf/fbudf.cpp +++ b/src/extlib/fbudf/fbudf.cpp @@ -507,7 +507,7 @@ FBUDF_API ISC_TIMESTAMP* addMonth(ISC_TIMESTAMP* v, const ISC_LONG& nmonths) } const int ly = times.tm_year + 1900; const bool leap = (ly % 4 == 0 && ly % 100 != 0) || ly % 400 == 0; - const int md[] = {31, leap ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; + const int md[] = {31, (leap ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; if (times.tm_mday > md[times.tm_mon]) times.tm_mday = md[times.tm_mon]; internal::encode_timestamp(×, v); diff --git a/src/isql/extract.epp b/src/isql/extract.epp index 7890ad910a..b026e1d81d 100644 --- a/src/isql/extract.epp +++ b/src/isql/extract.epp @@ -3174,7 +3174,7 @@ static void list_functions_ods12() } else isqlGlob.printf("%sALTER FUNCTION %s ", NEWLINE, FUN.RDB$FUNCTION_NAME); - + get_function_args_ods12(FUN.RDB$FUNCTION_NAME, FUN.RDB$RETURN_ARGUMENT); // Print the function body diff --git a/src/isql/show.epp b/src/isql/show.epp index d927de537d..731148f571 100644 --- a/src/isql/show.epp +++ b/src/isql/show.epp @@ -3356,7 +3356,7 @@ static processing_state show_functions(const SCHAR* funcname) } - if (i == 0 && private_flag || i == 1 && !private_flag) + if ((i == 0 && private_flag) || (i == 1 && !private_flag)) continue; // Strip trailing blanks @@ -3377,7 +3377,7 @@ static processing_state show_functions(const SCHAR* funcname) } first_dep = false; isqlGlob.printf("%s, %s", DEP.RDB$DEPENDED_ON_NAME, - Object_types[DEP.RDB$DEPENDED_ON_TYPE]); + Object_types[DEP.RDB$DEPENDED_ON_TYPE]); END_FOR ON_ERROR ISQL_errmsg (isc_status); @@ -3457,7 +3457,7 @@ static processing_state show_func(const SCHAR* funcname) fb_utils::exact_name(ARG.RDB$ARGUMENT_NAME); isqlGlob.printf("%-33s %s ", ARG.RDB$ARGUMENT_NAME, - (ARG.RDB$ARGUMENT_POSITION == FUN.RDB$RETURN_ARGUMENT ? "OUTPUT" : "INPUT")); + (ARG.RDB$ARGUMENT_POSITION == FUN.RDB$RETURN_ARGUMENT ? "OUTPUT" : "INPUT")); prm_mech_t mechanism = prm_mech_normal; bool prm_default_source_null = true; diff --git a/src/msgs/facilities2.sql b/src/msgs/facilities2.sql index c87da388a5..9e82ce0765 100644 --- a/src/msgs/facilities2.sql +++ b/src/msgs/facilities2.sql @@ -13,7 +13,7 @@ set bulk_insert INSERT INTO FACILITIES (LAST_CHANGE, FACILITY, FAC_CODE, MAX_NUM ('2012-02-18 20:00:00', 'SQLERR', 13, 1033) ('1996-11-07 13:38:42', 'SQLWARN', 14, 613) ('2006-09-10 03:04:31', 'JRD_BUGCHK', 15, 307) -('2009-12-21 04:00:05', 'ISQL', 17, 174) +('2013-06-27 23:00:00', 'ISQL', 17, 174) ('2010-07-10 10:50:30', 'GSEC', 18, 105) ('2012-05-25 19:59:42', 'GSTAT', 21, 56) ('2009-12-18 19:33:34', 'FBSVCMGR', 22, 57) diff --git a/src/remote/client/interface.cpp b/src/remote/client/interface.cpp index dcdf79983d..9878448589 100644 --- a/src/remote/client/interface.cpp +++ b/src/remote/client/interface.cpp @@ -6180,7 +6180,8 @@ static void authFillParametersBlock(ClntAuthBlock& cBlock, ClumpletWriter& dpb, { case Auth::AUTH_SUCCESS: case Auth::AUTH_MORE_DATA: - HANDSHAKE_DEBUG(fprintf(stderr, "Cli: authFillParametersBlock: plugin %s is OK\n", cBlock.plugins.name())); + HANDSHAKE_DEBUG(fprintf(stderr, "Cli: authFillParametersBlock: plugin %s is OK\n", + cBlock.plugins.name())); cleanDpb(dpb, tags); cBlock.extractDataFromPluginTo(dpb, tags, port->port_protocol); return; @@ -6189,12 +6190,15 @@ static void authFillParametersBlock(ClntAuthBlock& cBlock, ClumpletWriter& dpb, continue; case Auth::AUTH_FAILED: - HANDSHAKE_DEBUG(fprintf(stderr, "Cli: authFillParametersBlock: plugin %s FAILED\n", cBlock.plugins.name())); + HANDSHAKE_DEBUG(fprintf(stderr, "Cli: authFillParametersBlock: plugin %s FAILED\n", + cBlock.plugins.name())); (Arg::Gds(isc_login) << Arg::StatusVector(s.get())).raise(); break; // compiler silencer } } - HANDSHAKE_DEBUG(fprintf(stderr, "Cli: authFillParametersBlock: try next plugin, %s skipped\n", cBlock.plugins.name())); + + HANDSHAKE_DEBUG(fprintf(stderr, "Cli: authFillParametersBlock: try next plugin, %s skipped\n", + cBlock.plugins.name())); } } @@ -6252,8 +6256,9 @@ static void authReceiveResponse(ClntAuthBlock& cBlock, rem_port* port, Rdb* rdb, d = &packet->p_auth_cont.p_data; n = &packet->p_auth_cont.p_name; port->addServerKeys(&packet->p_auth_cont.p_keys); - HANDSHAKE_DEBUG(fprintf(stderr, "Cli: authReceiveResponse: ont_auth d=%d n=%d '%.*s' 0x%x\n", d->cstr_length, n->cstr_length, - n->cstr_length, n->cstr_address, n->cstr_address ? n->cstr_address[0] : 0)); + HANDSHAKE_DEBUG(fprintf(stderr, "Cli: authReceiveResponse: ont_auth d=%d n=%d '%.*s' 0x%x\n", + d->cstr_length, n->cstr_length, + n->cstr_length, n->cstr_address, n->cstr_address ? n->cstr_address[0] : 0)); break; case op_crypt: @@ -7505,13 +7510,15 @@ void ClntAuthBlock::extractDataFromPluginTo(Firebird::ClumpletWriter& dpb, } dpb.insertPath(tags->plugin_list, pluginList); firstTime = false; - HANDSHAKE_DEBUG(fprintf(stderr, "Cli: extractDataFromPluginTo: first time - added plugName & pluginList\n")); + HANDSHAKE_DEBUG(fprintf(stderr, + "Cli: extractDataFromPluginTo: first time - added plugName & pluginList\n")); } fb_assert(tags->specific_data); dpb.insertBytes(tags->specific_data, dataFromPlugin.begin(), dataFromPlugin.getCount()); - HANDSHAKE_DEBUG(fprintf(stderr, "Cli: extractDataFromPluginTo: Added %" SIZEFORMAT " bytes of spec data with tag %d\n", - dataFromPlugin.getCount(), tags->specific_data)); + HANDSHAKE_DEBUG(fprintf(stderr, + "Cli: extractDataFromPluginTo: Added %" SIZEFORMAT " bytes of spec data with tag %d\n", + dataFromPlugin.getCount(), tags->specific_data)); return; } @@ -7556,12 +7563,14 @@ void ClntAuthBlock::loadClnt(Firebird::ClumpletWriter& dpb, const ParametersSet* makeUtfString(uft8Convert, password); dpb.getString(password); dpb.deleteClumplet(); - HANDSHAKE_DEBUG(fprintf(stderr, "Cli: loadClnt: Loaded from PB password = %s\n", password.c_str())); + HANDSHAKE_DEBUG(fprintf(stderr, + "Cli: loadClnt: Loaded from PB password = %s\n", password.c_str())); } else if (t == tags->encrypt_key) { hasCryptKey = true; - HANDSHAKE_DEBUG(fprintf(stderr, "Cli: loadClnt: PB contains crypt key - need encrypted line to pass\n")); + HANDSHAKE_DEBUG(fprintf(stderr, + "Cli: loadClnt: PB contains crypt key - need encrypted line to pass\n")); } } } @@ -7591,8 +7600,9 @@ void ClntAuthBlock::extractDataFromPluginTo(P_AUTH_CONT* to) to->p_list.cstr_length = (ULONG) pluginList.length(); to->p_list.cstr_address = (UCHAR*) pluginList.c_str(); to->p_list.cstr_allocated = 0; - HANDSHAKE_DEBUG(fprintf(stderr, "Cli: extractDataFromPluginTo: added plugin list (%d len) to packet\n", - to->p_list.cstr_length)); + HANDSHAKE_DEBUG(fprintf(stderr, + "Cli: extractDataFromPluginTo: added plugin list (%d len) to packet\n", + to->p_list.cstr_length)); firstTime = false; } else diff --git a/src/remote/server/server.cpp b/src/remote/server/server.cpp index c57eac7b7c..307e54896b 100644 --- a/src/remote/server/server.cpp +++ b/src/remote/server/server.cpp @@ -376,8 +376,9 @@ public: // if we asked for more data but received nothing switch to next plugin bool forceNext = contAuth && (!authPort->port_srv_auth_block->hasDataForPlugin()); - HANDSHAKE_DEBUG(fprintf(stderr, "Srv: authenticate: ServerAuth calls plug %s\n", forceNext ? "forced-NEXT" : authItr->name())); - int authResult = forceNext ? Auth::AUTH_CONTINUE : + HANDSHAKE_DEBUG(fprintf(stderr, "Srv: authenticate: ServerAuth calls plug %s\n", + forceNext ? "forced-NEXT" : authItr->name())); + int authResult = forceNext ? Auth::AUTH_CONTINUE : authServer->authenticate(&st, authPort->port_srv_auth_block, &authPort->port_srv_auth_block->authBlockWriter); authPort->port_srv_auth_block->setPluginName(authItr->name()); @@ -1567,14 +1568,16 @@ static bool accept_connection(rem_port* port, P_CNCT* connect, PACKET* send) Firebird::ClumpletReader id(Firebird::ClumpletReader::UnTagged, connect->p_cnct_user_id.cstr_address, connect->p_cnct_user_id.cstr_length); - HANDSHAKE_DEBUG(fprintf(stderr, "Srv: accept_connection: is going to load data to port_srv_auth_block\n")); + HANDSHAKE_DEBUG(fprintf(stderr, + "Srv: accept_connection: is going to load data to port_srv_auth_block\n")); port->port_srv_auth_block->load(id); if (port->port_srv_auth_block->getLogin()) { port->port_login = port->port_srv_auth_block->getLogin(); } - HANDSHAKE_DEBUG(fprintf(stderr, "Srv: accept_connection: finished with port_srv_auth_block prepare, a=%d\n", accepted)); + HANDSHAKE_DEBUG(fprintf(stderr, + "Srv: accept_connection: finished with port_srv_auth_block prepare, a=%d\n", accepted)); if (port->port_srv_auth_block->getPluginName()) { @@ -1585,7 +1588,8 @@ static bool accept_connection(rem_port* port, P_CNCT* connect, PACKET* send) if (port->port_srv_auth_block->plugins) // We have all required data and iterator was created { - HANDSHAKE_DEBUG(fprintf(stderr, "Srv: accept_connection: call plugin %s\n", port->port_srv_auth_block->getPluginName())); + HANDSHAKE_DEBUG(fprintf(stderr, + "Srv: accept_connection: call plugin %s\n", port->port_srv_auth_block->getPluginName())); AuthServerPlugins* const plugins = port->port_srv_auth_block->plugins; for (; plugins->hasData(); plugins->next())