From fda9c3bc75dffdc09467d1b554e2b74adf6dbebe Mon Sep 17 00:00:00 2001 From: robocop Date: Mon, 5 Jan 2009 08:22:58 +0000 Subject: [PATCH] Style. --- src/burp/burp.h | 4 +- src/burp/canonical.cpp | 51 +++---- src/burp/misc.cpp | 10 +- src/burp/mvol.cpp | 80 ++++------ src/burp/restore.epp | 226 ++++++++++++---------------- src/burp/spit.cpp | 234 ++++++++++++----------------- src/common/config/config_file.cpp | 15 +- src/common/cvt.cpp | 31 ++-- src/dudley/ddl.h | 6 +- src/dudley/exe.epp | 44 ++---- src/dudley/expand.cpp | 13 +- src/dudley/lex.cpp | 3 +- src/dudley/parse.cpp | 10 +- src/dudley/trn.cpp | 3 +- src/gpre/fbrmclib.cpp | 8 +- src/gpre/pretty.cpp | 16 +- src/remote/os/win32/ibconfig.cpp | 4 +- src/utilities/fbcpl/fbdialog.cpp | 9 +- src/utilities/gstat/dba.epp | 38 ++--- src/utilities/ibmgr/ibmgr.cpp | 12 +- src/utilities/install/install.cpp | 3 +- src/utilities/install/services.cpp | 3 +- src/utilities/rebuild/rebuild.cpp | 22 ++- src/utilities/rebuild/rebuild.h | 4 +- 24 files changed, 346 insertions(+), 503 deletions(-) diff --git a/src/burp/burp.h b/src/burp/burp.h index 3f0e737aa8..46861438d4 100644 --- a/src/burp/burp.h +++ b/src/burp/burp.h @@ -878,7 +878,7 @@ public: TEXT mvol_db_name_buffer [MAX_FILE_NAME_SIZE]; SCHAR mvol_old_file [MAX_FILE_NAME_SIZE]; int mvol_volume_count; - USHORT mvol_empty_file; + bool mvol_empty_file; isc_db_handle db_handle; isc_tr_handle tr_handle; isc_tr_handle global_trans; @@ -887,7 +887,7 @@ public: ISC_STATUS_ARRAY status_vector; int exit_code; UCHAR* head_of_mem_list; - FILE* output_file; + FILE* output_file; /* * Link list of global fields that were converted from V3 sub_type diff --git a/src/burp/canonical.cpp b/src/burp/canonical.cpp index f1c0008f22..2ae803a91d 100644 --- a/src/burp/canonical.cpp +++ b/src/burp/canonical.cpp @@ -106,8 +106,7 @@ ULONG CAN_encode_decode(burp_rel* relation, continue; UCHAR* p = data + field->fld_offset; const bool array_fld = ((field->fld_flags & FLD_array) != 0); - FLD_LENGTH length = - (array_fld) ? 8 : field->fld_length; + const FLD_LENGTH length = (array_fld) ? 8 : field->fld_length; if (field->fld_offset >= offset) offset = field->fld_offset + length; if (field->fld_type == blr_varying && !array_fld) @@ -129,13 +128,11 @@ ULONG CAN_encode_decode(burp_rel* relation, case dtype_varying: { vary* pVary = reinterpret_cast(p); - if (!xdr_short(xdrs, - reinterpret_cast(&pVary->vary_length))) + if (!xdr_short(xdrs, reinterpret_cast(&pVary->vary_length))) { return FALSE; } - if (!xdr_opaque(xdrs, - reinterpret_cast(pVary->vary_string), + if (!xdr_opaque(xdrs, reinterpret_cast(pVary->vary_string), MIN(pVary->vary_length, length))) { return FALSE; @@ -177,20 +174,20 @@ ULONG CAN_encode_decode(burp_rel* relation, break; case dtype_timestamp: - if (!xdr_long(xdrs, &((SLONG *) p)[0])) + if (!xdr_long(xdrs, &((SLONG*) p)[0])) return FALSE; - if (!xdr_long(xdrs, &((SLONG *) p)[1])) + if (!xdr_long(xdrs, &((SLONG*) p)[1])) return FALSE; break; case dtype_quad: case dtype_blob: - if (!xdr_quad(xdrs, (SLONG *) p)) + if (!xdr_quad(xdrs, (SLONG*) p)) return FALSE; break; case dtype_int64: - if (!xdr_hyper(xdrs, (SINT64 *) p)) + if (!xdr_hyper(xdrs, (SINT64*) p)) return FALSE; break; @@ -208,7 +205,7 @@ ULONG CAN_encode_decode(burp_rel* relation, continue; offset = FB_ALIGN(offset, sizeof(SSHORT)); UCHAR* p = data + offset; - if (!xdr_short(xdrs, (SSHORT *) p)) + if (!xdr_short(xdrs, (SSHORT*) p)) return FALSE; offset += sizeof(SSHORT); } @@ -404,9 +401,7 @@ static bool_t burp_putlong(XDR* xdrs, const SLONG* lp) * **************************************/ SLONG l = htonl(*lp); - return (*xdrs->x_ops->x_putbytes) (xdrs, - reinterpret_cast(&l), - 4); + return (*xdrs->x_ops->x_putbytes) (xdrs, reinterpret_cast(&l), 4); } @@ -497,15 +492,12 @@ static bool_t xdr_datum(XDR* xdrs, DSC* desc, UCHAR* buffer) case dtype_varying: { vary* pVary = reinterpret_cast(p); - if (!xdr_short(xdrs, - reinterpret_cast(&pVary->vary_length))) + if (!xdr_short(xdrs, reinterpret_cast(&pVary->vary_length))) { return FALSE; } - if (!xdr_opaque(xdrs, - reinterpret_cast(pVary->vary_string), - MIN(desc->dsc_length - 2, - pVary->vary_length))) + if (!xdr_opaque(xdrs, reinterpret_cast(pVary->vary_string), + MIN(desc->dsc_length - 2, pVary->vary_length))) { return FALSE; } @@ -514,8 +506,7 @@ static bool_t xdr_datum(XDR* xdrs, DSC* desc, UCHAR* buffer) case dtype_cstring: if (xdrs->x_op == XDR_ENCODE) { - n = MIN(strlen(reinterpret_cast(p)), - (size_t) (desc->dsc_length - 1)); + n = MIN(strlen(reinterpret_cast(p)), (size_t) (desc->dsc_length - 1)); } if (!xdr_short(xdrs, &n)) return FALSE; @@ -526,14 +517,14 @@ static bool_t xdr_datum(XDR* xdrs, DSC* desc, UCHAR* buffer) break; case dtype_short: - if (!xdr_short(xdrs, (SSHORT *) p)) + if (!xdr_short(xdrs, (SSHORT*) p)) return FALSE; break; case dtype_sql_date: case dtype_sql_time: case dtype_long: - if (!xdr_long(xdrs, (SLONG *) p)) + if (!xdr_long(xdrs, (SLONG*) p)) return FALSE; break; @@ -548,15 +539,15 @@ static bool_t xdr_datum(XDR* xdrs, DSC* desc, UCHAR* buffer) break; case dtype_timestamp: - if (!xdr_long(xdrs, &((SLONG *) p)[0])) + if (!xdr_long(xdrs, &((SLONG*) p)[0])) return FALSE; - if (!xdr_long(xdrs, &((SLONG *) p)[1])) + if (!xdr_long(xdrs, &((SLONG*) p)[1])) return FALSE; break; case dtype_quad: case dtype_blob: - if (!xdr_quad(xdrs, (SLONG *) p)) + if (!xdr_quad(xdrs, (SLONG*) p)) return FALSE; break; @@ -589,8 +580,7 @@ static bool_t xdr_quad(XDR* xdrs, SLONG* ip) switch (xdrs->x_op) { case XDR_ENCODE: - if ((*xdrs->x_ops->x_putlong) (xdrs, &ip[0]) && - (*xdrs->x_ops->x_putlong) (xdrs, &ip[1])) + if ((*xdrs->x_ops->x_putlong) (xdrs, &ip[0]) && (*xdrs->x_ops->x_putlong) (xdrs, &ip[1])) { return TRUE; } @@ -664,8 +654,7 @@ static bool_t xdr_slice(XDR* xdrs, case XDR_DECODE: if (!slice->lstr_length) return TRUE; - if (slice->lstr_length > slice->lstr_allocated && - slice->lstr_allocated) + if (slice->lstr_length > slice->lstr_allocated && slice->lstr_allocated) { BURP_free(slice->lstr_address); slice->lstr_address = NULL; diff --git a/src/burp/misc.cpp b/src/burp/misc.cpp index 2c3d25b2f1..7a32316e74 100644 --- a/src/burp/misc.cpp +++ b/src/burp/misc.cpp @@ -67,7 +67,7 @@ UCHAR *MISC_alloc_burp(ULONG size) * are then freed when gbak exits. This is important for * NETWARE in particular. */ - *((UCHAR **) block) = tdgbl->head_of_mem_list; + *((UCHAR**) block) = tdgbl->head_of_mem_list; tdgbl->head_of_mem_list = block; return (block + ROUNDUP(sizeof(UCHAR *), FB_ALIGNMENT)); @@ -88,10 +88,10 @@ void MISC_free_burp( void *free) **************************************/ BurpGlobals* tdgbl = BurpGlobals::getSpecific(); - if (free != NULL) { + if (free != NULL) + { // Point at the head of the allocated block - UCHAR **block = - (UCHAR **) ((UCHAR *) free - ROUNDUP(sizeof(UCHAR *), FB_ALIGNMENT)); + UCHAR** block = (UCHAR**) ((UCHAR*) free - ROUNDUP(sizeof(UCHAR*), FB_ALIGNMENT)); // Scan for this block in the list of blocks for (UCHAR **ptr = &tdgbl->head_of_mem_list; *ptr; ptr = (UCHAR **) *ptr) @@ -101,7 +101,7 @@ void MISC_free_burp( void *free) *ptr = *block; // and free it - gds__free((SLONG *) block); + gds__free(block); return; } } diff --git a/src/burp/mvol.cpp b/src/burp/mvol.cpp index 13d50b49ad..af0202b45a 100644 --- a/src/burp/mvol.cpp +++ b/src/burp/mvol.cpp @@ -182,7 +182,7 @@ void MVOL_init_read(const char* database_name, // unused? BurpGlobals* tdgbl = BurpGlobals::getSpecific(); tdgbl->mvol_volume_count = 1; - tdgbl->mvol_empty_file = TRUE; + tdgbl->mvol_empty_file = true; if (file_name != NULL) { @@ -206,13 +206,11 @@ void MVOL_init_read(const char* database_name, // unused? UCHAR* new_buffer = BURP_alloc(temp_buffer_size); memcpy(new_buffer, tdgbl->mvol_io_buffer, tdgbl->mvol_io_buffer_size); BURP_free(tdgbl->mvol_io_buffer); - tdgbl->mvol_io_ptr = - new_buffer + (tdgbl->mvol_io_ptr - tdgbl->mvol_io_buffer); + tdgbl->mvol_io_ptr = new_buffer + (tdgbl->mvol_io_ptr - tdgbl->mvol_io_buffer); tdgbl->mvol_io_buffer = new_buffer; } - tdgbl->mvol_actual_buffer_size = tdgbl->mvol_io_buffer_size = - temp_buffer_size; + tdgbl->mvol_actual_buffer_size = tdgbl->mvol_io_buffer_size = temp_buffer_size; *cnt = tdgbl->mvol_io_cnt; *ptr = tdgbl->mvol_io_ptr; } @@ -230,7 +228,7 @@ void MVOL_init_write(const char* database_name, // unused? BurpGlobals* tdgbl = BurpGlobals::getSpecific(); tdgbl->mvol_volume_count = 1; - tdgbl->mvol_empty_file = TRUE; + tdgbl->mvol_empty_file = true; if (file_name != NULL) { @@ -244,8 +242,7 @@ void MVOL_init_write(const char* database_name, // unused? tdgbl->mvol_actual_buffer_size = tdgbl->mvol_io_buffer_size; const ULONG temp_buffer_size = tdgbl->mvol_io_buffer_size * tdgbl->gbl_sw_blk_factor; - tdgbl->mvol_io_ptr = tdgbl->mvol_io_buffer = - BURP_alloc(temp_buffer_size + MAX_HEADER_SIZE); + tdgbl->mvol_io_ptr = tdgbl->mvol_io_buffer = BURP_alloc(temp_buffer_size + MAX_HEADER_SIZE); tdgbl->mvol_io_cnt = tdgbl->mvol_actual_buffer_size; while (!write_header(tdgbl->file_desc, temp_buffer_size, false)) @@ -554,6 +551,7 @@ UCHAR MVOL_write(const UCHAR c, int* io_cnt, UCHAR** io_ptr) #ifndef WIN_NT cnt = write(tdgbl->file_desc, ptr, nBytesToWrite); #else + DWORD ret = 0; if (!WriteFile(tdgbl->file_desc, ptr, (DWORD) nBytesToWrite, &cnt, NULL)) { @@ -591,8 +589,7 @@ UCHAR MVOL_write(const UCHAR c, int* io_cnt, UCHAR** io_ptr) if (tdgbl->action->act_file->fil_next) { close_platf(tdgbl->file_desc); - for (burp_fil* file = tdgbl->gbl_sw_backup_files; file; - file = file->fil_next) + for (burp_fil* file = tdgbl->gbl_sw_backup_files; file; file = file->fil_next) { if (file->fil_fd == tdgbl->file_desc) file->fil_fd = INVALID_HANDLE_VALUE; @@ -607,8 +604,7 @@ UCHAR MVOL_write(const UCHAR c, int* io_cnt, UCHAR** io_ptr) // the rest of the bytes (%d) will be written to file %s tdgbl->action->act_file->fil_next->fil_length += tdgbl->action->act_file->fil_length; - tdgbl->action->act_file = - tdgbl->action->act_file->fil_next; + tdgbl->action->act_file = tdgbl->action->act_file->fil_next; tdgbl->file_desc = tdgbl->action->act_file->fil_fd; } else @@ -675,8 +671,10 @@ UCHAR MVOL_write(const UCHAR c, int* io_cnt, UCHAR** io_ptr) { int dbg_cnt; if (debug_on) + { for (dbg_cnt = 0; dbg_cnt < cnt; dbg_cnt++) printf("%d,\n", *(ptr + dbg_cnt)); + } } #endif @@ -760,7 +758,7 @@ static void file_not_empty() { BurpGlobals* tdgbl = BurpGlobals::getSpecific(); - tdgbl->mvol_empty_file = FALSE; + tdgbl->mvol_empty_file = false; } @@ -848,7 +846,7 @@ static DESC next_volume( DESC handle, ULONG mode, bool full_buffer) if (!tdgbl->mvol_empty_file) ++tdgbl->mvol_volume_count; - tdgbl->mvol_empty_file = TRUE; + tdgbl->mvol_empty_file = true; // Loop until we have opened a file successfully @@ -941,14 +939,12 @@ static void prompt_for_name(SCHAR* name, int length) // Get a location to read from. fb_assert(!tdgbl->uSvc->isService()); - if (isatty(fileno(stdout)) || - !(term_out = fopen(TERM_OUTPUT, "w"))) + if (isatty(fileno(stdout)) || !(term_out = fopen(TERM_OUTPUT, "w"))) { term_out = stdout; } - if (isatty(fileno(stdin)) || - !(term_in = fopen(TERM_INPUT, "r"))) + if (isatty(fileno(stdin)) || !(term_in = fopen(TERM_INPUT, "r"))) { term_in = stdin; } @@ -961,8 +957,7 @@ static void prompt_for_name(SCHAR* name, int length) if (strlen(tdgbl->mvol_old_file) > 0) { - BURP_msg_get(225, msg, SafeArg() << (tdgbl->mvol_volume_count - 1) << - tdgbl->mvol_old_file); + BURP_msg_get(225, msg, SafeArg() << (tdgbl->mvol_volume_count - 1) << tdgbl->mvol_old_file); fprintf(term_out, msg); BURP_msg_get(226, msg); // \tPress return to reopen that file, or type a new\n\tname @@ -1072,10 +1067,7 @@ static void put_numeric( SCHAR attribute, int value) // // Functional description // -static bool read_header(DESC handle, - ULONG* buffer_size, - USHORT* format, - bool init_flag) +static bool read_header(DESC handle, ULONG* buffer_size, USHORT* format, bool init_flag) { TEXT buffer[MAX_FILE_NAME_SIZE], msg[BURP_MSG_GET_SIZE]; @@ -1083,15 +1075,16 @@ static bool read_header(DESC handle, // Headers are a version number, and a volume number -// CVC: Nobody does an explicit check for the read operation, assuming -// that GET_ATTRIBUTE() != rec_burp will provide an implicit test. #ifndef WIN_NT - tdgbl->mvol_io_cnt = read(handle, tdgbl->mvol_io_buffer, - tdgbl->mvol_actual_buffer_size); + tdgbl->mvol_io_cnt = read(handle, tdgbl->mvol_io_buffer, tdgbl->mvol_actual_buffer_size); #else - ReadFile(handle, tdgbl->mvol_io_buffer, tdgbl->mvol_actual_buffer_size, - reinterpret_cast(&tdgbl->mvol_io_cnt), NULL); + DWORD bytesRead = 0; + ReadFile(handle, tdgbl->mvol_io_buffer, tdgbl->mvol_actual_buffer_size, &bytesRead, NULL); + tdgbl->mvol_io_cnt = bytesRead; #endif + if (!tdgbl->mvol_io_cnt) + BURP_error_redirect(0, 45); // maybe there's a better message + tdgbl->mvol_io_ptr = tdgbl->mvol_io_buffer; int attribute = get(tdgbl); @@ -1108,7 +1101,7 @@ static bool read_header(DESC handle, { case att_backup_blksize: { - ULONG temp_buffer_size = get_numeric(); + const ULONG temp_buffer_size = get_numeric(); if (init_flag) *buffer_size = temp_buffer_size; } @@ -1147,8 +1140,7 @@ static bool read_header(DESC handle, *p = 0; if (!init_flag && strcmp(buffer, tdgbl->gbl_backup_start_time)) { - BURP_msg_get(230, msg, SafeArg() << - tdgbl->gbl_backup_start_time << buffer); + BURP_msg_get(230, msg, SafeArg() << tdgbl->gbl_backup_start_time << buffer); // Expected backup start time %s, found %s\n printf(msg); return false; @@ -1182,8 +1174,7 @@ static bool read_header(DESC handle, *p = 0; if (!init_flag && strcmp(buffer, tdgbl->gbl_database_file_name)) { - BURP_msg_get(231, msg, SafeArg() << - tdgbl->gbl_database_file_name << buffer); + BURP_msg_get(231, msg, SafeArg() << tdgbl->gbl_database_file_name << buffer); // Expected backup database %s, found %s\n printf(msg); return false; @@ -1212,8 +1203,7 @@ static bool read_header(DESC handle, temp = get_numeric(); if (temp != tdgbl->mvol_volume_count) { - BURP_msg_get(232, msg, SafeArg() << - tdgbl->mvol_volume_count << temp); + BURP_msg_get(232, msg, SafeArg() << tdgbl->mvol_volume_count << temp); // Expected volume number %d, found volume %d\n printf(msg); return false; @@ -1232,9 +1222,7 @@ static bool read_header(DESC handle, //____________________________________________________________ // // -static bool write_header(DESC handle, - ULONG backup_buffer_size, - bool full_buffer) +static bool write_header(DESC handle, ULONG backup_buffer_size, bool full_buffer) { BurpGlobals* tdgbl = BurpGlobals::getSpecific(); @@ -1267,7 +1255,7 @@ static bool write_header(DESC handle, const ULONG vax_value = gds__vax_integer(reinterpret_cast( &tdgbl->mvol_volume_count), sizeof(tdgbl->mvol_volume_count)); - const UCHAR* p = (UCHAR *) &vax_value; + const UCHAR* p = (UCHAR*) &vax_value; UCHAR* q = tdgbl->mvol_io_volume; // CVC: Warning, do we want sizeof(int) or sizeof(some_abstract_FB_type)??? // It seems to me we want sizeof(ULONG) for safety. => Done. @@ -1281,7 +1269,7 @@ static bool write_header(DESC handle, { #ifdef WIN_NT DWORD bytes_written = 0; - const BOOL err = !WriteFile(handle, tdgbl->mvol_io_header, + const bool err = !WriteFile(handle, tdgbl->mvol_io_header, tdgbl->mvol_io_buffer_size, &bytes_written, NULL); #else ULONG bytes_written = write(handle, tdgbl->mvol_io_header, @@ -1305,7 +1293,7 @@ static bool write_header(DESC handle, tdgbl->action->act_file->fil_length = 0; } } - tdgbl->mvol_empty_file = FALSE; + tdgbl->mvol_empty_file = false; } return true; @@ -1337,11 +1325,9 @@ bool MVOL_split_hdr_write() #ifdef WIN_NT DWORD bytes_written = 0; - WriteFile(tdgbl->action->act_file->fil_fd, buffer, HDR_SPLIT_SIZE, - &bytes_written, NULL); + WriteFile(tdgbl->action->act_file->fil_fd, buffer, HDR_SPLIT_SIZE, &bytes_written, NULL); #else - ULONG bytes_written = - write(tdgbl->action->act_file->fil_fd, buffer, HDR_SPLIT_SIZE); + ULONG bytes_written = write(tdgbl->action->act_file->fil_fd, buffer, HDR_SPLIT_SIZE); #endif // WIN_NT if (bytes_written != HDR_SPLIT_SIZE) { diff --git a/src/burp/restore.epp b/src/burp/restore.epp index d322ed9816..4398fa3d2d 100644 --- a/src/burp/restore.epp +++ b/src/burp/restore.epp @@ -134,7 +134,7 @@ bool get_global_field(BurpGlobals* tdgbl); bool get_index(BurpGlobals* tdgbl, const burp_rel*); void get_misc_blob(BurpGlobals* tdgbl, ISC_QUAD&, USHORT, bool); SLONG get_numeric(BurpGlobals* tdgbl); -SINT64 get_int64(BurpGlobals* tdgbl); +SINT64 get_int64(BurpGlobals* tdgbl); bool get_procedure(BurpGlobals* tdgbl); bool get_procedure_prm (BurpGlobals* tdgbl, GDS_NAME ); bool get_ref_constraint(BurpGlobals* tdgbl); @@ -239,8 +239,7 @@ const int USER_PRIV_OBJECT_TYPE = 128; } // namespace -int RESTORE_restore (const TEXT* file_name, - const TEXT* database_name) +int RESTORE_restore (const TEXT* file_name, const TEXT* database_name) { /************************************** * @@ -480,8 +479,7 @@ int RESTORE_restore (const TEXT* file_name, ** Change ownership of any procedures necessary */ - for (burp_prc* procedure = tdgbl->procedures; procedure; - procedure = procedure->prc_next) + for (burp_prc* procedure = tdgbl->procedures; procedure; procedure = procedure->prc_next) { if (procedure->prc_owner[0]) { @@ -596,21 +594,16 @@ int RESTORE_restore (const TEXT* file_name, if (tdgbl->gbl_sw_user) { - dpb.insertString(isc_dpb_user_name, - tdgbl->gbl_sw_user, - strlen(tdgbl->gbl_sw_user)); + dpb.insertString(isc_dpb_user_name, tdgbl->gbl_sw_user, strlen(tdgbl->gbl_sw_user)); } if (tdgbl->gbl_sw_password) { - dpb.insertString(tdgbl->uSvc->isService() ? - isc_dpb_password_enc : isc_dpb_password, - tdgbl->gbl_sw_password, - strlen(tdgbl->gbl_sw_password)); + dpb.insertString(tdgbl->uSvc->isService() ? isc_dpb_password_enc : isc_dpb_password, + tdgbl->gbl_sw_password, strlen(tdgbl->gbl_sw_password)); } if (tdgbl->gbl_sw_tr_user) { - dpb.insertString(isc_dpb_trusted_auth, - tdgbl->gbl_sw_tr_user, strlen(tdgbl->gbl_sw_tr_user)); + dpb.insertString(isc_dpb_trusted_auth, tdgbl->gbl_sw_tr_user, strlen(tdgbl->gbl_sw_tr_user)); } dpb.insertByte(isc_dpb_no_db_triggers, 1); @@ -619,9 +612,8 @@ int RESTORE_restore (const TEXT* file_name, dpb.insertByte(isc_dpb_force_write, tdgbl->hdr_forced_writes ? 1 : 0); FB_API_HANDLE db_handle = 0; - if (isc_attach_database (tdgbl->status_vector, 0, database_name, - &db_handle, dpb.getBufferLength(), - reinterpret_cast(dpb.getBuffer()))) + if (isc_attach_database(tdgbl->status_vector, 0, database_name, &db_handle, + dpb.getBufferLength(), reinterpret_cast(dpb.getBuffer()))) { general_on_error(); } @@ -646,29 +638,23 @@ int RESTORE_restore (const TEXT* file_name, dpb.reset(isc_dpb_version1); if (tdgbl->gbl_sw_user) { - dpb.insertString(isc_dpb_user_name, - tdgbl->gbl_sw_user, - strlen(tdgbl->gbl_sw_user)); + dpb.insertString(isc_dpb_user_name, tdgbl->gbl_sw_user, strlen(tdgbl->gbl_sw_user)); } if (tdgbl->gbl_sw_password) { - dpb.insertString(tdgbl->uSvc->isService() ? - isc_dpb_password_enc : isc_dpb_password, - tdgbl->gbl_sw_password, - strlen(tdgbl->gbl_sw_password)); + dpb.insertString(tdgbl->uSvc->isService() ? isc_dpb_password_enc : isc_dpb_password, + tdgbl->gbl_sw_password, strlen(tdgbl->gbl_sw_password)); } if (tdgbl->gbl_sw_tr_user) { - dpb.insertString(isc_dpb_trusted_auth, - tdgbl->gbl_sw_tr_user, strlen(tdgbl->gbl_sw_tr_user)); + dpb.insertString(isc_dpb_trusted_auth, tdgbl->gbl_sw_tr_user, strlen(tdgbl->gbl_sw_tr_user)); } dpb.insertByte(isc_dpb_set_db_readonly, 1); dpb.insertByte(isc_dpb_no_db_triggers, 1); - if (isc_attach_database (tdgbl->status_vector, 0, database_name, - &db_handle, dpb.getBufferLength(), - reinterpret_cast(dpb.getBuffer()))) + if (isc_attach_database(tdgbl->status_vector, 0, database_name, &db_handle, + dpb.getBufferLength(), reinterpret_cast(dpb.getBuffer()))) { general_on_error(); } @@ -683,8 +669,7 @@ int RESTORE_restore (const TEXT* file_name, namespace // unnamed, private { -void add_files(BurpGlobals* tdgbl, - const char* file_name) +void add_files(BurpGlobals* tdgbl, const char* file_name) { /************************************** * @@ -878,8 +863,7 @@ void check_db_version(BurpGlobals* tdgbl) MISC_release_request_silent(req_handle2); } -void create_database(BurpGlobals* tdgbl, - const TEXT* file_name) +void create_database(BurpGlobals* tdgbl, const TEXT* file_name) { /************************************** * @@ -1007,21 +991,16 @@ void create_database(BurpGlobals* tdgbl, } if (tdgbl->gbl_sw_user) { - dpb.insertString(isc_dpb_user_name, - tdgbl->gbl_sw_user, - strlen(tdgbl->gbl_sw_user)); + dpb.insertString(isc_dpb_user_name, tdgbl->gbl_sw_user, strlen(tdgbl->gbl_sw_user)); } if (tdgbl->gbl_sw_password) { - dpb.insertString(tdgbl->uSvc->isService() ? - isc_dpb_password_enc : isc_dpb_password, - tdgbl->gbl_sw_password, - strlen(tdgbl->gbl_sw_password)); + dpb.insertString(tdgbl->uSvc->isService() ? isc_dpb_password_enc : isc_dpb_password, + tdgbl->gbl_sw_password, strlen(tdgbl->gbl_sw_password)); } if (tdgbl->gbl_sw_tr_user) { - dpb.insertString(isc_dpb_trusted_auth, - tdgbl->gbl_sw_tr_user, strlen(tdgbl->gbl_sw_tr_user)); + dpb.insertString(isc_dpb_trusted_auth, tdgbl->gbl_sw_tr_user, strlen(tdgbl->gbl_sw_tr_user)); } if (page_buffers) { @@ -1056,10 +1035,9 @@ void create_database(BurpGlobals* tdgbl, strlen(tdgbl->gbl_sw_fix_fss_metadata)); } - if (isc_create_database (status_vector, 0, file_name, - &DB, dpb.getBufferLength(), - reinterpret_cast(dpb.getBuffer()), - 0)) + if (isc_create_database(status_vector, 0, file_name, &DB, + dpb.getBufferLength(), reinterpret_cast(dpb.getBuffer()), + 0)) { BURP_error_redirect (status_vector, 33, SafeArg() << file_name); // msg 33 failed to create database %s @@ -1159,8 +1137,7 @@ void eat_text(BurpGlobals* tdgbl) MVOL_skip_block(tdgbl, l); } -burp_rel* find_relation(BurpGlobals* tdgbl, - const TEXT* name) +burp_rel* find_relation(BurpGlobals* tdgbl, const TEXT* name) { /************************************** * @@ -1175,8 +1152,7 @@ burp_rel* find_relation(BurpGlobals* tdgbl, **************************************/ // Why isn't strcmp used here? - for (burp_rel* relation = tdgbl->relations; relation; - relation = relation->rel_next) + for (burp_rel* relation = tdgbl->relations; relation; relation = relation->rel_next) { for (const TEXT* p = relation->rel_name, *q = name; *p == *q; p++, q++) { if (!*p) @@ -1230,9 +1206,12 @@ bool get_acl(BurpGlobals* tdgbl, * **************************************/ - static const UCHAR blr_items[] = {isc_info_blob_max_segment, - isc_info_blob_total_length, - isc_info_blob_num_segments}; + static const UCHAR blr_items[] = + { + isc_info_blob_max_segment, + isc_info_blob_total_length, + isc_info_blob_num_segments + }; // If the blob is null, don't store it. It will be restored as null. @@ -1393,9 +1372,7 @@ bool get_acl(BurpGlobals* tdgbl, return true; } -void get_array(BurpGlobals* tdgbl, - burp_rel* relation, - UCHAR* record_buffer) +void get_array(BurpGlobals* tdgbl, burp_rel* relation, UCHAR* record_buffer) { /************************************** * @@ -1515,10 +1492,8 @@ void get_array(BurpGlobals* tdgbl, int divisor = 1; for (int i2 = (2 * (i1 + 1) + 1); i2 <= field->fld_dimensions * 2; i2 += 2) divisor *= (field->fld_ranges[i2] - field->fld_ranges[i2 - 1] + 1); - last_element_dim[i1] = - (elements_remaining - 1) / divisor + field->fld_ranges[i3]; - elements_remaining -= - (last_element_dim[i1] - field->fld_ranges[i3]) * divisor; + last_element_dim[i1] = (elements_remaining - 1) / divisor + field->fld_ranges[i3]; + elements_remaining -= (last_element_dim[i1] - field->fld_ranges[i3]) * divisor; i3 += 2; } @@ -1556,24 +1531,27 @@ void get_array(BurpGlobals* tdgbl, add_byte(blr, isc_sdl_struct); add_byte(blr, 1); - if (field->fld_type == blr_text || field->fld_type == blr_varying) + switch (field->fld_type) { + case blr_text: + case blr_varying: if (field->fld_type == blr_text) add_byte(blr, blr_text2); else add_byte(blr, blr_varying2); add_word(blr, field->fld_character_set_id); add_word(blr, field->fld_length); - } - else if (field->fld_type == blr_short || field->fld_type == blr_long || - field->fld_type == blr_quad || field->fld_type == blr_int64) - { + break; + case blr_short: + case blr_long: + case blr_quad: + case blr_int64: add_byte(blr, field->fld_type); add_byte(blr, field->fld_scale); - } - else + break; + default: add_byte(blr, field->fld_type); - + } add_byte(blr, isc_sdl_relation); add_string(blr, relation->rel_name); @@ -1605,8 +1583,7 @@ void get_array(BurpGlobals* tdgbl, // dims were (1,2), we would just do a isc_put_slice(1..1, 1..2). // This is applied for any number of dimensions. // - for (range = field->fld_ranges, count = 0; range < end_ranges; - range += 2, count++) + for (range = field->fld_ranges, count = 0; range < end_ranges; range += 2, count++) { add_byte(blr, isc_sdl_do2); add_byte(blr, count); @@ -1627,8 +1604,7 @@ void get_array(BurpGlobals* tdgbl, // we perform. // if (current_dim + 1 == field->fld_dimensions - 1 && - field->fld_dimensions - count == 2 && - last_element_dim[count + 1] == range[3]) + field->fld_dimensions - count == 2 && last_element_dim[count + 1] == range[3]) { add_byte(blr, isc_sdl_long_integer); add_long(blr, range[0]); @@ -1658,7 +1634,7 @@ void get_array(BurpGlobals* tdgbl, lower = range[0]; add_byte(blr, isc_sdl_long_integer); upper = (current_dim == field->fld_dimensions - 1) ? - last_element_dim[count] : (last_element_dim[count] - 1); + last_element_dim[count] : (last_element_dim[count] - 1); if (upper < range[0]) { /** @@ -1754,12 +1730,11 @@ void get_array(BurpGlobals* tdgbl, CAN_slice (&xdr_buffer, &xdr_slice, FALSE, blr_length, blr_buffer); } - if (isc_put_slice (status_vector, &DB, &gds_trans, - blob_id, blr_length, reinterpret_cast(blr_buffer), - 0, // param length for subset of an array handling - NULL, // param for subset of an array handling - elements_written * field->fld_length, - buffer + data_at)) + if (isc_put_slice(status_vector, &DB, &gds_trans, + blob_id, blr_length, reinterpret_cast(blr_buffer), + 0, // param length for subset of an array handling + NULL, // param for subset of an array handling + elements_written * field->fld_length, buffer + data_at)) { BURP_print (81, field->fld_name); // msg 81 error accessing blob field %s -- continuing @@ -1786,24 +1761,27 @@ void get_array(BurpGlobals* tdgbl, add_byte(blr, isc_sdl_struct); add_byte(blr, 1); - if (field->fld_type == blr_text || field->fld_type == blr_varying) + switch (field->fld_type) { + case blr_text: + case blr_varying: if (field->fld_type == blr_text) add_byte(blr, blr_text2); else add_byte(blr, blr_varying2); add_word(blr, field->fld_character_set_id); add_word(blr, field->fld_length); - } - else if (field->fld_type == blr_short || field->fld_type == blr_long || - field->fld_type == blr_quad || field->fld_type == blr_int64) - { + break; + case blr_short: + case blr_long: + case blr_quad: + case blr_int64: add_byte(blr, field->fld_type); add_byte(blr, field->fld_scale); - } - else + break; + default: add_byte(blr, field->fld_type); - + } add_byte(blr, isc_sdl_relation); add_string(blr, relation->rel_name); @@ -1876,12 +1854,12 @@ void get_array(BurpGlobals* tdgbl, CAN_slice (&xdr_buffer, &xdr_slice, FALSE, blr_length, blr_buffer); - if (isc_put_slice (status_vector, &DB, &gds_trans, - blob_id, blr_length, - reinterpret_cast(blr_buffer), - 0, // param length for subset of an array handling - NULL, // param for subset of an array handling - return_length, buffer)) + if (isc_put_slice(status_vector, &DB, &gds_trans, + blob_id, blr_length, + reinterpret_cast(blr_buffer), + 0, // param length for subset of an array handling + NULL, // param for subset of an array handling + return_length, buffer)) { BURP_print (81, field->fld_name); // msg 81 error accessing blob field %s -- continuing @@ -1898,9 +1876,7 @@ void get_array(BurpGlobals* tdgbl, BURP_free (xdr_buffer.lstr_address); } -void get_blob(BurpGlobals* tdgbl, - const burp_fld* fields, - UCHAR* record_buffer) +void get_blob(BurpGlobals* tdgbl, const burp_fld* fields, UCHAR* record_buffer) { /************************************** * @@ -2003,9 +1979,7 @@ void get_blob(BurpGlobals* tdgbl, } -void get_blr_blob(BurpGlobals* tdgbl, - ISC_QUAD& blob_id, - bool glb_trans) +void get_blr_blob(BurpGlobals* tdgbl, ISC_QUAD& blob_id, bool glb_trans) { /************************************** * @@ -2108,7 +2082,7 @@ bool get_character_set(BurpGlobals* tdgbl) case att_charset_form: X.RDB$FORM_OF_USE.NULL = FALSE; - GET_TEXT(X.RDB$FORM_OF_USE); + GET_TEXT(X.RDB$FORM_OF_USE); break; case att_charset_numchar: @@ -2422,8 +2396,7 @@ bool get_collation(BurpGlobals* tdgbl) return true; } -rec_type get_data(BurpGlobals* tdgbl, - burp_rel* relation) +rec_type get_data(BurpGlobals* tdgbl, burp_rel* relation) { /************************************** * @@ -2538,8 +2511,7 @@ rec_type get_data(BurpGlobals* tdgbl, length = type_lengths[dtype_blob]; if (tdgbl->gbl_sw_fix_fss_data && !(field->fld_flags & FLD_array) && - field->fld_sub_type == isc_blob_text && - field->fld_character_set_id == CS_UNICODE_FSS) + field->fld_sub_type == isc_blob_text && field->fld_character_set_id == CS_UNICODE_FSS) { add_byte(blr, blr_blob2); add_word(blr, field->fld_sub_type); @@ -2628,8 +2600,8 @@ rec_type get_data(BurpGlobals* tdgbl, ISC_STATUS_ARRAY status_vector; USHORT blr_length = blr - blr_buffer; - if (isc_compile_request (status_vector, &DB, &request, - blr_length, reinterpret_cast(blr_buffer))) + if (isc_compile_request (status_vector, &DB, &request, + blr_length, reinterpret_cast(blr_buffer))) { isc_print_blr(reinterpret_cast(blr_buffer), NULL, NULL, 0); if (!tdgbl->gbl_sw_incremental) @@ -2744,8 +2716,7 @@ rec_type get_data(BurpGlobals* tdgbl, } - if (isc_start_and_send (status_vector, &request, &gds_trans, 0, - (USHORT) length, buffer, 0)) + if (isc_start_and_send (status_vector, &request, &gds_trans, 0, (USHORT) length, buffer, 0)) { if (status_vector[1] == isc_not_valid) { @@ -2921,8 +2892,7 @@ bool get_exception(BurpGlobals* tdgbl) } -burp_fld* get_field(BurpGlobals* tdgbl, - burp_rel* relation) +burp_fld* get_field(BurpGlobals* tdgbl, burp_rel* relation) { /************************************** * @@ -4058,8 +4028,8 @@ bool get_global_field(BurpGlobals* tdgbl) if (tdgbl->gbl_sw_fix_fss_data && tdgbl->gbl_sw_fix_fss_data_id == 0 && !X.RDB$CHARACTER_SET_ID.NULL && X.RDB$CHARACTER_SET_ID == CS_UNICODE_FSS && ((!X.RDB$CHARACTER_LENGTH.NULL && - (X.RDB$FIELD_TYPE == blr_text || X.RDB$FIELD_TYPE == blr_varying)) || - X.RDB$FIELD_TYPE == blr_blob)) + (X.RDB$FIELD_TYPE == blr_text || X.RDB$FIELD_TYPE == blr_varying)) || + X.RDB$FIELD_TYPE == blr_blob)) { if (X.RDB$FIELD_TYPE != blr_blob) X.RDB$CHARACTER_LENGTH = X.RDB$FIELD_LENGTH; @@ -4397,8 +4367,8 @@ bool get_global_field(BurpGlobals* tdgbl) if (tdgbl->gbl_sw_fix_fss_data && tdgbl->gbl_sw_fix_fss_data_id == 0 && !X.RDB$CHARACTER_SET_ID.NULL && X.RDB$CHARACTER_SET_ID == CS_UNICODE_FSS && ((!X.RDB$CHARACTER_LENGTH.NULL && - (X.RDB$FIELD_TYPE == blr_text || X.RDB$FIELD_TYPE == blr_varying)) || - X.RDB$FIELD_TYPE == blr_blob)) + (X.RDB$FIELD_TYPE == blr_text || X.RDB$FIELD_TYPE == blr_varying)) || + X.RDB$FIELD_TYPE == blr_blob)) { if (X.RDB$FIELD_TYPE != blr_blob) X.RDB$CHARACTER_LENGTH = X.RDB$FIELD_LENGTH; @@ -4423,8 +4393,7 @@ bool get_global_field(BurpGlobals* tdgbl) return true; } -bool get_index(BurpGlobals* tdgbl, - const burp_rel* relation) +bool get_index(BurpGlobals* tdgbl, const burp_rel* relation) { /************************************** * @@ -4709,8 +4678,7 @@ bool get_procedure(BurpGlobals* tdgbl) SSHORT l; scan_attr_t scan_next_attr; - isc_tr_handle local_trans = - tdgbl->global_trans ? tdgbl->global_trans : gds_trans; + isc_tr_handle local_trans = tdgbl->global_trans ? tdgbl->global_trans : gds_trans; burp_prc* procedure = (burp_prc*) BURP_alloc_zero (sizeof(burp_prc)); procedure->prc_next = tdgbl->procedures; @@ -4739,8 +4707,8 @@ bool get_procedure(BurpGlobals* tdgbl) { case att_procedure_name: l = GET_TEXT(X.RDB$PROCEDURE_NAME); - procedure->prc_name_length = l; - strcpy (procedure->prc_name, X.RDB$PROCEDURE_NAME); + procedure->prc_name_length = l; + strcpy (procedure->prc_name, X.RDB$PROCEDURE_NAME); MISC_terminate (X.RDB$PROCEDURE_NAME, temp, l, sizeof(temp)); BURP_verbose (195, temp); // msg 195 restoring stored procedure %s @@ -4850,8 +4818,8 @@ bool get_procedure(BurpGlobals* tdgbl) { case att_procedure_name: l = GET_TEXT(X.RDB$PROCEDURE_NAME); - procedure->prc_name_length = l; - strcpy (procedure->prc_name, X.RDB$PROCEDURE_NAME); + procedure->prc_name_length = l; + strcpy (procedure->prc_name, X.RDB$PROCEDURE_NAME); MISC_terminate (X.RDB$PROCEDURE_NAME, temp, l, sizeof(temp)); BURP_verbose (195, temp); // msg 195 restoring stored procedure %s @@ -4951,8 +4919,7 @@ bool get_procedure_prm (BurpGlobals* tdgbl, GDS_NAME procptr) TEXT temp[GDS_NAME_LEN]; scan_attr_t scan_next_attr; - isc_tr_handle local_trans = - tdgbl->global_trans ? tdgbl->global_trans : gds_trans; + isc_tr_handle local_trans = tdgbl->global_trans ? tdgbl->global_trans : gds_trans; if (tdgbl->RESTORE_ods >= DB_VERSION_DDL11_1) { @@ -4960,7 +4927,7 @@ bool get_procedure_prm (BurpGlobals* tdgbl, GDS_NAME procptr) REQUEST_HANDLE tdgbl->handles_get_procedure_prm_req_handle1) X IN RDB$PROCEDURE_PARAMETERS - strcpy (X.RDB$PROCEDURE_NAME, procptr); + strcpy(X.RDB$PROCEDURE_NAME, procptr); X.RDB$DESCRIPTION.NULL = TRUE; X.RDB$DEFAULT_VALUE.NULL = TRUE; @@ -6265,8 +6232,7 @@ bool get_trigger(BurpGlobals* tdgbl) BASED_ON RDB$TRIGGERS.RDB$TRIGGER_NAME name; scan_attr_t scan_next_attr; - isc_tr_handle local_trans = - tdgbl->global_trans ? tdgbl->global_trans : gds_trans; + isc_tr_handle local_trans = tdgbl->global_trans ? tdgbl->global_trans : gds_trans; if (tdgbl->RESTORE_ods >= DB_VERSION_DDL11_1) { @@ -6548,8 +6514,7 @@ bool get_trigger_message(BurpGlobals* tdgbl) if (flag) return true; - isc_tr_handle local_trans = - tdgbl->global_trans ? tdgbl->global_trans : gds_trans; + isc_tr_handle local_trans = tdgbl->global_trans ? tdgbl->global_trans : gds_trans; STORE (TRANSACTION_HANDLE local_trans REQUEST_HANDLE tdgbl->handles_get_trigger_message_req_handle2) @@ -6885,8 +6850,7 @@ bool get_view(BurpGlobals* tdgbl, // If there is a global transaction then use it - isc_tr_handle local_trans = - tdgbl->global_trans ? tdgbl->global_trans : gds_trans; + isc_tr_handle local_trans = tdgbl->global_trans ? tdgbl->global_trans : gds_trans; STORE (TRANSACTION_HANDLE local_trans REQUEST_HANDLE tdgbl->handles_get_view_req_handle1) diff --git a/src/burp/spit.cpp b/src/burp/spit.cpp index 017f28b513..7f3a9ad6ce 100644 --- a/src/burp/spit.cpp +++ b/src/burp/spit.cpp @@ -120,27 +120,22 @@ const size_t b_fil_len = sizeof(b_fil); ****************************************************** */ -static int conv_ntoc(SLONG, TEXT *); +static int conv_ntoc(SLONG, TEXT*); static int free_file_list(b_fil*); static int final_flush_io_buff(const UCHAR*, SLONG, FILE_DESC); -static int final_read_and_write(FILE_DESC, FILE_DESC, - const TEXT*, SLONG, UCHAR **, bool*); -static int flush_io_buff(const UCHAR*, SLONG, - FILE_DESC, SINT64, SLONG*, bool*); -static int get_file_name(const SCHAR *, SINT64, b_fil**); -static int get_file_size(const SCHAR *, const SCHAR *, SINT64*); -static int get_function_option(const SCHAR *, gsplit_option*, const SCHAR *, - const in_sw_tab_t* const); +static int final_read_and_write(FILE_DESC, FILE_DESC, const TEXT*, SLONG, UCHAR**, bool*); +static int flush_io_buff(const UCHAR*, SLONG, FILE_DESC, SINT64, SLONG*, bool*); +static int get_file_name(const SCHAR*, SINT64, b_fil**); +static int get_file_size(const SCHAR*, const SCHAR *, SINT64*); +static int get_function_option(const SCHAR*, gsplit_option*, const SCHAR*, const in_sw_tab_t* const); static int gen_multy_bakup_files(b_fil*, FILE_DESC, SLONG); -static int set_hdr_str(TEXT *, const TEXT *, SLONG, SLONG); +static int set_hdr_str(TEXT*, const TEXT*, SLONG, SLONG); static int join_multy_bakup_files(b_fil*); -static int print_clo(const TEXT *); -static int read_and_write(FILE_DESC, FILE_DESC, - const TEXT*, SLONG, - SINT64, UCHAR **, bool*, SINT64*, SLONG *); -static int read_and_write_for_join(FILE_DESC, const TEXT*, - UCHAR **, SLONG, SLONG *); -static int write_header(const b_fil*, header_rec, FILE_DESC, TEXT *); +static int print_clo(const TEXT*); +static int read_and_write(FILE_DESC, FILE_DESC, const TEXT*, SLONG, + SINT64, UCHAR**, bool*, SINT64*, SLONG*); +static int read_and_write_for_join(FILE_DESC, const TEXT*, UCHAR**, SLONG, SLONG*); +static int write_header(const b_fil*, header_rec, FILE_DESC, TEXT*); @@ -153,14 +148,11 @@ static int write_header(const b_fil*, header_rec, FILE_DESC, TEXT *); int main( int argc, char *argv[]) { - SLONG ret_cd, file_num = 0; - const SCHAR *prog_name = argv[0]; if (argc < 2) { - fprintf(stderr, "%s: No Command Line Option Specified\n", - argv[0]); - ret_cd = print_clo(prog_name); + fprintf(stderr, "%s: No Command Line Option Specified\n", argv[0]); + print_clo(prog_name); return FB_FAILURE; } @@ -180,8 +172,7 @@ int main( int argc, char *argv[]) ******************************* */ - for (in_sw_tab_t* in_sw_tab = spit_in_sw_table; in_sw_tab->in_sw_name; - in_sw_tab++) + for (in_sw_tab_t* in_sw_tab = spit_in_sw_table; in_sw_tab->in_sw_name; in_sw_tab++) { in_sw_tab->in_sw_state = false; } @@ -191,6 +182,7 @@ int main( int argc, char *argv[]) *********************************** */ + SLONG ret_cd, file_num = 0; bool file_nm_sw = false; const SCHAR* string = NULL; @@ -201,8 +193,7 @@ int main( int argc, char *argv[]) string = *argv; if (*string == '-') { argv++; - ret_cd = get_function_option(prog_name, &sw_replace, - string, spit_in_sw_table); + ret_cd = get_function_option(prog_name, &sw_replace, string, spit_in_sw_table); if (ret_cd == FB_FAILURE) { ret_cd = free_file_list(file_list); return FB_FAILURE; @@ -213,28 +204,24 @@ int main( int argc, char *argv[]) switch (sw_replace) { case IN_SW_SPIT_SP: - if (!file_nm_sw) { // process file name + if (!file_nm_sw) + { // process file name file_size = 0; file_num = file_num + 1; if (file_num > MAX_NUM_OF_FILES) { - fprintf(stderr, - "%s: maximum of files is %d\n", - prog_name, MAX_NUM_OF_FILES); - ret_cd = print_clo(prog_name); - ret_cd = free_file_list(file_list); + fprintf(stderr, "%s: maximum of files is %d\n", prog_name, MAX_NUM_OF_FILES); + print_clo(prog_name); + free_file_list(file_list); return FB_FAILURE; } if (strlen(string) > MAX_FILE_NM_LEN) { - fprintf(stderr, - "%s: file name %s is too long\n", - prog_name, string); - fprintf(stderr, - "%s: maximum length of file name is %d bytes\n", + fprintf(stderr, "%s: file name %s is too long\n", prog_name, string); + fprintf(stderr, "%s: maximum length of file name is %d bytes\n", prog_name, MAX_FILE_NM_LEN); - ret_cd = print_clo(prog_name); - ret_cd = free_file_list(file_list); + print_clo(prog_name); + free_file_list(file_list); return FB_FAILURE; } @@ -288,8 +275,7 @@ int main( int argc, char *argv[]) break; default: - fprintf(stderr, "%s: invalid option '%s'\n", - prog_name, string); + fprintf(stderr, "%s: invalid option '%s'\n", prog_name, string); ret_cd = print_clo(prog_name); ret_cd = free_file_list(file_list); return FB_FAILURE; @@ -300,23 +286,20 @@ int main( int argc, char *argv[]) } // while (argv < end) if (!file_list && sw_replace != IN_SW_SPIT_0) { - fprintf(stderr, - "%s: invalid option '%s', rest of parameters is missing\n", - prog_name, string); + fprintf(stderr, "%s: invalid option '%s', rest of parameters is missing\n", prog_name, string); ret_cd = print_clo(prog_name); ret_cd = free_file_list(file_list); return FB_FAILURE; } FILE_DESC input_file_desc; - switch (sw_replace) { + switch (sw_replace) + { case IN_SW_SPIT_SP: input_file_desc = GBAK_STDIN_DESC; ret_cd = gen_multy_bakup_files(file_list, input_file_desc, file_num); if (ret_cd == FB_FAILURE) { - fprintf(stderr, - "%s: progam fails to generate multi-volumn back-up files\n", - prog_name); + fprintf(stderr, "%s: progam fails to generate multi-volumn back-up files\n", prog_name); ret_cd = free_file_list(file_list); return FB_FAILURE; } @@ -325,9 +308,7 @@ int main( int argc, char *argv[]) case IN_SW_SPIT_JT: ret_cd = join_multy_bakup_files(file_list); if (ret_cd == FB_FAILURE) { - fprintf(stderr, - "%s: progam fails to join multi-volumn back-up files\n", - prog_name); + fprintf(stderr, "%s: progam fails to join multi-volumn back-up files\n", prog_name); ret_cd = free_file_list(file_list); return FB_FAILURE; } @@ -394,9 +375,7 @@ static int get_function_option(const SCHAR* prog_name, } if (*sw_replace != in_sw_tab->in_sw) { - fprintf(stderr, - "%s: invalid option '%s', incompatible option\n", - prog_name, string); + fprintf(stderr, "%s: invalid option '%s', incompatible option\n", prog_name, string); ret_cd = print_clo(prog_name); return FB_FAILURE; } @@ -576,22 +555,19 @@ static int gen_multy_bakup_files(b_fil* file_list, FILE_DESC input_file_desc, SL header_str[pos] = BLANK; pos = 0; - ret_cd = set_hdr_str(header_str, header_rec_name, - pos, sizeof(hdr_rec.name)); + ret_cd = set_hdr_str(header_str, header_rec_name, pos, sizeof(hdr_rec.name)); size_t indx; for (indx = 0; indx < sizeof(hdr_rec.name); indx++) hdr_rec.name[indx] = BLANK; pos = pos + sizeof(hdr_rec.name); time_t clock = time(0); // was SLONG - ret_cd = set_hdr_str(header_str, ctime(&clock), - pos, sizeof(hdr_rec.date_time)); + ret_cd = set_hdr_str(header_str, ctime(&clock), pos, sizeof(hdr_rec.date_time)); for (indx = 0; indx < sizeof(hdr_rec.date_time); indx++) hdr_rec.date_time[indx] = BLANK; pos = pos + sizeof(hdr_rec.date_time); - ret_cd = set_hdr_str(header_str, ", file No. ", - pos, sizeof(hdr_rec.text1)); + ret_cd = set_hdr_str(header_str, ", file No. ", pos, sizeof(hdr_rec.text1)); for (indx = 0; indx < sizeof(hdr_rec.text1); indx++) hdr_rec.text1[indx] = BLANK; @@ -606,8 +582,7 @@ static int gen_multy_bakup_files(b_fil* file_list, FILE_DESC input_file_desc, SL ret_cd = conv_ntoc(file_num, num_arr); if (ret_cd == FB_FAILURE) { free(io_buffer); - fprintf(stderr, - "gsplit could not convert numeric data to character data\n"); + fprintf(stderr, "gsplit could not convert numeric data to character data\n"); return FB_FAILURE; } @@ -634,7 +609,8 @@ static int gen_multy_bakup_files(b_fil* file_list, FILE_DESC input_file_desc, SL SINT64 byte_read = 0; SINT64 file_size = 0; - while (true) { + while (true) + { if (fl_ptr != NULL) { byte_read = 0; byte_write = 0; @@ -649,18 +625,14 @@ static int gen_multy_bakup_files(b_fil* file_list, FILE_DESC input_file_desc, SL output_fl_desc = open(file_name, mode_write, mask); if (output_fl_desc == -1) { free(io_buffer); - fprintf(stderr, "can not open back up file %s\n", - file_name); + fprintf(stderr, "can not open back up file %s\n", file_name); return FB_FAILURE; } - ret_cd = - write_header(fl_ptr, hdr_rec, output_fl_desc, header_str); + ret_cd = write_header(fl_ptr, hdr_rec, output_fl_desc, header_str); if (ret_cd == FB_FAILURE) { free(io_buffer); - fprintf(stderr, - "could not write header record to file %s\n", - file_name); + fprintf(stderr, "could not write header record to file %s\n", file_name); return FB_FAILURE; } @@ -672,11 +644,12 @@ static int gen_multy_bakup_files(b_fil* file_list, FILE_DESC input_file_desc, SL else io_size = IO_BUFFER_SIZE; - if (!fl_ptr) { - while (!end_of_input) { + if (!fl_ptr) + { + while (!end_of_input) + { ret_cd = final_read_and_write(input_file_desc, output_fl_desc, - file_name, io_size, &io_buffer, - &end_of_input); + file_name, io_size, &io_buffer, &end_of_input); if (ret_cd == FB_FAILURE) { free(io_buffer); return FB_FAILURE; @@ -688,13 +661,16 @@ static int gen_multy_bakup_files(b_fil* file_list, FILE_DESC input_file_desc, SL } } } - else { - while ((file_size > byte_read) && (fl_ptr != NULL)) { + else + { + while ((file_size > byte_read) && (fl_ptr != NULL)) + { ret_cd = read_and_write(input_file_desc, output_fl_desc, file_name, io_size, file_size, &io_buffer, &end_of_input, &byte_read, &byte_write); - switch (ret_cd) { + switch (ret_cd) + { case FB_FAILURE: free(io_buffer); return FB_FAILURE; @@ -706,42 +682,36 @@ static int gen_multy_bakup_files(b_fil* file_list, FILE_DESC input_file_desc, SL */ const UCHAR* remaining_io = io_buffer + byte_write; SLONG remaining_io_len = IO_BUFFER_SIZE - byte_write; - while (!flush_done && (fl_ptr != NULL)) { + while (!flush_done && (fl_ptr != NULL)) + { if (!fl_ptr->b_fil_next && fl_ptr->b_fil_size == 0) fl_ptr->b_fil_size = MIN_FILE_SIZE; file_size = fl_ptr->b_fil_size - header_rec_len; file_name = fl_ptr->b_fil_name; - output_fl_desc = - open(file_name, mode_write, mask); + output_fl_desc = open(file_name, mode_write, mask); if (output_fl_desc == -1) { free(io_buffer); - fprintf(stderr, - "can not open back up file %s\n", - file_name); + fprintf(stderr, "can not open back up file %s\n", file_name); return FB_FAILURE; } - ret_cd = write_header(fl_ptr, hdr_rec, - output_fl_desc, header_str); + ret_cd = write_header(fl_ptr, hdr_rec, output_fl_desc, header_str); if (ret_cd == FB_FAILURE) { free(io_buffer); - fprintf(stderr, - "fail to write header rec to file %s\n", - file_name); + fprintf(stderr, "fail to write header rec to file %s\n", file_name); return FB_FAILURE; } fl_ptr = fl_ptr->b_fil_next; - if (!fl_ptr) { + if (!fl_ptr) + { ret_cd = final_flush_io_buff(remaining_io, remaining_io_len, output_fl_desc); if (ret_cd == FB_FAILURE) { - fprintf(stderr, - "gsplit could not do backup due"); - fprintf(stderr, - " to lack of space or I/O problem\n"); + fprintf(stderr, "gsplit could not do backup due"); + fprintf(stderr, " to lack of space or I/O problem\n"); free(io_buffer); return FB_FAILURE; } @@ -755,8 +725,7 @@ static int gen_multy_bakup_files(b_fil* file_list, FILE_DESC input_file_desc, SL &byte_write, &flush_done); if (ret_cd == FB_FAILURE) { - fprintf(stderr, - "gsplit could not do backup due"); + fprintf(stderr, "gsplit could not do backup due"); fprintf(stderr, " I/O problem\n"); free(io_buffer); return FB_FAILURE; @@ -831,7 +800,8 @@ static int read_and_write(FILE_DESC input_file_desc, else read_cnt = read(input_file_desc, *io_buffer, io_size); - switch (read_cnt) { + switch (read_cnt) + { case 0: // no more data to be read close(output_fl_desc); *end_of_input = true; @@ -840,8 +810,7 @@ static int read_and_write(FILE_DESC input_file_desc, case -1: // read failed close(output_fl_desc); - fprintf(stderr, - "fail to read input from stdin, errno = %d\n", errno); + fprintf(stderr, "fail to read input from stdin, errno = %d\n", errno); return FB_FAILURE; default: // read ok @@ -851,7 +820,8 @@ static int read_and_write(FILE_DESC input_file_desc, const SLONG write_cnt = write(output_fl_desc, *io_buffer, read_cnt); - switch (write_cnt) { + switch (write_cnt) + { case -1: // write failed close(output_fl_desc); return FB_FAILURE; @@ -892,7 +862,8 @@ static int final_read_and_write(FILE_DESC input_file_desc, const SLONG read_cnt = read(input_file_desc, *io_buffer, io_size); - switch (read_cnt) { + switch (read_cnt) + { case 0: // no more data to be read close(output_fl_desc); *end_of_input = true; @@ -900,8 +871,7 @@ static int final_read_and_write(FILE_DESC input_file_desc, case -1: // read failed close(output_fl_desc); - fprintf(stderr, - "problem when reading input file, errno = %d\n", errno); + fprintf(stderr, "problem when reading input file, errno = %d\n", errno); return FB_FAILURE; default: // read ok @@ -910,7 +880,8 @@ static int final_read_and_write(FILE_DESC input_file_desc, const SLONG write_cnt = write(output_fl_desc, *io_buffer, read_cnt); - switch (write_cnt) { + switch (write_cnt) + { case -1: // write failed close(output_fl_desc); return FB_FAILURE; @@ -919,9 +890,7 @@ static int final_read_and_write(FILE_DESC input_file_desc, if (write_cnt == read_cnt) // write ok return FB_SUCCESS; - fprintf(stderr, - "There is no enough space to write to back up file %s\n", - file_name); + fprintf(stderr, "There is no enough space to write to back up file %s\n", file_name); close(output_fl_desc); return FB_FAILURE; } @@ -968,9 +937,7 @@ static int join_multy_bakup_files( b_fil* file_list) next_fl = fl_ptr->b_fil_next; const TEXT* file_name = fl_ptr->b_fil_name; - SLONG ret_cd = - read_and_write_for_join(output_fl_desc, file_name, &io_buffer, - cnt, &total_int); + SLONG ret_cd = read_and_write_for_join(output_fl_desc, file_name, &io_buffer, cnt, &total_int); if (ret_cd == FB_FAILURE) { free(io_buffer); @@ -1017,9 +984,7 @@ static int read_and_write_for_join(FILE_DESC output_fl_desc, int read_cnt = read(input_fl_desc, *io_buffer, header_rec_len); if (read_cnt != static_cast(header_rec_len)) { close(input_fl_desc); - fprintf(stderr, - "progam fails to read gsplit header record in back-up file%s\n", - file_name); + fprintf(stderr, "progam fails to read gsplit header record in back-up file%s\n", file_name); return FB_FAILURE; } @@ -1028,13 +993,11 @@ static int read_and_write_for_join(FILE_DESC output_fl_desc, if (ret_cd != 0) { close(input_fl_desc); fprintf(stderr, "gsplit: expected GSPLIT description record\n"); - fprintf(stderr, - "gsplit: Exiting before completion due to errors\n"); + fprintf(stderr, "gsplit: Exiting before completion due to errors\n"); return FB_FAILURE; } - SLONG skip_to_num = sizeof(hdr_rec.name) + sizeof(hdr_rec.date_time) + - sizeof(hdr_rec.text1); + SLONG skip_to_num = sizeof(hdr_rec.name) + sizeof(hdr_rec.date_time) + sizeof(hdr_rec.text1); SLONG skip_to_total = skip_to_num + sizeof(hdr_rec.num) + sizeof(hdr_rec.text2); char_ptr1 = reinterpret_cast(*io_buffer + skip_to_num); @@ -1057,18 +1020,18 @@ static int read_and_write_for_join(FILE_DESC output_fl_desc, if ((num_int != cnt) || (num_int > *total_int)) { close(input_fl_desc); - fprintf(stderr, - "gsplit: join backup file is out of sequence\n"); - fprintf(stderr, - "gsplit: Exiting before completion due to errors\n"); + fprintf(stderr, "gsplit: join backup file is out of sequence\n"); + fprintf(stderr, "gsplit: Exiting before completion due to errors\n"); return FB_FAILURE; } read_cnt = read(input_fl_desc, *io_buffer, IO_BUFFER_SIZE); - while (true) { - switch (read_cnt) { + while (true) + { + switch (read_cnt) + { case 0: // no more data to be read close(input_fl_desc); return FB_SUCCESS; @@ -1083,7 +1046,8 @@ static int read_and_write_for_join(FILE_DESC output_fl_desc, SLONG write_cnt = write(output_fl_desc, *io_buffer, read_cnt); - switch (write_cnt) { + switch (write_cnt) + { case -1: // write failed close(input_fl_desc); return FB_FAILURE; @@ -1164,13 +1128,11 @@ static int write_header(const b_fil* fl_ptr, SLONG ret_cd = conv_ntoc(fl_ptr->b_fil_number, num_arr); if (ret_cd == FB_FAILURE) { - printf - ("gsplit could not convert numeric data to character data\n"); + printf("gsplit could not convert numeric data to character data\n"); return FB_FAILURE; } num_arr[sizeof(num_arr) - 1] = TERMINAL; - SLONG pos = sizeof(hdr_rec.name) + sizeof(hdr_rec.date_time) + - sizeof(hdr_rec.text1); + SLONG pos = sizeof(hdr_rec.name) + sizeof(hdr_rec.date_time) + sizeof(hdr_rec.text1); ret_cd = set_hdr_str(header_str, num_arr, pos, sizeof(hdr_rec.num)); const TEXT* file_name = fl_ptr->b_fil_name; @@ -1235,12 +1197,11 @@ static int flush_io_buff(const UCHAR* remaining_io, write_cnt = write(output_fl_desc, remaining_io, remaining_io_len); } else { /* file_size <= remaining_io_len */ - - write_cnt = - write(output_fl_desc, remaining_io, (unsigned int) file_size); + write_cnt = write(output_fl_desc, remaining_io, (unsigned int) file_size); } - switch (write_cnt) { + switch (write_cnt) + { case -1: // write failed close(output_fl_desc); *flush_done = false; @@ -1250,7 +1211,6 @@ static int flush_io_buff(const UCHAR* remaining_io, if (write_cnt == remaining_io_len) // write ok *flush_done = true; else { // could not write out all remaining data - close(output_fl_desc); *flush_done = false; } @@ -1313,11 +1273,8 @@ static int print_clo(const TEXT* prog_name) fprintf(stderr, " gsplit -S[PLIT_BK_FILE] {k|m|g} [... [{k|m|g}]] or\n"); fprintf(stderr, " gsplit -J[OINT_BK_FILE] [... ]\n"); - fprintf(stderr, - "%s: option can be abbreviated to the unparenthesized characters\n", - prog_name); - fprintf(stderr, - "%s: Exiting before completion due to errors\n", prog_name); + fprintf(stderr, "%s: option can be abbreviated to the unparenthesized characters\n", prog_name); + fprintf(stderr, "%s: Exiting before completion due to errors\n", prog_name); return FB_SUCCESS; @@ -1342,7 +1299,8 @@ static int set_hdr_str(TEXT header_str[], const TEXT* in_str, SLONG pos, SLONG l const SLONG end = pos + len; for (SLONG indx = pos; indx < end; indx++) { - switch (*t_str) { + switch (*t_str) + { case NEW_LINE: case TERMINAL: header_str[indx] = ' '; diff --git a/src/common/config/config_file.cpp b/src/common/config/config_file.cpp index 0665500350..9ddb91c290 100644 --- a/src/common/config/config_file.cpp +++ b/src/common/config/config_file.cpp @@ -82,8 +82,7 @@ bool ConfigFile::stripComments(string& s) const if (!inString) // we finished a quoted string { // We don't want trash after closing the quoted string, except comments - const string::size_type startPos = - s.find_first_not_of(" \t\r", iter + 1 - s.begin()); + const string::size_type startPos = s.find_first_not_of(" \t\r", iter + 1 - s.begin()); if (startPos == string::npos || s[startPos] == '#') { s = s.substr(0, iter + 1 - s.begin()); @@ -231,8 +230,8 @@ void ConfigFile::loadConfig() #ifdef EXCEPTION_ON_NO_CONF if (fExceptionOnError) { - Firebird::string Msg = "Missing configuration file: " + - configFile.ToString() + ", exiting"; + const Firebird::string Msg = + "Missing configuration file: " + configFile.ToString() + ", exiting"; Firebird::Syslog::Record(Firebird::Syslog::Error, Msg.c_str()); Firebird::fatal_exception::raise(Msg.c_str()); } @@ -255,11 +254,11 @@ void ConfigFile::loadConfig() if (!goodLine || inputLine.find('=') == string::npos) { - Firebird::string Msg = (configFile + ": illegal line \"" + - inputLine + "\"").ToString(); + const Firebird::string Msg = + (configFile + ": illegal line \"" + inputLine + "\"").ToString(); Firebird::Syslog::Record(fExceptionOnError ? - Firebird::Syslog::Error : - Firebird::Syslog::Warning, Msg.c_str()); + Firebird::Syslog::Error : Firebird::Syslog::Warning, + Msg.c_str()); #ifdef EXCEPTION_ON_NO_CONF BadLinesCount++; #endif diff --git a/src/common/cvt.cpp b/src/common/cvt.cpp index 9539e31603..f39bb4ab0e 100644 --- a/src/common/cvt.cpp +++ b/src/common/cvt.cpp @@ -508,8 +508,7 @@ static void string_to_datetime(const dsc* desc, TEXT buffer[100]; // arbitrarily large const char* p = NULL; - const USHORT length = - CVT_make_string(desc, ttype_ascii, &p, (vary*) buffer, sizeof(buffer), err); + const USHORT length = CVT_make_string(desc, ttype_ascii, &p, (vary*) buffer, sizeof(buffer), err); const char* const end = p + length; @@ -945,8 +944,7 @@ SLONG CVT_get_long(const dsc* desc, SSHORT scale, ErrorFunction err) case dtype_text: { USHORT length = - CVT_make_string(desc, ttype_ascii, &p, (vary*) buffer, - sizeof(buffer), err); + CVT_make_string(desc, ttype_ascii, &p, (vary*) buffer, sizeof(buffer), err); scale -= CVT_decompose(p, length, dtype_long, &value, err); } break; @@ -1053,9 +1051,7 @@ double CVT_get_double(const dsc* desc, ErrorFunction err) const char* p; const USHORT length = - CVT_make_string(desc, ttype_ascii, - &p, - (vary*) buffer, sizeof(buffer), err); + CVT_make_string(desc, ttype_ascii, &p, (vary*) buffer, sizeof(buffer), err); value = 0.0; int scale = 0; SSHORT sign = 0; @@ -1297,8 +1293,7 @@ void CVT_move_common(const dsc* from, dsc* to, Callbacks* cb) return; case dtype_timestamp: - *((GDS_DATE *) to->dsc_address) = - ((GDS_TIMESTAMP *) from->dsc_address)->timestamp_date; + *((GDS_DATE *) to->dsc_address) = ((GDS_TIMESTAMP *) from->dsc_address)->timestamp_date; return; default: @@ -1328,8 +1323,7 @@ void CVT_move_common(const dsc* from, dsc* to, Callbacks* cb) return; case dtype_timestamp: - *((GDS_TIME *) to->dsc_address) = - ((GDS_TIMESTAMP *) from->dsc_address)->timestamp_time; + *((GDS_TIME *) to->dsc_address) = ((GDS_TIMESTAMP *) from->dsc_address)->timestamp_time; return; default: @@ -1383,8 +1377,7 @@ void CVT_move_common(const dsc* from, dsc* to, Callbacks* cb) { // scope USHORT strtype_unused; UCHAR *ptr; - length = l = - CVT_get_string_ptr(from, &strtype_unused, &ptr, NULL, 0, cb->err); + length = l = CVT_get_string_ptr(from, &strtype_unused, &ptr, NULL, 0, cb->err); q = ptr; } // end scope @@ -1434,8 +1427,7 @@ void CVT_move_common(const dsc* from, dsc* to, Callbacks* cb) break; case dtype_varying: - length = - MIN(length, (SLONG) (to->dsc_length - sizeof(USHORT))); + length = MIN(length, (SLONG) (to->dsc_length - sizeof(USHORT))); cb->validateData(toCharset, length, q, cb->err); toLength = length; @@ -2213,8 +2205,7 @@ SQUAD CVT_get_quad(const dsc* desc, SSHORT scale, ErrorFunction err) case dtype_text: { USHORT length = - CVT_make_string(desc, ttype_ascii, &p, (vary*) buffer, - sizeof(buffer), err); + CVT_make_string(desc, ttype_ascii, &p, (vary*) buffer, sizeof(buffer), err); scale -= CVT_decompose(p, length, dtype_quad, &value.high, err); } break; @@ -2309,8 +2300,7 @@ SINT64 CVT_get_int64(const dsc* desc, SSHORT scale, ErrorFunction err) break; case dtype_quad: - value = (((SINT64) ((SLONG *) p)[HIGH_WORD]) << 32) + - (((ULONG *) p)[LOW_WORD]); + value = (((SINT64) ((SLONG *) p)[HIGH_WORD]) << 32) + (((ULONG *) p)[LOW_WORD]); break; case dtype_real: @@ -2357,8 +2347,7 @@ SINT64 CVT_get_int64(const dsc* desc, SSHORT scale, ErrorFunction err) case dtype_text: { USHORT length = - CVT_make_string(desc, ttype_ascii, &p, (vary*) buffer, - sizeof(buffer), err); + CVT_make_string(desc, ttype_ascii, &p, (vary*) buffer, sizeof(buffer), err); scale -= CVT_decompose(p, length, dtype_int64, (SLONG *) & value, err); } break; diff --git a/src/dudley/ddl.h b/src/dudley/ddl.h index 80af772376..eeabe23430 100644 --- a/src/dudley/ddl.h +++ b/src/dudley/ddl.h @@ -100,7 +100,7 @@ typedef struct dudley_ctx { struct sym* ctx_name; struct dudley_rel* ctx_relation; struct dudley_fld* ctx_field; - USHORT ctx_view_rse; + bool ctx_view_rse; USHORT ctx_context_id; } *DUDLEY_CTX; @@ -157,7 +157,7 @@ typedef struct dudley_fld { SSHORT fld_position; /* field position */ SSHORT fld_segment_length; SSHORT fld_sub_type; - SSHORT fld_has_sub_type; + bool fld_has_sub_type; SSHORT fld_dimension; /* size of multi-dim. array */ SSHORT fld_system; /* 0 if field is user defined */ USHORT fld_flags; /* misc trash */ @@ -236,7 +236,7 @@ typedef struct funcarg { SSHORT funcarg_length; /* argument length in bytes */ SSHORT funcarg_return_arg; /* argument is the designated return arg */ SSHORT funcarg_sub_type; /* sub_type of text */ - SSHORT funcarg_has_sub_type; /* null field for sub_type field */ + bool funcarg_has_sub_type; /* null field for sub_type field */ funcarg* funcarg_next; /* next field in function */ } *FUNCARG; diff --git a/src/dudley/exe.epp b/src/dudley/exe.epp index 8d5ccbc9ff..b1dcf65cb2 100644 --- a/src/dudley/exe.epp +++ b/src/dudley/exe.epp @@ -1239,7 +1239,7 @@ static void add_global_field( DUDLEY_FLD field) if (DTYPE_IS_TEXT(make_dtype(desc.dsc_dtype))) { field->fld_scale = 0; field->fld_sub_type = desc.dsc_ttype(); - field->fld_has_sub_type = TRUE; + field->fld_has_sub_type = true; } else { field->fld_sub_type = 0; @@ -1746,10 +1746,8 @@ static void add_user_privilege( USERPRIV upriv) store_userpriv(upriv, grantor, priv, usr, upf); else /* update is the only privilege with a possible field list */ - for (upf = upriv->userpriv_upflist; upf; - upf = - upf->upfe_next) store_userpriv(upriv, grantor, priv, - usr, upf); + for (upf = upriv->userpriv_upflist; upf; upf =upf->upfe_next) + store_userpriv(upriv, grantor, priv, usr, upf); continue; } @@ -2683,10 +2681,8 @@ static void drop_user_privilege( USERPRIV upriv) erase_userpriv(upriv, priv, usr, upf); else /* update is the only privilege with a possible field list */ - for (upf = upriv->userpriv_upflist; upf; - upf = - upf->upfe_next) erase_userpriv(upriv, priv, usr, - upf); + for (upf = upriv->userpriv_upflist; upf; upf = upf->upfe_next) + erase_userpriv(upriv, priv, usr, upf); } /* don't call erase_userpriv if we just finished update */ @@ -2850,10 +2846,8 @@ static void get_relations( DBB databaseL) field->fld_next = relation->rel_fields; relation->rel_fields = field; field->fld_position = RFR.RDB$FIELD_POSITION; - relation->rel_field_position = - MAX(RFR.RDB$FIELD_POSITION, relation->rel_field_position); - field->fld_source = - HSH_typed_lookup(RFR.RDB$FIELD_SOURCE, (USHORT) 0, SYM_global); + relation->rel_field_position = MAX(RFR.RDB$FIELD_POSITION, relation->rel_field_position); + field->fld_source = HSH_typed_lookup(RFR.RDB$FIELD_SOURCE, (USHORT) 0, SYM_global); END_FOR; END_FOR; } @@ -2971,16 +2965,13 @@ static void get_triggers( DBB databaseL) T.RDB$SYSTEM_FLAG = 0 trigger = (DUDLEY_TRG) DDL_alloc(sizeof(dudley_trg)); - trigger->trg_name = symbol = - get_symbol(SYM_trigger, T.RDB$TRIGGER_NAME, (DUDLEY_CTX) trigger); + trigger->trg_name = symbol = get_symbol(SYM_trigger, T.RDB$TRIGGER_NAME, (DUDLEY_CTX) trigger); HSH_insert(symbol); - rel_name = - HSH_typed_lookup(T.RDB$RELATION_NAME, (USHORT) 0, SYM_relation); + rel_name = HSH_typed_lookup(T.RDB$RELATION_NAME, (USHORT) 0, SYM_relation); if (rel_name && rel_name->sym_object) trigger->trg_relation = (DUDLEY_REL) rel_name->sym_object; else - trigger->trg_relation = - (DUDLEY_REL) get_symbol(SYM_relation, T.RDB$RELATION_NAME, NULL); + trigger->trg_relation = (DUDLEY_REL) get_symbol(SYM_relation, T.RDB$RELATION_NAME, NULL); trigger->trg_type = (TRG_T) T.RDB$TRIGGER_TYPE; trigger->trg_inactive = T.RDB$TRIGGER_INACTIVE; trigger->trg_sequence = T.RDB$TRIGGER_SEQUENCE; @@ -3005,8 +2996,7 @@ static void get_udfs( DBB dbb) FUN.RDB$RETURN_ARGUMENT EQ ARG.RDB$ARGUMENT_POSITION FUNC function = (FUNC) DDL_alloc(sizeof(func)); function->func_database = dbb; - SYM symbol = - get_symbol(SYM_function, FUN.RDB$FUNCTION_NAME, (DUDLEY_CTX) function); + SYM symbol = get_symbol(SYM_function, FUN.RDB$FUNCTION_NAME, (DUDLEY_CTX) function); function->func_name = symbol; HSH_insert(symbol); FUNCARG arg = (FUNCARG) DDL_alloc(sizeof(funcarg)); @@ -3150,8 +3140,7 @@ static void make_desc( DUDLEY_NOD node, DSC * desc) desc->dsc_dtype = blr_long; desc->dsc_length = sizeof(SLONG); desc->dsc_sub_type = 0; - desc->dsc_scale = C_NUMERIC_SCALE(desc1) + - C_NUMERIC_SCALE(desc2); + desc->dsc_scale = C_NUMERIC_SCALE(desc1) + C_NUMERIC_SCALE(desc2); return; } desc->dsc_dtype = blr_double; @@ -3798,8 +3787,7 @@ static void set_generator( DUDLEY_NOD node) new_val = *number; *number = 0; - current_blr.str_current = current_blr.str_start = - reinterpret_cast(gds__alloc(1028)); + current_blr.str_current = current_blr.str_start = reinterpret_cast(gds__alloc(1028)); if (!current_blr.str_current) { DDL_error_abort(NULL, 14); /* msg 14: memory exhausted */ } @@ -3825,8 +3813,7 @@ static void set_generator( DUDLEY_NOD node) want to change the generator by */ *number = new_val - gen_value; - new_blr.str_current = new_blr.str_start = - reinterpret_cast(gds__alloc(1028)); + new_blr.str_current = new_blr.str_start = reinterpret_cast(gds__alloc(1028)); if (!new_blr.str_current) { DDL_error_abort(NULL, 14); /* msg 14: memory exhausted */ } @@ -3918,8 +3905,7 @@ static void store_blr( DUDLEY_NOD node, ISC_QUAD* blob_id, DUDLEY_REL relation) ISC_STATUS_ARRAY status_vector; FB_API_HANDLE handle; - blr.str_current = blr.str_start = - reinterpret_cast(gds__alloc(4096)); + blr.str_current = blr.str_start = reinterpret_cast(gds__alloc(4096)); if (!blr.str_current) DDL_error_abort(NULL, 14); /* msg 14: memory exhausted */ blr.str_length = 4096; diff --git a/src/dudley/expand.cpp b/src/dudley/expand.cpp index def875b585..106c07b92c 100644 --- a/src/dudley/expand.cpp +++ b/src/dudley/expand.cpp @@ -268,8 +268,7 @@ static void expand_global_field( DUDLEY_FLD field) context->ctx_field = field; field->fld_computed = resolve(field->fld_computed, request_context, 0); - field->fld_validation = - resolve(field->fld_validation, request_context, 0); + field->fld_validation = resolve(field->fld_validation, request_context, 0); context->ctx_field = 0; } @@ -320,7 +319,7 @@ static void expand_relation( DUDLEY_REL relation) rse = relation->rel_rse; contexts = (dudley_lls*) rse->nod_arg[s_rse_contexts]; my_context = lookup_context(NULL, contexts); - my_context->ctx_view_rse = TRUE; + my_context->ctx_view_rse = true; /* drop view context from context stack & build the request stack */ @@ -339,7 +338,7 @@ static void expand_relation( DUDLEY_REL relation) /* Put view context back on stack for global field resolution to follow */ LLS_PUSH((DUDLEY_NOD) my_context, &request_context); - my_context->ctx_view_rse = FALSE; + my_context->ctx_view_rse = false; } } @@ -747,8 +746,7 @@ static DUDLEY_NOD resolve( DUDLEY_NOD node, dudley_lls* right, dudley_lls* left) node->nod_arg[s_stt_default] = resolve(sub, right, 0); resolve_rse(node->nod_arg[s_stt_rse], &right); if (node->nod_arg[s_stt_value]) - node->nod_arg[s_stt_value] = - resolve(node->nod_arg[s_stt_value], right, 0); + node->nod_arg[s_stt_value] = resolve(node->nod_arg[s_stt_value], right, 0); return node; case nod_unique: @@ -794,8 +792,7 @@ static DUDLEY_NOD resolve( DUDLEY_NOD node, dudley_lls* right, dudley_lls* left) context->ctx_context_id = ++context_id; context->ctx_relation = old_context->ctx_relation; LLS_PUSH((DUDLEY_NOD) context, &left); - node->nod_arg[s_mod_action] = - resolve(node->nod_arg[s_mod_action], right, left); + node->nod_arg[s_mod_action] = resolve(node->nod_arg[s_mod_action], right, left); return node; case nod_index: diff --git a/src/dudley/lex.cpp b/src/dudley/lex.cpp index 5431bfd60e..d398e8dc34 100644 --- a/src/dudley/lex.cpp +++ b/src/dudley/lex.cpp @@ -394,8 +394,7 @@ TOK LEX_token(void) token->tok_length = p - token->tok_string; *p = '\0'; - token->tok_symbol = symbol = - HSH_lookup(token->tok_string, token->tok_length); + token->tok_symbol = symbol = HSH_lookup(token->tok_string, token->tok_length); if (symbol && symbol->sym_type == SYM_keyword) token->tok_keyword = (enum kwwords) symbol->sym_keyword; else diff --git a/src/dudley/parse.cpp b/src/dudley/parse.cpp index 3db15436c5..7d60f01661 100644 --- a/src/dudley/parse.cpp +++ b/src/dudley/parse.cpp @@ -2548,8 +2548,7 @@ static void modify_relation(void) field->fld_dtype = global->fld_dtype; field->fld_length = global->fld_length; field->fld_scale = global->fld_scale; - field->fld_segment_length = - global->fld_segment_length; + field->fld_segment_length = global->fld_segment_length; field->fld_sub_type = global->fld_sub_type; field->fld_has_sub_type = global->fld_has_sub_type; } @@ -3500,7 +3499,7 @@ static void parse_field_subtype( DUDLEY_FLD field) else field->fld_sub_type = PARSE_number(); - field->fld_has_sub_type = TRUE; + field->fld_has_sub_type = true; } @@ -4134,7 +4133,7 @@ static void validate_field( DUDLEY_FLD field) if ((field->fld_dtype) && !(field->fld_computed)) fb_msg_format(0, DDL_MSG_FAC, 223, sizeof(option), option, dummy); /* msg 223: data type */ - if ((field->fld_has_sub_type) && !(field->fld_computed)) + if (field->fld_has_sub_type && !(field->fld_computed)) fb_msg_format(0, DDL_MSG_FAC, 224, sizeof(option), option, dummy); /* msg 224: sub type */ if ((field->fld_segment_length) && !(field->fld_computed)) @@ -4151,8 +4150,7 @@ static void validate_field( DUDLEY_FLD field) if (field->fld_flags & fld_modify) return; - if ((field->fld_has_sub_type) && - (field->fld_dtype != blr_blob) && + if (field->fld_has_sub_type && (field->fld_dtype != blr_blob) && (field->fld_dtype != blr_text) && (field->fld_dtype != blr_varying)) { PARSE_error(228, 0, 0); /* msg 228: subtypes are valid only for blobs and text */ diff --git a/src/dudley/trn.cpp b/src/dudley/trn.cpp index dc2e1e8da0..97a3eda3d0 100644 --- a/src/dudley/trn.cpp +++ b/src/dudley/trn.cpp @@ -123,8 +123,7 @@ void TRN_translate(void) /* Start by reversing the set of actions */ str d; str* dyn = &d; - dyn->str_current = dyn->str_start = - reinterpret_cast(gds__alloc(8192)); + dyn->str_current = dyn->str_start = reinterpret_cast(gds__alloc(8192)); if (!dyn->str_current) DDL_error_abort(NULL, 14); /* msg 14: memory exhausted */ dyn->str_length = 8192; diff --git a/src/gpre/fbrmclib.cpp b/src/gpre/fbrmclib.cpp index 43ad91c83b..8b3b72b084 100644 --- a/src/gpre/fbrmclib.cpp +++ b/src/gpre/fbrmclib.cpp @@ -296,17 +296,13 @@ static ISC_ULONG CvtCobolToInt(const ISC_UCHAR *s, ISC_USHORT len, char type) switch (len) { case 2: - temp = (*(s) << 8) + - *(s + 1); + temp = (*(s) << 8) + *(s + 1); // If source is negative and signed, extend sign to dest if ((*(s + 1) & 0x80) && (type == 11)) temp |= 0xffff0000; break; case 4: - temp = (*(s) << 24) + - (*(s + 1) << 16) + - (*(s + 2) << 8) + - *(s + 3); + temp = (*(s) << 24) + (*(s + 1) << 16) + (*(s + 2) << 8) + *(s + 3); break; default: temp = 0; diff --git a/src/gpre/pretty.cpp b/src/gpre/pretty.cpp index e41039055b..d6a9ff91a3 100644 --- a/src/gpre/pretty.cpp +++ b/src/gpre/pretty.cpp @@ -144,7 +144,8 @@ int PRETTY_print_cdb( UCHAR* blr, FPTR_PRINT_CALLBACK routine, void* user_arg, S print_line(control, offset); SSHORT parameter; - while (parameter = BLR_BYTE) { + while (parameter = BLR_BYTE) + { const char* p; if (parameter > FB_NELEM(cdb_table) || !(p = cdb_table[parameter])) { @@ -317,7 +318,8 @@ static int print_blr_dtype(ctl* control, bool print_object) // Special case blob (261) to keep down the size of the // jump table - switch (dtype) { + switch (dtype) + { case blr_short: string = "short"; length = 2; @@ -413,7 +415,8 @@ static int print_blr_dtype(ctl* control, bool print_object) // than letting it be random. SSHORT offset = 0; - switch (dtype) { + switch (dtype) + { case blr_text: length = print_word(control, offset); break; @@ -509,9 +512,8 @@ static int print_byte( ctl* control, SSHORT offset) static int print_char( ctl* control, SSHORT offset) { const UCHAR c = BLR_BYTE; - const bool printable = (c >= 'a' && c <= 'z') || - (c >= 'A' && c <= 'Z') || - (c >= '0' && c <= '9' || c == '$' || c == '_'); + const bool printable = (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || + (c >= '0' && c <= '9') || c == '$' || c == '_'; sprintf(control->ctl_ptr, printable ? "'%c'," : control->ctl_language ? "chr(%d)," : "%d,", c); ADVANCE_PTR(control->ctl_ptr); @@ -529,7 +531,7 @@ static int print_char( ctl* control, SSHORT offset) static int print_dyn_verb( ctl* control, SSHORT level) { - SSHORT offset = control->ctl_blr - control->ctl_blr_start; + const SSHORT offset = control->ctl_blr - control->ctl_blr_start; const UCHAR dyn_operator = BLR_BYTE; const char* p; diff --git a/src/remote/os/win32/ibconfig.cpp b/src/remote/os/win32/ibconfig.cpp index fbaaa8338d..26ba2b51c3 100644 --- a/src/remote/os/win32/ibconfig.cpp +++ b/src/remote/os/win32/ibconfig.cpp @@ -58,7 +58,7 @@ const int HDR_BUFLEN = 512; static HINSTANCE hAppInstance = NULL; // Handle to the app. instance char szSysDbaPasswd[PASSWORD_LEN]; // Pointer to hold the password HBRUSH hIBGrayBrush = NULL; // Handle to a gray brush -static BOOL bServerApp = FALSE; // Flag indicating if Server application +static bool bServerApp = false; // Flag indicating if Server application static char szService[SERVICE_LEN]; // To store the service path // Window procedure @@ -125,7 +125,7 @@ void AddConfigPages(HWND hPropSheet, HINSTANCE hInst) *****************************************************************************/ hIBGrayBrush = CreateSolidBrush(GetSysColor(COLOR_BTNFACE)); hAppInstance = hInst; - bServerApp = TRUE; + bServerApp = true; szService[0] = '\0'; szSysDbaPasswd[0] = '\0'; diff --git a/src/utilities/fbcpl/fbdialog.cpp b/src/utilities/fbcpl/fbdialog.cpp index 91962520c1..d6a3b42451 100644 --- a/src/utilities/fbcpl/fbdialog.cpp +++ b/src/utilities/fbcpl/fbdialog.cpp @@ -273,10 +273,8 @@ bool CFBDialog::ValidateInstalledServices() // If Guardian installed but not Server service // then return false; { - fb_status.UseService = - CheckServiceInstalled(GetServiceName(REMOTE_SERVICE)); - fb_status.UseGuardian = - CheckServiceInstalled(GetServiceName(ISCGUARD_SERVICE)); + fb_status.UseService = CheckServiceInstalled(GetServiceName(REMOTE_SERVICE)); + fb_status.UseGuardian = CheckServiceInstalled(GetServiceName(ISCGUARD_SERVICE)); return (!fb_status.UseService && fb_status.UseGuardian) ? false : true; } @@ -377,8 +375,7 @@ void CFBDialog::ViewRegistryEntries() fb_status.AutoStart = false; - fb_status.UseService = - CheckServiceInstalled(GetServiceName(REMOTE_SERVICE)); + fb_status.UseService = CheckServiceInstalled(GetServiceName(REMOTE_SERVICE)); if ( fb_status.UseService ) { diff --git a/src/utilities/gstat/dba.epp b/src/utilities/gstat/dba.epp index 450b7ea918..b1051fafbd 100644 --- a/src/utilities/gstat/dba.epp +++ b/src/utilities/gstat/dba.epp @@ -849,8 +849,7 @@ int gstat(Firebird::UtilSvc* uSvc) /* free linked lists */ while (tddba->head_of_files_list != 0) { open_files* tmp1 = tddba->head_of_files_list; - tddba->head_of_files_list = - tddba->head_of_files_list->open_files_next; + tddba->head_of_files_list = tddba->head_of_files_list->open_files_next; delete tmp1; } @@ -977,15 +976,13 @@ static bool analyze_data_page( dba_rel* relation, const data_page* page, bool sw USHORT space = page->dpg_count * sizeof(data_page::dpg_repeat); const data_page::dpg_repeat* tail = page->dpg_rpt; - for (const data_page::dpg_repeat* const end = tail + page->dpg_count; tail < end; - tail++) + for (const data_page::dpg_repeat* const end = tail + page->dpg_count; tail < end; tail++) { if (tail->dpg_offset && tail->dpg_length) { space += tail->dpg_length; if (sw_record) { - const rhdf* header = - (const rhdf*) ((SCHAR *) page + tail->dpg_offset); + const rhdf* header = (const rhdf*) ((SCHAR *) page + tail->dpg_offset); if (!(header->rhdf_flags & (rhd_blob | rhd_chain | rhd_fragment))) { @@ -993,15 +990,13 @@ static bool analyze_data_page( dba_rel* relation, const data_page* page, bool sw relation->rel_record_space += tail->dpg_length; if (header->rhdf_flags & rhd_incomplete) { relation->rel_record_space -= RHDF_SIZE; - relation->rel_record_space += - analyze_fragments(relation, header); + relation->rel_record_space += analyze_fragments(relation, header); } else relation->rel_record_space -= RHD_SIZE; if (header->rhdf_b_page) - relation->rel_version_space += - analyze_versions(relation, header); + relation->rel_version_space += analyze_versions(relation, header); } } } @@ -1069,8 +1064,7 @@ static void analyze_index( dba_rel* relation, dba_idx* index) **************************************/ tdba* tddba = tdba::getSpecific(); - const index_root_page* index_root = - (const index_root_page*) db_read(relation->rel_index_root); + const index_root_page* index_root = (const index_root_page*) db_read(relation->rel_index_root); SLONG page; if (index_root->irt_count <= index->idx_id || @@ -1299,15 +1293,13 @@ static dba_fil* db_open(const char* file_name, USHORT file_length) if (tddba->files) { for (fil = tddba->files; fil->fil_next; fil = fil->fil_next); - fil->fil_next = - (dba_fil*) alloc(sizeof(dba_fil) + strlen(file_name) + 1); + fil->fil_next = (dba_fil*) alloc(sizeof(dba_fil) + strlen(file_name) + 1); fil->fil_next->fil_min_page = fil->fil_max_page + 1; fil = fil->fil_next; } else { /* empty list */ - fil = tddba->files = - (dba_fil*) alloc(sizeof(dba_fil) + strlen(file_name) + 1); + fil = tddba->files = (dba_fil*) alloc(sizeof(dba_fil) + strlen(file_name) + 1); fil->fil_min_page = 0L; } @@ -1380,11 +1372,9 @@ static const pag* db_read( SLONG page_number) page_number -= fil->fil_min_page - fil->fil_fudge; LARGE_INTEGER liOffset; - liOffset.QuadPart = - UInt32x32To64((DWORD) page_number, (DWORD) tddba->page_size); - if (SetFilePointer - (fil->fil_desc, (LONG) liOffset.LowPart, &liOffset.HighPart, - FILE_BEGIN) == (DWORD) -1) + liOffset.QuadPart = UInt32x32To64((DWORD) page_number, (DWORD) tddba->page_size); + if (SetFilePointer(fil->fil_desc, (LONG) liOffset.LowPart, &liOffset.HighPart, FILE_BEGIN) == + (DWORD) -1) { int lastError = GetLastError(); if (lastError != NO_ERROR) @@ -1476,15 +1466,13 @@ static dba_fil* db_open(const char* file_name, USHORT file_length) dba_fil* fil; if (tddba->files) { for (fil = tddba->files; fil->fil_next; fil = fil->fil_next); - fil->fil_next = - (dba_fil*) alloc(sizeof(dba_fil) + strlen(file_name) + 1); + fil->fil_next = (dba_fil*) alloc(sizeof(dba_fil) + strlen(file_name) + 1); fil->fil_next->fil_min_page = fil->fil_max_page + 1; fil = fil->fil_next; } else { /* empty list */ - fil = tddba->files = - (dba_fil*) alloc(sizeof(dba_fil) + strlen(file_name) + 1); + fil = tddba->files = (dba_fil*) alloc(sizeof(dba_fil) + strlen(file_name) + 1); fil->fil_min_page = 0L; } diff --git a/src/utilities/ibmgr/ibmgr.cpp b/src/utilities/ibmgr/ibmgr.cpp index f1cf683a0d..3fa645ba15 100644 --- a/src/utilities/ibmgr/ibmgr.cpp +++ b/src/utilities/ibmgr/ibmgr.cpp @@ -855,8 +855,7 @@ static SSHORT parse_cmd_line( int argc, TEXT** argv, bool zapPasswd) ibmgr_data.suboperation = SOP_NONE; ibmgr_data.par_entered = 0; - SSHORT ret = - get_switches(argc, argv, ibmgr_in_sw_table, &ibmgr_data, &quitflag, zapPasswd); + SSHORT ret = get_switches(argc, argv, ibmgr_in_sw_table, &ibmgr_data, &quitflag, zapPasswd); if (ret != FB_SUCCESS) { if (ret == ERR_SYNTAX) { SRVRMGR_msg_get(MSG_SYNTAX, msg); @@ -864,7 +863,8 @@ static SSHORT parse_cmd_line( int argc, TEXT** argv, bool zapPasswd) } return ACT_NONE; } - switch (ibmgr_data.operation) { + switch (ibmgr_data.operation) + { case OP_SHUT: if (strcmp(ibmgr_data.user, SYSDBA_USER_NAME)) { SRVRMGR_msg_get(MSG_NOPERM, msg); @@ -886,9 +886,9 @@ static SSHORT parse_cmd_line( int argc, TEXT** argv, bool zapPasswd) case OP_START: if ((strcmp(ibmgr_data.real_user, "root") && - strcmp(ibmgr_data.real_user, FIREBIRD_USER_NAME) && - strcmp(ibmgr_data.real_user, INTERBASE_USER_NAME) && - strcmp(ibmgr_data.real_user, INTERBASE_USER_SHORT)) || + strcmp(ibmgr_data.real_user, FIREBIRD_USER_NAME) && + strcmp(ibmgr_data.real_user, INTERBASE_USER_NAME) && + strcmp(ibmgr_data.real_user, INTERBASE_USER_SHORT)) || strcmp(ibmgr_data.user, SYSDBA_USER_NAME)) { SRVRMGR_msg_get(MSG_NOPERM, msg); diff --git a/src/utilities/install/install.cpp b/src/utilities/install/install.cpp index c2c88fd14e..e540a45622 100644 --- a/src/utilities/install/install.cpp +++ b/src/utilities/install/install.cpp @@ -209,8 +209,7 @@ USHORT CLIENT_install(const TEXT * rootdir, USHORT client, bool sw_force, if (kernel32 != 0) { typedef BOOL __stdcall proto_ntmove(LPCSTR, LPCSTR, DWORD); - proto_ntmove* ntmove = - (proto_ntmove*)GetProcAddress(kernel32, "MoveFileExA"); + proto_ntmove* ntmove = (proto_ntmove*)GetProcAddress(kernel32, "MoveFileExA"); if (ntmove != 0) { // We are definitely running on a system supporting the diff --git a/src/utilities/install/services.cpp b/src/utilities/install/services.cpp index f2bd14eb62..e000cb33d4 100644 --- a/src/utilities/install/services.cpp +++ b/src/utilities/install/services.cpp @@ -101,8 +101,7 @@ USHORT SERVICES_install(SC_HANDLE manager, display_name, SERVICE_CHANGE_CONFIG, dwServiceType, - (sw_startup == - STARTUP_DEMAND) ? SERVICE_DEMAND_START : + (sw_startup == STARTUP_DEMAND) ? SERVICE_DEMAND_START : SERVICE_AUTO_START, SERVICE_ERROR_NORMAL, path_name, NULL, NULL, dependencies, nt_user_name, nt_user_password); diff --git a/src/utilities/rebuild/rebuild.cpp b/src/utilities/rebuild/rebuild.cpp index 24b7e8e959..8918a9606e 100644 --- a/src/utilities/rebuild/rebuild.cpp +++ b/src/utilities/rebuild/rebuild.cpp @@ -208,16 +208,14 @@ int main( int argc, char *argv[]) gdbb->tdbb_database = &dbb_struct; gdbb->tdbb_transaction = &dull; dull.tra_number = header->hdr_next_transaction; - gdbb->tdbb_database->dbb_max_records = (rbdb->rbdb_page_size - - sizeof(struct data_page)) / + gdbb->tdbb_database->dbb_max_records = (rbdb->rbdb_page_size - sizeof(struct data_page)) / (sizeof(data_page::dpg_repeat) + OFFSETA(RHD, rhd_data)); gdbb->tdbb_database->dbb_pcontrol = &dim; - gdbb->tdbb_database->dbb_dp_per_pp = (rbdb->rbdb_page_size - - OFFSETA(pointer_page*, ppg_page)) * 8 / 34; - gdbb->tdbb_database->dbb_pcontrol->pgc_bytes = rbdb->rbdb_page_size - - OFFSETA(page_inv_page*, pip_bits); - gdbb->tdbb_database->dbb_pcontrol->pgc_ppp = - gdbb->tdbb_database->dbb_pcontrol->pgc_bytes * 8; + gdbb->tdbb_database->dbb_dp_per_pp = + (rbdb->rbdb_page_size - OFFSETA(pointer_page*, ppg_page)) * 8 / 34; + gdbb->tdbb_database->dbb_pcontrol->pgc_bytes = + rbdb->rbdb_page_size - OFFSETA(page_inv_page*, pip_bits); + gdbb->tdbb_database->dbb_pcontrol->pgc_ppp = gdbb->tdbb_database->dbb_pcontrol->pgc_bytes * 8; gdbb->tdbb_database->dbb_pcontrol->pgc_tpt = (rbdb->rbdb_page_size - OFFSETA(tx_inv_page*, tip_transactions)) * 4; gdbb->tdbb_database->dbb_pcontrol->pgc_pip = 1; @@ -843,20 +841,20 @@ static void get_switch( TEXT** argv, SWC token) token->swc_string = *argv; if (*token->swc_string == '-') { - token->swc_switch = TRUE; + token->swc_switch = true; token->swc_string++; } else - token->swc_switch = FALSE; + token->swc_switch = false; const int temp = strlen(token->swc_string) - 1; if (token->swc_string[temp] == ',') { token->swc_string[temp] = '\0'; - token->swc_comma = TRUE; + token->swc_comma = true; } else - token->swc_comma = FALSE; + token->swc_comma = false; } diff --git a/src/utilities/rebuild/rebuild.h b/src/utilities/rebuild/rebuild.h index 25322036fa..efdce51846 100644 --- a/src/utilities/rebuild/rebuild.h +++ b/src/utilities/rebuild/rebuild.h @@ -46,8 +46,8 @@ typedef struct rbdb { } *RBDB; typedef struct swc { - SCHAR swc_switch; - SCHAR swc_comma; + bool swc_switch; + bool swc_comma; TEXT *swc_string; } *SWC;