diff --git a/src/gpre/fbrmclib.cpp b/src/gpre/fbrmclib.cpp index c61e589fb6..92151165aa 100644 --- a/src/gpre/fbrmclib.cpp +++ b/src/gpre/fbrmclib.cpp @@ -1518,6 +1518,7 @@ EXPORT RM_ENTRY(rmc_ftoc) return (0); } + // Convert a Cobol alpha (PIC X) field to a C string. This is done by trimming trailing spaces // and adding the trailing '\0'. EXPORT RM_ENTRY(rmc_ctos) @@ -1537,6 +1538,7 @@ EXPORT RM_ENTRY(rmc_ctos) return (0); } + // Convert a C string to a Cobol alpha (PIC X) field. This is done by copying the original // string and padding on the right with spaces. EXPORT RM_ENTRY(rmc_stoc) diff --git a/src/gpre/rmc.cpp b/src/gpre/rmc.cpp index da7c341eac..2968b7388c 100644 --- a/src/gpre/rmc.cpp +++ b/src/gpre/rmc.cpp @@ -1151,9 +1151,8 @@ static void gen_based( const act* action) case dtype_sql_time: if (strlen(gpreGlob.sw_cob_dformat) == 0) fprintf(gpreGlob.out_file, "%sPIC S9(10)%s", names[COLUMN], USAGE_BINARY4); - else { + else fprintf(gpreGlob.out_file, "%sPIC X(%d)", names[COLUMN], strlen(gpreGlob.sw_cob_dformat)); - } break; case dtype_blob: diff --git a/src/gpre/sqe.cpp b/src/gpre/sqe.cpp index c7611071f2..96ddfd7a26 100644 --- a/src/gpre/sqe.cpp +++ b/src/gpre/sqe.cpp @@ -2674,9 +2674,11 @@ bool SQE_resolve_fields(GPRE_NOD fields, gpre_nod** ptr = fields->nod_arg; int count = fields->nod_count; + for (int i = 0; i < count; i++) { gpre_nod* node = ptr[i]; + if (node->nod_type == nod_asterisk) { const int old_count = count; fields = explode_asterisk(fields, i, selection); @@ -2687,23 +2689,25 @@ bool SQE_resolve_fields(GPRE_NOD fields, else { aggregate |= SQE_resolve(node, NULL, selection); pair(node, 0); + switch (node->nod_type) { - case nod_agg_count: - case nod_agg_max: - case nod_agg_min: - case nod_agg_average: - case nod_agg_total: - if ((node->nod_arg[1]) && - (request->req_database->dbb_flags & DBB_v3)) - { - selection->rse_reduced = - MSC_unary(nod_sort, node->nod_arg[1]); - } - break; + case nod_agg_count: + case nod_agg_max: + case nod_agg_min: + case nod_agg_average: + case nod_agg_total: + if ((node->nod_arg[1]) && + (request->req_database->dbb_flags & DBB_v3)) + { + selection->rse_reduced = + MSC_unary(nod_sort, node->nod_arg[1]); + } + break; } } } + return aggregate; } //____________________________________________________________ @@ -2859,8 +2863,10 @@ static gpre_rse* par_select( gpre_req* request, gpre_rse* union_rse) gpre_nod* into_list = NULL; if (!(request->req_flags & REQ_sql_declare_cursor)) + { into_list = (MSC_match(KW_INTO)) ? SQE_list(SQE_variable, request, false) : NULL; + } gpre_rse* select = par_rse(request, s_list, distinct); diff --git a/src/jrd/sdw.cpp b/src/jrd/sdw.cpp index 11983b875d..5603b1898f 100644 --- a/src/jrd/sdw.cpp +++ b/src/jrd/sdw.cpp @@ -94,9 +94,11 @@ void SDW_add(const TEXT* file_name, USHORT shadow_number, USHORT file_flags) jrd_file* shadow_file = PIO_create(dbb, file_name, false, false, false); if (dbb->dbb_flags & (DBB_force_write | DBB_no_fs_cache)) + { PIO_force_write(shadow_file, dbb->dbb_flags & DBB_force_write, dbb->dbb_flags & DBB_no_fs_cache); + } Shadow* shadow = allocate_shadow(shadow_file, shadow_number, file_flags); @@ -172,9 +174,11 @@ int SDW_add_file(const TEXT* file_name, SLONG start, USHORT shadow_number) jrd_file* next = file->fil_next; if (dbb->dbb_flags & (DBB_force_write | DBB_no_fs_cache)) + { PIO_force_write(next, dbb->dbb_flags & DBB_force_write, dbb->dbb_flags & DBB_no_fs_cache); + } /* Always write the header page, even for a conditional * shadow that hasn't been activated. @@ -980,7 +984,8 @@ void SDW_start(const TEXT* file_name, shadow_file = PIO_open(dbb, expanded_name, false, file_name, false); - if (dbb->dbb_flags & (DBB_force_write | DBB_no_fs_cache)) { + if (dbb->dbb_flags & (DBB_force_write | DBB_no_fs_cache)) + { PIO_force_write(shadow_file, dbb->dbb_flags & DBB_force_write, dbb->dbb_flags & DBB_no_fs_cache); diff --git a/src/lock/lock.cpp b/src/lock/lock.cpp index 3651029d4c..7ef9cbdc79 100644 --- a/src/lock/lock.cpp +++ b/src/lock/lock.cpp @@ -4384,13 +4384,12 @@ static void validate_lhb(const lhb* alhb) #endif validate_history(alhb->lhb_history); -/* validate_semaphore_mask (alhb->lhb_mask); */ + // validate_semaphore_mask (alhb->lhb_mask); CHECK(alhb->lhb_reserved[0] == 0); CHECK(alhb->lhb_reserved[1] == 0); DEBUG_MSG(0, ("validate_lhb completed:\n")); - } #endif @@ -4418,17 +4417,17 @@ static void validate_lock(const SRQ_PTR lock_ptr, USHORT freed, const SRQ_PTR lr else CHECK(lock->lbl_type == type_lbl); -// The following condition is always true because UCHAR >= 0 -// CHECK(lock->lbl_state >= LCK_none); + // The following condition is always true because UCHAR >= 0 + // CHECK(lock->lbl_state >= LCK_none); CHECK(lock->lbl_state < LCK_max); CHECK(lock->lbl_length <= lock->lbl_size); -/* The lbl_count's should never roll over to be negative */ + // The lbl_count's should never roll over to be negative for (ULONG i = 0; i < FB_NELEM(lock->lbl_counts); i++) CHECK(!(lock->lbl_counts[i] & 0x8000)) -/* The count of pending locks should never roll over to be negative */ + // The count of pending locks should never roll over to be negative CHECK(!(lock->lbl_pending_lrq_count & 0x8000)); USHORT direct_counts[LCK_max]; diff --git a/src/remote/xnet.cpp b/src/remote/xnet.cpp index 5037cb3cee..f818fbfdd9 100644 --- a/src/remote/xnet.cpp +++ b/src/remote/xnet.cpp @@ -1565,11 +1565,12 @@ static void server_shutdown(rem_port* port) **************************************/ xnet_log_error("Server shutdown detected"); - XCC xcc = (XCC)port->port_xcc; + XCC xcc = (XCC) port->port_xcc; xcc->xcc_flags |= XCCF_SERVER_SHUTDOWN; XPM xpm = xcc->xcc_xpm; - if (!(xpm->xpm_flags & XPMF_SERVER_SHUTDOWN)) { + if (!(xpm->xpm_flags & XPMF_SERVER_SHUTDOWN)) + { ULONG dead_proc_id = XPS(xpm->xpm_address)->xps_server_proc_id; @@ -1577,7 +1578,8 @@ static void server_shutdown(rem_port* port) XNET_LOCK(); - for (xpm = global_client_maps; xpm; xpm = xpm->xpm_next) { + for (xpm = global_client_maps; xpm; xpm = xpm->xpm_next) + { if (!(xpm->xpm_flags & XPMF_SERVER_SHUTDOWN) && XPS(xpm->xpm_address)->xps_server_proc_id == dead_proc_id) { diff --git a/src/utilities/install/install_nt.h b/src/utilities/install/install_nt.h index f386726337..a26b5646e9 100644 --- a/src/utilities/install/install_nt.h +++ b/src/utilities/install/install_nt.h @@ -37,7 +37,7 @@ static const char* ISCGUARD_EXECUTABLE = "bin\\fbguard"; static const char* GUARDIAN_MUTEX = "FirebirdGuardianMutex%s"; -static const char* FB_DEFAULT_INSTANCE = "DefaultInstance"; +static const char* FB_DEFAULT_INSTANCE = "DefaultInstance"; // Starting with 128 the service params are user defined const DWORD SERVICE_CREATE_GUARDIAN_MUTEX = 128; diff --git a/src/utilities/install/install_svc.cpp b/src/utilities/install/install_svc.cpp index 83c0785580..a2b947da24 100644 --- a/src/utilities/install/install_svc.cpp +++ b/src/utilities/install/install_svc.cpp @@ -75,10 +75,10 @@ int CLIB_ROUTINE main( int argc, char **argv) USHORT sw_arch = ARCH_SS; bool sw_interactive = false; - const TEXT *instance = FB_DEFAULT_INSTANCE; + const TEXT* instance = FB_DEFAULT_INSTANCE; - TEXT *username = 0; - TEXT *password = 0; + TEXT* username = 0; + TEXT* password = 0; // Let's get the root directory from the instance path of this program. // argv[0] is only _mostly_ guaranteed to give this info, @@ -507,21 +507,20 @@ static USHORT svc_query_ex(SC_HANDLE manager) { const DWORD dwBytes = pcbBytesNeeded + sizeof(ENUM_SERVICE_STATUS); ENUM_SERVICE_STATUS* service_data = new ENUM_SERVICE_STATUS [dwBytes]; - EnumServicesStatus (manager, SERVICE_WIN32, SERVICE_STATE_ALL, service_data, dwBytes, - &pcbBytesNeeded, &lpServicesReturned, &lpResumeHandle); + EnumServicesStatus(manager, SERVICE_WIN32, SERVICE_STATE_ALL, service_data, dwBytes, + &pcbBytesNeeded, &lpServicesReturned, &lpResumeHandle); if (lpServicesReturned == 0) delete[] service_data; else { - Firebird::string ServerServiceName; - Firebird::string ServerDisplayName; + Firebird::string serverServiceName; bool firebirdServicesInstalled = false; - for( int i = 0; i < lpServicesReturned; i++ ) + for ( DWORD i = 0; i < lpServicesReturned; i++ ) { - ServerServiceName = service_data[i].lpServiceName; - if ( ServerServiceName.substr(0, 8) == "Firebird" ) + serverServiceName = service_data[i].lpServiceName; + if ( serverServiceName.substr(0, 8) == "Firebird" ) { svc_query(service_data[i].lpServiceName, service_data[i].lpDisplayName, manager);