diff --git a/src/alice/exe.cpp b/src/alice/exe.cpp index d751f841a3..85bde20f8a 100644 --- a/src/alice/exe.cpp +++ b/src/alice/exe.cpp @@ -83,20 +83,20 @@ int EXE_action(const TEXT* database, const ULONG switches) buildDpb(dpb, switches); FB_API_HANDLE handle = 0; - isc_attach_database(tdgbl->status, 0, database, &handle, - dpb.getBufferLength(), + isc_attach_database(tdgbl->status, 0, database, &handle, + dpb.getBufferLength(), reinterpret_cast(dpb.getBuffer())); tdgbl->uSvc->started(); - if (tdgbl->status[1] && + if (tdgbl->status[1] && // Ignore isc_shutdown error produced when we switch to full shutdown mode. It is expected. (tdgbl->status[1] != isc_shutdown || !(switches & sw_shut) || tdgbl->ALICE_data.ua_shutdown_mode != SHUT_FULL) ) { error = true; } - + if (tdgbl->status[2] == isc_arg_warning) { tdgbl->uSvc->makePermanentVector(tdgbl->status); @@ -107,7 +107,7 @@ int EXE_action(const TEXT* database, const ULONG switches) tdgbl->uSvc->makePermanentVector(tdgbl->status); } - if (handle != 0) + if (handle != 0) { UCHAR error_string[128]; if ((switches & sw_validate) && (tdgbl->status[1] != isc_bug_check)) @@ -156,7 +156,7 @@ int EXE_two_phase(const TEXT* database, const ULONG switches) FB_API_HANDLE handle = 0; isc_attach_database(tdgbl->status, 0, database, &handle, - dpb.getBufferLength(), + dpb.getBufferLength(), reinterpret_cast(dpb.getBuffer())); tdgbl->uSvc->started(); @@ -223,13 +223,13 @@ static void buildDpb(Firebird::ClumpletWriter& dpb, const ULONG switches) dpb.insertByte(isc_dpb_verify, b); } else if (switches & sw_housekeeping) { - dpb.insertInt(isc_dpb_sweep_interval, + dpb.insertInt(isc_dpb_sweep_interval, tdgbl->ALICE_data.ua_sweep_interval); } /* else if (switches & sw_begin_log) { - dpb.insertString(isc_dpb_begin_log, - tdgbl->ALICE_data.ua_log_file, + dpb.insertString(isc_dpb_begin_log, + tdgbl->ALICE_data.ua_log_file, strlen(tdgbl->ALICE_data.ua_log_file)); } else if (switches & sw_quit_log) { @@ -237,18 +237,18 @@ static void buildDpb(Firebird::ClumpletWriter& dpb, const ULONG switches) } */ else if (switches & sw_buffers) { - dpb.insertInt(isc_dpb_set_page_buffers, + dpb.insertInt(isc_dpb_set_page_buffers, tdgbl->ALICE_data.ua_page_buffers); } else if (switches & sw_kill) { dpb.insertTag(isc_dpb_delete_shadow); } else if (switches & sw_write) { - dpb.insertByte(isc_dpb_force_write, + dpb.insertByte(isc_dpb_force_write, tdgbl->ALICE_data.ua_force ? 1 : 0); } else if (switches & sw_no_reserve) { - dpb.insertByte(isc_dpb_no_reserve, + dpb.insertByte(isc_dpb_no_reserve, tdgbl->ALICE_data.ua_no_reserve ? 1 : 0); } else if (switches & sw_mode) { @@ -278,7 +278,7 @@ static void buildDpb(Firebird::ClumpletWriter& dpb, const ULONG switches) case SHUT_FULL: b |= isc_dpb_shut_full; break; - default: + default: break; } dpb.insertByte(isc_dpb_shutdown, b); @@ -318,24 +318,24 @@ static void buildDpb(Firebird::ClumpletWriter& dpb, const ULONG switches) dpb.insertTag(isc_dpb_no_garbage_collect); } else if (switches & sw_set_db_dialect) { - dpb.insertInt(isc_dpb_set_db_sql_dialect, + dpb.insertInt(isc_dpb_set_db_sql_dialect, tdgbl->ALICE_data.ua_db_SQL_dialect); } if (tdgbl->ALICE_data.ua_user) { - dpb.insertString(isc_dpb_user_name, + dpb.insertString(isc_dpb_user_name, tdgbl->ALICE_data.ua_user, strlen(tdgbl->ALICE_data.ua_user)); } if (tdgbl->ALICE_data.ua_password) { dpb.insertString(tdgbl->uSvc->isService() ? isc_dpb_password_enc : isc_dpb_password, - tdgbl->ALICE_data.ua_password, + tdgbl->ALICE_data.ua_password, strlen(tdgbl->ALICE_data.ua_password)); } if (tdgbl->ALICE_data.ua_tr_user) { tdgbl->uSvc->checkService(); - dpb.insertString(isc_dpb_trusted_auth, + dpb.insertString(isc_dpb_trusted_auth, tdgbl->ALICE_data.ua_tr_user, strlen(tdgbl->ALICE_data.ua_tr_user)); } @@ -371,9 +371,9 @@ static void extract_db_info(const UCHAR* db_info_buffer, size_t buf_size) const SLONG length = gds__vax_integer(p, 2); p += 2; - // TMN: Here we should really have the following assert + // TMN: Here we should really have the following assert // fb_assert(length <= MAX_SSHORT); - // for all cases that use 'length' as input to 'gds__vax_integer' + // for all cases that use 'length' as input to 'gds__vax_integer' // Remember to keep this list in sync with the val_errors array. switch (item) { diff --git a/src/alice/tdr.cpp b/src/alice/tdr.cpp index a1d4c3c6cb..95c93eb839 100644 --- a/src/alice/tdr.cpp +++ b/src/alice/tdr.cpp @@ -195,19 +195,19 @@ bool TDR_attach_database(ISC_STATUS* status_vector, dpb.insertTag(isc_dpb_gfix_attach); tdgbl->uSvc->getAddressPath(dpb); if (tdgbl->ALICE_data.ua_user) { - dpb.insertString(isc_dpb_user_name, + dpb.insertString(isc_dpb_user_name, tdgbl->ALICE_data.ua_user, strlen(tdgbl->ALICE_data.ua_user)); } if (tdgbl->ALICE_data.ua_password) { dpb.insertString(tdgbl->uSvc->isService() ? isc_dpb_password_enc : isc_dpb_password, - tdgbl->ALICE_data.ua_password, + tdgbl->ALICE_data.ua_password, strlen(tdgbl->ALICE_data.ua_password)); } if (tdgbl->ALICE_data.ua_tr_user) { tdgbl->uSvc->checkService(); - dpb.insertString(isc_dpb_trusted_auth, + dpb.insertString(isc_dpb_trusted_auth, tdgbl->ALICE_data.ua_tr_user, strlen(reinterpret_cast(tdgbl->ALICE_data.ua_tr_user))); } @@ -323,7 +323,7 @@ void TDR_list_limbo(FB_API_HANDLE handle, const TEXT* name, const ULONG switches ALICE_print(71, SafeArg() << id); // msg 71: Transaction %d is in limbo. } - if (trans = MET_get_transaction(status_vector, handle, id)) + if (trans = MET_get_transaction(status_vector, handle, id)) { tdgbl->uSvc->putSLong(isc_spb_multi_tra_id, id); reattach_databases(trans); @@ -331,7 +331,7 @@ void TDR_list_limbo(FB_API_HANDLE handle, const TEXT* name, const ULONG switches TDR_shutdown_databases(trans); print_description(trans); } - else + else { tdgbl->uSvc->putSLong(isc_spb_single_tra_id, id); } @@ -770,7 +770,7 @@ static void reattach_database(TDR trans) ALICE_exit(FINI_ERROR, tdgbl); } - for (;;) + for (;;) { ALICE_print(88); // msg 88: Enter a valid path: char* p = buffer; diff --git a/src/burp/canonical.cpp b/src/burp/canonical.cpp index a03689b95a..f1c0008f22 100644 --- a/src/burp/canonical.cpp +++ b/src/burp/canonical.cpp @@ -1,7 +1,7 @@ /* * PROGRAM: JRD Backup and Restore Program * MODULE: canonical.cpp - * DESCRIPTION: + * DESCRIPTION: * * The contents of this file are subject to the Interbase Public * License Version 1.0 (the "License"); you may not use this file @@ -200,7 +200,7 @@ ULONG CAN_encode_decode(burp_rel* relation, } } -// Next, get null flags +// Next, get null flags for (field = relation->rel_fields; field; field = field->fld_next) { @@ -442,7 +442,7 @@ static bool_t expand_buffer(XDR* xdrs) * * Functional description * Allocate a new, larger buffer, copy - * everything we've got, and release the + * everything we've got, and release the * old one. * **************************************/ @@ -654,7 +654,7 @@ static bool_t xdr_slice(XDR* xdrs, if (!xdr_long(xdrs, reinterpret_cast(&slice->lstr_length))) return FALSE; -// Handle operation specific stuff, particularly memory allocation/deallocation +// Handle operation specific stuff, particularly memory allocation/deallocation switch (xdrs->x_op) { @@ -692,7 +692,7 @@ static bool_t xdr_slice(XDR* xdrs, return FALSE; } -// Get descriptor of array element +// Get descriptor of array element ISC_STATUS_ARRAY status_vector; sdl_info info; diff --git a/src/burp/misc.cpp b/src/burp/misc.cpp index 638122c4ac..2c3d25b2f1 100644 --- a/src/burp/misc.cpp +++ b/src/burp/misc.cpp @@ -48,7 +48,7 @@ UCHAR *MISC_alloc_burp(ULONG size) BurpGlobals* tdgbl = BurpGlobals::getSpecific(); -// Add some header space to store a list of blocks allocated for this gbak +// Add some header space to store a list of blocks allocated for this gbak size += ROUNDUP(sizeof(UCHAR *), FB_ALIGNMENT); UCHAR* block = (UCHAR*)gds__alloc(size); @@ -57,14 +57,14 @@ UCHAR *MISC_alloc_burp(ULONG size) /* NOMEM: message & abort FREE: all items freed at gbak exit */ { BURP_error(238, true); - // msg 238: System memory exhaused + // msg 238: System memory exhaused return NULL; } memset(block, 0, size); /* FREE: We keep a linked list of all gbak memory allocations, which - * are then freed when gbak exits. This is important for + * are then freed when gbak exits. This is important for * NETWARE in particular. */ *((UCHAR **) block) = tdgbl->head_of_mem_list; @@ -89,26 +89,26 @@ void MISC_free_burp( void *free) BurpGlobals* tdgbl = BurpGlobals::getSpecific(); if (free != NULL) { - // Point at the head of the allocated block + // Point at the head of the allocated block UCHAR **block = (UCHAR **) ((UCHAR *) free - ROUNDUP(sizeof(UCHAR *), FB_ALIGNMENT)); - // Scan for this block in the list of blocks + // Scan for this block in the list of blocks for (UCHAR **ptr = &tdgbl->head_of_mem_list; *ptr; ptr = (UCHAR **) *ptr) { if (*ptr == (UCHAR *) block) { - // Found it - remove it from the list + // Found it - remove it from the list *ptr = *block; - // and free it + // and free it gds__free((SLONG *) block); return; } } - // We should always find the block in the list + // We should always find the block in the list BURP_error(238, true); - // msg 238: System memory exhausted + // msg 238: System memory exhausted // (too lazy to add a better message) } } diff --git a/src/burp/mvol.cpp b/src/burp/mvol.cpp index 6ead5c43be..c54dcf5ca6 100644 --- a/src/burp/mvol.cpp +++ b/src/burp/mvol.cpp @@ -1,7 +1,7 @@ /* * PROGRAM: JRD Backup and Restore Program * MODULE: multivol.cpp - * DESCRIPTION: + * DESCRIPTION: * * The contents of this file are subject to the Interbase Public * License Version 1.0 (the "License"); you may not use this file @@ -84,7 +84,7 @@ static inline void put(BurpGlobals* tdgbl, UCHAR c) } #ifdef DEBUG -static UCHAR debug_on = 0; // able to turn this on in debug mode +static UCHAR debug_on = 0; // able to turn this on in debug mode #endif const int burp_msg_fac = 12; @@ -253,7 +253,7 @@ void MVOL_init_write(const char* database_name, // unused? if (tdgbl->action->act_action == ACT_backup_split) { BURP_error(269, true, tdgbl->action->act_file->fil_name.c_str()); - // msg 269 can't write a header record to file %s + // msg 269 can't write a header record to file %s } tdgbl->file_desc = next_volume(tdgbl->file_desc, MODE_WRITE, false); } @@ -299,12 +299,12 @@ int MVOL_read(int* cnt, UCHAR** ptr) if (cnt) { BURP_error_redirect(0, 220); - // msg 220 Unexpected I/O error while reading from backup file + // msg 220 Unexpected I/O error while reading from backup file } else { BURP_error_redirect(0, 50); - // msg 50 unexpected end of file on backup file + // msg 50 unexpected end of file on backup file } } } @@ -349,10 +349,10 @@ int MVOL_read(int* cnt, UCHAR** ptr) { if (cnt) BURP_error_redirect(NULL, 220); - // msg 220 Unexpected I/O error while reading from backup file + // msg 220 Unexpected I/O error while reading from backup file else BURP_error_redirect(NULL, 50); - // msg 50 unexpected end of file on backup file + // msg 50 unexpected end of file on backup file } } @@ -364,7 +364,7 @@ int MVOL_read(int* cnt, UCHAR** ptr) return *(tdgbl->mvol_io_ptr); } -#endif // !WIN_NT +#endif // !WIN_NT //____________________________________________________________ @@ -380,23 +380,23 @@ UCHAR* MVOL_read_block(BurpGlobals* tdgbl, UCHAR* ptr, ULONG count) while (count) { - // If buffer empty, reload it + // If buffer empty, reload it if (tdgbl->io_cnt <= 0) { *ptr++ = MVOL_read(&tdgbl->io_cnt, &tdgbl->io_ptr); - // One byte was "read" by MVOL_read + // One byte was "read" by MVOL_read count--; } const ULONG n = MIN(count, (ULONG) tdgbl->io_cnt); - // Copy data from the IO buffer + // Copy data from the IO buffer memcpy(ptr, tdgbl->io_ptr, n); ptr += n; - // Skip ahead in current buffer + // Skip ahead in current buffer count -= n; tdgbl->io_cnt -= n; @@ -420,18 +420,18 @@ void MVOL_skip_block( BurpGlobals* tdgbl, ULONG count) while (count) { - // If buffer empty, reload it + // If buffer empty, reload it if (tdgbl->io_cnt <= 0) { MVOL_read(&tdgbl->io_cnt, &tdgbl->io_ptr); - // One byte was "read" by MVOL_read + // One byte was "read" by MVOL_read count--; } const ULONG n = MIN(count, (ULONG) tdgbl->io_cnt); - // Skip ahead in current buffer + // Skip ahead in current buffer count -= n; tdgbl->io_cnt -= n; @@ -462,11 +462,11 @@ DESC MVOL_open(const char* name, ULONG mode, ULONG create) } else { - // it's a tape device + // it's a tape device // Note: we *want* to open the tape in Read-only mode or in - // write-only mode, but it turns out that on NT SetTapePosition - // will fail (thereby not rewinding the tape) if the tape is - // opened write-only, so we will make sure that we always have + // write-only mode, but it turns out that on NT SetTapePosition + // will fail (thereby not rewinding the tape) if the tape is + // opened write-only, so we will make sure that we always have // read access. So much for standards! // Ain't Windows wonderful??? // @@ -482,16 +482,16 @@ DESC MVOL_open(const char* name, ULONG mode, ULONG create) { // emulate UNIX rewinding the tape on open: // This MUST be done since Windows does NOT have anything - // like mt to allow the user to do tape management. The + // like mt to allow the user to do tape management. The // implication here is that we will be able to write ONLY // one (1) database per tape. This is bad if the user wishes to // backup several small databases. // Note: We are intentionally NOT trapping for errors during // rewind, since if we can not rewind, we are either a non-rewind // device (then it is user controlled) or we have a problem with - // the physical media. In the latter case I would rather wait for - // the write to fail so that we can loop and prompt the user for - // a different file/device. + // the physical media. In the latter case I would rather wait for + // the write to fail so that we can loop and prompt the user for + // a different file/device. // SetTapePosition(handle, TAPE_REWIND, 0, 0, 0, FALSE); if (GetTapeParameters(handle, GET_TAPE_MEDIA_INFORMATION, &size, @@ -503,7 +503,7 @@ DESC MVOL_open(const char* name, ULONG mode, ULONG create) } return handle; } -#endif // WIN_NT +#endif // WIN_NT //____________________________________________________________ @@ -558,7 +558,7 @@ UCHAR MVOL_write(const UCHAR c, int* io_cnt, UCHAR** io_ptr) (tdgbl->action->act_action == ACT_backup_split && (tdgbl->action->act_file->fil_length < left) ? tdgbl->action->act_file->fil_length : left); - + DWORD err = 0; // Assumes DWORD <==> ULONG if (!WriteFile(tdgbl->file_desc, ptr, nBytesToWrite, @@ -566,7 +566,7 @@ UCHAR MVOL_write(const UCHAR c, int* io_cnt, UCHAR** io_ptr) { err = GetLastError(); } -#endif // !WIN_NT +#endif // !WIN_NT tdgbl->mvol_io_buffer = tdgbl->mvol_io_data; if (cnt > 0) { @@ -588,7 +588,7 @@ UCHAR MVOL_write(const UCHAR c, int* io_cnt, UCHAR** io_ptr) errno == EFBIG) #else err == ERROR_DISK_FULL || err == ERROR_HANDLE_DISK_FULL) -#endif // !WIN_NT +#endif // !WIN_NT { if (tdgbl->action->act_action == ACT_backup_split) { @@ -604,7 +604,7 @@ UCHAR MVOL_write(const UCHAR c, int* io_cnt, UCHAR** io_ptr) if (file->fil_fd == tdgbl->file_desc) file->fil_fd = INVALID_HANDLE_VALUE; } - + tdgbl->action->act_file->fil_fd = INVALID_HANDLE_VALUE; BURP_print(272, SafeArg() << tdgbl->action->act_file->fil_name.c_str() << @@ -621,7 +621,7 @@ UCHAR MVOL_write(const UCHAR c, int* io_cnt, UCHAR** io_ptr) else { BURP_error(270, true); - // msg 270 free disk space exhausted + // msg 270 free disk space exhausted } cnt = 0; continue; @@ -639,7 +639,7 @@ UCHAR MVOL_write(const UCHAR c, int* io_cnt, UCHAR** io_ptr) if (left != size_to_write) { - // Wrote some, move remainder up in buffer. + // Wrote some, move remainder up in buffer. // NOTE: We should NOT use memcpy here. We're moving overlapped // data and memcpy does not guanantee the order the data @@ -652,7 +652,7 @@ UCHAR MVOL_write(const UCHAR c, int* io_cnt, UCHAR** io_ptr) full_buffer = true; else full_buffer = false; - tdgbl->file_desc = next_volume(tdgbl->file_desc, MODE_WRITE, + tdgbl->file_desc = next_volume(tdgbl->file_desc, MODE_WRITE, full_buffer); if (full_buffer) { @@ -670,7 +670,7 @@ UCHAR MVOL_write(const UCHAR c, int* io_cnt, UCHAR** io_ptr) else if (!SYSCALL_INTERRUPTED(errno)) { BURP_error_redirect(0, 221); - // msg 221 Unexpected I/O error while writing to backup file + // msg 221 Unexpected I/O error while writing to backup file } } if (left < cnt) { // this is impossible, but... @@ -755,7 +755,7 @@ static void bad_attribute(int attribute, USHORT type) static const SafeArg dummy; fb_msg_format(NULL, burp_msg_fac, type, sizeof(name), name, dummy); BURP_print(80, SafeArg() << name << attribute); - // msg 80 don't recognize %s attribute %ld -- continuing + // msg 80 don't recognize %s attribute %ld -- continuing for (int l = get(tdgbl); l; --l) get(tdgbl); } @@ -832,7 +832,7 @@ static DESC next_volume( DESC handle, ULONG mode, bool full_buffer) if (handle != INVALID_HANDLE_VALUE) #else if (handle > -1) -#endif // WIN_NT +#endif // WIN_NT { close_platf(handle); } @@ -858,20 +858,20 @@ static DESC next_volume( DESC handle, ULONG mode, bool full_buffer) tdgbl->mvol_empty_file = TRUE; -// Loop until we have opened a file successfully +// Loop until we have opened a file successfully SCHAR new_file[MAX_FILE_NAME_SIZE]; DESC new_desc = INVALID_HANDLE_VALUE; for (;;) { - // We aim to keep our descriptors clean + // We aim to keep our descriptors clean if (new_desc != INVALID_HANDLE_VALUE) { close_platf(new_desc); new_desc = INVALID_HANDLE_VALUE; } - // Get file name to try + // Get file name to try prompt_for_name(new_file, sizeof(new_file)); @@ -881,20 +881,20 @@ static DESC next_volume( DESC handle, ULONG mode, bool full_buffer) #else new_desc = open(new_file, mode, open_mask); if (new_desc < 0) -#endif // WIN_NT +#endif // WIN_NT { BURP_print(222, new_file); - // msg 222 \n\nCould not open file name \"%s\"\n + // msg 222 \n\nCould not open file name \"%s\"\n continue; } - // If the file is to be writable, probe it, and make sure it is... + // If the file is to be writable, probe it, and make sure it is... #ifdef WIN_NT if (mode == MODE_WRITE) #else if ((O_WRONLY == (mode & O_WRONLY)) || (O_RDWR == (mode & O_RDWR))) -#endif // WIN_NT +#endif // WIN_NT { if (!write_header(new_desc, 0L, full_buffer)) { @@ -905,13 +905,13 @@ static DESC next_volume( DESC handle, ULONG mode, bool full_buffer) else { BURP_msg_put(261, SafeArg() << tdgbl->mvol_volume_count << new_file); - // Starting with volume #vol_count, new_file + // Starting with volume #vol_count, new_file BURP_verbose(75, new_file); // msg 75 creating file %s } } else { - // File is open for read only. Read the header. + // File is open for read only. Read the header. ULONG temp_buffer_size; USHORT format; @@ -923,7 +923,7 @@ static DESC next_volume( DESC handle, ULONG mode, bool full_buffer) else { BURP_msg_put(261, SafeArg() << tdgbl->mvol_volume_count << new_file); - // Starting with volume #vol_count, new_file + // Starting with volume #vol_count, new_file BURP_verbose(100, new_file); // msg 100 opened file %s } } @@ -961,11 +961,11 @@ static void prompt_for_name(SCHAR* name, int length) term_in = stdin; } -// Loop until we have a file name to try +// Loop until we have a file name to try for (;;) { - // If there was an old file name, use that prompt + // If there was an old file name, use that prompt if (strlen(tdgbl->mvol_old_file) > 0) { @@ -973,14 +973,14 @@ static void prompt_for_name(SCHAR* name, int length) 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 + // \tPress return to reopen that file, or type a new\n\tname // followed by return to open a different file.\n fprintf(term_out, msg); } - else // First volume + else // First volume { BURP_msg_get(227, msg); - // Type a file name to open and hit return + // Type a file name to open and hit return fprintf(term_out, msg); } BURP_msg_get(228, msg); // " Name: " @@ -1005,11 +1005,11 @@ static void prompt_for_name(SCHAR* name, int length) strcpy(name, tdgbl->mvol_old_file); break; } - else // reprompt + else // reprompt continue; } - // OK, its a file name, strip the carriage return + // OK, its a file name, strip the carriage return SCHAR* name_ptr = name; while (*name_ptr && *name_ptr != '\n') @@ -1089,12 +1089,12 @@ static bool read_header(DESC handle, BurpGlobals* tdgbl = BurpGlobals::getSpecific(); -// Headers are a version number, and a volume number +// 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_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, @@ -1105,7 +1105,7 @@ static bool read_header(DESC handle, int attribute = get(tdgbl); if (attribute != rec_burp) BURP_error_redirect(0, 45); - // msg 45 expected backup description record + // msg 45 expected backup description record int l, maxlen; int temp; @@ -1294,7 +1294,7 @@ static bool write_header(DESC handle, #else ULONG bytes_written = write(handle, tdgbl->mvol_io_header, tdgbl->mvol_io_buffer_size); -#endif // WIN_NT +#endif // WIN_NT if (bytes_written != tdgbl->mvol_io_buffer_size) { @@ -1349,7 +1349,7 @@ bool MVOL_split_hdr_write(void) #else ULONG bytes_written = write(tdgbl->action->act_file->fil_fd, buffer, HDR_SPLIT_SIZE); -#endif // WIN_NT +#endif // WIN_NT if (bytes_written != HDR_SPLIT_SIZE) { return false; diff --git a/src/common/StatusArg.cpp b/src/common/StatusArg.cpp index 5559d38493..c588701ec8 100644 --- a/src/common/StatusArg.cpp +++ b/src/common/StatusArg.cpp @@ -62,7 +62,7 @@ StatusVector::ImplStatusVector::ImplStatusVector(const ISC_STATUS* s) throw() : StatusVector::StatusVector(ISC_STATUS k, ISC_STATUS c) : Base(FB_NEW(*getDefaultMemoryPool()) ImplStatusVector(k, c)) -{ +{ operator<<(*(static_cast(this))); } @@ -71,7 +71,7 @@ StatusVector::StatusVector(const ISC_STATUS* s) : { } -StatusVector::StatusVector() : +StatusVector::StatusVector() : Base(FB_NEW(*getDefaultMemoryPool()) ImplStatusVector(0, 0)) { } @@ -95,21 +95,21 @@ void StatusVector::ImplStatusVector::append(const StatusVector& v) throw() newVector.appendWarnings(v.implementation); } } - + *this = newVector; } bool StatusVector::ImplStatusVector::appendErrors(const ImplBase* const v) throw() { return append(v->value(), v->firstWarning() ? v->firstWarning() : v->length()); -} +} bool StatusVector::ImplStatusVector::appendWarnings(const ImplBase* const v) throw() { if (! v->firstWarning()) return true; return append(v->value() + v->firstWarning(), v->length() - v->firstWarning()); -} +} bool StatusVector::ImplStatusVector::append(const ISC_STATUS* const from, const int count) throw() { @@ -193,43 +193,43 @@ ISC_STATUS StatusVector::ImplStatusVector::copyTo(ISC_STATUS* dest) const throw( return dest[1]; } -Gds::Gds(ISC_STATUS s) throw() : +Gds::Gds(ISC_STATUS s) throw() : StatusVector(isc_arg_gds, s) { } -Num::Num(ISC_STATUS s) throw() : +Num::Num(ISC_STATUS s) throw() : Base(isc_arg_number, s) { } -Interpreted::Interpreted(const char* text) throw() : +Interpreted::Interpreted(const char* text) throw() : StatusVector(isc_arg_interpreted, (ISC_STATUS)(IPTR) text) { } -Interpreted::Interpreted(const AbstractString& text) throw() : +Interpreted::Interpreted(const AbstractString& text) throw() : StatusVector(isc_arg_interpreted, (ISC_STATUS)(IPTR) text.c_str()) { } -Unix::Unix(ISC_STATUS s) throw() : +Unix::Unix(ISC_STATUS s) throw() : Base(isc_arg_unix, s) { } -Windows::Windows(ISC_STATUS s) throw() : +Windows::Windows(ISC_STATUS s) throw() : Base(isc_arg_win32, s) { } -Warning::Warning(ISC_STATUS s) throw() : +Warning::Warning(ISC_STATUS s) throw() : StatusVector(isc_arg_warning, s) { } -Str::Str(const char* text) throw() : +Str::Str(const char* text) throw() : Base(isc_arg_string, (ISC_STATUS)(IPTR) text) { } -Str::Str(const AbstractString& text) throw() : +Str::Str(const AbstractString& text) throw() : Base(isc_arg_string, (ISC_STATUS)(IPTR) text.c_str()) { } -Str::Str(const MetaName& text) throw() : +Str::Str(const MetaName& text) throw() : Base(isc_arg_string, (ISC_STATUS)(IPTR) text.c_str()) { } -SqlState::SqlState(const char* text) throw() : +SqlState::SqlState(const char* text) throw() : Base(isc_arg_sql_state, (ISC_STATUS)(IPTR) text) { } -SqlState::SqlState(const AbstractString& text) throw() : +SqlState::SqlState(const AbstractString& text) throw() : Base(isc_arg_sql_state, (ISC_STATUS)(IPTR) text.c_str()) { } -OsError::OsError() throw() : +OsError::OsError() throw() : #ifdef WIN_NT Base(isc_arg_win32, GetLastError()) { } #else diff --git a/src/common/StatusHolder.cpp b/src/common/StatusHolder.cpp index 520a9bf9f7..6964447d58 100644 --- a/src/common/StatusHolder.cpp +++ b/src/common/StatusHolder.cpp @@ -1,7 +1,7 @@ /* * PROGRAM: Firebird exceptions classes * MODULE: StatusHolder.cpp - * DESCRIPTION: Firebird's exception classes + * DESCRIPTION: Firebird's exception classes * * The contents of this file are subject to the Initial * Developer's Public License Version 1.0 (the "License"); @@ -42,14 +42,14 @@ ISC_STATUS StatusHolder::save(const ISC_STATUS* status) const ISC_STATUS *from = status; ISC_STATUS *to = m_status_vector; - while (true) + while (true) { const ISC_STATUS type = *to++ = *from++; if (type == isc_arg_end) break; switch (type) { - case isc_arg_cstring: + case isc_arg_cstring: { const size_t len = *to++ = *from++; char *string = FB_NEW(*getDefaultMemoryPool()) char[len]; @@ -64,7 +64,7 @@ ISC_STATUS StatusHolder::save(const ISC_STATUS* status) case isc_arg_sql_state: { const char* temp = reinterpret_cast(*from++); - + const size_t len = strlen(temp); char* string = FB_NEW(*getDefaultMemoryPool()) char[len + 1]; memcpy(string, temp, len + 1); @@ -84,7 +84,7 @@ ISC_STATUS StatusHolder::save(const ISC_STATUS* status) void StatusHolder::clear() { ISC_STATUS *ptr = m_status_vector; - while (true) + while (true) { const ISC_STATUS type = *ptr++; if (type == isc_arg_end) @@ -105,18 +105,18 @@ void StatusHolder::clear() default: ptr++; break; - } + } } memset(m_status_vector, 0, sizeof(m_status_vector)); m_raised = false; } void StatusHolder::raise() -{ - if (getError()) +{ + if (getError()) { m_raised = true; - throw status_exception(m_status_vector, true); + throw status_exception(m_status_vector, true); } } diff --git a/src/common/UtilSvc.cpp b/src/common/UtilSvc.cpp index b21cc8821e..e17ccf9bda 100644 --- a/src/common/UtilSvc.cpp +++ b/src/common/UtilSvc.cpp @@ -1,7 +1,7 @@ /* * PROGRAM: Firebird utilities interface * MODULE: UtilSvc.cpp - * DESCRIPTION: Interface making it possible to use same code + * DESCRIPTION: Interface making it possible to use same code * as both utility or service * * The contents of this file are subject to the Initial @@ -49,7 +49,7 @@ public: } } - virtual void printf(const SCHAR* format, ...) + virtual void printf(const SCHAR* format, ...) { va_list arglist; va_start(arglist, format); @@ -90,7 +90,7 @@ public: { StringsBuffer::makeEnginePermanentVector(s); } - + // do nothing for non-service virtual void finish() { } virtual void started() { } diff --git a/src/common/classes/BaseStream.cpp b/src/common/classes/BaseStream.cpp index 818958bb33..e5f7b5dedf 100644 --- a/src/common/classes/BaseStream.cpp +++ b/src/common/classes/BaseStream.cpp @@ -92,9 +92,9 @@ int StringStream::write(const void* str, unsigned int n) } else m_current_pos += avail; - + m_current_pos[0] = 0; - + return avail; } diff --git a/src/common/classes/ClumpletReader.cpp b/src/common/classes/ClumpletReader.cpp index 7d4df789af..996f95de7f 100644 --- a/src/common/classes/ClumpletReader.cpp +++ b/src/common/classes/ClumpletReader.cpp @@ -58,12 +58,12 @@ public: return t2; } protected: - virtual void usage_mistake(const char* what) const + virtual void usage_mistake(const char* what) const { fatal_exception::raiseFmt( "Internal error when using clumplet API: %s", what); } - virtual void invalid_structure(const char* what) const + virtual void invalid_structure(const char* what) const { fatal_exception::raiseFmt( "Invalid clumplet buffer structure: %s", what); @@ -80,7 +80,7 @@ void ClumpletReader::dump() const return; } dmp++; - + try { ClumpletDump d(kind, getBuffer(), getBufferLength()); int t = (kind == SpbStart || kind == UnTagged || kind == WideUnTagged) ? -1 : d.getBufferTag(); @@ -107,13 +107,13 @@ void ClumpletReader::dump() const namespace Firebird { ClumpletReader::ClumpletReader(Kind k, const UCHAR* buffer, size_t buffLen) : - kind(k), static_buffer(buffer), static_buffer_end(buffer + buffLen) + kind(k), static_buffer(buffer), static_buffer_end(buffer + buffLen) { rewind(); // this will set cur_offset and spbState } ClumpletReader::ClumpletReader(MemoryPool& pool, Kind k, const UCHAR* buffer, size_t buffLen) : - AutoStorage(pool), kind(k), static_buffer(buffer), static_buffer_end(buffer + buffLen) + AutoStorage(pool), kind(k), static_buffer(buffer), static_buffer_end(buffer + buffLen) { rewind(); // this will set cur_offset and spbState } @@ -140,13 +140,13 @@ UCHAR ClumpletReader::getBufferTag() const { const UCHAR* const buffer_end = getBufferEnd(); const UCHAR* buffer_start = getBuffer(); - - switch (kind) + + switch (kind) { case Tpb: case Tagged: case WideTagged: - if (buffer_end - buffer_start == 0) + if (buffer_end - buffer_start == 0) { invalid_structure("empty buffer"); return 0; @@ -159,7 +159,7 @@ UCHAR ClumpletReader::getBufferTag() const usage_mistake("buffer is not tagged"); return 0; case SpbAttach: - if (buffer_end - buffer_start == 0) + if (buffer_end - buffer_start == 0) { invalid_structure("empty buffer"); return 0; @@ -167,12 +167,12 @@ UCHAR ClumpletReader::getBufferTag() const switch (buffer_start[0]) { case isc_spb_version1: - // This is old SPB format, it's almost like DPB - + // This is old SPB format, it's almost like DPB - // buffer's tag is the first byte. return buffer_start[0]; case isc_spb_version: // Buffer's tag is the second byte - if (buffer_end - buffer_start == 1) + if (buffer_end - buffer_start == 1) { invalid_structure("buffer too short (1 byte)"); return 0; @@ -215,7 +215,7 @@ ClumpletReader::ClumpletType ClumpletReader::getClumpletType(UCHAR tag) const return SingleTpb; case isc_action_svc_backup: case isc_action_svc_restore: - switch (tag) + switch (tag) { case isc_spb_bkp_file: case isc_spb_dbname: @@ -235,7 +235,7 @@ ClumpletReader::ClumpletType ClumpletReader::getClumpletType(UCHAR tag) const invalid_structure("unknown parameter for backup/restore"); break; case isc_action_svc_repair: - switch (tag) + switch (tag) { case isc_spb_dbname: return StringSpb; @@ -247,11 +247,11 @@ ClumpletReader::ClumpletType ClumpletReader::getClumpletType(UCHAR tag) const } invalid_structure("unknown parameter for repair"); break; - case isc_action_svc_add_user: + case isc_action_svc_add_user: case isc_action_svc_delete_user: case isc_action_svc_modify_user: case isc_action_svc_display_user: - switch (tag) + switch (tag) { case isc_spb_dbname: case isc_spb_sql_role_name: @@ -269,7 +269,7 @@ ClumpletReader::ClumpletType ClumpletReader::getClumpletType(UCHAR tag) const invalid_structure("unknown parameter for security database operation"); break; case isc_action_svc_properties: - switch (tag) + switch (tag) { case isc_spb_dbname: return StringSpb; @@ -296,7 +296,7 @@ ClumpletReader::ClumpletType ClumpletReader::getClumpletType(UCHAR tag) const // case isc_action_svc_add_license: // case isc_action_svc_remove_license: case isc_action_svc_db_stats: - switch (tag) + switch (tag) { case isc_spb_dbname: case isc_spb_command_line: @@ -311,7 +311,7 @@ ClumpletReader::ClumpletType ClumpletReader::getClumpletType(UCHAR tag) const break; case isc_action_svc_nbak: case isc_action_svc_nrest: - switch (tag) + switch (tag) { case isc_spb_nbk_file: case isc_spb_dbname: @@ -358,7 +358,7 @@ size_t ClumpletReader::getClumpletSize(bool wTag, bool wLength, bool wData) cons size_t rc = wTag ? 1 : 0; size_t lengthSize = 0; size_t dataSize = 0; - + switch (getClumpletType(clumplet[0])) { @@ -455,7 +455,7 @@ void ClumpletReader::rewind() } if (kind == UnTagged || kind == WideUnTagged || kind == SpbStart || kind == SpbItems) cur_offset = 0; - else if (kind == SpbAttach && getBufferLength() > 0 + else if (kind == SpbAttach && getBufferLength() > 0 && getBuffer()[0] != isc_spb_version1) cur_offset = 2; else diff --git a/src/common/classes/ClumpletWriter.cpp b/src/common/classes/ClumpletWriter.cpp index d6aa230fa4..f9f5d4f646 100644 --- a/src/common/classes/ClumpletWriter.cpp +++ b/src/common/classes/ClumpletWriter.cpp @@ -36,20 +36,20 @@ namespace Firebird { -ClumpletWriter::ClumpletWriter(Kind k, size_t limit, UCHAR tag) : - ClumpletReader(k, NULL, 0), sizeLimit(limit), dynamic_buffer(getPool()) +ClumpletWriter::ClumpletWriter(Kind k, size_t limit, UCHAR tag) : + ClumpletReader(k, NULL, 0), sizeLimit(limit), dynamic_buffer(getPool()) { initNewBuffer(tag); rewind(); } - -ClumpletWriter::ClumpletWriter(MemoryPool& given_pool, Kind k, size_t limit, UCHAR tag) : - ClumpletReader(given_pool, k, NULL, 0), sizeLimit(limit), dynamic_buffer(getPool()) + +ClumpletWriter::ClumpletWriter(MemoryPool& given_pool, Kind k, size_t limit, UCHAR tag) : + ClumpletReader(given_pool, k, NULL, 0), sizeLimit(limit), dynamic_buffer(getPool()) { initNewBuffer(tag); rewind(); } - + void ClumpletWriter::initNewBuffer(UCHAR tag) { switch (kind) @@ -72,7 +72,7 @@ void ClumpletWriter::initNewBuffer(UCHAR tag) } ClumpletWriter::ClumpletWriter(Kind k, size_t limit, const UCHAR* buffer, size_t buffLen, UCHAR tag) : - ClumpletReader(k, NULL, 0), sizeLimit(limit), dynamic_buffer(getPool()) + ClumpletReader(k, NULL, 0), sizeLimit(limit), dynamic_buffer(getPool()) { if (buffer && buffLen) { dynamic_buffer.push(buffer, buffLen); @@ -85,7 +85,7 @@ ClumpletWriter::ClumpletWriter(Kind k, size_t limit, const UCHAR* buffer, size_t ClumpletWriter::ClumpletWriter(MemoryPool& given_pool, Kind k, size_t limit, const UCHAR* buffer, size_t buffLen, UCHAR tag) : - ClumpletReader(given_pool, k, NULL, 0), sizeLimit(limit), dynamic_buffer(getPool()) + ClumpletReader(given_pool, k, NULL, 0), sizeLimit(limit), dynamic_buffer(getPool()) { if (buffer && buffLen) { dynamic_buffer.push(buffer, buffLen); @@ -203,7 +203,7 @@ void ClumpletWriter::insertBytesLengthCheck(UCHAR tag, const UCHAR* bytes, const usage_mistake("write past EOF"); return; } - + // Check length according to clumplet type const ClumpletType t = getClumpletType(tag); UCHAR lenSize = 0; @@ -344,7 +344,7 @@ void ClumpletWriter::deleteClumplet() if (buffer_end - clumplet < 2) { // It appears we're erasing EOF marker dynamic_buffer.shrink(cur_offset); - } + } else { dynamic_buffer.removeCount(cur_offset, getClumpletSize(true, true, true)); } diff --git a/src/common/classes/MetaName.cpp b/src/common/classes/MetaName.cpp index 06fba70969..d637ad87af 100644 --- a/src/common/classes/MetaName.cpp +++ b/src/common/classes/MetaName.cpp @@ -25,7 +25,7 @@ * * */ - + #include "firebird.h" #include @@ -49,7 +49,7 @@ namespace Firebird { return *this; } - int MetaName::compare(const char* s, size_t l) const + int MetaName::compare(const char* s, size_t l) const { if (s) { @@ -83,7 +83,7 @@ namespace Firebird { void MetaName::upper7() { - for (char* p = data; *p; p++) + for (char* p = data; *p; p++) { *p = UPPER7(*p); } @@ -91,7 +91,7 @@ namespace Firebird { void MetaName::lower7() { - for (char* p = data; *p; p++) + for (char* p = data; *p; p++) { *p = LOWWER7(*p); } diff --git a/src/common/classes/MsgPrint.cpp b/src/common/classes/MsgPrint.cpp index 932eb249ac..1b65a7a2d7 100644 --- a/src/common/classes/MsgPrint.cpp +++ b/src/common/classes/MsgPrint.cpp @@ -216,7 +216,7 @@ int MsgPrintHelper(BaseStream& out_stream, const safe_cell& item) size_t n = strlen(s); if (n > MAX_STRING) n = MAX_STRING; - + return out_stream.write(s, n); } case safe_cell::at_ptr: @@ -293,7 +293,7 @@ int MsgPrint(const char* format, const SafeArg& arg) int MsgPrint(const char* format) { static const SafeArg dummy; - + StdioStream st(stdout); return MsgPrint(st, format, dummy); } diff --git a/src/common/classes/SafeArg.cpp b/src/common/classes/SafeArg.cpp index 1b36bf8bc3..6b1c5a0a85 100644 --- a/src/common/classes/SafeArg.cpp +++ b/src/common/classes/SafeArg.cpp @@ -25,7 +25,7 @@ * */ - + // Localized messages type-safe printing facility. #include "firebird.h" @@ -311,10 +311,10 @@ void SafeArg::dump(const TEXT* target[], size_t v_size) const const safe_cell& SafeArg::getCell(size_t index) const { static safe_cell aux_cell = {safe_cell::at_none, {0}}; - + if (index < m_count) return m_arguments[index]; - + return aux_cell; } diff --git a/src/common/classes/TempFile.cpp b/src/common/classes/TempFile.cpp index 007835a27d..328d71e372 100644 --- a/src/common/classes/TempFile.cpp +++ b/src/common/classes/TempFile.cpp @@ -52,7 +52,7 @@ // Const definitions static const char* ENV_VAR = "FIREBIRD_TMP"; -static const char* DEFAULT_PATH = +static const char* DEFAULT_PATH = #if defined(UNIX) "/tmp/"; #elif defined(WIN_NT) @@ -234,7 +234,7 @@ void TempFile::seek(const offset_t offset) { if (position == offset) return; - + #if defined(WIN_NT) LARGE_INTEGER liOffset; liOffset.QuadPart = offset; diff --git a/src/common/classes/alloc.cpp b/src/common/classes/alloc.cpp index 0eca4d3a2f..1975ca9603 100644 --- a/src/common/classes/alloc.cpp +++ b/src/common/classes/alloc.cpp @@ -53,7 +53,7 @@ #define FREE_PATTERN 0xDEADBEEF #define ALLOC_PATTERN 0xFEEDABED #ifdef DEBUG_GDS_ALLOC -inline void PATTERN_FILL(void* ptr, size_t size, unsigned int pattern) +inline void PATTERN_FILL(void* ptr, size_t size, unsigned int pattern) { for (size_t i = 0; i < size / sizeof(unsigned int); i++) { @@ -90,13 +90,13 @@ inline static void mem_assert(bool value) // Returns redirect list for given memory block inline MemoryRedirectList* block_list_small(MemoryBlock* block) { - return (MemoryRedirectList*)((char*)block + MEM_ALIGN(sizeof(MemoryBlock)) + + return (MemoryRedirectList*)((char*)block + MEM_ALIGN(sizeof(MemoryBlock)) + block->mbk_small.mbk_length - MEM_ALIGN(sizeof(MemoryRedirectList))); } inline MemoryRedirectList* block_list_large(MemoryBlock* block) { - return (MemoryRedirectList*)((char*)block + MEM_ALIGN(sizeof(MemoryBlock)) + + return (MemoryRedirectList*)((char*)block + MEM_ALIGN(sizeof(MemoryBlock)) + block->mbk_large_length - MEM_ALIGN(sizeof(MemoryRedirectList))); } @@ -167,7 +167,7 @@ int dev_zero_fd = -1; /* Cached file descriptor for /dev/zero. */ #if defined(WIN_NT) || defined(HAVE_MMAP) // Extents cache is not used when DEBUG_GDS_ALLOC or USE_VALGRIND is enabled. -// This slows down things a little due to frequent syscalls mapping/unmapping +// This slows down things a little due to frequent syscalls mapping/unmapping // memory but allows to detect more allocation errors Vector extents_cache; Mutex* cache_mutex; // Will be initialized manually in MemoryPool::init @@ -177,7 +177,7 @@ size_t map_page_size = 0; inline size_t get_map_page_size() { - if (! map_page_size) + if (! map_page_size) { map_page_size = get_page_size(); } @@ -258,7 +258,7 @@ MemoryPool* MemoryPool::setContextPool(MemoryPool* newPool) TLS_SET(contextPool, newPool); return old; } - + MemoryPool* MemoryPool::getContextPool() { return TLS_GET(contextPool); @@ -269,7 +269,7 @@ MemoryStats* MemoryPool::default_stats_group = NULL; MemoryPool* MemoryPool::processMemoryPool = NULL; // Initialize process memory pool (called from InstanceControl). -// At this point also set contextMemoryPool for main thread +// At this point also set contextMemoryPool for main thread // (or all process in case of no threading). void MemoryPool::init() @@ -311,7 +311,7 @@ void MemoryPool::setStatsGroup(MemoryStats& statsL) // to be safe if (parent) parent->lock.enter(); - + lock.enter(); const size_t sav_used_memory = used_memory.value(); const size_t sav_mapped_memory = mapped_memory; @@ -319,18 +319,18 @@ void MemoryPool::setStatsGroup(MemoryStats& statsL) decrement_usage(sav_used_memory); this->stats = &statsL; increment_mapping(sav_mapped_memory); - increment_usage(sav_used_memory); + increment_usage(sav_used_memory); lock.leave(); if (parent) parent->lock.leave(); } -MemoryPool::MemoryPool(MemoryPool* parentL, +MemoryPool::MemoryPool(MemoryPool* parentL, MemoryStats &statsL, void *first_extent, void *root_page ) : parent_redirect(parentL != NULL), freeBlocks((InternalAllocator*)this, root_page), - extents((MemoryExtent *)first_extent), + extents((MemoryExtent *)first_extent), needSpare(false), pendingFree(NULL), used_memory(0), @@ -379,7 +379,7 @@ void MemoryPool::updateSpare() // Blocks added with tree_deallocate may require merging with nearby ones // This is why we do internal_deallocate internal_deallocate(temp); // Note that this method may change pendingFree! - + if (needSpare) break; // New pages were added to tree. Loop again } @@ -394,7 +394,7 @@ void* MemoryPool::external_alloc(size_t &size) { // This method is assumed to return NULL in case it cannot alloc size = FB_ALIGN(size, get_map_page_size()); - void *result = mmap(NULL, size, PROT_READ | PROT_WRITE, + void *result = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); // Let Valgrind forget that block was zero-initialized VALGRIND_DISCARD( @@ -478,7 +478,7 @@ void* MemoryPool::external_alloc(size_t &size) # endif # if defined WIN_NT size = FB_ALIGN(size, get_map_page_size()); - return VirtualAlloc(NULL, size, MEM_COMMIT, + return VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_READWRITE); # elif defined (HAVE_MMAP) && !defined(SOLARIS) @@ -489,16 +489,16 @@ void* MemoryPool::external_alloc(size_t &size) size = FB_ALIGN(size, get_map_page_size()); void* result = NULL; # ifdef MAP_ANONYMOUS - result = mmap(NULL, size, PROT_READ | PROT_WRITE, + result = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); -# else +# else // This code is needed for Solaris 2.6, AFAIK (only?) if (dev_zero_fd < 0) dev_zero_fd = open("/dev/zero", O_RDWR); - result = mmap(NULL, size, PROT_READ | PROT_WRITE, + result = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE, dev_zero_fd, 0); # endif //MAP_ANONYMOUS - return result == MAP_FAILED ? NULL : result; + return result == MAP_FAILED ? NULL : result; # elif defined(SOLARIS) // No successful return from mmap() will return the value MAP_FAILED. @@ -510,33 +510,33 @@ void* MemoryPool::external_alloc(size_t &size) void *result = NULL; # ifdef MAP_ANONYMOUS - result = mmap(0, size, PROT_READ | PROT_WRITE, + result = mmap(0, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON , -1, 0); if (result == MAP_FAILED) { // failure happens! return NULL; - } + } else { - return result; - } -# else + return result; + } +# else // This code is needed for Solaris 2.6, AFAIK if (dev_zero_fd < 0) dev_zero_fd = open("/dev/zero", O_RDWR); - result = mmap(NULL, size, PROT_READ | PROT_WRITE, + result = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE, dev_zero_fd, 0); if (result == MAP_FAILED) { return NULL; - } + } else { - return result; - } + return result; + } # endif //MAP_ANONYMOUS # else return malloc(size); # endif } - + void MemoryPool::external_free(void *blk, size_t &size, bool pool_destroying) { # if !defined(DEBUG_GDS_ALLOC) && (defined(WIN_NT) || defined(HAVE_MMAP)) @@ -558,7 +558,7 @@ void MemoryPool::external_free(void *blk, size_t &size, bool pool_destroying) if (munmap((caddr_t) blk, size)) system_call_failed::raise("munmap"); -# else +# else if (munmap(blk, size)) system_call_failed::raise("munmap"); # endif /*Solaris*/ @@ -573,8 +573,8 @@ void* MemoryPool::tree_alloc(size_t size) { if (size == sizeof(FreeBlocksTree::ItemList)) // This condition is to handle case when nodelist and itemlist have equal size - if (sizeof(FreeBlocksTree::ItemList) != sizeof(FreeBlocksTree::NodeList) || - spareLeafs.getCount()) + if (sizeof(FreeBlocksTree::ItemList) != sizeof(FreeBlocksTree::NodeList) || + spareLeafs.getCount()) { if (!spareLeafs.getCount()) Firebird::BadAlloc::raise(); @@ -623,7 +623,7 @@ void* MemoryPool::allocate_nothrow(size_t size if (parent_redirect) { - // We do not synchronize redirect_amount here. In the worst case we redirect slightly + // We do not synchronize redirect_amount here. In the worst case we redirect slightly // more allocations to parent than we wanted. This shouldn't cause problems if (redirect_amount + size < REDIRECT_THRESHOLD) { @@ -667,7 +667,7 @@ void* MemoryPool::allocate_nothrow(size_t size { // It may have changed while we were taking the lock parent_redirect = false; // Do some hard manual work to initialize first extent - + // This is the exact initial layout of memory pool in the first extent // // MemoryExtent // MemoryBlock @@ -726,7 +726,7 @@ void* MemoryPool::allocate_nothrow(size_t size lock.enter(); // If block cannot fit into extent then allocate it from OS directly if (size > EXTENT_SIZE - MEM_ALIGN(sizeof(MemoryBlock)) - MEM_ALIGN(sizeof(MemoryExtent))) { - size_t ext_size = MEM_ALIGN(sizeof(MemoryBlock)) + size + + size_t ext_size = MEM_ALIGN(sizeof(MemoryBlock)) + size + MEM_ALIGN(sizeof(MemoryRedirectList)); MemoryBlock *blk = (MemoryBlock*) external_alloc(ext_size); if (!blk) { @@ -759,7 +759,7 @@ void* MemoryPool::allocate_nothrow(size_t size //VALGRIND_MAKE_NOACCESS((char*)result - VALGRIND_REDZONE, VALGRIND_REDZONE); //VALGRIND_MAKE_WRITABLE(result, requested_size); //VALGRIND_MAKE_NOACCESS((char*)result + requested_size, VALGRIND_REDZONE); -#endif +#endif return result; } // Otherwise use conventional allocator @@ -780,7 +780,7 @@ void* MemoryPool::allocate_nothrow(size_t size //VALGRIND_MAKE_NOACCESS((char*)result - VALGRIND_REDZONE, VALGRIND_REDZONE); //VALGRIND_MAKE_WRITABLE(result, requested_size); //VALGRIND_MAKE_NOACCESS((char*)result + requested_size, VALGRIND_REDZONE); -#endif +#endif return result; } @@ -802,22 +802,22 @@ void* MemoryPool::allocate(size_t size bool MemoryPool::verify_pool(bool fast_checks_only) { lock.enter(); - mem_assert(!pendingFree || needSpare); // needSpare flag should be set if we are in + mem_assert(!pendingFree || needSpare); // needSpare flag should be set if we are in // a critically low memory condition size_t blk_used_memory = 0; size_t blk_mapped_memory = 0; // Verify that free blocks tree is consistent and indeed contains free memory blocks - if (freeBlocks.getFirst()) + if (freeBlocks.getFirst()) do { BlockInfo *current = &freeBlocks.current(); // Verify that head of free blocks list set correctly mem_assert(current->bli_fragments); mem_assert(ptrToBlock(current->bli_fragments)->mbk_prev_fragment == NULL); - + // Look over all blocks in list checking that things look kosher - for (FreeMemoryBlock *fragment = current->bli_fragments; + for (FreeMemoryBlock *fragment = current->bli_fragments; fragment; fragment = fragment->fbk_next_fragment) { // Make sure that list is actually doubly linked @@ -847,11 +847,11 @@ bool MemoryPool::verify_pool(bool fast_checks_only) blk_mapped_memory += EXTENT_SIZE; USHORT prev_length = 0; for (MemoryBlock *blk = (MemoryBlock *)((char*)extent + MEM_ALIGN(sizeof(MemoryExtent))); - ; + ; blk = next_block(blk)) { // Verify block flags, large blocks are not allowed here - mem_assert(!(blk->mbk_flags & + mem_assert(!(blk->mbk_flags & ~(MBK_USED | MBK_LAST | MBK_PARENT | MBK_DELAYED))); // Check that if block is marked as delayed free it is still accounted as used @@ -866,8 +866,8 @@ bool MemoryPool::verify_pool(bool fast_checks_only) } // Calculate memory usage - if ((blk->mbk_flags & MBK_USED) && !(blk->mbk_flags & MBK_PARENT) && - !(blk->mbk_flags & MBK_DELAYED) && (blk->mbk_type >= 0)) + if ((blk->mbk_flags & MBK_USED) && !(blk->mbk_flags & MBK_PARENT) && + !(blk->mbk_flags & MBK_DELAYED) && (blk->mbk_type >= 0)) { blk_used_memory += blk->mbk_small.mbk_length; } @@ -897,7 +897,7 @@ bool MemoryPool::verify_pool(bool fast_checks_only) mem_assert(foundPending || ptrToBlock(freeBlocks.current().bli_fragments) == blk); } - // See if next fragment seems kosher + // See if next fragment seems kosher // (note that FreeMemoryBlock has the same structure as PendingFreeBlock so we can do this check) FreeMemoryBlock *next_fragment = blockToPtr(blk)->fbk_next_fragment; if (next_fragment) { @@ -909,9 +909,9 @@ bool MemoryPool::verify_pool(bool fast_checks_only) } if (fast_checks_only) { - foundTree = !(blk->mbk_flags & MBK_USED) && + foundTree = !(blk->mbk_flags & MBK_USED) && (blk->mbk_prev_fragment || ptrToBlock(freeBlocks.current().bli_fragments) == blk); - } + } else { for (FreeMemoryBlock* freeBlk = freeBlocks.current().bli_fragments; freeBlk; freeBlk = freeBlk->fbk_next_fragment) { @@ -1009,7 +1009,7 @@ bool MemoryPool::verify_pool(bool fast_checks_only) else { mem_assert(blk_used_memory == (size_t) used_memory.value()); } - + return true; } @@ -1017,8 +1017,8 @@ static void print_block(FILE *file, MemoryBlock *blk, bool used_only, const char* filter_path, const size_t filter_len) { void *mem = blockToPtr(blk); - if (((blk->mbk_flags & MBK_USED) && - !(blk->mbk_flags & MBK_DELAYED) && blk->mbk_type >= 0) || !used_only) + if (((blk->mbk_flags & MBK_USED) && + !(blk->mbk_flags & MBK_DELAYED) && blk->mbk_type >= 0) || !used_only) { char flags[100]; flags[0] = 0; @@ -1068,7 +1068,7 @@ void MemoryPool::print_contents(FILE *file, bool used_only, const char* filter_path) { lock.enter(); - fprintf(file, "********* Printing contents of pool %p used=%ld mapped=%ld:\n", + fprintf(file, "********* Printing contents of pool %p used=%ld mapped=%ld:\n", this, (long)used_memory.value(), (long)mapped_memory); const size_t filter_len = filter_path ? strlen(filter_path) : 0; @@ -1077,7 +1077,7 @@ void MemoryPool::print_contents(FILE *file, bool used_only, if (!used_only) fprintf(file, "EXTENT %p:\n", extent); for (MemoryBlock *blk = (MemoryBlock *)((char*)extent + MEM_ALIGN(sizeof(MemoryExtent))); - ; + ; blk = next_block(blk)) { print_block(file, blk, used_only, filter_path, filter_len); @@ -1103,12 +1103,12 @@ void MemoryPool::print_contents(FILE *file, bool used_only, fprintf(file, "********* End of output for pool %p.\n", this); } -MemoryPool* MemoryPool::createPool(MemoryPool* parent, MemoryStats &stats) +MemoryPool* MemoryPool::createPool(MemoryPool* parent, MemoryStats &stats) { MemoryPool *pool; #ifndef USE_VALGRIND // If pool has a parent things are simplified. - // Note we do not use parent redirection when using Valgrind because it is + // Note we do not use parent redirection when using Valgrind because it is // difficult to make memory pass through any delayed free list in this case if (parent) { parent->lock.enter(); @@ -1130,7 +1130,7 @@ MemoryPool* MemoryPool::createPool(MemoryPool* parent, MemoryStats &stats) pool->parent_redirected = blk; parent->lock.leave(); - } + } else #endif { @@ -1157,11 +1157,11 @@ MemoryPool* MemoryPool::createPool(MemoryPool* parent, MemoryStats &stats) pool = new(mem + MEM_ALIGN(sizeof(MemoryExtent)) + - MEM_ALIGN(sizeof(MemoryBlock))) - MemoryPool(NULL, stats, mem, mem + - MEM_ALIGN(sizeof(MemoryExtent)) + - MEM_ALIGN(sizeof(MemoryBlock)) + - MEM_ALIGN(sizeof(MemoryPool)) + + MEM_ALIGN(sizeof(MemoryBlock))) + MemoryPool(NULL, stats, mem, mem + + MEM_ALIGN(sizeof(MemoryExtent)) + + MEM_ALIGN(sizeof(MemoryBlock)) + + MEM_ALIGN(sizeof(MemoryPool)) + MEM_ALIGN(sizeof(MemoryBlock))); pool->increment_mapping(EXTENT_SIZE); @@ -1257,13 +1257,13 @@ void MemoryPool::deletePool(MemoryPool* pool) MemoryExtent *next = extent->mxt_next; size_t ext_size = EXTENT_SIZE; external_free(extent, ext_size, true); - fb_assert(ext_size == EXTENT_SIZE); // Make sure exent size is a multiply of page size + fb_assert(ext_size == EXTENT_SIZE); // Make sure exent size is a multiply of page size extent = next; } // Deallocate blocks redirected to parent // IF parent is set then pool was allocated from it and is not deleted at this point yet - if (parent) { + if (parent) { parent->lock.enter(); MemoryBlock *redirected = pool->parent_redirected; while (redirected) { @@ -1276,10 +1276,10 @@ void MemoryPool::deletePool(MemoryPool* pool) // Remove protection from red zones of memory block or block as whole if it is // in delayed free queue. Since this code makes pointers to deallocated memory - // immediately valid we disable parent redirection in USE_VALGRIND mode. Code is + // immediately valid we disable parent redirection in USE_VALGRIND mode. Code is // here for case if you want to debug something with parent redirection enabled. VALGRIND_DISCARD( - VALGRIND_MAKE_WRITABLE((char*)redirected + MEM_ALIGN(sizeof(MemoryBlock)) - VALGRIND_REDZONE, + VALGRIND_MAKE_WRITABLE((char*)redirected + MEM_ALIGN(sizeof(MemoryBlock)) - VALGRIND_REDZONE, (redirected->mbk_flags & MBK_LARGE ? redirected->mbk_large_length: redirected->mbk_small.mbk_length) - (redirected->mbk_flags & (MBK_LARGE | MBK_PARENT) ? MEM_ALIGN(sizeof(MemoryRedirectList)) : 0) + VALGRIND_REDZONE) @@ -1352,20 +1352,20 @@ void* MemoryPool::internal_alloc(size_t size, SSHORT type FreeMemoryBlock *next_free = current->bli_fragments->fbk_next_fragment; if (next_free) { - // Moderately cheap case. Quite possibly we only need to tweak doubly + // Moderately cheap case. Quite possibly we only need to tweak doubly // linked lists a little ptrToBlock(next_free)->mbk_prev_fragment = NULL; current->bli_fragments = next_free; addFreeBlock(current_block); - } + } else { // This is special handling of case when we have single large fragment and - // cut off small pieces from it. This is common and we avoid modification + // cut off small pieces from it. This is common and we avoid modification // of free blocks tree in this case. bool get_prev_succeeded = freeBlocks.getPrev(); if (!get_prev_succeeded || freeBlocks.current().bli_length < current_block->mbk_small.mbk_length) { current->bli_length = current_block->mbk_small.mbk_length; - } + } else { // Moderately expensive case. We need to modify tree for sure if (get_prev_succeeded) { @@ -1406,7 +1406,7 @@ void* MemoryPool::internal_alloc(size_t size, SSHORT type if (prev) prev->next = itr->next; else - pendingFree = itr->next; + pendingFree = itr->next; PATTERN_FILL(itr, size, ALLOC_PATTERN); return itr; @@ -1460,8 +1460,8 @@ void* MemoryPool::internal_alloc(size_t size, SSHORT type blk->mbk_line = line; #endif blk->mbk_small.mbk_prev_length = 0; - if (EXTENT_SIZE - size - MEM_ALIGN(sizeof(MemoryExtent)) - MEM_ALIGN(sizeof(MemoryBlock)) - < MEM_ALIGN(sizeof(MemoryBlock)) + ALLOC_ALIGNMENT) + if (EXTENT_SIZE - size - MEM_ALIGN(sizeof(MemoryExtent)) - MEM_ALIGN(sizeof(MemoryBlock)) + < MEM_ALIGN(sizeof(MemoryBlock)) + ALLOC_ALIGNMENT) { // Block is small enough to be returned AS IS blk->mbk_flags |= MBK_LAST; @@ -1475,7 +1475,7 @@ void* MemoryPool::internal_alloc(size_t size, SSHORT type // Will be initialized (to NULL) by addFreeBlock code // rest->mbk_pool = this; rest->mbk_flags = MBK_LAST; - rest->mbk_small.mbk_length = EXTENT_SIZE - MEM_ALIGN(sizeof(MemoryExtent)) - + rest->mbk_small.mbk_length = EXTENT_SIZE - MEM_ALIGN(sizeof(MemoryExtent)) - MEM_ALIGN(sizeof(MemoryBlock)) - size - MEM_ALIGN(sizeof(MemoryBlock)); rest->mbk_small.mbk_prev_length = blk->mbk_small.mbk_length; addFreeBlock(rest); @@ -1516,10 +1516,10 @@ inline void MemoryPool::addFreeBlock(MemoryBlock *blk) // NOTE! Items placed into pendingFree queue have mbk_prev_fragment equal to ZERO. } } - + void MemoryPool::removeFreeBlock(MemoryBlock *blk) { - // NOTE! We signal items placed into pendingFree queue via setting their + // NOTE! We signal items placed into pendingFree queue via setting their // mbk_prev_fragment to ZERO. FreeMemoryBlock *fragmentToRemove = blockToPtr(blk); @@ -1527,7 +1527,7 @@ void MemoryPool::removeFreeBlock(MemoryBlock *blk) FreeMemoryBlock *next = fragmentToRemove->fbk_next_fragment; if (prev) { // Cheapest case. There is no need to touch B+ tree at all. - // Simply remove item from a middle or end of doubly linked list + // Simply remove item from a middle or end of doubly linked list prev->fbk_next_fragment = next; if (next) ptrToBlock(next)->mbk_prev_fragment = prev; @@ -1536,8 +1536,8 @@ void MemoryPool::removeFreeBlock(MemoryBlock *blk) // Need to locate item in tree BlockInfo* current; - if (freeBlocks.locate(blk->mbk_small.mbk_length) && - (current = &freeBlocks.current())->bli_fragments == fragmentToRemove) + if (freeBlocks.locate(blk->mbk_small.mbk_length) && + (current = &freeBlocks.current())->bli_fragments == fragmentToRemove) { if (next) { // Still moderately fast case. All we need is to replace the head of fragments list @@ -1550,10 +1550,10 @@ void MemoryPool::removeFreeBlock(MemoryBlock *blk) } } else { - // Our block could be in the pending free blocks list if we are in a - // critically-low memory condition or if tree_free placed it there. + // Our block could be in the pending free blocks list if we are in a + // critically-low memory condition or if tree_free placed it there. // Find and remove it from there. - PendingFreeBlock *itr = pendingFree, + PendingFreeBlock *itr = pendingFree, *temp = blockToPtr(blk); if (itr == temp) pendingFree = itr->next; @@ -1584,12 +1584,12 @@ void MemoryPool::free_blk_extent(MemoryBlock *blk) if (extent->mxt_next) extent->mxt_next->mxt_prev = extent->mxt_prev; - fb_assert(blk->mbk_small.mbk_length + MEM_ALIGN(sizeof(MemoryBlock)) + + fb_assert(blk->mbk_small.mbk_length + MEM_ALIGN(sizeof(MemoryBlock)) + MEM_ALIGN(sizeof(MemoryExtent)) == EXTENT_SIZE); size_t ext_size = EXTENT_SIZE; external_free(extent, ext_size, false); - fb_assert(ext_size == EXTENT_SIZE); // Make sure exent size is a multiply of page size + fb_assert(ext_size == EXTENT_SIZE); // Make sure exent size is a multiply of page size decrement_mapping(EXTENT_SIZE); } @@ -1598,11 +1598,11 @@ void MemoryPool::internal_deallocate(void *block) MemoryBlock *blk = ptrToBlock(block); // This method is normally called for used blocks from our pool. Also it may - // be called for free blocks in pendingFree list by updateSpare routine. + // be called for free blocks in pendingFree list by updateSpare routine. // Such blocks must have mbk_prev_fragment equal to NULL. fb_assert( - blk->mbk_flags & MBK_USED ? + blk->mbk_flags & MBK_USED ? blk->mbk_pool == this : blk->mbk_prev_fragment == NULL); @@ -1643,8 +1643,8 @@ void MemoryPool::internal_deallocate(void *block) // Mark block as free blk->mbk_flags &= ~MBK_USED; // Try to merge block with next free block - if (!(blk->mbk_flags & MBK_LAST) && - !((next = next_block(blk))->mbk_flags & MBK_USED)) + if (!(blk->mbk_flags & MBK_LAST) && + !((next = next_block(blk))->mbk_flags & MBK_USED)) { removeFreeBlock(next); blk->mbk_small.mbk_length += next->mbk_small.mbk_length + MEM_ALIGN(sizeof(MemoryBlock)); @@ -1694,12 +1694,12 @@ void MemoryPool::deallocate(void *block) VALGRIND_MEMPOOL_FREE(this, block); // Make it read and write protected - int handle = - VALGRIND_MAKE_NOACCESS((char*)block - VALGRIND_REDZONE, + int handle = + VALGRIND_MAKE_NOACCESS((char*)block - VALGRIND_REDZONE, (blk->mbk_flags & MBK_LARGE ? blk->mbk_large_length: blk->mbk_small.mbk_length) - (blk->mbk_flags & (MBK_LARGE | MBK_PARENT) ? MEM_ALIGN(sizeof(MemoryRedirectList)) : 0) + VALGRIND_REDZONE); - + // Extend circular buffer if possible if (delayedFreeCount < FB_NELEM(delayedFree)) { delayedFree[delayedFreeCount] = block; @@ -1723,7 +1723,7 @@ void MemoryPool::deallocate(void *block) // Remove protection from memory block VALGRIND_DISCARD( - VALGRIND_MAKE_WRITABLE((char*)block - VALGRIND_REDZONE, + VALGRIND_MAKE_WRITABLE((char*)block - VALGRIND_REDZONE, (blk->mbk_flags & MBK_LARGE ? blk->mbk_large_length: blk->mbk_small.mbk_length) - (blk->mbk_flags & (MBK_LARGE | MBK_PARENT) ? MEM_ALIGN(sizeof(MemoryRedirectList)) : 0) + VALGRIND_REDZONE) @@ -1804,7 +1804,7 @@ void MemoryPool::deallocate(void *block) } MemoryPool& AutoStorage::getAutoMemoryPool() -{ +{ #ifndef SUPERCLIENT MemoryPool* p = MemoryPool::getContextPool(); if (! p) @@ -1815,15 +1815,15 @@ MemoryPool& AutoStorage::getAutoMemoryPool() MemoryPool* p = getDefaultMemoryPool(); #endif //SUPERCLIENT fb_assert(p); - return *p; + return *p; } #if defined(DEV_BUILD) void AutoStorage::ProbeStack() const { // - // AutoStorage() default constructor can be used only - // for objects on the stack. ProbeStack() uses the + // AutoStorage() default constructor can be used only + // for objects on the stack. ProbeStack() uses the // following assumptions to check it: // 1. One and only one stack is used for all kind of variables. // 2. Objects don't grow > 64K. diff --git a/src/common/classes/class_perf.cpp b/src/common/classes/class_perf.cpp index cf805f7bdd..80e510ffa0 100644 --- a/src/common/classes/class_perf.cpp +++ b/src/common/classes/class_perf.cpp @@ -22,7 +22,7 @@ * * All Rights Reserved. * Contributor(s): ______________________________________. - * + * * */ @@ -43,7 +43,7 @@ const int TEST_ITEMS = 5000000; void report(int scaleNode, int scaleTree) { clock_t d = clock(); - printf("Add+remove %d elements from tree of scale %d/%d took %d milliseconds. \n", + printf("Add+remove %d elements from tree of scale %d/%d took %d milliseconds. \n", TEST_ITEMS, scaleNode, scaleTree, (int)(d-t)*1000/CLOCKS_PER_SEC); } @@ -61,9 +61,9 @@ static void testTree() { } printf(" DONE\n"); MallocAllocator temp; - + start(); - BePlusTree, + BePlusTree, DefaultComparator, 30, 30> tree30(NULL); for (i=0; i, + BePlusTree, DefaultComparator, 50, 50> tree50(NULL); for (i=0; i, + BePlusTree, DefaultComparator, 75, 75> tree75(NULL); for (i=0; i, + BePlusTree, DefaultComparator, 100, 100> tree100(NULL); for (i=0; i, + BePlusTree, DefaultComparator, 100, 250> tree100_250(NULL); for (i=0; i, + BePlusTree, DefaultComparator, 200, 200> tree200(NULL); for (i=0; i stlTree; start(); for (i=0; i, AllocItem> items(&allocator), bigItems(&allocator); // Allocate small items - int i, n = 0; + int i, n = 0; for (i=0;iallocate((n % MAX_ITEM_SIZE + MAX_ITEM_SIZE) / 2 + 1)}; @@ -214,7 +214,7 @@ static void testAllocatorMemoryPool() { if (items.getFirst()) do { pool->deallocate(items.current().item); n++; - } while (n < ALLOC_ITEMS / 2 && items.getNext()); + } while (n < ALLOC_ITEMS / 2 && items.getNext()); // Allocate big items for (i=0;ideallocate(items.current().item); n++; - } while (n < ALLOC_ITEMS / 2 && items.getNext()); + } while (n < ALLOC_ITEMS / 2 && items.getNext()); // Allocate big items for (i=0;i *and_res = SparseBitmap::bit_and(&bitmap, &bitmap2); bool has1 = tree2.getFirst(), has2 = and_res->getFirst(); @@ -154,9 +154,9 @@ void testBitmap() { has2 = and_res->getNext(); fb_assert(has1 == has2); fb_assert((ULONG)tree2.current() == and_res->current()); - } + } printf(" DONE\n"); - + printf("Verify OR operation for correctness (and backwards iterator)"); tree.clear(); @@ -199,7 +199,7 @@ struct Test { void testBePlusTree() { MallocAllocator temp; printf("Test Firebird::BePlusTree\n"); - + printf("Fill array with test data (%d items)...", (int)TEST_ITEMS); Vector v; int n = 0; @@ -210,11 +210,11 @@ void testBePlusTree() { v.add(((i + n) % TEST_ITEMS + TEST_ITEMS) / 2); } printf(" DONE\n"); - + printf("Create two trees one with factor 2 and one with factor 13 and fill them with test data: "); - BePlusTree, 2, 2> tree1(&temp); - BePlusTree, 13, 13> tree2(&temp); int cnt1 = 0, cnt2 = 0; for (i = 0; i < v.getCount(); i++) { @@ -237,10 +237,10 @@ void testBePlusTree() { if (!tree2.add(t)) fb_assert(false); cnt2++; - } + } } printf(" DONE\n"); - + bool passed = true; printf("Empty trees verifying fastRemove() result: "); @@ -277,7 +277,7 @@ void testBePlusTree() { passed = false; printf(passed ? "PASSED\n" : "FAILED\n"); passed = true; - + printf("Fill trees with data again: "); cnt1 = 0; cnt2 = 0; for (i = 0; i < v.getCount(); i++) { @@ -300,10 +300,10 @@ void testBePlusTree() { if (!tree2.add(t)) fb_assert(false); cnt2++; - } + } } printf(" DONE\n"); - + printf("Check that tree(2) contains test data: "); for (i = 0; i < v.getCount(); i++) { if (!tree1.locate(locEqual, v[i])) @@ -311,27 +311,27 @@ void testBePlusTree() { } printf(passed ? "PASSED\n" : "FAILED\n"); passed = true; - + printf("Check that tree(13) contains test data: "); for (i = 0; i < v.getCount(); i++) { if (!tree2.locate(locEqual, v[i])) passed = false; } printf(passed ? "PASSED\n" : "FAILED\n"); - + passed = true; - + printf("Check that tree(2) contains data from the tree(13) and its count is correct: "); n = 0; if (tree1.getFirst()) do { n++; - if (!tree2.locate(locEqual, tree1.current().value)) + if (!tree2.locate(locEqual, tree1.current().value)) passed = false; } while (tree1.getNext()); - if (n != cnt1 || cnt1 != cnt2) + if (n != cnt1 || cnt1 != cnt2) passed = false; printf(passed ? "PASSED\n" : "FAILED\n"); - + printf("Check that tree(13) contains data from the tree(2) "\ "and its count is correct (check in reverse order): "); n = 0; @@ -343,13 +343,13 @@ void testBePlusTree() { if (n != cnt2) passed = false; printf(passed ? "PASSED\n" : "FAILED\n"); - + printf("Remove half of data from the trees: "); passed = true; while (v.getCount() > TEST_ITEMS / 2) { if (!tree1.locate(locEqual, v[v.getCount() - 1])) fb_assert(false); - if (tree1.current().count > 1) + if (tree1.current().count > 1) tree1.current().count--; else { int nextValue = -1; @@ -360,7 +360,7 @@ void testBePlusTree() { if (tree1.fastRemove()) { if (tree1.current().value != nextValue) passed = false; - } + } else { if (nextValue >= 0) passed = false; @@ -369,7 +369,7 @@ void testBePlusTree() { } if (!tree2.locate(locEqual, v[v.getCount() - 1])) fb_assert(false); - if (tree2.current().count > 1) + if (tree2.current().count > 1) tree2.current().count--; else { int nextValue = -1; @@ -380,7 +380,7 @@ void testBePlusTree() { if (tree2.fastRemove()) { if (tree2.current().value != nextValue) passed = false; - } + } else { if (nextValue >= 0) passed = false; @@ -390,26 +390,26 @@ void testBePlusTree() { v.shrink(v.getCount() - 1); } printf(passed ? "PASSED\n" : "FAILED\n"); - + passed = true; printf("Check that tree(2) contains test data: "); for (i = 0; i < v.getCount(); i++) { if (!tree1.locate(locEqual, v[i])) passed = false; - } + } printf(passed ? "PASSED\n" : "FAILED\n"); passed = true; - + printf("Check that tree(13) contains test data: "); for (i = 0; i < v.getCount(); i++) { if (!tree2.locate(locEqual, v[i])) passed = false; - } + } printf(passed ? "PASSED\n" : "FAILED\n"); - + passed = true; - + printf("Check that tree(2) contains data from the tree(13) and its count is correct: "); n = 0; if (tree1.getFirst()) do { @@ -417,12 +417,12 @@ void testBePlusTree() { if (!tree2.locate(locEqual, tree1.current().value)) passed = false; } while (tree1.getNext()); - if (n != cnt1 || cnt1 != cnt2) + if (n != cnt1 || cnt1 != cnt2) passed = false; printf(passed ? "PASSED\n" : "FAILED\n"); - + passed = true; - + printf("Check that tree(13) contains data from the tree(2) "\ "and its count is correct (check in reverse order): "); n = 0; @@ -431,17 +431,17 @@ void testBePlusTree() { if (!tree1.locate(locEqual, tree2.current().value)) passed = false; } while (tree2.getPrev()); - if (n != cnt2) + if (n != cnt2) passed = false; printf(passed ? "PASSED\n" : "FAILED\n"); - + passed = true; - + printf("Remove the rest of data from the trees: "); for (i = 0;i < v.getCount(); i++) { if (!tree1.locate(locEqual, v[i])) fb_assert(false); - if (tree1.current().count > 1) + if (tree1.current().count > 1) tree1.current().count--; else { int nextValue = -1; @@ -452,7 +452,7 @@ void testBePlusTree() { if (tree1.fastRemove()) { if (tree1.current().value != nextValue) passed = false; - } + } else { if (nextValue >= 0) passed = false; @@ -472,7 +472,7 @@ void testBePlusTree() { if (tree2.fastRemove()) { if (tree2.current().value != nextValue) passed = false; - } + } else { if (nextValue >= 0) passed = false; @@ -515,11 +515,11 @@ void testAllocator() { printf("Test Firebird::MemoryPool\n"); MemoryPool* parent = getDefaultMemoryPool(); MemoryPool* pool = MemoryPool::createPool(parent); - + MallocAllocator allocator; BePlusTree, AllocItem> items(&allocator), bigItems(&allocator); - + Vector la; printf("Allocate %d large items: ", LARGE_ITEMS); int i; @@ -529,7 +529,7 @@ void testAllocator() { } VERIFY_POOL(pool); printf(" DONE\n"); - + printf("Allocate %d items: ", ALLOC_ITEMS); int n = 0; VERIFY_POOL(pool); @@ -542,7 +542,7 @@ void testAllocator() { printf(" DONE\n"); VERIFY_POOL(pool); VERIFY_POOL(parent); - + printf("Deallocate half of items in quasi-random order: "); n = 0; if (items.getFirst()) do { @@ -552,7 +552,7 @@ void testAllocator() { printf(" DONE\n"); VERIFY_POOL(pool); VERIFY_POOL(parent); - + printf("Allocate %d big items: ", BIG_ITEMS); n = 0; VERIFY_POOL(pool); @@ -565,7 +565,7 @@ void testAllocator() { printf(" DONE\n"); VERIFY_POOL(pool); VERIFY_POOL(parent); - + printf("Deallocate the rest of small items in quasi-random order: "); while (items.getNext()) { pool->deallocate(items.current().item); @@ -573,26 +573,26 @@ void testAllocator() { printf(" DONE\n"); VERIFY_POOL(pool); VERIFY_POOL(parent); - + printf("Deallocate big items in quasi-random order: "); if (bigItems.getFirst()) do { pool->deallocate(bigItems.current().item); } while (bigItems.getNext()); printf(" DONE\n"); - + printf("Deallocate %d large items: ", LARGE_ITEMS/2); for (i = 0; ideallocate(la[i]); VERIFY_POOL(pool); printf(" DONE\n"); - + // pool->verify_pool(); // parent->verify_pool(); pool->print_contents(stdout, false); parent->print_contents(stdout, false); MemoryPool::deletePool(pool); -// parent->verify_pool(); +// parent->verify_pool(); // TODO: // Test critically low memory conditions // Test that tree correctly recovers in low-memory conditions diff --git a/src/common/classes/fb_string.cpp b/src/common/classes/fb_string.cpp index 997d0f3551..33d648b070 100644 --- a/src/common/classes/fb_string.cpp +++ b/src/common/classes/fb_string.cpp @@ -2,7 +2,7 @@ * PROGRAM: string class definition * MODULE: fb_string.cpp * DESCRIPTION: Provides almost that same functionality, - * that STL::basic_string does, + * that STL::basic_string does, * but behaves MemoryPools friendly. * * The contents of this file are subject to the Initial @@ -115,7 +115,7 @@ namespace Firebird { initialize(sizeL); memset(stringBuffer, c, sizeL); } - + void AbstractString::adjustRange(const size_type length, size_type& pos, size_type& n) { if (pos == npos) { @@ -153,7 +153,7 @@ namespace Firebird { return baseAppend(n); } reserveBuffer(stringLength + n); - memmove(stringBuffer + p0 + n, stringBuffer + p0, + memmove(stringBuffer + p0 + n, stringBuffer + p0, stringLength - p0 + 1); // Do not forget to move null terminator too stringLength += n; return stringBuffer + p0; @@ -162,7 +162,7 @@ namespace Firebird { void AbstractString::baseErase(size_type p0, size_type n) { adjustRange(length(), p0, n); - memmove(stringBuffer + p0, + memmove(stringBuffer + p0, stringBuffer + p0 + n, stringLength - (p0 + n) + 1); stringLength -= n; shrinkBuffer(); @@ -295,7 +295,7 @@ namespace Firebird { baseErase(0, length()); if (! file) return false; - + bool rc = false; int c; while ((c = getc(file)) != EOF) { @@ -423,7 +423,7 @@ extern "C" { } } resize(l); - return; + return; } temp[tempsize - 1] = 0; if (l < tempsize) { diff --git a/src/common/classes/locks.cpp b/src/common/classes/locks.cpp index f021982084..ceeab5b839 100644 --- a/src/common/classes/locks.cpp +++ b/src/common/classes/locks.cpp @@ -1,7 +1,7 @@ /* * PROGRAM: Client/Server Common Code * MODULE: locks.cpp - * DESCRIPTION: Win32 Mutex support compatible with + * DESCRIPTION: Win32 Mutex support compatible with * old OS versions (like Windows 95) * * The contents of this file are subject to the Initial @@ -46,7 +46,7 @@ TryEnterCS::TryEnterCS() { HMODULE kernel32 = GetModuleHandle("kernel32.dll"); if (kernel32) { - m_funct = (tTryEnterCriticalSection*) + m_funct = (tTryEnterCriticalSection*) GetProcAddress(kernel32, "TryEnterCriticalSection"); } } @@ -68,7 +68,7 @@ void Spinlock::init() SetCriticalSectionSpinCount = MISS_SPIN_COUNT; return; } - SetCriticalSectionSpinCount = + SetCriticalSectionSpinCount = (tSetCriticalSectionSpinCount *) GetProcAddress( kernel32, "SetCriticalSectionSpinCount"); if (!SetCriticalSectionSpinCount) { diff --git a/src/common/classes/semaphore.cpp b/src/common/classes/semaphore.cpp index 935ff86d4b..65fc8bed16 100644 --- a/src/common/classes/semaphore.cpp +++ b/src/common/classes/semaphore.cpp @@ -33,7 +33,7 @@ /* There is a problem with values returned by sem_open() in MacOS 10.5 and earlier. They are not pointers. They are handles, in format of file handle (0,1,2,3,...), -and worse - they share same space with actual file handles. And when we close +and worse - they share same space with actual file handles. And when we close unneeded file handles in divorce_terminal(), we kill all global semaphores. MIXED_SEMAPHORE_AND_FILE_HANDLE exists to avoid it. */ diff --git a/src/common/classes/string_test.cpp b/src/common/classes/string_test.cpp index a7f0bdb402..9f75f4959a 100644 --- a/src/common/classes/string_test.cpp +++ b/src/common/classes/string_test.cpp @@ -2,7 +2,7 @@ char lbl[] = "0123456789"; //#define CHECK_FATAL_RANGE_EXCEPTION //Don't modify 3 lines upper from this - they are used in file read test -//If you plan to check range exception, you may uncomment it - +//If you plan to check range exception, you may uncomment it - //anyway file test should not happen /* @@ -184,7 +184,7 @@ void test(void) { } { string a, b, c; - + a = "uuu"; b = lbl; c = a + b; @@ -254,19 +254,19 @@ void test(void) { { string a, b; b = lbl; - + a.assign(3, 'u'); validate(a, "uuu"); a.assign(lbl); validate(a, lbl); - + a.assign(lbl, 2); validate(a, "01"); - + a.assign(b, 3, 3); validate(a, "345"); - + a.assign(b); validate(a, lbl); @@ -287,15 +287,15 @@ void test(void) { a = lbl; a.insert(3, lbl); validate(a, "01201234567893456789"); - + a = lbl; a.insert(4, lbl, 2); validate(a, "012301456789"); - + a = lbl; a.insert(5, b, 3, 3); validate(a, "0123434556789"); - + a = lbl; a.insert(5, b); validate(a, "01234012345678956789"); @@ -313,8 +313,8 @@ void test(void) { a = lbl; x = a.begin(); x += 2; - string::iterator f = b.begin(); - string::iterator t = b.end(); + string::iterator f = b.begin(); + string::iterator t = b.end(); f++; t--; a.insert(x, f, t); validate(a, "011234567823456789"); @@ -368,27 +368,27 @@ void test(void) { a = lbl; a.replace(3, 3, lbl); validate(a, "01201234567896789"); - + a = lbl; f0 = a.begin() + 3; t0 = f0 + 3; a.replace(f0, t0, lbl); validate(a, "01201234567896789"); - + a = lbl; a.replace(4, 4, lbl, 2); validate(a, "01230189"); - + a = lbl; f0 = a.begin() + 4; t0 = f0 + 4; a.replace(f0, t0, lbl, 2); validate(a, "01230189"); - + a = lbl; a.replace(5, 10, b, 3, 3); validate(a, "01234345"); - + a = lbl; f0 = a.begin() + 5; t0 = f0 + 10; @@ -396,7 +396,7 @@ void test(void) { t = f + 3; a.replace(f0, t0, f, t); validate(a, "01234345"); - + a = lbl; a.replace(5, 0, b); validate(a, "01234012345678956789"); @@ -406,7 +406,7 @@ void test(void) { t0 = f0; a.replace(f0, t0, b); validate(a, "01234012345678956789"); - + a = lbl; a.replace(2, 1, "Something reaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaally long"); validate(a, "01Something reaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaally long3456789"); @@ -428,7 +428,7 @@ void test(void) { // a.swap(b); // validate(b, "3456789"); -// validate(a, lbl); +// validate(a, lbl); } #ifdef DEV_BUILD @@ -441,7 +441,7 @@ void test(void) { string a = "012345uuu345678"; // 9 string b = "345"; - + check(a.find(b), 3); check(a.find("45"), 4); check(a.find('5'), 5); @@ -561,7 +561,7 @@ void test(void) { check(c.compare(d), 1); check(c.compare(e), 1); - + check(a.compare(1, 10, b), 1); check(a.compare(1, 10, b, 1, 10), 0); check(a.compare(lbl), 0); @@ -570,7 +570,7 @@ void test(void) { #ifdef FULL_FIRE { string a = " 011100 ", b; - + b = a; b.ltrim(); validate(b, "011100 "); @@ -631,7 +631,7 @@ void start() { void report() { clock_t d = clock(); - printf("Test of %d iterations with %s took %d milliseconds.\n", + printf("Test of %d iterations with %s took %d milliseconds.\n", TEST_ITEMS, NAME, (int)(d-t)*1000/CLOCKS_PER_SEC); } diff --git a/src/common/classes/timestamp.cpp b/src/common/classes/timestamp.cpp index ac93c8d45c..00967fd754 100644 --- a/src/common/classes/timestamp.cpp +++ b/src/common/classes/timestamp.cpp @@ -53,7 +53,7 @@ TimeStamp TimeStamp::getCurrentTimeStamp() // NS: We round generated timestamps to whole millisecond. // Not many applications can deal with fractional milliseconds properly and // we do not use high resolution timers either so actual time granularity - // is going to to be somewhere in range between 1 ms (like on UNIX/Risc) + // is going to to be somewhere in range between 1 ms (like on UNIX/Risc) // and 53 ms (such as Win9X) time_t seconds; // UTC time @@ -71,7 +71,7 @@ TimeStamp TimeStamp::getCurrentTimeStamp() milliseconds = time_buffer.millitm; #endif - // NS: Current FB behavior of using server time zone is not appropriate for + // NS: Current FB behavior of using server time zone is not appropriate for // distributed applications. We should be storing UTC times everywhere and // convert timestamps to client timezone as necessary. Replace localtime stuff // with these lines as soon as the appropriate functionality is implemented @@ -255,12 +255,12 @@ void TimeStamp::round_time(ISC_TIME &ntime, const int precision) { const int scale = -ISC_TIME_SECONDS_PRECISION_SCALE - precision; - // for the moment, if greater precision was requested than we can + // for the moment, if greater precision was requested than we can // provide return what we have. if (scale <= 0) return; - static const ISC_TIME pow10table[] = + static const ISC_TIME pow10table[] = {1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000}; fb_assert(scale < FB_NELEM(pow10table)); diff --git a/src/common/config/config.cpp b/src/common/config/config.cpp index 9b27318b6a..aa4db10572 100644 --- a/src/common/config/config.cpp +++ b/src/common/config/config.cpp @@ -135,7 +135,7 @@ static Firebird::InitInstance sysConfig; * Implementation interface */ -ConfigImpl::ConfigImpl(MemoryPool& p) : ConfigRoot(p) +ConfigImpl::ConfigImpl(MemoryPool& p) : ConfigRoot(p) { /* Prepare some stuff */ @@ -244,7 +244,7 @@ static Firebird::PathName* rootFromCommandLine = 0; void Config::setRootDirectoryFromCommandLine(const Firebird::PathName& newRoot) { delete rootFromCommandLine; - rootFromCommandLine = FB_NEW(*getDefaultMemoryPool()) + rootFromCommandLine = FB_NEW(*getDefaultMemoryPool()) Firebird::PathName(*getDefaultMemoryPool(), newRoot); } diff --git a/src/common/config/config_file.cpp b/src/common/config/config_file.cpp index 9d4a673c2e..edde0be677 100644 --- a/src/common/config/config_file.cpp +++ b/src/common/config/config_file.cpp @@ -179,7 +179,7 @@ string ConfigFile::parseValueFrom(string inputLine, string::size_type initialPos { return inputLine.substr(startPos + 1, inputLine.length() - startPos - 2); } - + return inputLine.substr(startPos); } diff --git a/src/common/config/dir_list.cpp b/src/common/config/dir_list.cpp index f3fbd7914b..79a272e538 100644 --- a/src/common/config/dir_list.cpp +++ b/src/common/config/dir_list.cpp @@ -28,7 +28,7 @@ namespace Firebird { -void ParsedPath::parse(const PathName& path) +void ParsedPath::parse(const PathName& path) { clear(); @@ -46,7 +46,7 @@ void ParsedPath::parse(const PathName& path) } while (oldpath.length() > 0); } -PathName ParsedPath::subPath(size_t n) const +PathName ParsedPath::subPath(size_t n) const { PathName rc = (*this)[0]; if (PathUtils::isRelative(rc + PathUtils::dir_sep)) @@ -59,14 +59,14 @@ PathName ParsedPath::subPath(size_t n) const return rc; } -ParsedPath::operator PathName() const +ParsedPath::operator PathName() const { if (!getCount()) return ""; return subPath(getCount()); } -bool ParsedPath::contains(const ParsedPath& pPath) const +bool ParsedPath::contains(const ParsedPath& pPath) const { size_t nFullElem = getCount(); if (nFullElem > 1 && (*this)[nFullElem - 1].length() == 0) @@ -75,7 +75,7 @@ bool ParsedPath::contains(const ParsedPath& pPath) const if (pPath.getCount() < nFullElem) { return false; } - + size_t i; for (i = 0; i < nFullElem; i++) { if (pPath[i] != (*this)[i]) { @@ -92,10 +92,10 @@ bool ParsedPath::contains(const ParsedPath& pPath) const } bool DirectoryList::keyword( - const ListMode keyMode, - PathName& value, - PathName key, - PathName next) + const ListMode keyMode, + PathName& value, + PathName key, + PathName next) { if (value.length() < key.length()) { return false; @@ -128,7 +128,7 @@ bool DirectoryList::keyword( return true; } -void DirectoryList::initialize(bool simple_mode) +void DirectoryList::initialize(bool simple_mode) { if (mode != NotInitialized) return; @@ -141,7 +141,7 @@ void DirectoryList::initialize(bool simple_mode) mode = SimpleList; } else { - if (keyword(None, val, "None", "") || + if (keyword(None, val, "None", "") || keyword(Full, val, "Full", "")) { return; } @@ -185,7 +185,7 @@ void DirectoryList::initialize(bool simple_mode) add(ParsedPath(dir)); } -bool DirectoryList::isPathInList(const PathName& path) const +bool DirectoryList::isPathInList(const PathName& path) const { #ifdef BOOT_BUILD return true; @@ -211,7 +211,7 @@ bool DirectoryList::isPathInList(const PathName& path) const PathName varpath(path); if (PathUtils::isRelative(path)) { - PathUtils::concatPath(varpath, + PathUtils::concatPath(varpath, PathName(Config::getRootDirectory()), path); } @@ -227,7 +227,7 @@ bool DirectoryList::isPathInList(const PathName& path) const #endif //BOOT_BUILD } -bool DirectoryList::expandFileName(PathName& path, const PathName& name) const +bool DirectoryList::expandFileName(PathName& path, const PathName& name) const { fb_assert(mode != NotInitialized); for (size_t i = 0; i < getCount(); i++) { diff --git a/src/common/cvt.cpp b/src/common/cvt.cpp index 813516d1e1..7dc1c385d3 100644 --- a/src/common/cvt.cpp +++ b/src/common/cvt.cpp @@ -297,7 +297,7 @@ static void integer_to_text(const dsc* from, dsc* to, Callbacks* cb) ************************************** * * Functional description - * Convert your basic binary number to + * Convert your basic binary number to * nice, formatted text. * **************************************/ @@ -455,9 +455,9 @@ static void string_to_datetime(const dsc* desc, * "today" Today's date 0:0:0.0 time * "tomorrow" Tomorrow's date 0:0:0.0 time * "yesterday" Yesterday's date 0:0:0.0 time - * YYYY-MM-DD [HH:[Min:[SS.[Thou]]]]] - * MM:DD[:YY [HH:[Min:[SS.[Thou]]]]] - * DD.MM[:YY [HH:[Min:[SS.[Thou]]]]] + * YYYY-MM-DD [HH:[Min:[SS.[Thou]]]]] + * MM:DD[:YY [HH:[Min:[SS.[Thou]]]]] + * DD.MM[:YY [HH:[Min:[SS.[Thou]]]]] * Where: * DD = 1 .. 31 (Day of month) * YY = 00 .. 99 2-digit years are converted to the nearest year @@ -476,7 +476,7 @@ static void string_to_datetime(const dsc* desc, * 95 ==> 1995 * If the current year is 1997, then 46 is converted * to 2046 (etc). - * = 100.. 5200 (Year) + * = 100.. 5200 (Year) * MM = 1 .. 12 (Month of year) * = "JANUARY"... (etc) * HH = 0 .. 23 (Hour of day) @@ -512,7 +512,7 @@ static void string_to_datetime(const dsc* desc, const char* p = NULL; const USHORT length = CVT_make_string(desc, ttype_ascii, &p, (vary*) buffer, sizeof(buffer), err); - + const char* const end = p + length; USHORT n, components[7]; @@ -526,7 +526,7 @@ static void string_to_datetime(const dsc* desc, const int start_component = (expect_type == expect_sql_time) ? 3 : 0; int i; - for (i = start_component; i < 7; i++) + for (i = start_component; i < 7; i++) { // Skip leading blanks. If we run out of characters, we're done @@ -927,7 +927,7 @@ SLONG CVT_get_long(const dsc* desc, SSHORT scale, ErrorFunction err) else d -= 0.5 + eps; - /* make sure the cast will succeed - different machines + /* make sure the cast will succeed - different machines do different things if the value is larger than a long can hold */ /* If rounding would yield a legitimate value, permit it */ @@ -1129,7 +1129,7 @@ double CVT_get_double(const dsc* desc, ErrorFunction err) exp = exp * 10 + *p - '0'; /* The following is a 'safe' test to prevent overflow of - exp here and of scale below. A more precise test occurs + exp here and of scale below. A more precise test occurs later in this routine. */ if (exp >= SHORT_LIMIT) @@ -1237,7 +1237,7 @@ void CVT_move_common(const dsc* from, dsc* to, Callbacks* cb) const UCHAR* q = from->dsc_address; /* If the datatypes and lengths are identical, just move the - stuff byte by byte. Although this may seem slower than + stuff byte by byte. Although this may seem slower than optimal, it would cost more to find the fast move than the fast move would gain. */ @@ -1358,7 +1358,7 @@ void CVT_move_common(const dsc* from, dsc* to, Callbacks* cb) case dtype_cstring: case dtype_text: { - /* If we are within the engine, INTL_convert_string + /* If we are within the engine, INTL_convert_string * will convert the string between character sets * (or die trying). * This module, however, can be called from outside @@ -1371,7 +1371,7 @@ void CVT_move_common(const dsc* from, dsc* to, Callbacks* cb) * * a charset type binary is compatible with all other types. * if a charset involved is ttype_dynamic, we must look up - * the charset of the attachment (only if we are in the + * the charset of the attachment (only if we are in the * engine). If we are outside the engine, the * assume that the engine has converted the values * previously in the request. @@ -1383,7 +1383,7 @@ void CVT_move_common(const dsc* from, dsc* to, Callbacks* cb) CHARSET_ID charset2; if (cb->transliterate(from, to, charset2, cb->err)) return; - + { // scope USHORT strtype_unused; UCHAR *ptr; @@ -1756,7 +1756,7 @@ USHORT CVT_make_string(const dsc* desc, { /************************************** * - * C V T _ m a k e _ s t r i n g + * C V T _ m a k e _ s t r i n g * ************************************** * @@ -2198,7 +2198,7 @@ SQUAD CVT_get_quad(const dsc* desc, SSHORT scale, ErrorFunction err) else d -= 0.5; - /* make sure the cast will succeed - different machines + /* make sure the cast will succeed - different machines do different things if the value is larger than a quad can hold */ @@ -2343,7 +2343,7 @@ SINT64 CVT_get_int64(const dsc* desc, SSHORT scale, ErrorFunction err) else d -= 0.5 + eps; - /* make sure the cast will succeed - different machines + /* make sure the cast will succeed - different machines do different things if the value is larger than a quad can hold. @@ -2524,7 +2524,7 @@ void CVT_move(const dsc* from, dsc* to, ErrorFunction err) * Move (and possible convert) something to something else. * **************************************/ - Callbacks toCommon = {transliterate, getChid, err, getToCharset, + Callbacks toCommon = {transliterate, getChid, err, getToCharset, validateData, validateLength, getCurDate, isVersion4}; CVT_move_common(from, to, &toCommon); diff --git a/src/common/fb_exception.cpp b/src/common/fb_exception.cpp index 0f38862aa2..ecf918db1d 100644 --- a/src/common/fb_exception.cpp +++ b/src/common/fb_exception.cpp @@ -22,7 +22,7 @@ class InterlockedStringsBuffer : public CircularBuffer public: explicit InterlockedStringsBuffer(Firebird::MemoryPool&) : CircularBuffer() { } - virtual const char* alloc(const char* string, size_t& length) + virtual const char* alloc(const char* string, size_t& length) { Firebird::MutexLockGuard guard(buffer_lock); return CircularBuffer::alloc(string, length); @@ -47,15 +47,15 @@ ISC_STATUS dupStringTemp(const char* s) void fill_status(ISC_STATUS* ptr, const ISC_STATUS* orig_status) { // Move in status and clone transient strings - while (true) + while (true) { const ISC_STATUS type = *ptr++ = *orig_status++; - if (type == isc_arg_end) + if (type == isc_arg_end) break; switch (type) { - case isc_arg_cstring: - { + case isc_arg_cstring: + { const size_t len = *ptr++ = *orig_status++; char *string = FB_NEW(*getDefaultMemoryPool()) char[len]; const char *temp = reinterpret_cast(*orig_status++); @@ -74,7 +74,7 @@ void fill_status(ISC_STATUS* ptr, const ISC_STATUS* orig_status) *ptr++ = *orig_status++; break; } - } + } } Firebird::GlobalPtr engine_failures; @@ -87,15 +87,15 @@ namespace Firebird { void StringsBuffer::makePermanentVector(ISC_STATUS* perm, const ISC_STATUS* trans) { - while (true) + while (true) { const ISC_STATUS type = *perm++ = *trans++; switch (type) { case isc_arg_end: return; - case isc_arg_cstring: - { + case isc_arg_cstring: + { size_t len = *perm++ = *trans++; const char* temp = reinterpret_cast(*trans++); *perm++ = (ISC_STATUS)(IPTR) (alloc(temp, len)); @@ -125,7 +125,7 @@ void StringsBuffer::makeEnginePermanentVector(ISC_STATUS* v) /********************************* status_exception *******************************/ -status_exception::status_exception() throw() : +status_exception::status_exception() throw() : m_strings_permanent(true) { memset(m_status_vector, 0, sizeof(m_status_vector)); @@ -138,10 +138,10 @@ status_exception::status_exception(const ISC_STATUS *status_vector, bool permane if (status_vector) { - set_status(status_vector, permanent); + set_status(status_vector, permanent); } } - + void status_exception::set_status(const ISC_STATUS *new_vector, bool permanent) throw() { fb_assert(new_vector != 0); @@ -151,7 +151,7 @@ void status_exception::set_status(const ISC_STATUS *new_vector, bool permanent) m_strings_permanent = permanent; ISC_STATUS *ptr = m_status_vector; - while (true) + while (true) { const ISC_STATUS type = *ptr++ = *new_vector++; if (type == isc_arg_end) @@ -166,10 +166,10 @@ void status_exception::release_vector() throw() { if (m_strings_permanent) return; - + // Free owned strings ISC_STATUS *ptr = m_status_vector; - while (true) + while (true) { const ISC_STATUS type = *ptr++; if (type == isc_arg_end) @@ -188,18 +188,18 @@ void status_exception::release_vector() throw() default: ptr++; break; - } + } } } -status_exception::~status_exception() throw() +status_exception::~status_exception() throw() { release_vector(); } /********************************* fatal_exception *******************************/ -void fatal_exception::raiseFmt(const char* format, ...) +void fatal_exception::raiseFmt(const char* format, ...) { va_list args; va_start(args, format); @@ -210,11 +210,11 @@ void fatal_exception::raiseFmt(const char* format, ...) throw fatal_exception(buffer); } -void status_exception::raise(const ISC_STATUS *status_vector) +void status_exception::raise(const ISC_STATUS *status_vector) { throw status_exception(status_vector, true); } - + void status_exception::raise(const Arg::StatusVector& statusVector) { ISC_STATUS_ARRAY temp; @@ -231,10 +231,10 @@ ISC_STATUS status_exception::stuff_exception(ISC_STATUS* const status_vector, St sb = &engine_failures; } - if (strings_permanent()) + if (strings_permanent()) { // Copy status vector - while (true) + while (true) { const ISC_STATUS type = *sv++ = *ptr++; if (type == isc_arg_end) @@ -280,7 +280,7 @@ void LongJump::raise() ISC_STATUS LongJump::stuff_exception(ISC_STATUS* const status_vector, StringsBuffer* sb) const throw() { /* - * Do nothing for a while - not all utilities are ready, + * Do nothing for a while - not all utilities are ready, * status_vector is passed in them by other means. * Ideally status_exception should be always used for it, * and we should activate the following code: @@ -290,7 +290,7 @@ ISC_STATUS LongJump::stuff_exception(ISC_STATUS* const status_vector, StringsBuf { sb = &engine_failures; } - + const char *temp = "Unexpected Firebird::LongJump"; *sv++ = isc_arg_gds; @@ -299,14 +299,14 @@ ISC_STATUS LongJump::stuff_exception(ISC_STATUS* const status_vector, StringsBuf *sv++ = (ISC_STATUS)(IPTR) (sb->alloc(temp, strlen(temp))); *sv++ = isc_arg_end; */ - + return status_vector[1]; } /********************************* system_error ****************************/ -system_error::system_error(const char* syscall, int error_code) : +system_error::system_error(const char* syscall, int error_code) : status_exception(0, false), errorCode(error_code) { Arg::Gds temp(isc_sys_request); @@ -336,11 +336,11 @@ int system_error::getSystemError() /********************************* system_call_failed ****************************/ -system_call_failed::system_call_failed(const char* syscall, int error_code) : +system_call_failed::system_call_failed(const char* syscall, int error_code) : system_error(syscall, error_code) { #ifdef DEV_BUILD - // raised failed system call exception in DEV_BUILD in 99.99% means + // raised failed system call exception in DEV_BUILD in 99.99% means // problems with the code - let's create memory dump now abort(); #endif @@ -361,9 +361,9 @@ void system_call_failed::raise(const char* syscall) fatal_exception::fatal_exception(const char* message) : status_exception(0, false) { - ISC_STATUS temp[] = {isc_arg_gds, - isc_random, - isc_arg_string, dupStringTemp(message), + ISC_STATUS temp[] = {isc_arg_gds, + isc_random, + isc_arg_string, dupStringTemp(message), isc_arg_end}; set_status(temp, false); } diff --git a/src/common/thd.cpp b/src/common/thd.cpp index 6a056fc664..aa41705acf 100644 --- a/src/common/thd.cpp +++ b/src/common/thd.cpp @@ -123,12 +123,12 @@ void THD_yield(void) * **************************************/ #ifdef USE_POSIX_THREADS -/* use sched_yield() instead of pthread_yield(). Because pthread_yield() - is not part of the (final) POSIX 1003.1c standard. Several drafts of - the standard contained pthread_yield(), but then the POSIX guys - discovered it was redundant with sched_yield() and dropped it. - So, just use sched_yield() instead. POSIX systems on which - sched_yield() is available define _POSIX_PRIORITY_SCHEDULING +/* use sched_yield() instead of pthread_yield(). Because pthread_yield() + is not part of the (final) POSIX 1003.1c standard. Several drafts of + the standard contained pthread_yield(), but then the POSIX guys + discovered it was redundant with sched_yield() and dropped it. + So, just use sched_yield() instead. POSIX systems on which + sched_yield() is available define _POSIX_PRIORITY_SCHEDULING in . Darwin defined _POSIX_THREAD_PRIORITY_SCHEDULING instead of _POSIX_PRIORITY_SCHEDULING. */ diff --git a/src/common/utils.cpp b/src/common/utils.cpp index 85daf8adaf..8fbc78398a 100644 --- a/src/common/utils.cpp +++ b/src/common/utils.cpp @@ -722,7 +722,7 @@ namespace { flagEcho = GetConsoleMode(handle, &dwMode) && (dwMode & ENABLE_ECHO_INPUT); if (flagEcho) SetConsoleMode(handle, dwMode & ~ENABLE_ECHO_INPUT); -#endif +#endif } } ~InputFile() @@ -738,7 +738,7 @@ namespace { DWORD dwMode; if (GetConsoleMode(handle, &dwMode)) SetConsoleMode(handle, dwMode | ENABLE_ECHO_INPUT); -#endif +#endif } if (f && f != stdin) { fclose(f); diff --git a/src/config/AdminException.cpp b/src/config/AdminException.cpp index 02e442ea2d..4f9893a300 100644 --- a/src/config/AdminException.cpp +++ b/src/config/AdminException.cpp @@ -1,19 +1,19 @@ /* - * - * The contents of this file are subject to the Initial - * Developer's Public License Version 1.0 (the "License"); - * you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * http://www.ibphoenix.com/idpl.html. * - * Software distributed under the License is distributed on - * an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either - * express or implied. See the License for the specific + * The contents of this file are subject to the Initial + * Developer's Public License Version 1.0 (the "License"); + * you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * http://www.ibphoenix.com/idpl.html. + * + * Software distributed under the License is distributed on + * an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either + * express or implied. See the License for the specific * language governing rights and limitations under the License. * * The contents of this file or any work derived from this file - * may not be distributed under any other license whatsoever - * without the express prior written permission of the original + * may not be distributed under any other license whatsoever + * without the express prior written permission of the original * author. * * diff --git a/src/config/ArgsException.cpp b/src/config/ArgsException.cpp index d4b5c3216a..8cbedd8501 100644 --- a/src/config/ArgsException.cpp +++ b/src/config/ArgsException.cpp @@ -1,19 +1,19 @@ /* - * - * The contents of this file are subject to the Initial - * Developer's Public License Version 1.0 (the "License"); - * you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * http://www.ibphoenix.com/idpl.html. * - * Software distributed under the License is distributed on - * an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either - * express or implied. See the License for the specific + * The contents of this file are subject to the Initial + * Developer's Public License Version 1.0 (the "License"); + * you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * http://www.ibphoenix.com/idpl.html. + * + * Software distributed under the License is distributed on + * an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either + * express or implied. See the License for the specific * language governing rights and limitations under the License. * * The contents of this file or any work derived from this file - * may not be distributed under any other license whatsoever - * without the express prior written permission of the original + * may not be distributed under any other license whatsoever + * without the express prior written permission of the original * author. * * diff --git a/src/config/Configuration.cpp b/src/config/Configuration.cpp index 94c4c00934..204518a13b 100644 --- a/src/config/Configuration.cpp +++ b/src/config/Configuration.cpp @@ -1,19 +1,19 @@ /* - * - * The contents of this file are subject to the Initial - * Developer's Public License Version 1.0 (the "License"); - * you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * http://www.ibphoenix.com/idpl.html. * - * Software distributed under the License is distributed on - * an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either - * express or implied. See the License for the specific + * The contents of this file are subject to the Initial + * Developer's Public License Version 1.0 (the "License"); + * you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * http://www.ibphoenix.com/idpl.html. + * + * Software distributed under the License is distributed on + * an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either + * express or implied. See the License for the specific * language governing rights and limitations under the License. * * The contents of this file or any work derived from this file - * may not be distributed under any other license whatsoever - * without the express prior written permission of the original + * may not be distributed under any other license whatsoever + * without the express prior written permission of the original * author. * * @@ -53,7 +53,7 @@ ConfObject* Configuration::findObject(const char* objectType, const char* object { if (!configFile) loadConfigFile(); - + return configFile->findObject (objectType, objectName); } @@ -61,7 +61,7 @@ const char* Configuration::getRootDirectory() { if (!configFile) loadConfigFile(); - + return configFile->getRootDirectory(); } @@ -81,16 +81,16 @@ ConfObject* Configuration::getObject(const char* objectType) { if (!configFile) loadConfigFile(); - + return configFile->getObject (objectType); } ConfObject* Configuration::getObject(const char* objectType, const char* objectName) { ConfObject* object = findObject (objectType, objectName); - + if (!object) object = getObject (objectType); - + return object; } diff --git a/src/config/FileName.cpp b/src/config/FileName.cpp index 0f987030a8..4fa94f380a 100644 --- a/src/config/FileName.cpp +++ b/src/config/FileName.cpp @@ -24,20 +24,20 @@ FileName::FileName(const Firebird::PathName& name) : else if (*p == '.') dot = p; } - + if (slash) { directory.assign (start, (int) (slash - rootName)); rootName = slash + 1; } - + if (dot) { extension = dot + 1; root.assign (rootName, (int) (dot - rootName)); } else - root = rootName; + root = rootName; } FileName::~FileName() diff --git a/src/config/InputStream.cpp b/src/config/InputStream.cpp index dc3006cf3e..32eb4e11bb 100644 --- a/src/config/InputStream.cpp +++ b/src/config/InputStream.cpp @@ -1,19 +1,19 @@ /* - * - * The contents of this file are subject to the Initial - * Developer's Public License Version 1.0 (the "License"); - * you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * http://www.ibphoenix.com/idpl.html. * - * Software distributed under the License is distributed on - * an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either - * express or implied. See the License for the specific + * The contents of this file are subject to the Initial + * Developer's Public License Version 1.0 (the "License"); + * you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * http://www.ibphoenix.com/idpl.html. + * + * Software distributed under the License is distributed on + * an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either + * express or implied. See the License for the specific * language governing rights and limitations under the License. * * The contents of this file or any work derived from this file - * may not be distributed under any other license whatsoever - * without the express prior written permission of the original + * may not be distributed under any other license whatsoever + * without the express prior written permission of the original * author. * * diff --git a/src/config/Stream.cpp b/src/config/Stream.cpp index 579feed437..cc4ae16ea1 100644 --- a/src/config/Stream.cpp +++ b/src/config/Stream.cpp @@ -181,7 +181,7 @@ void Stream::setMinSegment(int length) Stream::Segment* Stream::allocSegment(int tail) { fb_assert(tail >= 0); - + Segment *segment; int length = tail; diff --git a/src/config/StreamSegment.cpp b/src/config/StreamSegment.cpp index b925648eb9..0894e11c11 100644 --- a/src/config/StreamSegment.cpp +++ b/src/config/StreamSegment.cpp @@ -97,7 +97,7 @@ void StreamSegment::advance(int size) char* StreamSegment::copy(void *target, int length) { char* targ = static_cast(target); - + for (int len = length; len;) { const int l = MIN (len, available); diff --git a/src/dsql/StmtNodes.cpp b/src/dsql/StmtNodes.cpp index 600ed68257..633e5bd336 100644 --- a/src/dsql/StmtNodes.cpp +++ b/src/dsql/StmtNodes.cpp @@ -161,7 +161,7 @@ jrd_nod* InAutonomousTransactionNode::execute(thread_db* tdbb, jrd_req* request) EXE_execute_db_triggers(tdbb, request->req_transaction, jrd_req::req_trigger_trans_commit); } - + { // scope Firebird::AutoSetRestore2 autoNullifyRequest( tdbb, &thread_db::getRequest, &thread_db::setRequest, NULL); diff --git a/src/dsql/dsql.cpp b/src/dsql/dsql.cpp index 96cdb77f55..71c3a35316 100644 --- a/src/dsql/dsql.cpp +++ b/src/dsql/dsql.cpp @@ -142,11 +142,11 @@ dsql_dbb::~dsql_dbb() /** - + DSQL_allocate_statement - + @brief Allocate a statement handle. - + @param tdbb @param attachment @@ -160,7 +160,7 @@ dsql_req* DSQL_allocate_statement(thread_db* tdbb, dsql_dbb* const database = init(attachment); Jrd::ContextPoolHolder context(tdbb, database->createPool()); - // allocate the request block + // allocate the request block MemoryPool& pool = *tdbb->getDefaultPool(); dsql_req* const request = FB_NEW(pool) dsql_req(pool); @@ -171,11 +171,11 @@ dsql_req* DSQL_allocate_statement(thread_db* tdbb, /** - + DSQL_execute - + @brief Execute a non-SELECT dynamic SQL statement. - + @param tdbb @param tra_handle @@ -204,7 +204,7 @@ void DSQL_execute(thread_db* tdbb, Jrd::ContextPoolHolder context(tdbb, &request->req_pool); - if (request->req_flags & REQ_orphan) + if (request->req_flags & REQ_orphan) { ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-901) << Arg::Gds(isc_bad_req_handle)); @@ -214,7 +214,7 @@ void DSQL_execute(thread_db* tdbb, request->req_type = REQ_EMBED_SELECT; } -// Only allow NULL trans_handle if we're starting a transaction +// Only allow NULL trans_handle if we're starting a transaction if (!*tra_handle && request->req_type != REQ_START_TRANS) { @@ -226,7 +226,7 @@ void DSQL_execute(thread_db* tdbb, Make sure the cursor is not already open. */ if (request->req_type == REQ_SELECT || - request->req_type == REQ_EXEC_BLOCK || + request->req_type == REQ_EXEC_BLOCK || request->req_type == REQ_SELECT_BLOCK || request->req_type == REQ_SELECT_UPD || request->req_type == REQ_EMBED_SELECT || @@ -240,7 +240,7 @@ void DSQL_execute(thread_db* tdbb, } } -// A select with a non zero output length is a singleton select +// A select with a non zero output length is a singleton select bool singleton; if (request->req_type == REQ_SELECT && out_msg_length != 0) { singleton = true; @@ -270,7 +270,7 @@ void DSQL_execute(thread_db* tdbb, * to the list of open cursors (it's not really open). */ if ((request->req_type == REQ_SELECT && out_msg_length == 0) || - (request->req_type == REQ_SELECT_BLOCK) || + (request->req_type == REQ_SELECT_BLOCK) || request->req_type == REQ_SELECT_UPD || request->req_type == REQ_EMBED_SELECT || request->req_type == REQ_GET_SEGMENT || @@ -283,11 +283,11 @@ void DSQL_execute(thread_db* tdbb, /** - + DSQL_execute_immediate - + @brief Execute a non-SELECT dynamic SQL statement. - + @param tdbb @param attachment @@ -317,23 +317,23 @@ void DSQL_execute_immediate(thread_db* tdbb, USHORT out_msg_type, USHORT out_msg_length, UCHAR* out_msg) { execute_immediate(tdbb, attachment, tra_handle, length, - string, dialect, in_blr_length, + string, dialect, in_blr_length, in_blr, in_msg_type, in_msg_length, in_msg, - out_blr_length, - out_blr, - out_msg_type, out_msg_length, + out_blr_length, + out_blr, + out_msg_type, out_msg_length, out_msg); } /** - + DSQL_fetch - + @brief Fetch next record from a dynamic SQL cursor - + @param user_status @param req_handle @@ -359,7 +359,7 @@ ISC_STATUS DSQL_fetch(thread_db* tdbb, Jrd::ContextPoolHolder context(tdbb, &request->req_pool); - // if the cursor isn't open, we've got a problem + // if the cursor isn't open, we've got a problem if (!(request->req_flags & REQ_cursor_open)) { ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-504) << @@ -518,11 +518,11 @@ ISC_STATUS DSQL_fetch(thread_db* tdbb, /** - + DSQL_free_statement - + @brief Release request for a dsql statement - + @param user_status @param req_handle @@ -558,11 +558,11 @@ void DSQL_free_statement(thread_db* tdbb, /** - + DSQL_insert - + @brief Insert next record into a dynamic SQL cursor - + @param user_status @param req_handle @@ -582,13 +582,13 @@ void DSQL_insert(thread_db* tdbb, Jrd::ContextPoolHolder context(tdbb, &request->req_pool); - if (request->req_flags & REQ_orphan) + if (request->req_flags & REQ_orphan) { ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-901) << Arg::Gds(isc_bad_req_handle)); } -// if the cursor isn't open, we've got a problem +// if the cursor isn't open, we've got a problem if (request->req_type == REQ_PUT_SEGMENT) { @@ -609,7 +609,7 @@ void DSQL_insert(thread_db* tdbb, parse_blr(blr_length, blr, msg_length, message->msg_parameters); if (request->req_type == REQ_PUT_SEGMENT) { - // For put segment, use the user buffer and indicator directly. + // For put segment, use the user buffer and indicator directly. dsql_par* parameter = request->req_blob->blb_segment; const UCHAR* buffer = dsql_msg_buf + (IPTR) parameter->par_user_desc.dsc_address; @@ -621,11 +621,11 @@ void DSQL_insert(thread_db* tdbb, /** - + DSQL_prepare - + @brief Prepare a statement for execution. - + @param user_status @param trans_handle @@ -661,7 +661,7 @@ void DSQL_prepare(thread_db* tdbb, Arg::Gds(isc_bad_req_handle)); } - // check to see if old request has an open cursor + // check to see if old request has an open cursor if (old_request && (old_request->req_flags & REQ_cursor_open)) { ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-519) << @@ -683,7 +683,7 @@ void DSQL_prepare(thread_db* tdbb, try { -// Figure out which parser version to use +// Figure out which parser version to use /* Since the API to dsql8_prepare is public and can not be changed, there needs to * be a way to send the parser version to DSQL so that the parser can compare the keyword * version to the parser version. To accomplish this, the parser version is combined with @@ -735,7 +735,7 @@ void DSQL_prepare(thread_db* tdbb, request->req_flags |= REQ_prepared; - // Now that we know that the new request exists, zap the old one. + // Now that we know that the new request exists, zap the old one. { Jrd::ContextPoolHolder context(tdbb, &old_request->req_pool); @@ -760,11 +760,11 @@ void DSQL_prepare(thread_db* tdbb, /** - + DSQL_set_cursor_name - + @brief Set a cursor name for a dynamic request - + @param user_status @param req_handle @@ -790,7 +790,7 @@ void DSQL_set_cursor(thread_db* tdbb, // Note that "" will be replaced with ". // The code is very strange, because it doesn't check for "" really // and thus deletes one isolated " in the middle of the cursor. - for (Firebird::string::iterator i = cursor.begin(); + for (Firebird::string::iterator i = cursor.begin(); i < cursor.end(); ++i) { if (*i == '\"') { @@ -819,9 +819,9 @@ void DSQL_set_cursor(thread_db* tdbb, } cursor.resize(length); - // If there already is a different cursor by the same name, bitch + // If there already is a different cursor by the same name, bitch - const dsql_sym* symbol = + const dsql_sym* symbol = HSHD_lookup(request->req_dbb, cursor.c_str(), length, SYM_cursor, 0); if (symbol) { @@ -850,11 +850,11 @@ void DSQL_set_cursor(thread_db* tdbb, /** - + DSQL_sql_info - + @brief Provide information on dsql statement - + @param user_status @param req_handle @@ -878,11 +878,11 @@ void DSQL_sql_info(thread_db* tdbb, /** - + close_cursor - + @brief Close an open cursor. - + @param request @param tdbb @@ -917,12 +917,12 @@ static void close_cursor(thread_db* tdbb, dsql_req* request) /** - + convert - + @brief Convert a number to VAX form -- least significant bytes first. Return the length. - + @param number @param buffer @@ -956,11 +956,11 @@ static USHORT convert( SLONG number, UCHAR* buffer) /** - + execute_blob - + @brief Open or create a blob. - + @param tdbb @param request @@ -1043,11 +1043,11 @@ static void execute_blob(thread_db* tdbb, /** - + execute_immediate - + @brief Common part of prepare and execute a statement. - + @param tdbb @param attachment @@ -1095,7 +1095,7 @@ static void execute_immediate(thread_db* tdbb, try { -// Figure out which parser version to use +// Figure out which parser version to use /* Since the API to dsql8_execute_immediate is public and can not be changed, there needs to * be a way to send the parser version to DSQL so that the parser can compare the keyword * version to the parser version. To accomplish this, the parser version is combined with @@ -1150,11 +1150,11 @@ static void execute_immediate(thread_db* tdbb, /** - + execute_request - + @brief Execute a dynamic SQL statement. - + @param tdbb @param request @@ -1245,11 +1245,11 @@ static void execute_request(thread_db* tdbb, break; default: - // Catch invalid request types + // Catch invalid request types fb_assert(false); } - // If there is no data required, just start the request + // If there is no data required, just start the request dsql_msg* message = request->req_send; if (!message) @@ -1286,7 +1286,7 @@ static void execute_request(thread_db* tdbb, if (out_msg_length && out_blr_length) { parse_blr(out_blr_length, out_blr, out_msg_length, message->msg_parameters); - } + } else if (!out_msg_length && isBlock) { message = &temp_msg; message->msg_number = 1; @@ -1300,7 +1300,7 @@ static void execute_request(thread_db* tdbb, if (out_msg_length) map_in_out(NULL, message, 0, out_blr, out_msg_length, out_msg); - // if this is a singleton select, make sure there's in fact one record + // if this is a singleton select, make sure there's in fact one record if (singleton) { @@ -1393,12 +1393,12 @@ static void execute_request(thread_db* tdbb, } /** - + filter_sub_type - + @brief Determine the sub_type to use in filtering a blob. - + @param request @param node @@ -1422,13 +1422,13 @@ static SSHORT filter_sub_type( dsql_req* request, const dsql_nod* node) /** - + get_indices - + @brief Retrieve the indices from the index tree in the request info buffer (explain_ptr), and print them out in the plan buffer. Return true on success and false on failure. - + @param explain_length_ptr @param explain_ptr @@ -1468,7 +1468,7 @@ static bool get_indices( explain_length--; length = *explain++; - // if this isn't the first index, put out a comma + // if this isn't the first index, put out a comma if (plan[-1] != '(' && plan[-1] != ' ') { plan_length -= 2; @@ -1478,7 +1478,7 @@ static bool get_indices( *plan++ = ' '; } - // now put out the index name + // now put out the index name if ((plan_length -= length) < 0) return false; @@ -1501,13 +1501,13 @@ static bool get_indices( /** - + get_plan_info - + @brief Get the access plan for the request and turn it into a textual representation suitable for human reading. - + @param request @param buffer_length @@ -1527,7 +1527,7 @@ static USHORT get_plan_info(thread_db* tdbb, SCHAR* buffer_ptr = *out_buffer; - // get the access path info for the underlying request from the engine + // get the access path info for the underlying request from the engine try { @@ -1573,12 +1573,12 @@ static USHORT get_plan_info(thread_db* tdbb, at the begining of the function hence they had trash the second time. */ USHORT join_count = 0, level = 0; - // keep going until we reach the end of the explain info + // keep going until we reach the end of the explain info while (explain_length > 0 && buffer_length > 0) { if (!get_rsb_item(&explain_length, &explain, &buffer_length, &plan, - &join_count, &level)) + &join_count, &level)) { // don't allocate buffer of the same length second time // and let user know plan is incomplete @@ -1592,7 +1592,7 @@ static USHORT get_plan_info(thread_db* tdbb, break; } - // assume we have run out of room in the buffer, try again with a larger one + // assume we have run out of room in the buffer, try again with a larger one const size_t new_length = MAX_SSHORT; char* const temp = static_cast(gds__alloc(new_length)); if (!temp) { @@ -1618,11 +1618,11 @@ static USHORT get_plan_info(thread_db* tdbb, /** - + get_request_info - + @brief Get the records updated/deleted for record - + @param request @param buffer_length @@ -1637,7 +1637,7 @@ static USHORT get_request_info(thread_db* tdbb, if (!request->req_request) // DDL return 0; - // get the info for the request from the engine + // get the info for the request from the engine try { @@ -1691,13 +1691,13 @@ static USHORT get_request_info(thread_db* tdbb, /** - + get_rsb_item - + @brief Use recursion to print out a reverse-polish access plan of joins and join types. Return true on success and false on failure - + @param explain_length_ptr @param explain_ptr @@ -1727,7 +1727,7 @@ static bool get_rsb_item(SSHORT* explain_length_ptr, { case isc_info_rsb_begin: if (!*level_ptr) { - // put out the PLAN prefix + // put out the PLAN prefix p = "\nPLAN "; if ((plan_length -= strlen(p)) < 0) @@ -1757,7 +1757,7 @@ static bool get_rsb_item(SSHORT* explain_length_ptr, *plan++ = '('; } - // if this isn't the first relation, put out a comma + // if this isn't the first relation, put out a comma if (plan[-1] != '(') { plan_length -= 2; @@ -1767,7 +1767,7 @@ static bool get_rsb_item(SSHORT* explain_length_ptr, *plan++ = ' '; } - // put out the relation name + // put out the relation name { // scope to keep length local. explain_length--; SSHORT length = (UCHAR) * explain++; @@ -1790,7 +1790,7 @@ static bool get_rsb_item(SSHORT* explain_length_ptr, case isc_info_rsb_union: case isc_info_rsb_recursive: - // put out all the substreams of the join + // put out all the substreams of the join { // scope to have union_count, union_level and union_join_count local. explain_length--; USHORT union_count = (USHORT) * explain++ - 1; @@ -1844,7 +1844,7 @@ static bool get_rsb_item(SSHORT* explain_length_ptr, *plan++ = ' '; } - // put out the join type + // put out the join type if (rsb_type == isc_info_rsb_cross || rsb_type == isc_info_rsb_left_cross) @@ -1860,7 +1860,7 @@ static bool get_rsb_item(SSHORT* explain_length_ptr, while (*p) *plan++ = *p++; - // put out all the substreams of the join + // put out all the substreams of the join explain_length--; { // scope to have join_count local. @@ -1878,14 +1878,14 @@ static bool get_rsb_item(SSHORT* explain_length_ptr, } } // scope - // put out the final parenthesis for the join + // put out the final parenthesis for the join if (--plan_length < 0) return false; else *plan++ = ')'; - // this qualifies as a stream, so decrement the join count + // this qualifies as a stream, so decrement the join count if (*parent_join_count) -- * parent_join_count; @@ -1915,7 +1915,7 @@ static bool get_rsb_item(SSHORT* explain_length_ptr, while (*p) *plan++ = *p++; - // print out additional index information + // print out additional index information if (rsb_type == isc_info_rsb_indexed || rsb_type == isc_info_rsb_navigate || @@ -1944,7 +1944,7 @@ static bool get_rsb_item(SSHORT* explain_length_ptr, *plan++ = ')'; } - // detect the end of a single relation and put out a final parenthesis + // detect the end of a single relation and put out a final parenthesis if (!*parent_join_count) if (--plan_length < 0) @@ -1952,7 +1952,7 @@ static bool get_rsb_item(SSHORT* explain_length_ptr, else *plan++ = ')'; - // this also qualifies as a stream, so decrement the join count + // this also qualifies as a stream, so decrement the join count if (*parent_join_count) -- * parent_join_count; @@ -1973,7 +1973,7 @@ static bool get_rsb_item(SSHORT* explain_length_ptr, break; } - // if this isn't the first item in the list, put out a comma + // if this isn't the first item in the list, put out a comma if (*parent_join_count && plan[-1] != '(') { plan_length -= 2; @@ -2030,11 +2030,11 @@ static bool get_rsb_item(SSHORT* explain_length_ptr, /** - + init - + @brief Initialize dynamic SQL. This is called only once. - + @param db_handle @@ -2126,12 +2126,12 @@ static dsql_dbb* init(Attachment* attachment) /** - + map_in_out - + @brief Map data from external world into message or from message to external world. - + @param request @param message @@ -2162,7 +2162,7 @@ static void map_in_out( dsql_req* request, { if (parameter->par_index) { - // Make sure the message given to us is long enough + // Make sure the message given to us is long enough DSC desc = parameter->par_user_desc; USHORT length = (IPTR) desc.dsc_address + desc.dsc_length; @@ -2252,11 +2252,11 @@ static void map_in_out( dsql_req* request, /** - + parse_blr - + @brief Parse the message of a blr request. - + @param blr_length @param blr @@ -2289,14 +2289,14 @@ static USHORT parse_blr( ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-804) << Arg::Gds(isc_dsql_sqlda_err)); } - blr++; // skip the blr_version + blr++; // skip the blr_version if (*blr++ != blr_begin || *blr++ != blr_message) { ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-804) << Arg::Gds(isc_dsql_sqlda_err)); } - ++blr; // skip the message number + ++blr; // skip the message number USHORT count = *blr++; count += (*blr++) << 8; count /= 2; @@ -2308,7 +2308,7 @@ static USHORT parse_blr( desc.dsc_scale = 0; desc.dsc_sub_type = 0; desc.dsc_flags = 0; - + switch (*blr++) { case blr_text: @@ -2453,12 +2453,12 @@ static USHORT parse_blr( /** - + prepare - + @brief Prepare a statement for execution. Return SQL status code. Note: caller is responsible for pool handling. - + @param request @param string_length @@ -2503,7 +2503,7 @@ static dsql_req* prepare(thread_db* tdbb, dsql_dbb* database, jrd_tra* transacti } } - // allocate the statement block, then prepare the statement + // allocate the statement block, then prepare the statement Jrd::ContextPoolHolder context(tdbb, database->createPool()); @@ -2515,7 +2515,7 @@ static dsql_req* prepare(thread_db* tdbb, dsql_dbb* database, jrd_tra* transacti try { - // Parse the SQL statement. If it croaks, return + // Parse the SQL statement. If it croaks, return Parser parser(*tdbb->getDefaultPool(), client_dialect, statement->req_dbb->dbb_db_SQL_dialect, parser_version, string, string_length, tdbb->getAttachment()->att_charset); @@ -2532,7 +2532,7 @@ static dsql_req* prepare(thread_db* tdbb, dsql_dbb* database, jrd_tra* transacti Arg::Gds(isc_command_end_err)); } - // allocate the send and receive messages + // allocate the send and receive messages statement->req_send = FB_NEW(pool) dsql_msg; dsql_msg* message = FB_NEW(pool) dsql_msg; @@ -2563,7 +2563,7 @@ static dsql_req* prepare(thread_db* tdbb, dsql_dbb* database, jrd_tra* transacti if (!node) return statement; - // stop here for statements not requiring code generation + // stop here for statements not requiring code generation if (statement->req_type == REQ_DDL && parser.isStmtAmbiguous() && statement->req_dbb->dbb_db_SQL_dialect != client_dialect) @@ -2580,7 +2580,7 @@ static dsql_req* prepare(thread_db* tdbb, dsql_dbb* database, jrd_tra* transacti return statement; } - // Work on blob segment statements + // Work on blob segment statements if (statement->req_type == REQ_GET_SEGMENT || statement->req_type == REQ_PUT_SEGMENT) @@ -2591,7 +2591,7 @@ static dsql_req* prepare(thread_db* tdbb, dsql_dbb* database, jrd_tra* transacti return statement; } - // Generate BLR, DDL or TPB for statement + // Generate BLR, DDL or TPB for statement // Start transactions takes parameters via a parameter block. // The statement blr string is used for that @@ -2608,8 +2608,8 @@ static dsql_req* prepare(thread_db* tdbb, dsql_dbb* database, jrd_tra* transacti GEN_request(statement, node); const USHORT length = statement->req_blr_data.getCount(); - - // stop here for ddl statements + + // stop here for ddl statements if (statement->req_type == REQ_CREATE_DB || statement->req_type == REQ_DDL) @@ -2617,7 +2617,7 @@ static dsql_req* prepare(thread_db* tdbb, dsql_dbb* database, jrd_tra* transacti return statement; } - // have the access method compile the statement + // have the access method compile the statement #ifdef DSQL_DEBUG if (DSQL_debug & 64) { @@ -2630,9 +2630,9 @@ static dsql_req* prepare(thread_db* tdbb, dsql_dbb* database, jrd_tra* transacti } #endif - // check for warnings + // check for warnings if (tdbb->tdbb_status_vector[2] == isc_arg_warning) { - // save a status vector + // save a status vector memcpy(local_status, tdbb->tdbb_status_vector, sizeof(ISC_STATUS_ARRAY)); } @@ -2655,17 +2655,17 @@ static dsql_req* prepare(thread_db* tdbb, dsql_dbb* database, jrd_tra* transacti status = tdbb->tdbb_status_vector[1]; } - // restore warnings (if there are any) + // restore warnings (if there are any) if (local_status[2] == isc_arg_warning) { int indx, len, warning; - // find end of a status vector + // find end of a status vector PARSE_STATUS(tdbb->tdbb_status_vector, indx, warning); if (indx) --indx; - // calculate length of saved warnings + // calculate length of saved warnings PARSE_STATUS(local_status, len, warning); len -= 2; @@ -2691,13 +2691,13 @@ static dsql_req* prepare(thread_db* tdbb, dsql_dbb* database, jrd_tra* transacti /** - + put_item - + @brief Put information item in output buffer if there is room, and return an updated pointer. If there isn't room for the item, indicate truncation and return NULL. - + @param item @param length @@ -2734,11 +2734,11 @@ static UCHAR* put_item( UCHAR item, /** - + release_request - + @brief Release a dynamic request. - + @param request @param top_level @@ -2747,7 +2747,7 @@ static UCHAR* put_item( UCHAR item, static void release_request(thread_db* tdbb, dsql_req* request, bool drop) { SET_TDBB(tdbb); - + // If request is parent, orphan the children and // release a portion of their requests @@ -2848,7 +2848,7 @@ static void sql_info(thread_db* tdbb, memset(buffer, 0, sizeof(buffer)); // Pre-initialize buffer. This is necessary because we don't want to transfer rubbish over the wire - memset(info, 0, info_length); + memset(info, 0, info_length); const UCHAR* const end_items = items + item_length; const UCHAR* const end_info = info + info_length; @@ -2931,10 +2931,10 @@ static void sql_info(thread_db* tdbb, case REQ_SAVEPOINT: number = isc_info_sql_stmt_savepoint; break; - case REQ_EXEC_BLOCK: + case REQ_EXEC_BLOCK: number = isc_info_sql_stmt_exec_procedure; break; - case REQ_SELECT_BLOCK: + case REQ_SELECT_BLOCK: number = isc_info_sql_stmt_select; break; default: @@ -2965,7 +2965,7 @@ static void sql_info(thread_db* tdbb, } else if (item == isc_info_sql_records) { length = get_request_info(tdbb, request, (SSHORT) sizeof(buffer), buffer); - if (length && !(info = put_item(item, length, buffer, info, end_info))) + if (length && !(info = put_item(item, length, buffer, info, end_info))) { return; } @@ -3015,7 +3015,7 @@ static void sql_info(thread_db* tdbb, const UCHAR* end_describe = items; while (end_describe < end_items && *end_describe != isc_info_end && - *end_describe != isc_info_sql_describe_end) + *end_describe != isc_info_sql_describe_end) { end_describe++; } @@ -3050,11 +3050,11 @@ static void sql_info(thread_db* tdbb, /** - + var_info - + @brief Provide information on an internal message. - + @param message @param items @@ -3068,8 +3068,8 @@ static UCHAR* var_info( dsql_msg* message, const UCHAR* items, const UCHAR* const end_describe, - UCHAR* info, - const UCHAR* const end, + UCHAR* info, + const UCHAR* const end, USHORT first_index) { if (!message || !message->msg_index) @@ -3102,7 +3102,7 @@ static UCHAR* var_info( SLONG sql_sub_type = 0; SLONG sql_scale = 0; SLONG sql_type = 0; - + switch (param->par_desc.dsc_dtype) { case dtype_real: diff --git a/src/dsql/errd.cpp b/src/dsql/errd.cpp index a76a6a9edf..38f4c1f686 100644 --- a/src/dsql/errd.cpp +++ b/src/dsql/errd.cpp @@ -19,7 +19,7 @@ * * All Rights Reserved. * Contributor(s): ______________________________________. - * + * * 27 Nov 2001 Ann W. Harrison - preserve string arguments in * ERRD_post_warning * @@ -42,7 +42,7 @@ #include "../dsql/utld_proto.h" // This is the only one place in dsql code, where we need both -// dsql.h and err_proto.h. +// dsql.h and err_proto.h. // To avoid warnings, undefine some macro's here //#undef BUGCHECK //#undef IBERROR @@ -65,11 +65,11 @@ static void internal_post(const ISC_STATUS* status_vector); #ifdef DEV_BUILD /** - + ERRD_assert_msg - + @brief Generate an assertion failure with a message - + @param msg @param file @@ -86,15 +86,15 @@ void ERRD_assert_msg(const char* msg, const char* file, ULONG lineno) (msg ? msg : ""), (file ? file : ""), lineno); ERRD_bugcheck(buffer); } -#endif // DEV_BUILD +#endif // DEV_BUILD /** - + ERRD_bugcheck - + @brief Somebody has screwed up. Bugcheck. - + @param text @@ -108,16 +108,16 @@ void ERRD_bugcheck(const char* text) /** - + ERRD_error - + @brief This routine should only be used by fatal error messages, those that cannot use the normal error routines because something is very badly wrong. ERRD_post() should be used by most error messages, especially so that strings will be handled. - + @param code @param text @@ -134,14 +134,14 @@ void ERRD_error(const char* text) /** - + ERRD_post_warning - + @brief Post a warning to the current status vector. - + @param status - @param + @param **/ bool ERRD_post_warning(const Firebird::Arg::StatusVector& v) @@ -155,7 +155,7 @@ bool ERRD_post_warning(const Firebird::Arg::StatusVector& v) (status_vector[0] == isc_arg_gds && status_vector[1] == 0 && status_vector[2] != isc_arg_warning)) { - // this is a blank status vector + // this is a blank status vector status_vector[0] = isc_arg_gds; status_vector[1] = 0; status_vector[2] = isc_arg_end; @@ -163,7 +163,7 @@ bool ERRD_post_warning(const Firebird::Arg::StatusVector& v) } else { - // find end of a status vector + // find end of a status vector int warning_indx = 0; PARSE_STATUS(status_vector, indx, warning_indx); if (indx) { @@ -178,21 +178,21 @@ bool ERRD_post_warning(const Firebird::Arg::StatusVector& v) return true; } - // not enough free space + // not enough free space return false; } /** - + ERRD_post - + @brief Post an error, copying any potentially transient data before we punt. - + @param statusVector - @param + @param **/ void ERRD_post(const Firebird::Arg::StatusVector& v) @@ -204,22 +204,22 @@ void ERRD_post(const Firebird::Arg::StatusVector& v) /** - + internal_post - + @brief Post an error, copying any potentially transient data before we punt. - + @param tmp_status - @param + @param **/ static void internal_post(const ISC_STATUS* tmp_status) { ISC_STATUS* status_vector = JRD_get_thread_data()->tdbb_status_vector; -// calculate length of the status +// calculate length of the status int tmp_status_len = 0, warning_indx = 0; PARSE_STATUS(tmp_status, tmp_status_len, warning_indx); fb_assert(warning_indx == 0); @@ -228,7 +228,7 @@ static void internal_post(const ISC_STATUS* tmp_status) (status_vector[0] == isc_arg_gds && status_vector[1] == 0 && status_vector[2] != isc_arg_warning)) { - // this is a blank status vector + // this is a blank status vector status_vector[0] = isc_arg_gds; status_vector[1] = isc_dsql_error; status_vector[2] = isc_arg_end; @@ -244,11 +244,11 @@ static void internal_post(const ISC_STATUS* tmp_status) for (i = 0; i < ISC_STATUS_LENGTH; i++) { if (status_vector[i] == isc_arg_end && i == status_len) { - break; // end of argument list + break; // end of argument list } if (i && i == warning_indx) { - break; // vector has no more errors + break; // vector has no more errors } if (status_vector[i] == tmp_status[1] && i && @@ -257,7 +257,7 @@ static void internal_post(const ISC_STATUS* tmp_status) (memcmp(&status_vector[i], &tmp_status[1], sizeof(ISC_STATUS) * (tmp_status_len - 2)) == 0)) { - // duplicate found + // duplicate found ERRD_punt(); } } @@ -272,7 +272,7 @@ static void internal_post(const ISC_STATUS* tmp_status) ISC_STATUS_ARRAY warning_status; if (warning_indx) { - // copy current warning(s) to a temp buffer + // copy current warning(s) to a temp buffer MOVE_CLEAR(warning_status, sizeof(warning_status)); memcpy(warning_status, &status_vector[warning_indx], sizeof(ISC_STATUS) * (ISC_STATUS_LENGTH - warning_indx)); @@ -287,7 +287,7 @@ static void internal_post(const ISC_STATUS* tmp_status) { memcpy(&status_vector[err_status_len], tmp_status, sizeof(ISC_STATUS) * tmp_status_len); ERR_make_permanent(&status_vector[err_status_len]); - // copy current warning(s) to the status_vector + // copy current warning(s) to the status_vector if (warning_count && i + warning_count - 1 < ISC_STATUS_LENGTH) { memcpy(&status_vector[i - 1], warning_status, @@ -299,12 +299,12 @@ static void internal_post(const ISC_STATUS* tmp_status) /** - + ERRD_punt - + @brief Error stuff has been copied to status vector. Now punt. - + **/ @@ -317,11 +317,11 @@ void ERRD_punt(const ISC_STATUS* local) UTLD_copy_status(local, tdbb->tdbb_status_vector); } -// Save any strings in a permanent location +// Save any strings in a permanent location UTLD_save_status_strings(tdbb->tdbb_status_vector); -// Give up whatever we were doing and return to the user. +// Give up whatever we were doing and return to the user. status_exception::raise(tdbb->tdbb_status_vector); } diff --git a/src/dsql/hsh.cpp b/src/dsql/hsh.cpp index 75ef608985..ea798b447b 100644 --- a/src/dsql/hsh.cpp +++ b/src/dsql/hsh.cpp @@ -66,11 +66,11 @@ namespace #include /** - + HSHD_debug - + @brief Print out the hash table for debugging. - + **/ @@ -78,13 +78,13 @@ void HSHD_debug() { Firebird::ReadLockGuard guard(hash_sync); - // dump each hash table entry + // dump each hash table entry for (SSHORT h = 0; h < HASH_SIZE; h++) { for (DSQL_SYM collision = hash_table()[h]; collision; collision = collision->sym_collision) { - // check any homonyms first + // check any homonyms first fprintf(stderr, "Symbol type %d: %s %p\n", collision->sym_type, collision->sym_string, collision->sym_dbb); @@ -102,13 +102,13 @@ void HSHD_debug() /** - + HSHD_finish - + @brief Remove symbols used by a particular database. Don't bother to release them since their pools will be released. - + @param database @@ -117,12 +117,12 @@ void HSHD_finish(const void* database) { Firebird::WriteLockGuard guard(hash_sync); - // check each hash table entry + // check each hash table entry for (SSHORT h = 0; h < HASH_SIZE; h++) { for (DSQL_SYM* collision = &hash_table()[h]; *collision;) { - // check any homonyms first + // check any homonyms first DSQL_SYM chain = *collision; for (DSQL_SYM* homptr = &chain->sym_homonym; *homptr;) { @@ -138,7 +138,7 @@ void HSHD_finish(const void* database) } } - // now, see if the root entry has to go + // now, see if the root entry has to go if (chain->sym_dbb == database) { if (chain->sym_homonym) @@ -162,11 +162,11 @@ void HSHD_finish(const void* database) /** - + HSHD_insert - + @brief Insert a symbol into the hash table. - + @param symbol @@ -184,7 +184,7 @@ void HSHD_insert(DSQL_SYM symbol) { if ((!database || (database == old->sym_dbb)) && scompare(symbol->sym_string, symbol->sym_length, old->sym_string, - old->sym_length)) + old->sym_length)) { symbol->sym_homonym = old->sym_homonym; old->sym_homonym = symbol; @@ -198,12 +198,12 @@ void HSHD_insert(DSQL_SYM symbol) /** - + HSHD_lookup - + @brief Perform a string lookup against hash table. Make sure to only return a symbol of the desired type. - + @param database @param string @@ -229,7 +229,7 @@ DSQL_SYM HSHD_lookup(const void* database, if ((database == symbol->sym_dbb) && scompare(string, length, symbol->sym_string, symbol->sym_length)) { - // Search for a symbol of the proper type + // Search for a symbol of the proper type while (symbol && symbol->sym_type != type) { symbol = symbol->sym_homonym; @@ -254,11 +254,11 @@ DSQL_SYM HSHD_lookup(const void* database, /** - + HSHD_remove - + @brief Remove a symbol from the hash table. - + @param symbol @@ -283,9 +283,9 @@ void HSHD_remove(DSQL_SYM symbol) /** - + HSHD_set_flag - + @brief Set a flag in all similar objects in a chain. This is used primarily to mark relations, procedures and functions as deleted. The object must have the same name and @@ -297,7 +297,7 @@ void HSHD_remove(DSQL_SYM symbol) This is because there's no way at present for DSQL to tell if two databases as represented in DSQL are attachments to the same physical database. - + @param database @param string @@ -337,14 +337,14 @@ void HSHD_set_flag(const void* database, if (symbol->sym_dbb && (database != symbol->sym_dbb) && scompare(string, length, symbol->sym_string, symbol->sym_length)) { - // the symbol name matches and it's from a different database + // the symbol name matches and it's from a different database for (DSQL_SYM homonym = symbol; homonym; homonym = homonym->sym_homonym) { if (homonym->sym_type == type) { - // the homonym is of the correct type + // the homonym is of the correct type /* the next check is for the same relation or procedure ID, which indicates that it MAY be the same relation or @@ -381,14 +381,14 @@ void HSHD_set_flag(const void* database, /** - - hash - - @brief Returns the hash function of a string. - - @param - @param + hash + + @brief Returns the hash function of a string. + + + @param + @param **/ static USHORT hash(const SCHAR* string, USHORT length) @@ -406,13 +406,13 @@ static USHORT hash(const SCHAR* string, USHORT length) /** - + remove_symbol - + @brief Given the address of a collision, - remove a symbol from the collision + remove a symbol from the collision and homonym linked lists. - + @param collision @param symbol @@ -450,15 +450,15 @@ static bool remove_symbol(DSQL_SYM* collision, DSQL_SYM symbol) /** - + scompare - + @brief Compare two symbolic strings The character set for these strings is either ASCII or Unicode in UTF format. Symbols are case-significant - so no uppercase operation is performed. - + @param string1 @param length1 diff --git a/src/dsql/keywords.cpp b/src/dsql/keywords.cpp index 0ffd7164b4..fd79d6d657 100644 --- a/src/dsql/keywords.cpp +++ b/src/dsql/keywords.cpp @@ -138,7 +138,7 @@ static const TOK tokens[] = {CURRENT_USER, "CURRENT_USER", 2, false}, {CURSOR, "CURSOR", 1, false}, {DATABASE, "DATABASE", 1, false}, - {DATA, "DATA", 2, true}, + {DATA, "DATA", 2, true}, {DATE, "DATE", 1, false}, {DATEADD, "DATEADD", 2, false}, {DATEDIFF, "DATEDIFF", 2, false}, diff --git a/src/dsql/movd.cpp b/src/dsql/movd.cpp index acfbaa6846..b80d714dda 100644 --- a/src/dsql/movd.cpp +++ b/src/dsql/movd.cpp @@ -40,11 +40,11 @@ static void post_error(const Arg::StatusVector&); /** - + MOVD_move - + @brief Move (and possible convert) something to something else. - + @param from @param to @@ -58,14 +58,14 @@ void MOVD_move(const dsc* from, dsc* to) /** - + post_error - + @brief A conversion error occurred. Complain. - + @param status - @param + @param **/ static void post_error(const Arg::StatusVector& v) diff --git a/src/dsql/pass1.cpp b/src/dsql/pass1.cpp index 6e86dbd2ed..632b166ec1 100644 --- a/src/dsql/pass1.cpp +++ b/src/dsql/pass1.cpp @@ -370,7 +370,7 @@ dsql_ctx* PASS1_make_context(CompiledStatement* statement, const dsql_nod* relat ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-204) << Arg::Gds(isc_dsql_procedure_err) << Arg::Gds(isc_random) << Arg::Str(relation_name->str_data) << - Arg::Gds(isc_dsql_line_col_error) << Arg::Num(relation_node->nod_line) << + Arg::Gds(isc_dsql_line_col_error) << Arg::Num(relation_node->nod_line) << Arg::Num(relation_node->nod_column)); } } @@ -390,7 +390,7 @@ dsql_ctx* PASS1_make_context(CompiledStatement* statement, const dsql_nod* relat ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-204) << Arg::Gds(isc_dsql_relation_err) << Arg::Gds(isc_random) << Arg::Str(relation_name->str_data) << - Arg::Gds(isc_dsql_line_col_error) << Arg::Num(relation_node->nod_line) << + Arg::Gds(isc_dsql_line_col_error) << Arg::Num(relation_node->nod_line) << Arg::Num(relation_node->nod_column)); } } @@ -398,7 +398,7 @@ dsql_ctx* PASS1_make_context(CompiledStatement* statement, const dsql_nod* relat if (procedure && !procedure->prc_out_count) { ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-84) << Arg::Gds(isc_dsql_procedure_use_err) << Arg::Str(relation_name->str_data) << - Arg::Gds(isc_dsql_line_col_error) << Arg::Num(relation_node->nod_line) << + Arg::Gds(isc_dsql_line_col_error) << Arg::Num(relation_node->nod_line) << Arg::Num(relation_node->nod_column)); } @@ -434,14 +434,14 @@ dsql_ctx* PASS1_make_context(CompiledStatement* statement, const dsql_nod* relat string = (dsql_str*) relation_node->nod_arg[e_rln_alias]; } - if (string) + if (string) { context->ctx_internal_alias = (TEXT*) string->str_data; } DEV_BLKCHK(string, dsql_type_str); if (statement->req_alias_relation_prefix && !(relation_node->nod_type == nod_derived_table)) - { + { if (string) { string = pass1_alias_concat(statement->req_alias_relation_prefix, string); } @@ -774,9 +774,9 @@ dsql_nod* PASS1_node(CompiledStatement* statement, dsql_nod* input) { cte->nod_flags |= NOD_DT_CTE_USED; - if ((statement->req_flags & REQ_CTE_recursive) && - statement->req_curr_ctes.hasData() && - (statement->req_curr_ctes.object() == cte)) + if ((statement->req_flags & REQ_CTE_recursive) && + statement->req_curr_ctes.hasData() && + (statement->req_curr_ctes.object() == cte)) { ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) << // Recursive CTE member (%s) can refer itself only in FROM clause @@ -795,7 +795,7 @@ dsql_nod* PASS1_node(CompiledStatement* statement, dsql_nod* input) dsql_nod* const select_expr = cte->nod_arg[e_derived_table_rse]; dsql_nod* const query = select_expr->nod_arg[e_sel_query_spec]; - const bool isRecursive = (query->nod_type == nod_list) && + const bool isRecursive = (query->nod_type == nod_list) && (query->nod_flags & NOD_UNION_RECURSIVE); dsql_str* cte_name = (dsql_str*) cte->nod_arg[e_derived_table_alias]; @@ -1751,7 +1751,7 @@ dsql_nod* PASS1_statement(CompiledStatement* statement, dsql_nod* input) node = MAKE_node(input->nod_type, input->nod_count); node->nod_arg[e_exec_stmt_sql] = PASS1_node(statement, input->nod_arg[e_exec_stmt_sql]); - node->nod_arg[e_exec_stmt_inputs] = + node->nod_arg[e_exec_stmt_inputs] = PASS1_node(statement, input->nod_arg[e_exec_stmt_inputs]); // check params names uniqueness, if present @@ -1765,7 +1765,7 @@ dsql_nod* PASS1_statement(CompiledStatement* statement, dsql_nod* input) for (int i = 0; i < cnt; i++) { const dsql_str* name = (dsql_str*) prm[i]->nod_arg[e_named_param_name]; - + size_t pos; if (names.find(name->str_data, pos)) { ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-637) << @@ -1776,9 +1776,9 @@ dsql_nod* PASS1_statement(CompiledStatement* statement, dsql_nod* input) } } - node->nod_arg[e_exec_stmt_outputs] = + node->nod_arg[e_exec_stmt_outputs] = PASS1_node(statement, input->nod_arg[e_exec_stmt_outputs]); - + if (input->nod_arg[e_exec_stmt_proc_block]) { statement->req_loop_level++; @@ -2464,14 +2464,14 @@ static dsql_nod* ambiguity_check(CompiledStatement* statement, dsql_nod* node, delete node; } ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-204) << - Arg::Gds(isc_dsql_ambiguous_field_name) << Arg::Str(buffer) << + Arg::Gds(isc_dsql_ambiguous_field_name) << Arg::Str(buffer) << Arg::Str(++p) << Arg::Gds(isc_random) << Arg::Str(name->str_data)); return NULL; } ERRD_post_warning(Arg::Warning(isc_sqlwarn) << Arg::Num(204) << - Arg::Warning(isc_dsql_ambiguous_field_name) << Arg::Str(buffer) << + Arg::Warning(isc_dsql_ambiguous_field_name) << Arg::Str(buffer) << Arg::Str(++p) << Arg::Gds(isc_random) << Arg::Str(name->str_data)); @@ -2697,7 +2697,7 @@ static void field_appears_once(const dsql_nod* fields, const dsql_nod* old_field { const Firebird::MetaName& n1 = reinterpret_cast(elem1->nod_arg[e_fld_field])->fld_name; - + for (int j = i + 1; j < fields->nod_count; ++j) { const dsql_nod* elem2 = fields->nod_arg[j]; @@ -2708,14 +2708,14 @@ static void field_appears_once(const dsql_nod* fields, const dsql_nod* old_field { const Firebird::MetaName& n2 = reinterpret_cast(elem2->nod_arg[e_fld_field])->fld_name; - + if (n1 == n2) { const dsql_ctx* tmp_ctx = (dsql_ctx*) elem2->nod_arg[e_fld_context]; const dsql_rel* bad_rel = tmp_ctx ? tmp_ctx->ctx_relation : 0; field_duplication(bad_rel ? bad_rel->rel_name.c_str() : 0, n2.c_str(), - is_insert ? old_fields->nod_arg[j]: old_fields->nod_arg[j]->nod_arg[1], + is_insert ? old_fields->nod_arg[j]: old_fields->nod_arg[j]->nod_arg[1], statement); } } @@ -2751,9 +2751,9 @@ static void field_duplication(const TEXT* qualifier_name, const TEXT* field_name } ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-206) << - Arg::Gds(isc_dsql_no_dup_name) << Arg::Str(field_name) << + Arg::Gds(isc_dsql_no_dup_name) << Arg::Str(field_name) << Arg::Str(statement) << - Arg::Gds(isc_dsql_line_col_error) << Arg::Num(flawed_node->nod_line) << + Arg::Gds(isc_dsql_line_col_error) << Arg::Num(flawed_node->nod_line) << Arg::Num(flawed_node->nod_column)); } @@ -2789,14 +2789,14 @@ static void field_unknown(const TEXT* qualifier_name, const TEXT* field_name, ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-206) << Arg::Gds(isc_dsql_field_err) << Arg::Gds(isc_random) << Arg::Str(field_name) << - Arg::Gds(isc_dsql_line_col_error) << Arg::Num(flawed_node->nod_line) << + Arg::Gds(isc_dsql_line_col_error) << Arg::Num(flawed_node->nod_line) << Arg::Num(flawed_node->nod_column)); } else { ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-206) << Arg::Gds(isc_dsql_field_err) << - Arg::Gds(isc_dsql_line_col_error) << Arg::Num(flawed_node->nod_line) << + Arg::Gds(isc_dsql_line_col_error) << Arg::Num(flawed_node->nod_line) << Arg::Num(flawed_node->nod_column)); } } @@ -2964,14 +2964,14 @@ static bool get_object_and_field(const dsql_nod* node, const dsql_ctx* context = reinterpret_cast(node->nod_arg[e_fld_context]); DEV_BLKCHK(context, dsql_type_ctx); - + if (context->ctx_relation) *obj_name = context->ctx_relation->rel_name.c_str(); else if (context->ctx_procedure) *obj_name = context->ctx_procedure->prc_name.c_str(); else *obj_name = NULL; - + *fld_name = reinterpret_cast(node->nod_arg[e_fld_field])->fld_name; return obj_name && fld_name; @@ -3361,9 +3361,9 @@ static bool node_match(const dsql_nod* node1, const dsql_nod* node2, } // Handle derived fields. - if ((node1->nod_type == nod_derived_field) || (node2->nod_type == nod_derived_field)) + if ((node1->nod_type == nod_derived_field) || (node2->nod_type == nod_derived_field)) { - if ((node1->nod_type == nod_derived_field) && (node2->nod_type == nod_derived_field)) + if ((node1->nod_type == nod_derived_field) && (node2->nod_type == nod_derived_field)) { const USHORT scope_level1 = (USHORT)(U_IPTR)node1->nod_arg[e_derived_field_scope]; const USHORT scope_level2 = (USHORT)(U_IPTR)node2->nod_arg[e_derived_field_scope]; @@ -3474,7 +3474,7 @@ static bool node_match(const dsql_nod* node1, const dsql_nod* node2, (node1->nod_type == nod_agg_total2) || (node1->nod_type == nod_agg_average2) || (node1->nod_type == nod_agg_average) || - (node1->nod_type == nod_agg_list)) + (node1->nod_type == nod_agg_list)) { if ((node1->nod_flags & NOD_AGG_DISTINCT) != (node2->nod_flags & NOD_AGG_DISTINCT)) @@ -3900,7 +3900,7 @@ static dsql_nod* pass1_constant( CompiledStatement* statement, dsql_nod* input) */ ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-204) << Arg::Gds(isc_dsql_datatype_err) << - Arg::Gds(isc_collation_not_found) << Arg::Str(global_temp_collation_name->str_data) << + Arg::Gds(isc_collation_not_found) << Arg::Str(global_temp_collation_name->str_data) << Arg::Str(resolved->intlsym_name)); } resolved = resolved_collation; @@ -3925,7 +3925,7 @@ static dsql_nod* pass1_constant( CompiledStatement* statement, dsql_nod* input) adjust = sizeof(USHORT); else if (constant->nod_desc.dsc_dtype == dtype_cstring) adjust = 1; - + constant->nod_desc.dsc_length -= adjust; CharSet* charSet = INTL_charset_lookup(tdbb, INTL_GET_CHARSET(&constant->nod_desc)); @@ -4007,7 +4007,7 @@ static dsql_ctx* pass1_cursor_context( CompiledStatement* statement, const dsql_ { ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-504) << Arg::Gds(isc_dsql_cursor_err) << - Arg::Gds(isc_dsql_cursor_rel_ambiguous) << Arg::Str(rname->str_data) << + Arg::Gds(isc_dsql_cursor_rel_ambiguous) << Arg::Str(rname->str_data) << Arg::Str(string->str_data)); } else @@ -4027,7 +4027,7 @@ static dsql_ctx* pass1_cursor_context( CompiledStatement* statement, const dsql_ { ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-504) << Arg::Gds(isc_dsql_cursor_err) << - Arg::Gds(isc_dsql_cursor_rel_not_found) << Arg::Str(rname->str_data) << + Arg::Gds(isc_dsql_cursor_rel_not_found) << Arg::Str(rname->str_data) << Arg::Str(string->str_data)); } @@ -4242,7 +4242,7 @@ static dsql_nod* pass1_dbkey( CompiledStatement* statement, dsql_nod* input) return ambiguity_check(statement, node, MAKE_cstring("RDB$DB_KEY"), contexts); } } - else + else { const bool cfgRlxAlias = Config::getRelaxedAliasChecking(); bool rlxAlias = false; @@ -4280,7 +4280,7 @@ static dsql_nod* pass1_dbkey( CompiledStatement* statement, dsql_nod* input) if (rlxAlias == cfgRlxAlias) break; - + rlxAlias = cfgRlxAlias; } } @@ -4372,7 +4372,7 @@ static dsql_nod* pass1_delete( CompiledStatement* statement, dsql_nod* input) pass1_relproc_is_recursive - @brief check if table reference is recursive i.e. its name is equal + @brief check if table reference is recursive i.e. its name is equal to the name of current processing CTE @param statement @@ -4404,7 +4404,7 @@ static bool pass1_relproc_is_recursive(CompiledStatement* statement, dsql_nod* i const dsql_nod* curr_cte = statement->req_curr_ctes.object(); const dsql_str* cte_name = (dsql_str*) curr_cte->nod_arg[e_derived_table_alias]; - const bool recursive = (cte_name->str_length == rel_name->str_length) && + const bool recursive = (cte_name->str_length == rel_name->str_length) && (strncmp(rel_name->str_data, cte_name->str_data, cte_name->str_length) == 0); if (recursive) { @@ -4422,7 +4422,7 @@ static bool pass1_relproc_is_recursive(CompiledStatement* statement, dsql_nod* i @brief check if join have recursive members. If found remove this member from join and return its boolean (to be added into WHERE clause). We must remove member only if it is a table reference. - Punt if recursive reference is found in outer join or more than one + Punt if recursive reference is found in outer join or more than one recursive reference is found @param statement @@ -4433,7 +4433,7 @@ static dsql_nod* pass1_join_is_recursive(CompiledStatement* statement, dsql_nod* { const NOD_TYPE join_type = input->nod_arg[e_join_type]->nod_type; bool remove = false; - + bool leftRecursive = false; dsql_nod* leftBool = NULL; dsql_nod** join_table = &input->nod_arg[e_join_left_rel]; @@ -4508,8 +4508,8 @@ static dsql_nod* pass1_join_is_recursive(CompiledStatement* statement, dsql_nod* pass1_rse_is_recursive @brief check if rse is recursive. If recursive reference is a table - in the FROM list remove it. If recursive reference is a part of - join add join boolean (returned by pass1_join_is_recursive) to the + in the FROM list remove it. If recursive reference is a part of + join add join boolean (returned by pass1_join_is_recursive) to the WHERE clause. Punt if more than one recursive reference is found @param statement @@ -4523,7 +4523,7 @@ static bool pass1_rse_is_recursive(CompiledStatement* statement, dsql_nod* input dsql_nod* table_list = input->nod_arg[e_qry_from]; dsql_nod** table = table_list->nod_arg; dsql_nod** end = table_list->nod_arg + table_list->nod_count; - + bool found = false; for (dsql_nod** prev = table; table < end; table++) { @@ -4558,7 +4558,7 @@ static bool pass1_rse_is_recursive(CompiledStatement* statement, dsql_nod* input } found = true; - input->nod_arg[e_qry_where] = + input->nod_arg[e_qry_where] = compose(input->nod_arg[e_qry_where], joinBool, nod_and); } } @@ -4582,11 +4582,11 @@ static bool pass1_rse_is_recursive(CompiledStatement* statement, dsql_nod* input @brief Process derived table which can be recursive CTE If it is non-recursive return input node unchanged - If it is recursive return new derived table which is an union of - union of anchor (non-recursive) queries and union of recursive - queries. Check recursive queries to satisfy various criterias. + If it is recursive return new derived table which is an union of + union of anchor (non-recursive) queries and union of recursive + queries. Check recursive queries to satisfy various criterias. Note that our parser is right-to-left therefore recursive members - will be first in union's list + will be first in union's list @param statement @@ -4628,19 +4628,19 @@ static dsql_nod* pass1_recursive_cte(CompiledStatement* statement, dsql_nod* inp if (rse->nod_arg[e_qry_distinct]) { ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) << // Recursive member of CTE '%s' has %s clause - Arg::Gds(isc_dsql_cte_wrong_clause) << Arg::Str(cte_alias->str_data) << + Arg::Gds(isc_dsql_cte_wrong_clause) << Arg::Str(cte_alias->str_data) << Arg::Str("DISTINCT")); } if (rse->nod_arg[e_qry_group]) { ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) << // Recursive member of CTE '%s' has %s clause - Arg::Gds(isc_dsql_cte_wrong_clause) << Arg::Str(cte_alias->str_data) << + Arg::Gds(isc_dsql_cte_wrong_clause) << Arg::Str(cte_alias->str_data) << Arg::Str("GROUP BY")); } if (rse->nod_arg[e_qry_having]) { ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) << // Recursive member of CTE '%s' has %s clause - Arg::Gds(isc_dsql_cte_wrong_clause) << Arg::Str(cte_alias->str_data) << + Arg::Gds(isc_dsql_cte_wrong_clause) << Arg::Str(cte_alias->str_data) << Arg::Str("HAVING")); } // hvlad: we need also forbid any aggregate function here @@ -4675,9 +4675,9 @@ static dsql_nod* pass1_recursive_cte(CompiledStatement* statement, dsql_nod* inp // Non-recursive member is missing in CTE '%s' Arg::Gds(isc_dsql_cte_miss_nonrecursive) << Arg::Str(cte_alias->str_data)); } - + qry = recursive_rse; - dsql_nod* list = 0; + dsql_nod* list = 0; while (qry->nod_arg[0] != anchor_rse) { list = qry; @@ -4698,7 +4698,7 @@ static dsql_nod* pass1_recursive_cte(CompiledStatement* statement, dsql_nod* inp dsql_nod* select = MAKE_node(nod_select_expr, e_sel_count); select->nod_arg[e_sel_query_spec] = union_node; - select->nod_arg[e_sel_order] = select->nod_arg[e_sel_rows] = + select->nod_arg[e_sel_order] = select->nod_arg[e_sel_rows] = select->nod_arg[e_sel_with_list] = NULL; dsql_nod* node = MAKE_node(nod_derived_table, e_derived_table_count); @@ -4799,14 +4799,14 @@ static dsql_nod* pass1_derived_table(CompiledStatement* statement, dsql_nod* inp for (DsqlContextStack::iterator stack(*statement->req_context); stack.hasData(); ++stack) { dsql_ctx* local_context = stack.object(); - if ((local_context->ctx_scope_level < statement->req_scope_level) || + if ((local_context->ctx_scope_level < statement->req_scope_level) || (local_context->ctx_flags & CTX_system)) { temp.push(local_context); } } dsql_ctx* baseContext = NULL; - if (temp.hasData()) { + if (temp.hasData()) { baseContext = temp.object(); } statement->req_context = &temp; @@ -4815,20 +4815,20 @@ static dsql_nod* pass1_derived_table(CompiledStatement* statement, dsql_nod* inp dsql_nod* const select_expr = input->nod_arg[e_derived_table_rse]; dsql_nod* query = select_expr->nod_arg[e_sel_query_spec]; dsql_nod* rse = NULL; - const bool isRecursive = + const bool isRecursive = (query->nod_type == nod_list) && (query->nod_flags & NOD_UNION_RECURSIVE); USHORT recursive_map_ctx = 0; - + if (isRecursive) { - // Create dummy, non-recursive select statement by doing a union of - // one, non-recursive member. The dummy will be replaced at the end + // Create dummy, non-recursive select statement by doing a union of + // one, non-recursive member. The dummy will be replaced at the end // of this function. query->nod_count = 1; query->nod_flags &= ~NOD_UNION_RECURSIVE; - dsql_ctx* baseUnionCtx = statement->req_union_context.hasData() ? + dsql_ctx* baseUnionCtx = statement->req_union_context.hasData() ? statement->req_union_context.object() : NULL; // reserve extra context number for map's secondary context @@ -4842,13 +4842,13 @@ static dsql_nod* pass1_derived_table(CompiledStatement* statement, dsql_nod* inp query->nod_count = 2; query->nod_flags |= NOD_UNION_RECURSIVE; - while (statement->req_union_context.hasData() && + while (statement->req_union_context.hasData() && statement->req_union_context.object() != baseUnionCtx) { statement->req_union_context.pop(); } } - else + else { // AB: 2005-01-06 // If our derived table contains a single query with a sub-select buried @@ -5014,7 +5014,7 @@ static dsql_nod* pass1_derived_table(CompiledStatement* statement, dsql_nod* inp ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) << Arg::Gds(isc_dsql_command_err) << - Arg::Gds(isc_dsql_derived_field_unnamed) << Arg::Num(count + 1) << + Arg::Gds(isc_dsql_derived_field_unnamed) << Arg::Num(count + 1) << Arg::Str(aliasname)); } } @@ -5033,7 +5033,7 @@ static dsql_nod* pass1_derived_table(CompiledStatement* statement, dsql_nod* inp // column %s was specified multiple times for derived table %s ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) << Arg::Gds(isc_dsql_command_err) << - Arg::Gds(isc_dsql_derived_field_dup_name) << Arg::Str(name1->str_data) << + Arg::Gds(isc_dsql_derived_field_dup_name) << Arg::Str(name1->str_data) << Arg::Str(aliasname)); } } @@ -5063,7 +5063,7 @@ static dsql_nod* pass1_derived_table(CompiledStatement* statement, dsql_nod* inp temp.clear(); rse->nod_arg[e_rse_items] = context->ctx_rse->nod_arg[e_rse_items]; - + dsql_nod* node2 = MAKE_node(nod_derived_table, e_derived_table_count); *node2 = *node; node2->nod_arg[e_derived_table_rse] = rse; @@ -5076,12 +5076,12 @@ static dsql_nod* pass1_derived_table(CompiledStatement* statement, dsql_nod* inp statement->req_context = req_base; - // mark union's map context as recursive and assign + // mark union's map context as recursive and assign // secondary context number to it dsql_nod* items = rse->nod_arg[e_rse_items]; dsql_nod* map_item = items->nod_arg[0]; if (map_item->nod_type == nod_derived_field) { - map_item = map_item->nod_arg[e_alias_value]; + map_item = map_item->nod_arg[e_alias_value]; } dsql_ctx* map_context = (dsql_ctx*) map_item->nod_arg[e_map_context]; @@ -5348,7 +5348,7 @@ static dsql_nod* pass1_field(CompiledStatement* statement, dsql_nod* input, bool resolve_by_alias = true; const bool relaxedAliasChecking = Config::getRelaxedAliasChecking(); - while (true) + while (true) { // AB: Loop through the scope_levels starting by its own. bool done = false; @@ -5371,7 +5371,7 @@ static dsql_nod* pass1_field(CompiledStatement* statement, dsql_nod* input, continue; } - dsql_fld* field = resolve_context(statement, qualifier, context, is_check_constraint, + dsql_fld* field = resolve_context(statement, qualifier, context, is_check_constraint, resolve_by_alias); // AB: When there's no relation and no procedure then we have a derived table. @@ -5428,7 +5428,7 @@ static dsql_nod* pass1_field(CompiledStatement* statement, dsql_nod* input, if (field || using_field) { // Intercept any reference to a field with datatype that // did not exist prior to V6 and post an error - + if (statement->req_client_dialect <= SQL_DIALECT_V5 && field && (field->fld_dtype == dtype_sql_date || field->fld_dtype == dtype_sql_time || @@ -6228,7 +6228,7 @@ static dsql_nod* pass1_group_by_list(CompiledStatement* statement, dsql_nod* inp DEV_BLKCHK(*ptr, dsql_type_nod); dsql_nod* sub = (*ptr); dsql_nod* frnode = NULL; - if (sub->nod_type == nod_field_name) + if (sub->nod_type == nod_field_name) { // check for alias or field node frnode = pass1_field(statement, sub, false, selectList); @@ -6249,7 +6249,7 @@ static dsql_nod* pass1_group_by_list(CompiledStatement* statement, dsql_nod* inp { frnode = pass1_node_psql(statement, *ptr, false); } - + stack.push(frnode); } // Finally make the complete list. @@ -6344,7 +6344,7 @@ static dsql_nod* pass1_insert( CompiledStatement* statement, dsql_nod* input, bo fields = pass1_node_psql(statement, fields, false); // We do not allow cases like INSERT INTO T(f1, f2, f1)... field_appears_once(fields, old_fields, true, "INSERT"); - + // begin IBO hack // 02-May-2004, Nickolay Samofatov. Do not constify ptr further e.g. to // const dsql_nod* const* .... etc. It chokes GCC 3.4.0 @@ -6795,7 +6795,7 @@ static dsql_nod* pass1_label(CompiledStatement* statement, dsql_nod* input) // ERROR: Label %s is not found in the current scope ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) << Arg::Gds(isc_dsql_command_err) << - Arg::Gds(isc_dsql_invalid_label) << Arg::Str(string->str_data) << + Arg::Gds(isc_dsql_invalid_label) << Arg::Str(string->str_data) << Arg::Str("is not found")); } else { @@ -6808,7 +6808,7 @@ static dsql_nod* pass1_label(CompiledStatement* statement, dsql_nod* input) // ERROR: Label %s already exists in the current scope ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) << Arg::Gds(isc_dsql_command_err) << - Arg::Gds(isc_dsql_invalid_label) << Arg::Str(string->str_data) << + Arg::Gds(isc_dsql_invalid_label) << Arg::Str(string->str_data) << Arg::Str("already exists")); } else { @@ -6930,7 +6930,7 @@ static dsql_nod* pass1_lookup_alias(CompiledStatement* statement, const dsql_str strcat(buffer2, " in the select list with name"); ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-204) << - Arg::Gds(isc_dsql_ambiguous_field_name) << Arg::Str(buffer1) << + Arg::Gds(isc_dsql_ambiguous_field_name) << Arg::Str(buffer1) << Arg::Str(buffer2) << Arg::Gds(isc_random) << Arg::Str(name->str_data)); } @@ -7223,7 +7223,7 @@ static dsql_nod* pass1_merge(CompiledStatement* statement, dsql_nod* input) } -// Changes statement->isPsql() value, calls PASS1_node and restore statement->isPsql(). +// Changes statement->isPsql() value, calls PASS1_node and restore statement->isPsql(). static dsql_nod* pass1_node_psql(CompiledStatement* statement, dsql_nod* input, bool psql) { PsqlChanger changer(statement, psql); @@ -7360,7 +7360,7 @@ static dsql_nod* pass1_not(CompiledStatement* statement, node->nod_arg[0] = PASS1_node(statement, sub); return node; } - + if (is_between) { // handle the special BETWEEN case fb_assert(node_type == nod_or); @@ -7484,9 +7484,9 @@ static dsql_nod* pass1_alias_list(CompiledStatement* statement, dsql_nod* alias_ dsql_ctx* context = NULL; while (aliasCount > 0) { - if (context) + if (context) { - if (context->ctx_rse && !context->ctx_relation && !context->ctx_procedure) + if (context->ctx_rse && !context->ctx_relation && !context->ctx_procedure) { // Derived table statement->req_scope_level++; @@ -7501,7 +7501,7 @@ static dsql_nod* pass1_alias_list(CompiledStatement* statement, dsql_nod* alias_ // since we already matched it to the context. for (; arg < end; arg++, aliasCount--) { - if (!(relation = pass1_base_table(statement, relation, (dsql_str*) *arg))) + if (!(relation = pass1_base_table(statement, relation, (dsql_str*) *arg))) break; } @@ -7520,7 +7520,7 @@ static dsql_nod* pass1_alias_list(CompiledStatement* statement, dsql_nod* alias_ // calculate the length leaving room for spaces and a null USHORT alias_length = alias_list->nod_count; dsql_nod** aliasArg = startArg; - for (; aliasArg < end; aliasArg++) + for (; aliasArg < end; aliasArg++) { DEV_BLKCHK(*aliasArg, dsql_type_str); alias_length += static_cast(((dsql_str*) *aliasArg)->str_length); @@ -7530,7 +7530,7 @@ static dsql_nod* pass1_alias_list(CompiledStatement* statement, dsql_nod* alias_ alias->str_length = alias_length; TEXT* p = new_context->ctx_alias = (TEXT*) alias->str_data; - for (aliasArg = startArg; aliasArg < end; aliasArg++) + for (aliasArg = startArg; aliasArg < end; aliasArg++) { for (const TEXT* q = (TEXT*) ((dsql_str*) *aliasArg)->str_data; *q;) *p++ = *q++; @@ -7540,10 +7540,10 @@ static dsql_nod* pass1_alias_list(CompiledStatement* statement, dsql_nod* alias_ context = new_context; } - else + else { - context = NULL; - } + context = NULL; + } } } else @@ -7607,7 +7607,7 @@ static dsql_ctx* pass1_alias(CompiledStatement* statement, DsqlContextStack& sta } // check for matching alias. - if (context->ctx_internal_alias) + if (context->ctx_internal_alias) { if (!strcmp(context->ctx_internal_alias, reinterpret_cast(alias->str_data))) @@ -7756,7 +7756,7 @@ static dsql_nod* pass1_returning(CompiledStatement* statement, const dsql_nod* i // RETURNING without INTO is not allowed for PSQL ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) << // Unexpected end of command - Arg::Gds(isc_command_end_err2) << Arg::Num(errSrc->nod_line) << + Arg::Gds(isc_command_end_err2) << Arg::Num(errSrc->nod_line) << Arg::Num(errSrc->nod_column)); } @@ -7764,12 +7764,12 @@ static dsql_nod* pass1_returning(CompiledStatement* statement, const dsql_nod* i fb_assert(count); dsql_nod* node = MAKE_node(nod_list, count); - if (target) + if (target) { // PSQL case fb_assert(statement->isPsql()); if (count != target->nod_count) { - // count of column list and value list don't match + // count of column list and value list don't match ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-804) << Arg::Gds(isc_dsql_var_count_err)); } @@ -7824,11 +7824,11 @@ static dsql_nod* pass1_returning(CompiledStatement* statement, const dsql_nod* i /** - + pass1_rse @brief wrapper for pass1_rse_impl - substitute recursive CTE alias (if needed) + substitute recursive CTE alias (if needed) and call pass1_rse_impl @param statement @@ -7864,7 +7864,7 @@ static dsql_nod* pass1_rse( CompiledStatement* statement, dsql_nod* input, dsql_ /** - + pass1_rse_impl @brief Compile a record selection expression. @@ -7897,12 +7897,12 @@ static dsql_nod* pass1_rse_impl( CompiledStatement* statement, dsql_nod* input, if (input->nod_type == nod_select_expr) { dsql_nod* node_with = input->nod_arg[e_sel_with_list]; - try + try { if (node_with) statement->addCTEs(node_with); - dsql_nod* ret = + dsql_nod* ret = pass1_rse(statement, input->nod_arg[e_sel_query_spec], input->nod_arg[e_sel_order], input->nod_arg[e_sel_rows], update_lock, viewFlags); @@ -7914,7 +7914,7 @@ static dsql_nod* pass1_rse_impl( CompiledStatement* statement, dsql_nod* input, } return ret; - } + } catch (const Firebird::Exception&) { if (node_with) statement->clearCTEs(); @@ -8488,7 +8488,7 @@ static dsql_nod* pass1_sort( CompiledStatement* statement, dsql_nod* input, dsql dsql_nod* node = MAKE_node(input->nod_type, input->nod_count); dsql_nod** ptr2 = node->nod_arg; - + for (int sortloop = 0; sortloop < input->nod_count; sortloop++) { DEV_BLKCHK(input->nod_arg[sortloop], dsql_type_nod); @@ -9895,8 +9895,8 @@ static dsql_nod* remap_field(CompiledStatement* statement, dsql_nod* field, } if (context->ctx_scope_level < lscope_level) { - field->nod_arg[e_derived_field_value] = - remap_field(statement, field->nod_arg[e_derived_field_value], + field->nod_arg[e_derived_field_value] = + remap_field(statement, field->nod_arg[e_derived_field_value], context, current_level); } return field; @@ -10105,7 +10105,7 @@ static dsql_nod* remap_field(CompiledStatement* statement, dsql_nod* field, case nod_constant: case nod_dbkey: - return post_map(field, context); + return post_map(field, context); default: return field; @@ -10244,9 +10244,9 @@ static dsql_fld* resolve_context( CompiledStatement* statement, const dsql_str* // return NULL; // } - // AB: If this context is a system generated context as in NEW/OLD inside - // triggers, the qualifier by the field is mandatory. While we can't - // fall back from a higher scope-level to the NEW/OLD contexts without + // AB: If this context is a system generated context as in NEW/OLD inside + // triggers, the qualifier by the field is mandatory. While we can't + // fall back from a higher scope-level to the NEW/OLD contexts without // the qualifier present. // An exception is a check-constraint that is allowed to reference fields // without the qualifier. @@ -10712,7 +10712,7 @@ dsql_nod* CompiledStatement::findCTE(const dsql_str* name) dsql_nod* cte = req_ctes[i]; const dsql_str* cte_name = (dsql_str*) cte->nod_arg[e_derived_table_alias]; - if (name->str_length == cte_name->str_length && + if (name->str_length == cte_name->str_length && strncmp(name->str_data, cte_name->str_data, cte_name->str_length) == 0) { return cte; @@ -10782,9 +10782,9 @@ static void trace_line(const char* message, ...) { } /** - + DSQL_pretty - + @brief Pretty print a node tree. @@ -11035,7 +11035,7 @@ void DSQL_pretty(const dsql_nod* node, int column) case nod_exec_procedure: verb = "execute procedure"; break; - case nod_exec_block: + case nod_exec_block: verb = "execute block"; break; case nod_exists: @@ -11295,7 +11295,7 @@ void DSQL_pretty(const dsql_nod* node, int column) case nod_join_inner: verb = "join_inner"; break; - // SKIDDER: some more missing node types + // SKIDDER: some more missing node types case nod_commit: verb = "commit"; break; @@ -11641,7 +11641,7 @@ void DSQL_pretty(const dsql_nod* node, int column) field->fld_name.c_str(), context->ctx_context); return; } - + case nod_field_name: trace_line("%sfield name: \"", buffer); string = (dsql_str*) node->nod_arg[e_fln_context]; @@ -11759,15 +11759,15 @@ void DSQL_pretty(const dsql_nod* node, int column) case nod_param_val: verb = "param_val"; // do we need more here? break; - + case nod_query_spec: verb = "query_spec"; break; - + case nod_comment: verb = "comment"; break; - + case nod_mod_udf: verb = "mod_udf"; break; @@ -11795,11 +11795,11 @@ void DSQL_pretty(const dsql_nod* node, int column) case nod_collation_specific_attr: verb = "collation_specific_attr"; break; - + case nod_returning: verb = "returning"; break; - + case nod_tra_misc: verb = "tra_misc"; break; @@ -11850,7 +11850,7 @@ void DSQL_pretty(const dsql_nod* node, int column) if (node->nod_count == 2) DSQL_pretty(*ptr, column + 1); return; - + case nod_mod_role: verb = "mod_role"; break; diff --git a/src/dsql/preparse.cpp b/src/dsql/preparse.cpp index 6eb1fdbb4e..3eb45bfeb9 100644 --- a/src/dsql/preparse.cpp +++ b/src/dsql/preparse.cpp @@ -1,7 +1,7 @@ /* * PROGRAM: Dynamic SQL runtime support * MODULE: preparse.cpp - * DESCRIPTION: Dynamic SQL pre parser / parser on client side. + * DESCRIPTION: Dynamic SQL pre parser / parser on client side. * This module will probably change to a YACC parser. * * The contents of this file are subject to the Interbase Public @@ -79,7 +79,7 @@ static const pp_table pp_symbols[] = { {"", 0, 0} }; -// define the tokens +// define the tokens enum token_vals { NO_MORE_TOKENS = -1, @@ -95,9 +95,9 @@ using namespace Firebird; /** - + PREPARSE_execute - + @brief @param user_status @@ -135,7 +135,7 @@ bool PREPARSE_execute( if (get_token(user_status, SYMBOL, false, &stmt, stmt_end, token) || token.length() != pp_symbols[PP_CREATE].length || - token != pp_symbols[PP_CREATE].symbol) + token != pp_symbols[PP_CREATE].symbol) { return false; } @@ -144,7 +144,7 @@ bool PREPARSE_execute( (token.length() != pp_symbols[PP_DATABASE].length && token.length() != pp_symbols[PP_SCHEMA].length) || (token != pp_symbols[PP_DATABASE].symbol && - token != pp_symbols[PP_SCHEMA].symbol)) + token != pp_symbols[PP_SCHEMA].symbol)) { return false; } @@ -175,7 +175,7 @@ bool PREPARSE_execute( matched = false; for (int i = 3; pp_symbols[i].length && !matched; i++) { if (token.length() == pp_symbols[i].length && - token == pp_symbols[i].symbol) + token == pp_symbols[i].symbol) { bool get_out = false; // CVC: What's strange, this routine doesn't check token.length() @@ -232,7 +232,7 @@ bool PREPARSE_execute( break; case PP_LENGTH: - // Skip a token for value + // Skip a token for value if (get_token(user_status, '=', true, &stmt, stmt_end, token) || get_token(user_status, NUMERIC, false, &stmt, stmt_end, token)) @@ -258,10 +258,10 @@ bool PREPARSE_execute( } while (matched); -// This code is because 3.3 server does not recognize isc_dpb_overwrite. +// This code is because 3.3 server does not recognize isc_dpb_overwrite. FB_API_HANDLE temp_db_handle = 0; - if (!isc_attach_database(user_status, 0, file_name.c_str(), - &temp_db_handle, dpb.getBufferLength(), + if (!isc_attach_database(user_status, 0, file_name.c_str(), + &temp_db_handle, dpb.getBufferLength(), reinterpret_cast(dpb.getBuffer())) || user_status[1] != isc_io_error) { @@ -287,7 +287,7 @@ bool PREPARSE_execute( isc_create_database(user_status, 0, file_name.c_str(), (db_handle), dpb.getBufferLength(), - reinterpret_cast(dpb.getBuffer()), + reinterpret_cast(dpb.getBuffer()), 0); } catch (const Exception& ex) @@ -301,9 +301,9 @@ bool PREPARSE_execute( /** - + generate_error - + @brief @param user_status @@ -351,9 +351,9 @@ static void generate_error(ISC_STATUS* user_status, /** - + get_next_token - + @brief @param stmt @@ -426,7 +426,7 @@ static SSHORT get_next_token(const SCHAR** stmt, } *stmt = s; if (token.length() > MAX_TOKEN_SIZE) { - // '=' used as then there is no place for null termination + // '=' used as then there is no place for null termination token.erase(MAX_TOKEN_SIZE); return TOKEN_TOO_LONG; } @@ -448,7 +448,7 @@ static SSHORT get_next_token(const SCHAR** stmt, return NUMERIC; } -// Is is a symbol +// Is is a symbol if (char_class & CHR_LETTER) { token += UPPER(c); @@ -473,9 +473,9 @@ static SSHORT get_next_token(const SCHAR** stmt, /** - + get_token - + @brief @param status @@ -506,13 +506,13 @@ static SSHORT get_token(ISC_STATUS* status, case TOKEN_TOO_LONG: *stmt = temp_stmt; - // generate error here + // generate error here generate_error(status, token, result, 0); return FB_FAILURE; } -// Some token was found +// Some token was found if (result == token_type) { *stmt = temp_stmt; diff --git a/src/dsql/user_dsql.cpp b/src/dsql/user_dsql.cpp index aff6b02647..17c53951e0 100644 --- a/src/dsql/user_dsql.cpp +++ b/src/dsql/user_dsql.cpp @@ -57,7 +57,7 @@ enum name_type { NAME_cursor = 2 }; -/* declare a structure which enables us to associate a cursor with a +/* declare a structure which enables us to associate a cursor with a statement and vice versa */ struct dsql_dbb @@ -70,14 +70,14 @@ struct dsql_name; // fwd. decl. struct dsql_stmt { - dsql_stmt* stmt_next; // next in chain + dsql_stmt* stmt_next; // next in chain dsql_name* stmt_stmt; // symbol table entry for statement name dsql_name* stmt_cursor; // symbol table entry for cursor name - FB_API_HANDLE stmt_handle; // stmt handle returned by dsql_xxx - FB_API_HANDLE stmt_db_handle; // database handle for this statement + FB_API_HANDLE stmt_handle; // stmt handle returned by dsql_xxx + FB_API_HANDLE stmt_db_handle; // database handle for this statement }; -// declare a structure to hold the cursor and statement names +// declare a structure to hold the cursor and statement names struct dsql_name { @@ -109,9 +109,9 @@ static USHORT name_length(const SCHAR*); static void remove_name(dsql_name*, dsql_name**); static bool scompare(const SCHAR*, USHORT, const SCHAR*, USHORT); -// declare the private data +// declare the private data -static bool init_flag = false; // whether we've been initialized +static bool init_flag = false; // whether we've been initialized static dsql_err_stblock* UDSQL_error = NULL; static dsql_stmt* statements = NULL; static dsql_name* statement_names = NULL; @@ -530,7 +530,7 @@ ISC_STATUS API_ROUTINE isc_embed_dsql_insert(ISC_STATUS* user_status, INIT_DSQL(user_status, local_status); try { - // get the symbol table entry + // get the symbol table entry dsql_stmt* statement = lookup_stmt(cursor_name, cursor_names, NAME_cursor); @@ -612,7 +612,7 @@ ISC_STATUS API_ROUTINE isc_embed_dsql_open2(ISC_STATUS* user_status, INIT_DSQL(user_status, local_status); try { - // get the symbol table entry + // get the symbol table entry dsql_stmt* statement = lookup_stmt(cursor_name, cursor_names, NAME_cursor); @@ -692,7 +692,7 @@ ISC_STATUS API_ROUTINE isc_embed_dsql_prepare(ISC_STATUS* user_status, length, string, dialect, sqlda); if (s) { - // An error occurred. Free any newly allocated statement handle. + // An error occurred. Free any newly allocated statement handle. if (!statement) { ISC_STATUS_ARRAY local_status2; @@ -711,13 +711,13 @@ ISC_STATUS API_ROUTINE isc_embed_dsql_prepare(ISC_STATUS* user_status, if (!statement) { statement = (dsql_stmt*) gds__alloc((SLONG) sizeof(dsql_stmt)); - // FREE: by user calling isc_embed_dsql_release() - if (!statement) // NOMEM: + // FREE: by user calling isc_embed_dsql_release() + if (!statement) // NOMEM: error_post(Arg::Gds(isc_virmemexh)); #ifdef DEBUG_GDS_ALLOC gds_alloc_flag_unfreed((void *) statement); -#endif // DEBUG_GDS_ALLOC +#endif // DEBUG_GDS_ALLOC statement->stmt_next = statements; statements = statement; @@ -762,7 +762,7 @@ ISC_STATUS API_ROUTINE isc_embed_dsql_release(ISC_STATUS* user_status, INIT_DSQL(user_status, local_status); try { - // If a request already exists under that name, purge it out + // If a request already exists under that name, purge it out dsql_stmt* statement = lookup_stmt(stmt_name, statement_names, NAME_statement); @@ -852,10 +852,10 @@ ISC_STATUS API_ROUTINE isc_dsql_fetch2_a(ISC_STATUS* user_status, *sqlcode = 0; const ISC_STATUS s = - isc_dsql_fetch2(user_status, - reinterpret_cast(stmt_handle), - dialect, - reinterpret_cast(sqlda), + isc_dsql_fetch2(user_status, + reinterpret_cast(stmt_handle), + dialect, + reinterpret_cast(sqlda), direction, offset); if (s == 100) @@ -1344,8 +1344,8 @@ static dsql_name* insert_name(const TEXT* symbol_name, dsql_name** list_ptr, dsq **************************************/ const USHORT l = name_length(symbol_name); dsql_name* name = (dsql_name*) gds__alloc((SLONG) sizeof(dsql_name) + l); -// FREE: by exit handler cleanup() or database_cleanup() - if (!name) // NOMEM: +// FREE: by exit handler cleanup() or database_cleanup() + if (!name) // NOMEM: error_post(Arg::Gds(isc_virmemexh)); name->name_stmt = stmt; name->name_length = l; diff --git a/src/dudley/ddl.cpp b/src/dudley/ddl.cpp index 752f1e268a..c747876b75 100644 --- a/src/dudley/ddl.cpp +++ b/src/dudley/ddl.cpp @@ -332,7 +332,7 @@ int CLIB_ROUTINE main( int argc, char* argv[]) } FILE* input_file; - + if (dudleyGlob.DDL_extract) { strcpy(dudleyGlob.DB_file_string, file_name_1); strcpy(dudleyGlob.DDL_file_string, file_name_2); @@ -355,8 +355,8 @@ int CLIB_ROUTINE main( int argc, char* argv[]) dudleyGlob.DDL_interactive = dudleyGlob.DDL_service || isatty(0); } else { - /* - * try to open the input DDL file. + /* + * try to open the input DDL file. * If it already has a .GDL extension, just try to open it. * Otherwise, add the extension, try, remove the extension, * and try again. @@ -696,7 +696,7 @@ bool DDL_yes_no( USHORT number) * **************************************/ TEXT prompt[128], reprompt[128], yes_ans[128], no_ans[128]; - + static const SafeArg dummy; fb_msg_format(0, DDL_MSG_FAC, number, sizeof(prompt), prompt, dummy); diff --git a/src/dudley/expand.cpp b/src/dudley/expand.cpp index 6f3034f650..462d535844 100644 --- a/src/dudley/expand.cpp +++ b/src/dudley/expand.cpp @@ -69,7 +69,7 @@ void EXP_actions(void) * Expand the output of the parser. * Look for field references and put * them in appropriate context. - * + * **************************************/ ACT action; @@ -398,11 +398,11 @@ static DUDLEY_FLD field_context( DUDLEY_NOD node, dudley_lls* contexts, DUDLEY_C * * Functional description * Lookup a field reference, guessing the - * context. Since by now all field references + * context. Since by now all field references * ought to be entered in the hash table, this is * pretty easy. We may be looking up a global * field reference, in which case the context - * relation will be null. + * relation will be null. * * **************************************/ @@ -468,7 +468,7 @@ static DUDLEY_FLD field_search( DUDLEY_NOD node, dudley_lls* contexts, DUDLEY_CT * iteratively. The context indicated is * the current context. Get to there, then * work backward. - * + * **************************************/ DUDLEY_FLD field; DUDLEY_CTX context, old_context; @@ -562,7 +562,7 @@ static DUDLEY_FLD lookup_field( DUDLEY_FLD old_field) * Lookup a field reference, from a modify or * delete field statement, and make sure we * found the thing originally. - * context. Since by now all field references + * context. Since by now all field references * ought to be entered in the hash table, this is * pretty easy. * @@ -650,7 +650,7 @@ static DUDLEY_TRG lookup_trigger( DUDLEY_TRG trigger) { /************************************** * - * l o o k u p _ t r i g g e r + * l o o k u p _ t r i g g e r * ************************************** * @@ -886,7 +886,7 @@ static void resolve_rse( DUDLEY_NOD rse, dudley_lls** stack) ************************************** * * Functional description - * Resolve record selection expression, augmenting + * Resolve record selection expression, augmenting * context stack. At the same time, put a context * node in front of every context and build a list * out of the whole thing; diff --git a/src/dudley/generate.cpp b/src/dudley/generate.cpp index 50925ed714..93c7cec062 100644 --- a/src/dudley/generate.cpp +++ b/src/dudley/generate.cpp @@ -36,7 +36,7 @@ static void get_set_generator(STR, DUDLEY_NOD); static inline void check_blr(str* blr, const int l) { - if (!(blr->str_current - blr->str_start + l <= blr->str_length) + if (!(blr->str_current - blr->str_start + l <= blr->str_length) && !TRN_get_buffer(blr, l) ) { DDL_err(289); @@ -538,7 +538,7 @@ static void generate( STR blr, DUDLEY_NOD node) operatr = blr_matching2; break; // case nod_substr: -// operatr = blr_substring; +// operatr = blr_substring; // break; default: diff --git a/src/dudley/hsh.cpp b/src/dudley/hsh.cpp index ee33de397f..4ca699c523 100644 --- a/src/dudley/hsh.cpp +++ b/src/dudley/hsh.cpp @@ -173,7 +173,7 @@ struct word { // {KW_RAW, "RAW"}, // {KW_RAW_PARTITIONS, "RAW_PARTITIONS"}, {KW_REFERENCE, "REFERENCE"}, - {KW_RELATION, "RELATION"}, + {KW_RELATION, "RELATION"}, {KW_RETURN_ARGUMENT, "RETURN_ARGUMENT"}, /* function argument return_mode */ {KW_RETURN_VALUE, "RETURN_VALUE"}, /* function argument return_mode */ {KW_REVOKE, "REVOKE"}, @@ -250,8 +250,8 @@ struct word { {KW_MAX, "MAX"}, {KW_TO, "TO"}, {KW_TOTAL, "TOTAL"}, - {KW_UNIQUE, "UNIQUE"}, - {KW_UPPERCASE, "UPPERCASE"}, + {KW_UNIQUE, "UNIQUE"}, + {KW_UPPERCASE, "UPPERCASE"}, {KW_WITH, "WITH"} }; @@ -344,7 +344,7 @@ void HSH_remove( SYM symbol) { /************************************** * - * H S H _ r e m o v e + * H S H _ r e m o v e * ************************************** * diff --git a/src/dudley/parse.cpp b/src/dudley/parse.cpp index 7df2c4df00..9d83d29951 100644 --- a/src/dudley/parse.cpp +++ b/src/dudley/parse.cpp @@ -242,7 +242,7 @@ FUNC PARSE_function(int existingFunction) * * Functional description * Get the function block associated with the current token. Also - * advance the token. Create a new function requested. + * advance the token. Create a new function requested. * **************************************/ if (dudleyGlob.DDL_token.tok_type != tok_ident) @@ -253,7 +253,7 @@ FUNC PARSE_function(int existingFunction) FUNC function; if (symbol && (function = (FUNC) symbol->sym_object) && - function->func_database == dudleyGlob.database) + function->func_database == dudleyGlob.database) { LEX_token(); return function; @@ -324,7 +324,7 @@ DUDLEY_NOD PARSE_make_list(dudley_lls* stack) while (stack) node->nod_arg[--count] = LLS_POP(&stack); - + return node; } @@ -369,7 +369,7 @@ bool PARSE_match( enum kwwords keyword) for (SYM symbol = dudleyGlob.DDL_token.tok_symbol; symbol; symbol = symbol->sym_homonym) if (symbol->sym_type == SYM_keyword && - symbol->sym_keyword == (int) keyword) + symbol->sym_keyword == (int) keyword) { LEX_token(); return true; @@ -560,7 +560,7 @@ static SYM copy_symbol( SYM old_name) * does the implicit invocation of same-named * global fields. * - * We'll just leave the type blank for now. + * We'll just leave the type blank for now. * **************************************/ SYM new_name = (SYM) DDL_alloc(SYM_LEN + old_name->sym_length); @@ -674,7 +674,7 @@ static void define_database( enum act_t action_type) **************************************/ if (dudleyGlob.database) DDL_error_abort(0, 120); - // msg 120: GDEF processes only one database at a time + // msg 120: GDEF processes only one database at a time dudleyGlob.database = (DBB) DDL_alloc(sizeof(dbb)); dudleyGlob.database->dbb_name = PARSE_symbol(tok_quoted); @@ -740,7 +740,7 @@ static void define_database( enum act_t action_type) */ else PARSE_error(121, 0, 0); - // msg 121 only SECURITY_CLASS, DESCRIPTION and CACHE can be dropped + // msg 121 only SECURITY_CLASS, DESCRIPTION and CACHE can be dropped } else if (PARSE_match(KW_FILE)) { FIL file = define_file(); @@ -1113,7 +1113,7 @@ static FIL define_log_file( USHORT log_type) else if (PARSE_match(KW_RAW_PARTITIONS)) { if (log_type != DBB_log_preallocated) PARSE_error(332, 0, 0); - // msg 332: Partitions not supported in series of log file specification + // msg 332: Partitions not supported in series of log file specification PARSE_match(KW_EQUALS); file->fil_partitions = PARSE_number(); file->fil_raw = LOG_raw; @@ -1204,7 +1204,7 @@ static void define_relation(void) || EXE_relation(relation))) { PARSE_error(137, relation->rel_name->sym_string, 0); - // msg 137: relation %s already exists + // msg 137: relation %s already exists } if (PARSE_match(KW_EXTERNAL_FILE)) { @@ -1334,7 +1334,7 @@ static void define_shadow(void) * * Functional description * Define a shadow file to the database. - * Parse it as a set of normal file additions, + * Parse it as a set of normal file additions, * setting the shadow number on all files. * **************************************/ @@ -1351,7 +1351,7 @@ static void define_shadow(void) PARSE_error(139, 0, 0); /* msg 139: shadow number must be a positive integer */ } -/* match the keywords MANUAL or AUTO to imply whether the shadow +/* match the keywords MANUAL or AUTO to imply whether the shadow should be automatically deleted when something goes awry */ if (PARSE_match(KW_MANUAL)) @@ -1365,7 +1365,7 @@ static void define_shadow(void) shadow->fil_name = PARSE_symbol(tok_quoted); if (!check_filename(shadow->fil_name, false)) PARSE_error(297, 0, 0); - // msg 297: A node name is not permitted in a shadow or secondary file name + // msg 297: A node name is not permitted in a shadow or secondary file name if (PARSE_match(KW_LENGTH)) { shadow->fil_length = PARSE_number(); @@ -1424,7 +1424,7 @@ static void define_trigger(void) trigger->trg_sequence = trg_sequence; if (!(int) trigger->trg_type) /* still none */ - PARSE_error(141, dudleyGlob.DDL_token.tok_string, 0); + PARSE_error(141, dudleyGlob.DDL_token.tok_string, 0); /* msg 141: expected STORE, MODIFY, ERASE, encountered \"%s\" */ bool action = false; @@ -1530,7 +1530,7 @@ static void define_view(void) || EXE_relation(relation))) { PARSE_error(300, relation->rel_name->sym_string, 0); - // msg 300: relation %s already exists + // msg 300: relation %s already exists } PARSE_match(KW_OF); @@ -1895,7 +1895,7 @@ static void end_text( TXT text) dudleyGlob.DDL_token.tok_position - dudleyGlob.DDL_token.tok_length - text->txt_position; #if (defined WIN_NT) -/* the length of the text field should subtract out the +/* the length of the text field should subtract out the line feeds, since they are automatically filtered out when reading from a file */ @@ -1913,7 +1913,7 @@ static SYM gen_trigger_name( TRG_T type, DUDLEY_REL relation) ************************************** * * Functional description - * Generate a trigger name for an old style trigger. + * Generate a trigger name for an old style trigger. * **************************************/ SYM symbol = (SYM) DDL_alloc(SYM_LEN + GDS_NAME_LEN); @@ -1992,7 +1992,7 @@ static void get_trigger_attributes( int *flags, int *type, int *sequence) * PRE and POST are optional in new style definitions. * For STORE & MODIFY PRE is the default. * For ERASE, POST is the default. - * + * **************************************/ if (PARSE_match(KW_INACTIVE)) { @@ -2098,9 +2098,9 @@ static void grant_user_privilege(void) PARSE_error(313, dudleyGlob.DDL_token.tok_string, 0); /* msg 313: expected ON or '(', encountered "%s" */ do { - if (dudleyGlob.DDL_token.tok_keyword == KW_SELECT - || dudleyGlob.DDL_token.tok_keyword == KW_INSERT - || dudleyGlob.DDL_token.tok_keyword == KW_DELETE + if (dudleyGlob.DDL_token.tok_keyword == KW_SELECT + || dudleyGlob.DDL_token.tok_keyword == KW_INSERT + || dudleyGlob.DDL_token.tok_keyword == KW_DELETE || dudleyGlob.DDL_token.tok_keyword == KW_UPDATE) { break; @@ -2188,7 +2188,7 @@ static DUDLEY_CTX lookup_context( SYM symbol, dudley_lls* contexts) for (; contexts; contexts = contexts->lls_next) { DUDLEY_CTX context = (DUDLEY_CTX) contexts->lls_object; SYM name = context->ctx_name; - if (name && !strcmp(name->sym_string, symbol->sym_string)) + if (name && !strcmp(name->sym_string, symbol->sym_string)) return context; } @@ -2713,7 +2713,7 @@ static void modify_trigger(void) while (!(dudleyGlob.DDL_token.tok_keyword == KW_SEMI)) { if ((PARSE_match(KW_MESSAGE)) || (PARSE_match(KW_MSGADD)) || - (PARSE_match(KW_MSGMODIFY))) + (PARSE_match(KW_MSGMODIFY))) { msg_type = trgmsg_modify; } @@ -3089,9 +3089,9 @@ static bool parse_action(void) static void parse_array( DUDLEY_FLD field) { -/************************************** +/************************************** * - * p a r s e _ a r r a y + * p a r s e _ a r r a y * ************************************** * @@ -3149,7 +3149,7 @@ static TXT parse_description(void) ************************************** * * Functional description - * Create a text block to hold the pointer and length + * Create a text block to hold the pointer and length * of the description of a metadata item. * **************************************/ @@ -3444,7 +3444,7 @@ static void parse_field_dtype( DUDLEY_FLD field) LEX_token(); if (field->fld_dtype == blr_text || - field->fld_dtype == blr_varying || field->fld_dtype == blr_cstring) + field->fld_dtype == blr_varying || field->fld_dtype == blr_cstring) { if (!PARSE_match(KW_L_BRCKET) && !PARSE_match(KW_LT)) PARSE_error(200, dudleyGlob.DDL_token.tok_string, 0); /* msg 200: expected \"[\", encountered \"%s\" */ @@ -3561,7 +3561,7 @@ static FUNCARG parse_function_arg( FUNC function, USHORT * position) PARSE_error(204, 0, 0); /* msg 204: argument mode is by value, or by reference */ } -/* (kw_comma or kw_semi) here means this argument is not a +/* (kw_comma or kw_semi) here means this argument is not a return_value or a return_argument in which case it had better not be passed by value */ @@ -3786,7 +3786,7 @@ static int parse_page_size(void) * Functional description * parse the page_size clause of a * define database statement - * + * * **************************************/ PARSE_match(KW_EQUALS); @@ -3971,8 +3971,8 @@ static SLONG score_entry( SCE element) ************************************** * * Functional description - * Compute a value to determine placement of an - * access control element in an Apollo access + * Compute a value to determine placement of an + * access control element in an Apollo access * control list. * **************************************/ @@ -3982,7 +3982,7 @@ static SLONG score_entry( SCE element) const TEXT* const* ptr = (TEXT**) element->sce_idents; for (const TEXT* const* const end = ptr + id_max; ptr < end; - ptr++) + ptr++) { score <<= 1; if (*ptr) diff --git a/src/dudley/trn.cpp b/src/dudley/trn.cpp index f03fa805c1..13245feb71 100644 --- a/src/dudley/trn.cpp +++ b/src/dudley/trn.cpp @@ -354,7 +354,7 @@ static void add_dimensions( STR dyn, DUDLEY_FLD field) ************************************** * * Functional description - * Generate dynamic DDL to create dimensions. + * Generate dynamic DDL to create dimensions. * First get rid of any old ones. * **************************************/ @@ -385,7 +385,7 @@ static void add_field( STR dyn, DUDLEY_FLD field, DUDLEY_REL view) ************************************** * * Functional description - * Generate dynamic DDL to create a + * Generate dynamic DDL to create a * local field. * **************************************/ @@ -499,7 +499,7 @@ static void add_filter( STR dyn, FILTER filter) ************************************** * * Functional description - * Generate dynamic DDL to create a + * Generate dynamic DDL to create a * blob filter. * **************************************/ @@ -526,7 +526,7 @@ static void add_function( STR dyn, FUNC function) ************************************** * * Functional description - * Generate dynamic DDL to create a + * Generate dynamic DDL to create a * user define function. * **************************************/ @@ -551,7 +551,7 @@ static void add_function_arg( STR dyn, FUNCARG func_arg) ************************************** * * Functional description - * Generate dynamic DDL to create a + * Generate dynamic DDL to create a * user defined function. * **************************************/ @@ -578,7 +578,7 @@ static void add_generator( STR dyn, SYM symbol) ************************************** * * Functional description - * Generate dynamic DDL to create a + * Generate dynamic DDL to create a * generator. * **************************************/ @@ -867,7 +867,7 @@ static void drop_field( STR dyn, DUDLEY_FLD field) ************************************** * * Functional description - * Generate dynamic DDL to eliminate + * Generate dynamic DDL to eliminate * a local field. * **************************************/ @@ -893,7 +893,7 @@ static void drop_filter( STR dyn, FILTER filter) ************************************** * * Functional description - * Generate dynamic DDL to delete a + * Generate dynamic DDL to delete a * blob filter. * **************************************/ @@ -913,7 +913,7 @@ static void drop_function( STR dyn, FUNC function) ************************************** * * Functional description - * Generate dynamic DDL to delete a + * Generate dynamic DDL to delete a * user defined function. * **************************************/ @@ -933,7 +933,7 @@ static void drop_global_field( STR dyn, DUDLEY_FLD field) ************************************** * * Functional description - * Generate dynamic DDL to eliminate + * Generate dynamic DDL to eliminate * a global field. * **************************************/ @@ -969,7 +969,7 @@ static void drop_relation( STR dyn, DUDLEY_REL relation) { /************************************** * - * d r o p _ r e l a t i o n + * d r o p _ r e l a t i o n * ************************************** * @@ -1188,7 +1188,7 @@ static void modify_field( STR dyn, DUDLEY_FLD field, DUDLEY_REL view) ************************************** * * Functional description - * Generate dynamic DDL to modify a + * Generate dynamic DDL to modify a * local field. * **************************************/ @@ -1293,7 +1293,7 @@ static void modify_global_field( STR dyn, DUDLEY_FLD field) } else put_symbol(dyn, isc_dyn_fld_query_name, field->fld_query_name); - + if (field->fld_flags & fld_null_query_header) { check_dyn(dyn, 3); dyn->add_byte(isc_dyn_fld_query_header); diff --git a/src/extlib/fbudf/fbudf.cpp b/src/extlib/fbudf/fbudf.cpp index 5538074c07..5d308321e6 100644 --- a/src/extlib/fbudf/fbudf.cpp +++ b/src/extlib/fbudf/fbudf.cpp @@ -64,7 +64,7 @@ be easy to add needed headers to stdafx.h after a makefile is built. #if defined (_WIN32) /* BOOL APIENTRY DllMain( HANDLE ,//hModule, - DWORD ul_reason_for_call, + DWORD ul_reason_for_call, LPVOID //lpReserved ) { @@ -114,7 +114,7 @@ namespace internal }; /* - inline fb_len get_varchar_len(const char* vchar) + inline fb_len get_varchar_len(const char* vchar) { return reinterpret_cast(vchar)->vary_length; } @@ -129,7 +129,7 @@ namespace internal { reinterpret_cast(vchar)->vary_length = len; } - + inline void set_varchar_len(ISC_UCHAR* vchar, const fb_len len) { reinterpret_cast(vchar)->vary_length = len; @@ -739,7 +739,7 @@ FBUDF_API void fbround(const paramdsc* v, paramdsc* rc) rc->dsc_scale = 0; return; } - + // round(0.3) => 0 ### round(0.5) => 1 // round(-0.3) => 0 ### round(-0.5) => 0 // round(-0.3) => 0 ### round(-0.5) => -1 ### SYMMETRIC_MATH defined. diff --git a/src/extlib/ib_udf.cpp b/src/extlib/ib_udf.cpp index 7303e98eb9..074418939b 100644 --- a/src/extlib/ib_udf.cpp +++ b/src/extlib/ib_udf.cpp @@ -15,11 +15,11 @@ * * All Rights Reserved. * Contributor(s): ______________________________________. - * Changes made by Claudio Valderrama for the Firebird project - * changes to substr and added substrlen + * Changes made by Claudio Valderrama for the Firebird project + * changes to substr and added substrlen * 2004.9.1 Claudio Valderrama, change some UDF's to be able to detect NULL. * 2004.12.5 Slavomir Skopalik contributed IB_UDF_frac. - * + * */ #include "firebird.h" @@ -145,8 +145,8 @@ double EXPORT IB_UDF_div( ISC_LONG *a, ISC_LONG *b) } else { - // This is a Kludge! We need to return INF, - // but this seems to be the only way to do + // This is a Kludge! We need to return INF, + // but this seems to be the only way to do // it since there seens to be no constant for it. #ifdef HAVE_INFINITY return INFINITY; @@ -189,7 +189,7 @@ char *EXPORT IB_UDF_lower(const char *s) { if (!s) return 0; - + char* buf = (char *) ib_util_malloc(strlen(s) + 1); char* p = buf; while (*s) @@ -211,7 +211,7 @@ char *EXPORT IB_UDF_lpad( const char *s, ISC_LONG *a, const char *c) return 0; const long avalue = *a; - + if (avalue >= 0) { long current = 0; const long length = strlen(s); @@ -242,10 +242,10 @@ char *EXPORT IB_UDF_ltrim( const char *s) { if (!s) return 0; - + while (*s == ' ') /* skip leading blanks */ s++; - + const long length = strlen(s); char* buf = (char *) ib_util_malloc(length + 1); memcpy(buf, s, length); @@ -265,8 +265,8 @@ double EXPORT IB_UDF_mod( ISC_LONG *a, ISC_LONG *b) } else { - // This is a Kludge! We need to return INF, - // but this seems to be the only way to do + // This is a Kludge! We need to return INF, + // but this seems to be the only way to do // it since there seens to be no constant for it. #ifdef HAVE_INFINITY return INFINITY; @@ -296,7 +296,7 @@ char *EXPORT IB_UDF_rpad( const char *s, ISC_LONG *a, const char *c) { if (!s || !c) return 0; - + const long avalue = *a; if (avalue >= 0) { @@ -328,10 +328,10 @@ char *EXPORT IB_UDF_rtrim( const char *s) { if (!s) return 0; - + const char* p = s + strlen(s); while (--p >= s && *p == ' '); // empty loop body - + const long length = p - s + 1; char* buf = (char *) ib_util_malloc(length + 1); memcpy(buf, s, length); diff --git a/src/gpre/ada.cpp b/src/gpre/ada.cpp index edb34f3472..a71631ce1d 100644 --- a/src/gpre/ada.cpp +++ b/src/gpre/ada.cpp @@ -1,26 +1,26 @@ //____________________________________________________________ -// +// // PROGRAM: ADA preprocesser // MODULE: ada.cpp // DESCRIPTION: Inserted text generator for ADA -// +// // The contents of this file are subject to the Interbase Public // License Version 1.0 (the "License"); you may not use this file // except in compliance with the License. You may obtain a copy // of the License at http://www.Inprise.com/IPL.html -// +// // Software distributed under the License is distributed on an // "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express // or implied. See the License for the specific language governing // rights and limitations under the License. -// +// // The Original Code was created by Inprise Corporation // and its predecessors. Portions created by Inprise Corporation are // Copyright (C) Inprise Corporation. -// +// // All Rights Reserved. // Contributor(s): ______________________________________. -// +// // //____________________________________________________________ // @@ -165,10 +165,10 @@ static inline void set_sqlcode(const act* action, const int column) } //____________________________________________________________ -// +// // Code generator for ADA. Not to be confused with -// -// +// +// void ADA_action( const act* action, int column) { @@ -420,7 +420,7 @@ void ADA_action( const act* action, int column) return; } -// Put in a trailing brace for those actions still with us +// Put in a trailing brace for those actions still with us if (action->act_flags & ACT_sql) gen_whenever(action->act_whenever, column); @@ -428,10 +428,10 @@ void ADA_action( const act* action, int column) //____________________________________________________________ -// +// // Print a statment, breaking it into // reasonable 120 character hunks. -// +// void ADA_print_buffer( TEXT* output_bufferL, const int column) { @@ -474,9 +474,9 @@ void ADA_print_buffer( TEXT* output_bufferL, const int column) //____________________________________________________________ -// +// // Align output to a specific column for output. -// +// static void align( int column) { @@ -495,10 +495,10 @@ static void align( int column) //____________________________________________________________ -// +// // Build an assignment from a host language variable to // a port variable. -// +// static void asgn_from( const act* action, REF reference, int column) { @@ -536,10 +536,10 @@ static void asgn_from( const act* action, REF reference, int column) } //____________________________________________________________ -// +// // Build an assignment to a host language variable from // a port variable. -// +// static void asgn_to( const act* action, REF reference, int column) { @@ -551,7 +551,7 @@ static void asgn_to( const act* action, REF reference, int column) gen_get_or_put_slice(action, source, true, column); return; } -// +// //if (field && (field->fld_flags & FLD_text)) // printa (column, "firebird.isc_ftof (%s, %d, %s, sizeof (%s));", // gen_name (s, source, true), @@ -559,12 +559,12 @@ static void asgn_to( const act* action, REF reference, int column) // reference->ref_value, // reference->ref_value); //else -// +// TEXT s[MAX_REF_SIZE]; printa(column, "%s := %s;", reference->ref_value, gen_name(s, source, true)); -// Pick up NULL value if one is there +// Pick up NULL value if one is there if (reference = reference->ref_null) printa(column, "%s := %s;", reference->ref_value, gen_name(s, reference, true)); @@ -572,10 +572,10 @@ static void asgn_to( const act* action, REF reference, int column) //____________________________________________________________ -// +// // Build an assignment to a host language variable from // a port variable. -// +// static void asgn_to_proc( REF reference, int column) { @@ -591,10 +591,10 @@ static void asgn_to_proc( REF reference, int column) //____________________________________________________________ -// +// // Generate a function call for free standing ANY. Somebody else // will need to generate the actual function. -// +// static void gen_any( const act* action, int column) { @@ -618,9 +618,9 @@ static void gen_any( const act* action, int column) //____________________________________________________________ -// +// // Generate code for AT END clause of FETCH. -// +// static void gen_at_end( const act* action, int column) { @@ -632,9 +632,9 @@ static void gen_at_end( const act* action, int column) //____________________________________________________________ -// +// // Substitute for a BASED ON clause. -// +// static void gen_based( const act* action, int column) { @@ -651,10 +651,10 @@ static void gen_based( const act* action, int column) sprintf(s, "array ("); for (q = s; *q; q++); - // Print out the dimension part of the declaration + // Print out the dimension part of the declaration const dim* dimension = field->fld_array_info->ary_dimension; for (SSHORT i = 1; i < field->fld_array_info->ary_dimension_count; - dimension = dimension->dim_next, i++) + dimension = dimension->dim_next, i++) { sprintf(s2, "%s range %"SLONGFORMAT"..%"SLONGFORMAT ",\n ", @@ -715,7 +715,7 @@ static void gen_based( const act* action, int column) sprintf(s2, "datatype %d unknown\n", field->fld_dtype); return ; } - + for (p = s2; *p; p++, q++) *q = *p; if (!strcmp(based_on->bas_terminator, ";")) @@ -726,9 +726,9 @@ static void gen_based( const act* action, int column) //____________________________________________________________ -// +// // Make a blob FOR loop. -// +// static void gen_blob_close( const act* action, USHORT column) { @@ -756,9 +756,9 @@ static void gen_blob_close( const act* action, USHORT column) //____________________________________________________________ -// +// // End a blob FOR loop. -// +// static void gen_blob_end( const act* action, USHORT column) { @@ -775,9 +775,9 @@ static void gen_blob_end( const act* action, USHORT column) //____________________________________________________________ -// +// // Make a blob FOR loop. -// +// static void gen_blob_for( const act* action, USHORT column) { @@ -797,11 +797,11 @@ static void gen_blob_for( const act* action, USHORT column) // for unknown reasons it contains a core dump. The V3.3 version of // this function appears to work fine, so we are using it instead. // Ravi Kumar -// +// //____________________________________________________________ -// +// // Generate the call to open (or create) a blob. -// +// static gen_blob_open( const act* action, USHORT column) { @@ -858,11 +858,11 @@ static gen_blob_open( const act* action, USHORT column) // has a core drop. // Ravi Kumar // CVC: no surprise, since "reference" was left uninitialized in one execution path! -// +// //____________________________________________________________ -// +// // Generate the call to open (or create) a blob. -// +// static void gen_blob_open( const act* action, USHORT column) { @@ -890,9 +890,9 @@ static void gen_blob_open( const act* action, USHORT column) //____________________________________________________________ -// +// // Callback routine for BLR pretty printer. -// +// static void gen_blr(void* user_arg, SSHORT offset, const char* string) { @@ -917,9 +917,9 @@ static void gen_blr(void* user_arg, SSHORT offset, const char* string) //____________________________________________________________ -// +// // Zap all know handles. -// +// static void gen_clear_handles( const act* action, int column) { @@ -932,9 +932,9 @@ static void gen_clear_handles( const act* action, int column) #ifdef NOT_USED_OR_REPLACED //____________________________________________________________ -// +// // Generate a symbol to ease compatibility with V3. -// +// static void gen_compatibility_symbol( const TEXT* symbol, @@ -949,9 +949,9 @@ static void gen_compatibility_symbol( //____________________________________________________________ -// +// // Generate text to compile a request. -// +// static void gen_compile( const act* action, int column) { @@ -999,9 +999,9 @@ static void gen_compile( const act* action, int column) //____________________________________________________________ -// +// // Generate a call to create a database. -// +// static void gen_create_database( const act* action, int column) { @@ -1074,7 +1074,7 @@ static void gen_create_database( const act* action, int column) printa(column + (request->req_length ? 4 : 0), "firebird.FREE (%s);", s2); - // reset the length of the dpb + // reset the length of the dpb if (request->req_length) printa(column, "%s = %d;", s1, request->req_length); } @@ -1095,9 +1095,9 @@ static void gen_create_database( const act* action, int column) //____________________________________________________________ -// +// // Generate substitution text for END_STREAM. -// +// static int gen_cursor_close( const act* action, gpre_req* request, int column) { @@ -1107,29 +1107,29 @@ static int gen_cursor_close( const act* action, gpre_req* request, int column) //____________________________________________________________ -// +// // Generate text to initialize a cursor. -// +// static void gen_cursor_init( const act* action, int column) { // If blobs are present, zero out all of the blob handles. After this -//int, the handles are the user's responsibility +//int, the handles are the user's responsibility if (action->act_request-> req_flags & (REQ_sql_blob_open | REQ_sql_blob_create)) { - printa(column, "gds_%d := 0;", + printa(column, "gds_%d := 0;", action->act_request->req_blobs->blb_ident); } } #ifdef NOT_USED_OR_REPLACED //____________________________________________________________ -// +// // Generate text to open an embedded SQL cursor. -// +// static int gen_cursor_open( const act* action, gpre_req* request, int column) { @@ -1139,11 +1139,11 @@ static int gen_cursor_open( const act* action, gpre_req* request, int column) #endif //____________________________________________________________ -// +// // Generate insertion text for the database statement, // including the definitions of all gpreGlob.requests, and blob // and port declarations for gpreGlob.requests in the main routine. -// +// static void gen_database( const act* action, int column) { @@ -1197,7 +1197,7 @@ static void gen_database( const act* action, int column) } } -// generate event parameter block for each event in module +// generate event parameter block for each event in module USHORT max_count = 0; for (gpre_lls* stack_ptr = gpreGlob.events; stack_ptr; stack_ptr = stack_ptr->lls_next) { @@ -1213,7 +1213,7 @@ static void gen_database( const act* action, int column) for (request = gpreGlob.requests; request; request = request->req_next) { gen_request(request, column); - // Array declarations + // Array declarations const gpre_port* port = request->req_primary; if (port) for (REF reference = port->por_references; reference; @@ -1271,17 +1271,17 @@ static void gen_database( const act* action, int column) //____________________________________________________________ -// +// // Generate a call to update metadata. -// +// static void gen_ddl( const act* action, int column) { -// Set up command type for call to RDB$DDL +// Set up command type for call to RDB$DDL const gpre_req* request = action->act_request; -// Generate a call to RDB$DDL to perform action +// Generate a call to RDB$DDL to perform action if (gpreGlob.sw_auto) { t_start_auto(action, 0, status_vector(action), column, true); @@ -1313,9 +1313,9 @@ static void gen_ddl( const act* action, int column) //____________________________________________________________ -// +// // Generate a call to create a database. -// +// static void gen_drop_database( const act* action, int column) { @@ -1331,9 +1331,9 @@ static void gen_drop_database( const act* action, int column) //____________________________________________________________ -// +// // Generate a dynamic SQL statement. -// +// static void gen_dyn_close( const act* action, int column) { @@ -1348,9 +1348,9 @@ static void gen_dyn_close( const act* action, int column) //____________________________________________________________ -// +// // Generate a dynamic SQL statement. -// +// static void gen_dyn_declare( const act* action, int column) { @@ -1367,9 +1367,9 @@ static void gen_dyn_declare( const act* action, int column) //____________________________________________________________ -// +// // Generate a dynamic SQL statement. -// +// static void gen_dyn_describe(const act* action, int column, @@ -1389,9 +1389,9 @@ static void gen_dyn_describe(const act* action, //____________________________________________________________ -// +// // Generate a dynamic SQL statement. -// +// static void gen_dyn_execute( const act* action, int column) { @@ -1449,9 +1449,9 @@ static void gen_dyn_execute( const act* action, int column) //____________________________________________________________ -// +// // Generate a dynamic SQL statement. -// +// static void gen_dyn_fetch( const act* action, int column) { @@ -1475,9 +1475,9 @@ static void gen_dyn_fetch( const act* action, int column) //____________________________________________________________ -// +// // Generate code for an EXECUTE IMMEDIATE dynamic SQL statement. -// +// static void gen_dyn_immediate( const act* action, int column) { @@ -1520,9 +1520,9 @@ static void gen_dyn_immediate( const act* action, int column) //____________________________________________________________ -// +// // Generate a dynamic SQL statement. -// +// static void gen_dyn_insert( const act* action, int column) { @@ -1544,9 +1544,9 @@ static void gen_dyn_insert( const act* action, int column) //____________________________________________________________ -// +// // Generate a dynamic SQL statement. -// +// static void gen_dyn_open( const act* action, int column) { @@ -1594,9 +1594,9 @@ static void gen_dyn_open( const act* action, int column) //____________________________________________________________ -// +// // Generate a dynamic SQL statement. -// +// static void gen_dyn_prepare( const act* action, int column) { @@ -1648,9 +1648,9 @@ static void gen_dyn_prepare( const act* action, int column) //____________________________________________________________ -// +// // Generate substitution text for END_MODIFY. -// +// static void gen_emodify( const act* action, int column) { @@ -1659,7 +1659,7 @@ static void gen_emodify( const act* action, int column) upd* modify = (upd*) action->act_object; for (REF reference = modify->upd_port->por_references; reference; - reference = reference->ref_next) + reference = reference->ref_next) { REF source = reference->ref_source; if (!source) @@ -1676,16 +1676,16 @@ static void gen_emodify( const act* action, int column) //____________________________________________________________ -// +// // Generate substitution text for END_STORE. -// +// static void gen_estore( const act* action, int column) { gpre_req* request = action->act_request; // if we did a store ... returning_values aka store2 -// just wrap up any dangling error handling +// just wrap up any dangling error handling if (request->req_type == REQ_store2) { if (action->act_error) endif(column); @@ -1699,9 +1699,9 @@ static void gen_estore( const act* action, int column) //____________________________________________________________ -// +// // Generate definitions associated with a single request. -// +// static void gen_endfor( const act* action, int column) { @@ -1718,9 +1718,9 @@ static void gen_endfor( const act* action, int column) //____________________________________________________________ -// +// // Generate substitution text for ERASE. -// +// static void gen_erase( const act* action, int column) { @@ -1730,12 +1730,12 @@ static void gen_erase( const act* action, int column) //____________________________________________________________ -// +// // Generate event parameter blocks for use // with a particular call to isc_event_wait. // For languages too dim to deal with variable // arg lists, set up a vector for the event names. -// +// static SSHORT gen_event_block( const act* action) { @@ -1764,9 +1764,9 @@ static SSHORT gen_event_block( const act* action) //____________________________________________________________ -// +// // Generate substitution text for EVENT_INIT. -// +// static void gen_event_init( const act* action, int column) { @@ -1789,7 +1789,7 @@ static void gen_event_init( const act* action, int column) args.pat_vector1 = status_vector(action); args.pat_value1 = (int) init->nod_arg[2]; -// generate call to dynamically generate event blocks +// generate call to dynamically generate event blocks TEXT variable[MAX_REF_SIZE]; USHORT count = 0; @@ -1813,11 +1813,11 @@ static void gen_event_init( const act* action, int column) (int) event_list->nod_count); PATTERN_expand(column, pattern1, &args); -// generate actual call to event_wait +// generate actual call to event_wait PATTERN_expand(column, pattern2, &args); -// get change in event counts, copying event parameter block for reuse +// get change in event counts, copying event parameter block for reuse PATTERN_expand(column, pattern3, &args); @@ -1827,9 +1827,9 @@ static void gen_event_init( const act* action, int column) //____________________________________________________________ -// +// // Generate substitution text for EVENT_WAIT. -// +// static void gen_event_wait( const act* action, int column) { @@ -1845,7 +1845,7 @@ static void gen_event_wait( const act* action, int column) gpre_sym* event_name = (gpre_sym*) action->act_object; // go through the stack of gpreGlob.events, checking to see if the -// event has been initialized and getting the event identifier +// event has been initialized and getting the event identifier int ident = -1; DBB database; @@ -1872,7 +1872,7 @@ static void gen_event_wait( const act* action, int column) args.pat_vector1 = status_vector(action); args.pat_value1 = ident; -// generate calls to wait on the event and to fill out the gpreGlob.events array +// generate calls to wait on the event and to fill out the gpreGlob.events array PATTERN_expand(column, pattern1, &args); PATTERN_expand(column, pattern2, &args); @@ -1884,11 +1884,11 @@ static void gen_event_wait( const act* action, int column) //____________________________________________________________ -// +// // Generate replacement text for the SQL FETCH statement. The // epilog FETCH statement is handled by GEN_S_FETCH (generate // stream fetch). -// +// static void gen_fetch( const act* action, int column) { @@ -1897,36 +1897,36 @@ static void gen_fetch( const act* action, int column) #ifdef SCROLLABLE_CURSORS gpre_port* port = request->req_aport; if (port) { - /* set up the reference to point to the correct value - in the linked list of values, and prepare for the + /* set up the reference to point to the correct value + in the linked list of values, and prepare for the next FETCH statement if applicable */ REF reference; for (reference = port->por_references; reference; - reference = reference->ref_next) + reference = reference->ref_next) { VAL value = reference->ref_values; reference->ref_value = value->val_value; reference->ref_values = value->val_next; } - // find the direction and offset parameters + // find the direction and offset parameters reference = port->por_references; const TEXT* offset = reference->ref_value; reference = reference->ref_next; const TEXT* direction = reference->ref_value; - /* the direction in which the engine will scroll is sticky, so check to see - the last direction passed to the engine; if the direction is the same and - the offset is 1, then there is no need to pass the message; this prevents + /* the direction in which the engine will scroll is sticky, so check to see + the last direction passed to the engine; if the direction is the same and + the offset is 1, then there is no need to pass the message; this prevents extra packets and allows for batch fetches in either direction */ printa(column, "if isc_%ddirection MOD 2 /= %s or %s /= 1 then", request->req_ident, direction, offset); column += INDENT; - /* assign the direction and offset parameters to the appropriate message, + /* assign the direction and offset parameters to the appropriate message, then send the message to the engine */ asgn_from(action, port->por_references, column); @@ -1986,16 +1986,16 @@ static void gen_fetch( const act* action, int column) //____________________________________________________________ -// +// // Generate substitution text for FINISH. -// +// static void gen_finish( const act* action, int column) { DBB db = NULL; if (gpreGlob.sw_auto || ((action->act_flags & ACT_sql) && - (action->act_type != ACT_disconnect))) + (action->act_type != ACT_disconnect))) { printa(column, "if %sgds_trans /= 0 then", gpreGlob.ada_package); printa(column + INDENT, "firebird.%s_TRANSACTION (%s %sgds_trans);", @@ -2004,7 +2004,7 @@ static void gen_finish( const act* action, int column) endif(column); } -// the user supplied one or more db_handles +// the user supplied one or more db_handles for (rdy* ready = (rdy*) action->act_object; ready; ready = ready->rdy_next) { db = ready->rdy_database; @@ -2017,7 +2017,7 @@ static void gen_finish( const act* action, int column) endif(column); } -// no hanbdles, so we finish all known databases +// no hanbdles, so we finish all known databases if (!db) { if (action->act_error || (action->act_flags & ACT_sql)) @@ -2061,9 +2061,9 @@ static void gen_finish( const act* action, int column) //____________________________________________________________ -// +// // Generate substitution text for FOR statement. -// +// static void gen_for( const act* action, int column) { @@ -2098,9 +2098,9 @@ static void gen_for( const act* action, int column) //____________________________________________________________ -// +// // Generate a function for free standing ANY or statistical. -// +// static void gen_function( const act* function, int column) { @@ -2130,7 +2130,7 @@ static void gen_function( const act* function, int column) if (port) { for (REF reference = port->por_references; reference; - reference = reference->ref_next) + reference = reference->ref_next) { const gpre_fld* field = reference->ref_field; const TEXT* dtype; @@ -2199,10 +2199,10 @@ static void gen_function( const act* function, int column) } //____________________________________________________________ -// +// // Generate a call to isc_get_slice // or isc_put_slice for an array. -// +// static void gen_get_or_put_slice(const act* action, REF reference, @@ -2218,28 +2218,28 @@ static void gen_get_or_put_slice(const act* action, return; PAT args; - args.pat_vector1 = status_vector(action); // status vector - args.pat_database = action->act_request->req_database; // database handle - args.pat_string1 = action->act_request->req_trans; // transaction handle + args.pat_vector1 = status_vector(action); // status vector + args.pat_database = action->act_request->req_database; // database handle + args.pat_string1 = action->act_request->req_trans; // transaction handle TEXT s1[MAX_REF_SIZE]; gen_name(s1, reference, true); // blob handle args.pat_string2 = s1; - args.pat_value1 = reference->ref_sdl_length; // slice descr. length + args.pat_value1 = reference->ref_sdl_length; // slice descr. length TEXT s2[25]; - sprintf(s2, "isc_%d", reference->ref_sdl_ident); // slice description + sprintf(s2, "isc_%d", reference->ref_sdl_ident); // slice description args.pat_string3 = s2; - args.pat_value2 = 0; // parameter length + args.pat_value2 = 0; // parameter length TEXT s3[25]; - sprintf(s3, "isc_null_vector_l"); // parameter block init + sprintf(s3, "isc_null_vector_l"); // parameter block init args.pat_string4 = s3; args.pat_long1 = reference->ref_field->fld_array_info->ary_size; - // slice size + // slice size TEXT s4[25]; if (action->act_flags & ACT_sql) { sprintf(s4, "%s'address", reference->ref_value); @@ -2249,9 +2249,9 @@ static void gen_get_or_put_slice(const act* action, reference->ref_field->fld_array_info->ary_ident); } - args.pat_string5 = s4; // array name + args.pat_string5 = s4; // array name - args.pat_string6 = "isc_array_length"; // return length + args.pat_string6 = "isc_array_length"; // return length if (get) PATTERN_expand(column, pattern1, &args); @@ -2261,9 +2261,9 @@ static void gen_get_or_put_slice(const act* action, //____________________________________________________________ -// +// // Generate the code to do a get segment. -// +// static void gen_get_segment( const act* action, int column) { @@ -2301,10 +2301,10 @@ static void gen_get_segment( const act* action, int column) //____________________________________________________________ -// +// // Generate code to drive a mass update. Just start a request // and get the result. -// +// static void gen_loop( const act* action, int column) { @@ -2326,10 +2326,10 @@ static void gen_loop( const act* action, int column) //____________________________________________________________ -// +// // Generate a name for a reference. Name is constructed from // port and parameter idents. -// +// static TEXT* gen_name(TEXT* const string, const ref* reference, @@ -2348,9 +2348,9 @@ static TEXT* gen_name(TEXT* const string, //____________________________________________________________ -// +// // Generate a block to handle errors. -// +// static void gen_on_error( const act* action, USHORT column) { @@ -2368,9 +2368,9 @@ static void gen_on_error( const act* action, USHORT column) //____________________________________________________________ -// +// // Generate code for an EXECUTE PROCEDURE. -// +// static void gen_procedure( const act* action, int column) { @@ -2397,16 +2397,16 @@ static void gen_procedure( const act* action, int column) "firebird.gds_transact_request (%V1 %RF%DH%RE, %RF%RT%RE, %VF%RS%VE, %RF%RI%RE, %VF0%VE, %S2, %VF%QL%VE, %QI'address);\n"; -// Get database attach and transaction started +// Get database attach and transaction started if (gpreGlob.sw_auto) t_start_auto(action, 0, status_vector(action), column, true); -// Move in input values +// Move in input values asgn_from(action, request->req_values, column); -// Execute the procedure +// Execute the procedure PATTERN_expand(column, pattern, &args); @@ -2414,7 +2414,7 @@ static void gen_procedure( const act* action, int column) printa(column, "if SQLCODE = 0 then"); -// Move out output values +// Move out output values asgn_to_proc(request->req_references, column); endif(column); @@ -2422,9 +2422,9 @@ static void gen_procedure( const act* action, int column) //____________________________________________________________ -// +// // Generate the code to do a put segment. -// +// static void gen_put_segment( const act* action, int column) { @@ -2450,9 +2450,9 @@ static void gen_put_segment( const act* action, int column) //____________________________________________________________ -// +// // Generate BLR in raw, numeric form. Ugly but dense. -// +// static void gen_raw( const UCHAR* blr, @@ -2463,7 +2463,7 @@ static void gen_raw( TEXT* p = buffer; const TEXT* const limit = buffer + 60; - for (const UCHAR* const end = blr + request_length - 1; blr <= end; ++blr) + for (const UCHAR* const end = blr + request_length - 1; blr <= end; ++blr) { const UCHAR c = *blr; sprintf(p, "%d", c); @@ -2484,9 +2484,9 @@ static void gen_raw( //____________________________________________________________ -// +// // Generate substitution text for READY -// +// static void gen_ready( const act* action, int column) { @@ -2514,9 +2514,9 @@ static void gen_ready( const act* action, int column) //____________________________________________________________ -// +// // Generate receive call for a port. -// +// static void gen_receive( const act* action, int column, gpre_port* port) { @@ -2532,7 +2532,7 @@ static void gen_receive( const act* action, int column, gpre_port* port) //____________________________________________________________ -// +// // Generate substitution text for RELEASE_REQUESTS // For active databases, call isc_release_request. // for all others, just zero the handle. For the @@ -2540,7 +2540,7 @@ static void gen_receive( const act* action, int column, gpre_port* port) // are likely if the request was compiled on a database // which has been released and re-readied. If there is // a serious error, it will be caught on the next statement. -// +// static void gen_release( const act* action, int column) { @@ -2564,17 +2564,17 @@ static void gen_release( const act* action, int column) //____________________________________________________________ -// +// // Generate definitions associated with a single request. -// +// static void gen_request( gpre_req* request, int column) { -// generate request handle, blob handles, and ports +// generate request handle, blob handles, and ports if (!(request->req_flags & (REQ_exp_hand | REQ_sql_blob_open | REQ_sql_blob_create)) && - request->req_type != REQ_slice && request->req_type != REQ_procedure) + request->req_type != REQ_slice && request->req_type != REQ_procedure) { printa(column, "%s\t: firebird.request_handle := 0;-- request handle --", request->req_handle); @@ -2585,8 +2585,8 @@ static void gen_request( gpre_req* request, int column) request->req_ident, SHORT_DCL); // check the case where we need to extend the dpb dynamically at runtime, -// in which case we need dpb length and a pointer to be defined even if -// there is no static dpb defined +// in which case we need dpb length and a pointer to be defined even if +// there is no static dpb defined if (request->req_flags & REQ_extend_dpb) { printa(column, @@ -2598,7 +2598,7 @@ static void gen_request( gpre_req* request, int column) request->req_ident); } -// generate actual BLR string +// generate actual BLR string if (request->req_length) { const SSHORT length = request->req_length; @@ -2609,7 +2609,7 @@ static void gen_request( gpre_req* request, int column) "function isc_to_dpb_ptr is new unchecked_conversion (system.address, firebird.dpb_ptr);"); gpreGlob.ada_flags &= ~gpreGlob.ADA_create_database; } - // fall into ... + // fall into ... case REQ_ready: printa(column, "isc_%dl\t: firebird.isc_ushort := %d;\t-- db parameter block --", @@ -2690,7 +2690,7 @@ static void gen_request( gpre_req* request, int column) string_type, request->req_ident, request->req_length); } -// Print out slice description language if there are arrays associated with request +// Print out slice description language if there are arrays associated with request for (const gpre_port* port = request->req_ports; port; port = port->por_next) for (const ref* reference = port->por_references; reference; reference = reference->ref_next) @@ -2715,7 +2715,7 @@ static void gen_request( gpre_req* request, int column) } } -// Print out any blob parameter blocks required +// Print out any blob parameter blocks required for (const blb* blob = request->req_blobs; blob; blob = blob->blb_next) if (blob->blb_bpb_length) { @@ -2726,7 +2726,7 @@ static void gen_request( gpre_req* request, int column) printa(INDENT, ");\n"); } -// If this is a GET_SLICE/PUT_slice, allocate some variables +// If this is a GET_SLICE/PUT_slice, allocate some variables if (request->req_type == REQ_slice) { printa(INDENT, "isc_%ds\t: %s;\t\t", request->req_ident, LONG_DCL); @@ -2737,10 +2737,10 @@ static void gen_request( gpre_req* request, int column) //____________________________________________________________ -// +// // Generate receive call for a port // in a store2 statement. -// +// static void gen_return_value( const act* action, int column) { @@ -2757,17 +2757,17 @@ static void gen_return_value( const act* action, int column) //____________________________________________________________ -// +// // Process routine head. If there are gpreGlob.requests in the // routine, insert local definitions. -// +// static void gen_routine( const act* action, int column) { column += INDENT; for (gpre_req* request = (gpre_req*) action->act_object; request; - request = request->req_routine) + request = request->req_routine) { gpre_port* port; for (port = request->req_ports; port; port = port->por_next) @@ -2806,9 +2806,9 @@ static void gen_routine( const act* action, int column) //____________________________________________________________ -// +// // Generate substitution text for END_STREAM. -// +// static void gen_s_end( const act* action, int column) { @@ -2836,9 +2836,9 @@ static void gen_s_end( const act* action, int column) //____________________________________________________________ -// +// // Generate substitution text for FETCH. -// +// static void gen_s_fetch( const act* action, int column) { @@ -2851,10 +2851,10 @@ static void gen_s_fetch( const act* action, int column) //____________________________________________________________ -// +// // Generate text to compile and start a stream. This is // used both by START_STREAM and FOR -// +// static void gen_s_start( const act* action, int column) { @@ -2890,9 +2890,9 @@ static void gen_s_start( const act* action, int column) //____________________________________________________________ -// +// // Substitute for a segment, segment length, or blob handle. -// +// static void gen_segment( const act* action, int column) { @@ -2906,9 +2906,9 @@ static void gen_segment( const act* action, int column) //____________________________________________________________ -// +// // Generate code for standalone SELECT statement. -// +// static void gen_select( const act* action, int column) { @@ -2946,9 +2946,9 @@ static void gen_select( const act* action, int column) //____________________________________________________________ -// +// // Generate a send or receive call for a port. -// +// static void gen_send( const act* action, gpre_port* port, int column) { @@ -2964,9 +2964,9 @@ static void gen_send( const act* action, gpre_port* port, int column) //____________________________________________________________ -// +// // Generate support for get/put slice statement. -// +// static void gen_slice( const act* action, int column) { @@ -2981,7 +2981,7 @@ static void gen_slice( const act* action, int column) slc* slice = (slc*) action->act_object; gpre_req* parent_request = slice->slc_parent_request; -// Compute array size +// Compute array size printa(column, "isc_%ds := %d", request->req_ident, slice->slc_field->fld_array->fld_length); @@ -3003,27 +3003,27 @@ static void gen_slice( const act* action, int column) fprintf(gpreGlob.out_file, ";"); -// Make assignments to variable vector +// Make assignments to variable vector REF reference; for (reference = request->req_values; reference; reference = reference->ref_next) { - printa(column, "isc_%dv (%d) := %s;", request->req_ident, + printa(column, "isc_%dv (%d) := %s;", request->req_ident, reference->ref_id + 1, reference->ref_value); } PAT args; args.pat_reference = slice->slc_field_ref; - args.pat_request = parent_request; // blob id request - args.pat_vector1 = status_vector(action); // status vector - args.pat_database = parent_request->req_database; // database handle - args.pat_value1 = request->req_length; // slice descr. length - args.pat_ident1 = request->req_ident; // request name - args.pat_value2 = slice->slc_parameters * sizeof(SLONG); // parameter length + args.pat_request = parent_request; // blob id request + args.pat_vector1 = status_vector(action); // status vector + args.pat_database = parent_request->req_database; // database handle + args.pat_value1 = request->req_length; // slice descr. length + args.pat_ident1 = request->req_ident; // request name + args.pat_value2 = slice->slc_parameters * sizeof(SLONG); // parameter length reference = (REF) slice->slc_array->nod_arg[0]; - args.pat_string5 = reference->ref_value; // array name + args.pat_string5 = reference->ref_value; // array name args.pat_string6 = "isc_array_length"; PATTERN_expand(column, @@ -3033,10 +3033,10 @@ static void gen_slice( const act* action, int column) //____________________________________________________________ -// +// // Generate either a START or START_AND_SEND depending // on whether or a not a port is present. -// +// static void gen_start( const act* action, gpre_port* port, int column) { @@ -3071,10 +3071,10 @@ static void gen_start( const act* action, gpre_port* port, int column) //____________________________________________________________ -// +// // Generate text for STORE statement. This includes the compile // call and any variable initialization required. -// +// static void gen_store( const act* action, int column) { @@ -3083,11 +3083,11 @@ static void gen_store( const act* action, int column) if (action->act_error || (action->act_flags & ACT_sql)) make_ok_test(action, request, column); -// Initialize any blob fields +// Initialize any blob fields TEXT name[MAX_REF_SIZE]; const gpre_port* port = request->req_primary; for (const ref* reference = port->por_references; reference; - reference = reference->ref_next) + reference = reference->ref_next) { const gpre_fld* field = reference->ref_field; if (field->fld_flags & FLD_blob) @@ -3098,15 +3098,15 @@ static void gen_store( const act* action, int column) //____________________________________________________________ -// +// // Generate substitution text for START_TRANSACTION. -// +// static void gen_t_start( const act* action, int column) { // for automatically generated transactions, and transactions that are // explicitly started, but don't have any arguments so don't get a TPB, -// generate something plausible. +// generate something plausible. const gpre_tra* trans; if (!action || !(trans = (gpre_tra*) action->act_object)) { @@ -3116,7 +3116,7 @@ static void gen_t_start( const act* action, int column) // build a complete statement, including tpb's. // first generate any appropriate ready statements, -// and fill in the tpb vector (aka TEB). +// and fill in the tpb vector (aka TEB). int count = 0; for (const tpb* tpb_iterator = trans->tra_tpb; tpb_iterator; @@ -3154,9 +3154,9 @@ static void gen_t_start( const act* action, int column) //____________________________________________________________ -// +// // Generate a TPB in the output file -// +// static void gen_tpb(const tpb* tpb_buffer, int column) { @@ -3180,7 +3180,7 @@ static void gen_tpb(const tpb* tpb_buffer, int column) } } -// handle the last character +// handle the last character const TEXT c = *text++; sprintf(p, "%d", c); @@ -3190,9 +3190,9 @@ static void gen_tpb(const tpb* tpb_buffer, int column) //____________________________________________________________ -// +// // Generate substitution text for COMMIT, ROLLBACK, PREPARE, and SAVE -// +// static void gen_trans( const act* action, int column) { @@ -3227,9 +3227,9 @@ static void gen_trans( const act* action, int column) //____________________________________________________________ -// +// // Substitute for a variable reference. -// +// static void gen_type( const act* action, int column) { @@ -3240,9 +3240,9 @@ static void gen_type( const act* action, int column) //____________________________________________________________ -// +// // Generate substitution text for UPDATE ... WHERE CURRENT OF ... -// +// static void gen_update( const act* action, int column) { @@ -3254,9 +3254,9 @@ static void gen_update( const act* action, int column) //____________________________________________________________ -// +// // Substitute for a variable reference. -// +// static void gen_variable( const act* action, int column) { @@ -3267,9 +3267,9 @@ static void gen_variable( const act* action, int column) //____________________________________________________________ -// +// // Generate tests for any WHENEVER clauses that may have been declared. -// +// static void gen_whenever(const swe* label, int column) { @@ -3297,17 +3297,17 @@ static void gen_whenever(const swe* label, int column) //____________________________________________________________ -// +// // Generate a declaration of an array in the // output file. -// +// static void make_array_declaration( REF reference, int column) { gpre_fld* field = reference->ref_field; const TEXT* name = field->fld_symbol->sym_string; -// Don't generate multiple declarations for the array. V3 Bug 569. +// Don't generate multiple declarations for the array. V3 Bug 569. if (field->fld_array_info->ary_declared) return; @@ -3315,7 +3315,7 @@ static void make_array_declaration( REF reference, int column) field->fld_array_info->ary_declared = true; if ((field->fld_array->fld_dtype <= dtype_varying) - && (field->fld_array->fld_length != 1)) + && (field->fld_array->fld_length != 1)) { if (field->fld_array->fld_sub_type == 1) fprintf(gpreGlob.out_file, "subtype isc_%d_byte is %s(1..%d);\n", @@ -3330,7 +3330,7 @@ static void make_array_declaration( REF reference, int column) fprintf(gpreGlob.out_file, "type isc_%dt is array (", field->fld_array_info->ary_ident); -// Print out the dimension part of the declaration +// Print out the dimension part of the declaration const dim* dimension = field->fld_array_info->ary_dimension; for (int i = 1; i < field->fld_array_info->ary_dimension_count; @@ -3393,7 +3393,7 @@ static void make_array_declaration( REF reference, int column) fprintf(gpreGlob.out_file, ";\n"); -// Print out the database field +// Print out the database field fprintf(gpreGlob.out_file, "isc_%d : isc_%dt;\t--- %s\n\n", field->fld_array_info->ary_ident, @@ -3402,12 +3402,12 @@ static void make_array_declaration( REF reference, int column) //____________________________________________________________ -// -// Generate code to test existence +// +// Generate code to test existence // of open cursor and do the right thing: // if type == ACT_open && isc_nl, error // if type == ACT_close && !isc_nl, error -// +// static void make_cursor_open_test( enum act_t type, gpre_req* request, int column) { @@ -3425,9 +3425,9 @@ static void make_cursor_open_test( enum act_t type, gpre_req* request, int colum //____________________________________________________________ -// +// // Turn a symbol into a varying string. -// +// static TEXT* make_name(TEXT* const string, const gpre_sym* symbol) { @@ -3438,10 +3438,10 @@ static TEXT* make_name(TEXT* const string, const gpre_sym* symbol) //____________________________________________________________ -// +// // Generate code to test existence of // compiled request with active transaction. -// +// static void make_ok_test( const act* action, gpre_req* request, int column) { @@ -3455,9 +3455,9 @@ static void make_ok_test( const act* action, gpre_req* request, int column) //____________________________________________________________ -// +// // Insert a port record description in output. -// +// static void make_port( const gpre_port* port, int column) { @@ -3466,7 +3466,7 @@ static void make_port( const gpre_port* port, int column) const ref* reference; for (reference = port->por_references; reference; - reference = reference->ref_next) + reference = reference->ref_next) { const gpre_fld* field = reference->ref_field; const TEXT* name; @@ -3549,7 +3549,7 @@ static void make_port( const gpre_port* port, int column) int pos = 0; for (reference = port->por_references; reference; - reference = reference->ref_next) + reference = reference->ref_next) { const gpre_fld* field = reference->ref_field; if (reference->ref_value && field->fld_array_info) @@ -3564,10 +3564,10 @@ static void make_port( const gpre_port* port, int column) //____________________________________________________________ -// +// // Generate the actual insertion text for a // ready; -// +// static void make_ready(const dbb* db, const TEXT* filename, @@ -3582,7 +3582,7 @@ static void make_ready(const dbb* db, sprintf(s2, "isc_%d", request->req_ident); /* if the dpb needs to be extended at runtime to include items - in host variables, do so here; this assumes that there is + in host variables, do so here; this assumes that there is always a request generated for runtime variables */ if (request->req_flags & REQ_extend_dpb) { @@ -3650,7 +3650,7 @@ static void make_ready(const dbb* db, printa(column + (request->req_length ? 4 : 0), "firebird.FREE (%s);", s2); - // reset the length of the dpb + // reset the length of the dpb if (request->req_length) printa(column, "%s = %d;", s1, request->req_length); } @@ -3658,9 +3658,9 @@ static void make_ready(const dbb* db, //____________________________________________________________ -// +// // Print a fixed string at a particular column. -// +// static void printa( int column, const TEXT* string, ...) { @@ -3675,9 +3675,9 @@ static void printa( int column, const TEXT* string, ...) //____________________________________________________________ -// +// // Generate the appropriate transaction handle. -// +// static const TEXT* request_trans( const act* action, const gpre_req* request) { @@ -3693,10 +3693,10 @@ static const TEXT* request_trans( const act* action, const gpre_req* request) //____________________________________________________________ -// +// // Generate the appropriate status vector parameter for a gds // call depending on where or not the action has an error clause. -// +// static const TEXT* status_vector( const act* action) { @@ -3708,9 +3708,9 @@ static const TEXT* status_vector( const act* action) //____________________________________________________________ -// +// // Generate substitution text for START_TRANSACTION. -// +// static void t_start_auto(const act* action, const gpre_req* request, diff --git a/src/gpre/c_cxx.cpp b/src/gpre/c_cxx.cpp index 31277268b2..813d582427 100644 --- a/src/gpre/c_cxx.cpp +++ b/src/gpre/c_cxx.cpp @@ -1,27 +1,27 @@ //____________________________________________________________ -// +// // PROGRAM: C preprocess // MODULE: c_cxx.cpp // DESCRIPTION: C and C++ code generator -// +// // The contents of this file are subject to the Interbase Public // License Version 1.0 (the "License"); you may not use this file // except in compliance with the License. You may obtain a copy // of the License at http://www.Inprise.com/IPL.html -// +// // Software distributed under the License is distributed on an // "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express // or implied. See the License for the specific language governing // rights and limitations under the License. -// +// // The Original Code was created by Inprise Corporation // and its predecessors. Portions created by Inprise Corporation are // Copyright (C) Inprise Corporation. -// +// // All Rights Reserved. // Contributor(s): ______________________________________.16/09/2003 // TMN (Mike Nordell) 11.APR.2001 - Reduce compiler warnings -// +// // 2002.10.28 Sean Leyne - Code cleanup, removed obsolete "DecOSF" port // // @@ -166,15 +166,15 @@ static inline void set_sqlcode(const act* action, const int column) } //____________________________________________________________ -// -// +// +// void C_CXX_action(const act* action, int column) { global_status_name = "isc_status"; -// Put leading braces where required +// Put leading braces where required switch (action->act_type) { case ACT_alter_database: @@ -504,7 +504,7 @@ void C_CXX_action(const act* action, int column) return; } -// Put in a trailing brace for those actions still with us +// Put in a trailing brace for those actions still with us if (action->act_flags & ACT_sql) gen_whenever(action->act_whenever, column); @@ -517,10 +517,10 @@ void C_CXX_action(const act* action, int column) //____________________________________________________________ -// +// // Align output to a specific column for output. If the // column is negative, don't do anything. -// +// static void align( int column) { @@ -539,16 +539,16 @@ static void align( int column) //____________________________________________________________ -// +// // Build an assignment from a host language variable to // a port variable. The string assignments are a little -// hairy because the normal mode is varying (null +// hairy because the normal mode is varying (null // terminated) strings, but the fixed subtype makes the // string a byte stream. Furthering the complication, a // single character byte stream is handled as a single byte, // meaining that it is the byte, not the address of the // byte. -// +// static void asgn_from( const act* action, REF reference, int column) { @@ -630,10 +630,10 @@ static void asgn_from( const act* action, REF reference, int column) } //____________________________________________________________ -// +// // Build an assignment to a host language variable from // a port variable. -// +// static void asgn_to( const act* action, REF reference, int column) { @@ -681,7 +681,7 @@ static void asgn_to( const act* action, REF reference, int column) reference->ref_value, reference->ref_value); } -// Pick up NULL value if one is there +// Pick up NULL value if one is there if (reference = reference->ref_null) { align(column); @@ -692,10 +692,10 @@ static void asgn_to( const act* action, REF reference, int column) //____________________________________________________________ -// +// // Build an assignment to a host language variable from // a port variable. -// +// static void asgn_to_proc(const ref* reference, int column) { @@ -728,10 +728,10 @@ static void asgn_to_proc(const ref* reference, int column) //____________________________________________________________ -// +// // Generate a function call for free standing ANY. Somebody else // will need to generate the actual function. -// +// static void gen_any( const act* action, int column) { @@ -754,9 +754,9 @@ static void gen_any( const act* action, int column) //____________________________________________________________ -// +// // Generate code for AT END clause of FETCH. -// +// static void gen_at_end( const act* action, int column) { @@ -768,9 +768,9 @@ static void gen_at_end( const act* action, int column) //____________________________________________________________ -// +// // Substitute for a BASED ON clause. -// +// static void gen_based( const act* action, int column) { @@ -850,7 +850,7 @@ static void gen_based( const act* action, int column) } } -// print the first variable, then precede the rest with commas +// print the first variable, then precede the rest with commas column += INDENT; @@ -892,7 +892,7 @@ static void gen_based( const act* action, int column) // *??????? // if (*variable != '*' && field->fld_dtype <= dtype_varying && // field->fld_length > 1) -// +// fprintf(gpreGlob.out_file, "[%d]", field->fld_length); } } @@ -902,9 +902,9 @@ static void gen_based( const act* action, int column) //____________________________________________________________ -// +// // Make a blob FOR loop. -// +// static void gen_blob_close( const act* action, USHORT column) { @@ -937,9 +937,9 @@ static void gen_blob_close( const act* action, USHORT column) //____________________________________________________________ -// +// // End a blob FOR loop. -// +// static void gen_blob_end( const act* action, USHORT column) { @@ -962,9 +962,9 @@ isc_close_blob (%V1, &%BH);\n\ //____________________________________________________________ -// +// // Make a blob FOR loop. -// +// static void gen_blob_for( const act* action, USHORT column) { @@ -985,9 +985,9 @@ static void gen_blob_for( const act* action, USHORT column) //____________________________________________________________ -// +// // Generate the call to open (or create) a blob. -// +// static void gen_blob_open( const act* action, USHORT column) { @@ -1063,9 +1063,9 @@ static void gen_blob_open( const act* action, USHORT column) //____________________________________________________________ -// +// // Callback routine for BLR pretty printer. -// +// static void gen_blr(void* user_arg, SSHORT offset, const char* string) { @@ -1078,7 +1078,7 @@ static void gen_blr(void* user_arg, SSHORT offset, const char* string) indent++; } -// Limit indentation to 192 characters +// Limit indentation to 192 characters indent = MIN(indent, 192); @@ -1128,9 +1128,9 @@ static void gen_blr(void* user_arg, SSHORT offset, const char* string) //____________________________________________________________ -// +// // Zap all know handles. -// +// static void gen_clear_handles( const act* action, int column) { @@ -1142,9 +1142,9 @@ static void gen_clear_handles( const act* action, int column) //____________________________________________________________ -// +// // Generate a symbol to ease compatibility with V3. -// +// static void gen_compatibility_symbol( const TEXT* symbol, @@ -1159,9 +1159,9 @@ static void gen_compatibility_symbol( //____________________________________________________________ -// +// // Generate text to compile a request. -// +// static void gen_compile( const act* action, int column) { @@ -1189,7 +1189,7 @@ static void gen_compile( const act* action, int column) PATTERN_expand((USHORT) (column + INDENT), pattern1, &args); // If blobs are present, zero out all of the blob handles. After this -// point, the handles are the user's responsibility +// point, the handles are the user's responsibility const blb* blob = request->req_blobs; if (blob) { @@ -1203,9 +1203,9 @@ static void gen_compile( const act* action, int column) //____________________________________________________________ -// +// // Generate a call to create a database. -// +// static void gen_create_database( const act* action, int column) { @@ -1250,7 +1250,7 @@ static void gen_create_database( const act* action, int column) PATTERN_expand((USHORT) column, pattern1, &args); -// if the dpb was extended, free it here +// if the dpb was extended, free it here if (request->req_flags & REQ_extend_dpb) { if (request->req_length) @@ -1293,9 +1293,9 @@ static void gen_create_database( const act* action, int column) //____________________________________________________________ -// +// // Generate substitution text for END_STREAM. -// +// static int gen_cursor_close( const act* action, const gpre_req* request, int column) { @@ -1316,15 +1316,15 @@ static int gen_cursor_close( const act* action, const gpre_req* request, int col //____________________________________________________________ -// +// // Generate text to initialize a cursor. -// +// static void gen_cursor_init( const act* action, int column) { // If blobs are present, zero out all of the blob handles. After this -// point, the handles are the user's responsibility +// point, the handles are the user's responsibility if (action->act_request-> req_flags & (REQ_sql_blob_open | REQ_sql_blob_create)) @@ -1336,9 +1336,9 @@ static void gen_cursor_init( const act* action, int column) //____________________________________________________________ -// +// // Generate text to open an embedded SQL cursor. -// +// static int gen_cursor_open( const act* action, const gpre_req* request, int column) { @@ -1378,9 +1378,9 @@ static int gen_cursor_open( const act* action, const gpre_req* request, int colu //____________________________________________________________ -// +// // Generate insertion text for the database statement. -// +// static void gen_database( const act* action, int column) { @@ -1463,7 +1463,7 @@ static void gen_database( const act* action, int column) gen_tpb(tpb_iterator, column); } -// generate event parameter block for each event in module +// generate event parameter block for each event in module SSHORT max_count = 0; for (gpre_lls* stack_ptr = gpreGlob.events; stack_ptr; stack_ptr = stack_ptr->lls_next) { @@ -1516,9 +1516,9 @@ static void gen_database( const act* action, int column) //____________________________________________________________ -// +// // Generate a call to update metadata. -// +// static void gen_ddl( const act* action, int column) { @@ -1553,9 +1553,9 @@ static void gen_ddl( const act* action, int column) //____________________________________________________________ -// +// // Generate a call to create a database. -// +// static void gen_drop_database( const act* action, int column) { @@ -1571,9 +1571,9 @@ static void gen_drop_database( const act* action, int column) //____________________________________________________________ -// +// // Generate a dynamic SQL statement. -// +// static void gen_dyn_close( const act* action, int column) { @@ -1588,9 +1588,9 @@ static void gen_dyn_close( const act* action, int column) //____________________________________________________________ -// +// // Generate a dynamic SQL statement. -// +// static void gen_dyn_declare( const act* action, int column) { @@ -1607,9 +1607,9 @@ static void gen_dyn_declare( const act* action, int column) //____________________________________________________________ -// +// // Generate a dynamic SQL statement. -// +// static void gen_dyn_describe(const act* action, int column, @@ -1629,9 +1629,9 @@ static void gen_dyn_describe(const act* action, //____________________________________________________________ -// +// // Generate a dynamic SQL statement. -// +// static void gen_dyn_execute( const act* action, int column) { @@ -1683,9 +1683,9 @@ static void gen_dyn_execute( const act* action, int column) //____________________________________________________________ -// +// // Generate a dynamic SQL statement. -// +// static void gen_dyn_fetch( const act* action, int column) { @@ -1703,9 +1703,9 @@ static void gen_dyn_fetch( const act* action, int column) //____________________________________________________________ -// +// // Generate code for an EXECUTE IMMEDIATE dynamic SQL statement. -// +// static void gen_dyn_immediate( const act* action, int column) { @@ -1748,9 +1748,9 @@ static void gen_dyn_immediate( const act* action, int column) //____________________________________________________________ -// +// // Generate a dynamic SQL statement. -// +// static void gen_dyn_insert( const act* action, int column) { @@ -1769,9 +1769,9 @@ static void gen_dyn_insert( const act* action, int column) //____________________________________________________________ -// +// // Generate a dynamic SQL statement. -// +// static void gen_dyn_open( const act* action, int column) { @@ -1818,9 +1818,9 @@ static void gen_dyn_open( const act* action, int column) //____________________________________________________________ -// +// // Generate a dynamic SQL statement. -// +// static void gen_dyn_prepare( const act* action, int column) { @@ -1862,13 +1862,13 @@ static void gen_dyn_prepare( const act* action, int column) //____________________________________________________________ -// +// // Generate substitution text for END_MODIFY. -// +// // Trickier because a fixed subtype single character // field is a single character, not a pointer to a // single character. -// +// static void gen_emodify( const act* action, int column) { @@ -1907,16 +1907,16 @@ static void gen_emodify( const act* action, int column) //____________________________________________________________ -// +// // Generate substitution text for END_STORE. -// +// static void gen_estore( const act* action, int column) { const gpre_req* request = action->act_request; // if we did a store ... returning_values aka store2 -// just wrap up pending error and return +// just wrap up pending error and return if (request->req_type == REQ_store2) { if (action->act_error) @@ -1936,9 +1936,9 @@ static void gen_estore( const act* action, int column) //____________________________________________________________ -// +// // Generate definitions associated with a single request. -// +// static void gen_endfor( const act* action, int column) { @@ -1956,9 +1956,9 @@ static void gen_endfor( const act* action, int column) //____________________________________________________________ -// +// // Generate substitution text for ERASE. -// +// static void gen_erase( const act* action, int column) { @@ -1974,10 +1974,10 @@ static void gen_erase( const act* action, int column) //____________________________________________________________ -// +// // Generate event parameter blocks for use // with a particular call to isc_event_wait. -// +// static SSHORT gen_event_block( const act* action) { @@ -1997,9 +1997,9 @@ static SSHORT gen_event_block( const act* action) //____________________________________________________________ -// +// // Generate substitution text for EVENT_INIT. -// +// static void gen_event_init( const act* action, int column) { @@ -2023,7 +2023,7 @@ static void gen_event_init( const act* action, int column) args.pat_long1 = (IPTR) init->nod_arg[2]; args.pat_value2 = (int) event_list->nod_count; -// generate call to dynamically generate event blocks +// generate call to dynamically generate event blocks PATTERN_expand((USHORT) column, pattern1, &args); @@ -2044,11 +2044,11 @@ static void gen_event_init( const act* action, int column) printb(");"); -// generate actual call to event_wait +// generate actual call to event_wait PATTERN_expand((USHORT) column, pattern2, &args); -// get change in event counts, copying event parameter block for reuse +// get change in event counts, copying event parameter block for reuse PATTERN_expand((USHORT) column, pattern3, &args); @@ -2059,9 +2059,9 @@ static void gen_event_init( const act* action, int column) //____________________________________________________________ -// +// // Generate substitution text for EVENT_WAIT. -// +// static void gen_event_wait( const act* action, int column) { @@ -2079,7 +2079,7 @@ static void gen_event_wait( const act* action, int column) gpre_sym* event_name = (gpre_sym*) action->act_object; // go through the stack of gpreGlob.events, checking to see if the -// event has been initialized and getting the event identifier +// event has been initialized and getting the event identifier DBB database; int ident = -1; @@ -2103,7 +2103,7 @@ static void gen_event_wait( const act* action, int column) args.pat_vector1 = status_vector(action); args.pat_long1 = ident; -// generate calls to wait on the event and to fill out the gpreGlob.events array +// generate calls to wait on the event and to fill out the gpreGlob.events array PATTERN_expand((USHORT) column, pattern1, &args); PATTERN_expand((USHORT) column, pattern2, &args); @@ -2115,11 +2115,11 @@ static void gen_event_wait( const act* action, int column) //____________________________________________________________ -// +// // Generate replacement text for the SQL FETCH statement. The // epilog FETCH statement is handled by GEN_S_FETCH (generate // stream fetch). -// +// static void gen_fetch( const act* action, int column) { @@ -2148,9 +2148,9 @@ static void gen_fetch( const act* action, int column) reference = reference->ref_next; const SCHAR* direction = reference->ref_value; - /* the direction in which the engine will scroll is sticky, so check to see - the last direction passed to the engine; if the direction is the same and - the offset is 1, then there is no need to pass the message; this prevents + /* the direction in which the engine will scroll is sticky, so check to see + the last direction passed to the engine; if the direction is the same and + the offset is 1, then there is no need to pass the message; this prevents extra packets and allows for batch fetches in either direction */ printa(column, "if (isc_%ddirection %% 2 != %s || %s != 1)", @@ -2214,9 +2214,9 @@ static void gen_fetch( const act* action, int column) //____________________________________________________________ -// +// // Generate substitution text for FINISH -// +// static void gen_finish( const act* action, int column) { @@ -2237,14 +2237,14 @@ static void gen_finish( const act* action, int column) DBB db = NULL; -// the user supplied one or more db_handles +// the user supplied one or more db_handles for (rdy* ready = (rdy*) action->act_object; ready; ready = ready->rdy_next) { db = ready->rdy_database; printa(column, "isc_detach_database (%s, &%s);", status_vector(action), db->dbb_name->sym_string); } -// no hanbdles, so we finish all known databases +// no hanbdles, so we finish all known databases if (!db) for (db = gpreGlob.isc_databases; db; db = db->dbb_next) { @@ -2265,9 +2265,9 @@ static void gen_finish( const act* action, int column) //____________________________________________________________ -// +// // Generate substitution text for FOR statement. -// +// static void gen_for( const act* action, int column) { @@ -2303,9 +2303,9 @@ static void gen_for( const act* action, int column) //____________________________________________________________ -// +// // Generate a function for free standing ANY or statistical. -// +// static void gen_function( const act* function, int column) { @@ -2420,10 +2420,10 @@ static void gen_function( const act* function, int column) //____________________________________________________________ -// +// // Generate a call to isc_get_slice // or isc_put_slice for an array. -// +// static void gen_get_or_put_slice(const act* action, const ref* reference, @@ -2473,9 +2473,9 @@ static void gen_get_or_put_slice(const act* action, //____________________________________________________________ -// +// // Generate the code to do a get segment. -// +// static void gen_get_segment( const act* action, int column) { @@ -2522,9 +2522,9 @@ static void gen_get_segment( const act* action, int column) //____________________________________________________________ -// +// // Generate text to compile and start a SQL command -// +// static void gen_loop( const act* action, int column) { @@ -2546,10 +2546,10 @@ static void gen_loop( const act* action, int column) //____________________________________________________________ -// +// // Generate a name for a reference. Name is constructed from // port and parameter idents. -// +// static TEXT* gen_name(char* const string, const ref* reference, @@ -2570,9 +2570,9 @@ static TEXT* gen_name(char* const string, //____________________________________________________________ -// +// // Generate a block to handle errors. -// +// static void gen_on_error( const act* action, USHORT column) { @@ -2593,9 +2593,9 @@ static void gen_on_error( const act* action, USHORT column) //____________________________________________________________ -// +// // Generate code for an EXECUTE PROCEDURE. -// +// static void gen_procedure( const act* action, int column) { @@ -2620,16 +2620,16 @@ static void gen_procedure( const act* action, int column) pattern = "isc_transact_request (%V1, %RF%DH%RE, %RF%RT%RE, sizeof (%RI), %RI, 0, 0, (short) %QL, (char *) %RF%QI%RE);"; -// Get database attach and transaction started +// Get database attach and transaction started if (gpreGlob.sw_auto) t_start_auto(action, 0, status_vector(action), column, true); -// Move in input values +// Move in input values asgn_from(action, request->req_values, column); -// Execute the procedure +// Execute the procedure PATTERN_expand((USHORT) column, pattern, &args); @@ -2639,7 +2639,7 @@ static void gen_procedure( const act* action, int column) column += INDENT; begin(column); -// Move out output values +// Move out output values asgn_to_proc(request->req_references, column); endp(column); @@ -2647,9 +2647,9 @@ static void gen_procedure( const act* action, int column) //____________________________________________________________ -// +// // Generate the code to do a put segment. -// +// static void gen_put_segment( const act* action, int column) { @@ -2692,9 +2692,9 @@ static void gen_put_segment( const act* action, int column) //____________________________________________________________ -// +// // Generate BLR/MBLR/etc. in raw, numeric form. Ugly but dense. -// +// static void gen_raw(const UCHAR* blr, int request_length) { @@ -2726,9 +2726,9 @@ static void gen_raw(const UCHAR* blr, int request_length) //____________________________________________________________ -// +// // Generate substitution text for READY -// +// static void gen_ready( const act* action, int column) { @@ -2756,9 +2756,9 @@ static void gen_ready( const act* action, int column) //____________________________________________________________ -// +// // Generate a send or receive call for a port. -// +// static void gen_receive( const act* action, int column, const gpre_port* port) { @@ -2776,7 +2776,7 @@ static void gen_receive( const act* action, int column, const gpre_port* port) //____________________________________________________________ -// +// // Generate substitution text for RELEASE_REQUESTS // For active databases, call isc_release_request. // for all others, just zero the handle. For the @@ -2784,7 +2784,7 @@ static void gen_receive( const act* action, int column, const gpre_port* port) // are likely if the request was compiled on a database // which has been released and re-readied. If there is // a serious error, it will be caught on the next statement. -// +// static void gen_release( const act* action, int column) { @@ -2806,13 +2806,13 @@ static void gen_release( const act* action, int column) //____________________________________________________________ -// +// // Generate definitions associated with a single request. -// +// static void gen_request(const gpre_req* request) { - if (!(request->req_flags & (REQ_exp_hand | REQ_sql_blob_open + if (!(request->req_flags & (REQ_exp_hand | REQ_sql_blob_open | REQ_sql_blob_create)) && request->req_type != REQ_slice && request->req_type != REQ_procedure) { @@ -2821,8 +2821,8 @@ static void gen_request(const gpre_req* request) } // check the case where we need to extend the dpb dynamically at runtime, -// in which case we need dpb length and a pointer to be defined even if -// there is no static dpb defined +// in which case we need dpb length and a pointer to be defined even if +// there is no static dpb defined if (request->req_flags & REQ_extend_dpb) { printa(0, "static char\n *isc_%dp;", request->req_ident); @@ -2855,7 +2855,7 @@ static void gen_request(const gpre_req* request) request->req_ident, request->req_length); printa(0, "static %schar\n isc_%d [] = {", CONST_STR, request->req_ident); - + const TEXT* string_type = "blr"; if (gpreGlob.sw_raw) { gen_raw(request->req_blr, request->req_length); @@ -2914,11 +2914,11 @@ static void gen_request(const gpre_req* request) string_type, request->req_ident); } -// Print out slice description language if there are arrays associated with request +// Print out slice description language if there are arrays associated with request for (const gpre_port* port = request->req_ports; port; port = port->por_next) for (const ref* reference = port->por_references; reference; - reference = reference->ref_next) + reference = reference->ref_next) { if (reference->ref_sdl) { printa(0, "static %sshort\n isc_%dl = %d;", CONST_STR, @@ -2939,7 +2939,7 @@ static void gen_request(const gpre_req* request) } } -// Print out any blob parameter blocks required +// Print out any blob parameter blocks required for (const blb* blob = request->req_blobs; blob; blob = blob->blb_next) if (blob->blb_bpb_length) { @@ -2948,7 +2948,7 @@ static void gen_request(const gpre_req* request) gen_raw(blob->blb_bpb, blob->blb_bpb_length); printa(INDENT, "};\n"); } -// If this is a GET_SLICE/PUT_slice, allocate some variables +// If this is a GET_SLICE/PUT_slice, allocate some variables if (request->req_type == REQ_slice) { printa(0, "static %s", DCL_LONG); @@ -2960,10 +2960,10 @@ static void gen_request(const gpre_req* request) //____________________________________________________________ -// +// // Generate receive call for a port // in a store2 statement. -// +// static void gen_return_value( const act* action, int column) { @@ -2979,10 +2979,10 @@ static void gen_return_value( const act* action, int column) //____________________________________________________________ -// +// // Process routine head. If there are gpreGlob.requests in the // routine, insert local definitions. -// +// static void gen_routine( const act* action, int column) { @@ -3008,9 +3008,9 @@ static void gen_routine( const act* action, int column) //____________________________________________________________ -// +// // Generate substitution text for END_STREAM. -// +// static void gen_s_end( const act* action, int column) { @@ -3036,9 +3036,9 @@ static void gen_s_end( const act* action, int column) //____________________________________________________________ -// +// // Generate substitution text for FETCH. -// +// static void gen_s_fetch( const act* action, int column) { @@ -3055,10 +3055,10 @@ static void gen_s_fetch( const act* action, int column) //____________________________________________________________ -// +// // Generate text to compile and start a stream. This is // used both by START_STREAM and FOR -// +// static void gen_s_start( const act* action, int column) { @@ -3095,9 +3095,9 @@ static void gen_s_start( const act* action, int column) //____________________________________________________________ -// +// // Substitute for a segment, segment length, or blob handle. -// +// static void gen_segment( const act* action, int column) { @@ -3111,10 +3111,10 @@ static void gen_segment( const act* action, int column) //____________________________________________________________ -// -// +// +// // generate code for a singleton select. -// +// static void gen_select( const act* action, int column) { @@ -3141,7 +3141,7 @@ static void gen_select( const act* action, int column) align(column); asgn_to(action, (REF) var_list->nod_arg[i], column); } - + if (request->req_database->dbb_flags & DBB_v3) { gen_receive(action, column, port); printa(column, "if (!SQLCODE && %s)", name); @@ -3158,9 +3158,9 @@ static void gen_select( const act* action, int column) //____________________________________________________________ -// +// // Generate a send or receive call for a port. -// +// static void gen_send( const act* action, const gpre_port* port, int column) { @@ -3178,9 +3178,9 @@ static void gen_send( const act* action, const gpre_port* port, int column) //____________________________________________________________ -// +// // Generate support for get/put slice statement. -// +// static void gen_slice( const act* action, REF var_reference, int column) { @@ -3193,7 +3193,7 @@ static void gen_slice( const act* action, REF var_reference, int column) slc* slice = (slc*) action->act_object; gpre_req* parent_request = slice->slc_parent_request; -// Compute array size +// Compute array size printa(column, "isc_%ds = %d", request->req_ident, slice->slc_field->fld_array->fld_length); @@ -3215,7 +3215,7 @@ static void gen_slice( const act* action, REF var_reference, int column) fprintf(gpreGlob.out_file, ";"); -// Make assignments to variable vector +// Make assignments to variable vector REF reference; for (reference = request->req_values; reference; @@ -3251,12 +3251,12 @@ static void gen_slice( const act* action, REF var_reference, int column) //____________________________________________________________ -// +// // Generate either a START or START_AND_SEND depending // on whether or a not a port is present. If this START // or START_AND_SEND is being generated for a STORE or a // MODIFY statement, generate PUT_SLICE calls, as well. -// +// static void gen_start(const act* action, const gpre_port* port, @@ -3286,10 +3286,10 @@ static void gen_start(const act* action, //____________________________________________________________ -// +// // Generate text for STORE statement. This includes the compile // call and any variable initialization required. -// +// static void gen_store( const act* action, int column) { @@ -3304,7 +3304,7 @@ static void gen_store( const act* action, int column) begin(column); } -// Initialize any blob fields +// Initialize any blob fields TEXT name[MAX_REF_SIZE]; gpre_port* port = request->req_primary; @@ -3320,15 +3320,15 @@ static void gen_store( const act* action, int column) //____________________________________________________________ -// +// // Generate substitution text for START_TRANSACTION. -// +// static void gen_t_start( const act* action, int column) { const TEXT* vector = status_vector(action); -// if this is a purely default transaction, just let it through +// if this is a purely default transaction, just let it through const gpre_tra* trans; if (!action || !(trans = (gpre_tra*) action->act_object)) { @@ -3336,7 +3336,7 @@ static void gen_t_start( const act* action, int column) return; } -// build a complete statement, including tpb's. Ready db's +// build a complete statement, including tpb's. Ready db's const tpb* tpb_iterator; if (gpreGlob.sw_auto) @@ -3358,7 +3358,7 @@ static void gen_t_start( const act* action, int column) (trans->tra_handle) ? trans->tra_handle : gpreGlob.transaction_name, trans->tra_db_count); -// Some systems don't like infinitely long lines. Limit them to 256. +// Some systems don't like infinitely long lines. Limit them to 256. int remaining = 256 - column - strlen(vector) - strlen((trans->tra_handle) ? trans->tra_handle : gpreGlob.transaction_name) - @@ -3387,9 +3387,9 @@ static void gen_t_start( const act* action, int column) //____________________________________________________________ -// +// // Generate a TPB in the output file -// +// static void gen_tpb(tpb* tpb_buffer, int column) { @@ -3435,9 +3435,9 @@ static void gen_tpb(tpb* tpb_buffer, int column) //____________________________________________________________ -// +// // Generate substitution text for COMMIT, ROLLBACK, PREPARE, and SAVE -// +// static void gen_trans( const act* action, int column) { @@ -3469,9 +3469,9 @@ static void gen_trans( const act* action, int column) //____________________________________________________________ -// +// // Substitute for a variable reference. -// +// static void gen_type( const act* action, int column) { @@ -3481,7 +3481,7 @@ static void gen_type( const act* action, int column) //____________________________________________________________ -// +// // Generate substitution text for UPDATE ... WHERE CURRENT OF ... // Notice this function's first param has member // action_act_object->upd_port->por_references that's changed. @@ -3496,9 +3496,9 @@ static void gen_update( const act* action, int column) //____________________________________________________________ -// +// // Substitute for a variable reference. -// +// static void gen_variable( const act* action, int column) { @@ -3509,9 +3509,9 @@ static void gen_variable( const act* action, int column) //____________________________________________________________ -// +// // Generate tests for any WHENEVER clauses that may have been declared. -// +// static void gen_whenever( const swe* label, int column) { @@ -3539,10 +3539,10 @@ static void gen_whenever( const swe* label, int column) //____________________________________________________________ -// +// // Generate a declaration of an array in the // output file. -// +// static void make_array_declaration(ref* reference) { @@ -3550,7 +3550,7 @@ static void make_array_declaration(ref* reference) gpre_fld* field = reference->ref_field; const TEXT* name = field->fld_symbol->sym_string; -// Don't generate multiple declarations for the array. V3 Bug 569. +// Don't generate multiple declarations for the array. V3 Bug 569. if (field->fld_array_info->ary_declared) return; @@ -3617,7 +3617,7 @@ static void make_array_declaration(ref* reference) fprintf(gpreGlob.out_file, "static %s isc_%d", dtype, field->fld_array_info->ary_ident); -// Print out the dimension part of the declaration +// Print out the dimension part of the declaration for (dim* dimension = field->fld_array_info->ary_dimension; dimension; dimension = dimension->dim_next) @@ -3629,16 +3629,16 @@ static void make_array_declaration(ref* reference) if (field->fld_array_info->ary_dtype <= dtype_varying) fprintf(gpreGlob.out_file, " [%d]", field->fld_array->fld_length); -// Print out the database field +// Print out the database field fprintf(gpreGlob.out_file, ";\t/* %s */\n", name); } //____________________________________________________________ -// +// // Turn a symbol into a varying string. -// +// // CVC: this code in unclear to me: it's advancing sym_string pointer, // so after this call the pointer is at the position of the null terminator. @@ -3675,10 +3675,10 @@ static TEXT* make_name( TEXT* const string, const gpre_sym* symbol) //____________________________________________________________ -// +// // Generate code to test existence of compiled request with // active transaction -// +// static void make_ok_test( const act* action, const gpre_req* request, int column) { @@ -3692,9 +3692,9 @@ static void make_ok_test( const act* action, const gpre_req* request, int column //____________________________________________________________ -// +// // Insert a port record description in output. -// +// static void make_port(const gpre_port* port, int column) { @@ -3788,10 +3788,10 @@ static void make_port(const gpre_port* port, int column) //____________________________________________________________ -// +// // Generate the actual insertion text for a // ready; -// +// static void make_ready( const dbb* db, @@ -3829,7 +3829,7 @@ static void make_ready( } } -// generate the attach database itself +// generate the attach database itself const TEXT* dpb_size_ptr = "0"; const TEXT* dpb_ptr = "(char*) 0"; @@ -3850,7 +3850,7 @@ static void make_ready( db->dbb_name->sym_string, (request ? s1 : dpb_size_ptr), (request ? s2 : dpb_ptr)); -// if the dpb was extended, free it here +// if the dpb was extended, free it here if (request && request->req_flags & REQ_extend_dpb) { if (request->req_length) @@ -3866,9 +3866,9 @@ static void make_ready( //____________________________________________________________ -// +// // Print a fixed string at a particular column. -// +// static void printa( int column, const char* string, ...) { @@ -3882,9 +3882,9 @@ static void printa( int column, const char* string, ...) //____________________________________________________________ -// +// // Print a fixed string at a particular column. -// +// static void printb( const TEXT* string, ...) { @@ -3897,9 +3897,9 @@ static void printb( const TEXT* string, ...) //____________________________________________________________ -// +// // Generate the appropriate transaction handle. -// +// static const TEXT* request_trans( const act* action, const gpre_req* request) { @@ -3917,10 +3917,10 @@ static const TEXT* request_trans( const act* action, const gpre_req* request) //____________________________________________________________ -// +// // Generate the appropriate status vector parameter for a gds // call depending on where or not the action has an error clause. -// +// static const TEXT* status_vector( const act* action) { @@ -3933,12 +3933,12 @@ static const TEXT* status_vector( const act* action) //____________________________________________________________ -// +// // Generate substitution text for START_TRANSACTION. // The complications include the fact that all databases // must be readied, and that everything should stop if // any thing fails so we don't trash the status vector. -// +// static void t_start_auto(const act* action, const gpre_req* request, @@ -3948,17 +3948,17 @@ static void t_start_auto(const act* action, { const TEXT* trname = request_trans(action, request); -// find out whether we're using a status vector or not +// find out whether we're using a status vector or not const int stat = !strcmp(vector, global_status_name); -// this is a default transaction, make sure all databases are ready +// this is a default transaction, make sure all databases are ready begin(column); const dbb* db; int count; - + if (gpreGlob.sw_auto) { TEXT buffer[256]; buffer[0] = 0; @@ -3992,7 +3992,7 @@ static void t_start_auto(const act* action, printa(column, "isc_start_transaction (%s, (FB_API_HANDLE*) &%s, (short) %d", vector, trname, count); -// Some systems don't like infinitely long lines. Limit them to 256. +// Some systems don't like infinitely long lines. Limit them to 256. int remaining = 256 - column - strlen(vector) - strlen(trname) - 31; diff --git a/src/gpre/cmd.cpp b/src/gpre/cmd.cpp index b8a29e8e23..20316ac0a5 100644 --- a/src/gpre/cmd.cpp +++ b/src/gpre/cmd.cpp @@ -1,27 +1,27 @@ //____________________________________________________________ -// +// // PROGRAM: C preprocessor // MODULE: cmd.cpp // DESCRIPTION: Data definition compiler -// +// // The contents of this file are subject to the Interbase Public // License Version 1.0 (the "License"); you may not use this file // except in compliance with the License. You may obtain a copy // of the License at http://www.Inprise.com/IPL.html -// +// // Software distributed under the License is distributed on an // "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express // or implied. See the License for the specific language governing // rights and limitations under the License. -// +// // The Original Code was created by Inprise Corporation // and its predecessors. Portions created by Inprise Corporation are // Copyright (C) Inprise Corporation. -// +// // All Rights Reserved. // Contributor(s): ______________________________________. // TMN (Mike Nordell) 11.APR.2001 - Reduce compiler warnings -// +// // //____________________________________________________________ // @@ -122,7 +122,7 @@ int CMD_compile_ddl(gpre_req* request) IND index; gpre_rel* relation; -// Initialize the blr string +// Initialize the blr string act* action = request->req_actions; request->req_blr = request->req_base = MSC_alloc(250); @@ -258,9 +258,9 @@ int CMD_compile_ddl(gpre_req* request) //____________________________________________________________ -// +// // Add cache file to a database. -// +// /* static void add_cache( gpre_req* request, const act* action, dbb* database) { @@ -280,9 +280,9 @@ static void add_cache( gpre_req* request, const act* action, dbb* database) */ //____________________________________________________________ -// +// // Generate dynamic DDL for modifying database. -// +// static void alter_database( gpre_req* request, act* action) { @@ -292,7 +292,7 @@ static void alter_database( gpre_req* request, act* action) request->add_byte(isc_dyn_mod_database); -// Reverse the order of files (parser left them backwards) +// Reverse the order of files (parser left them backwards) FIL files = db->dbb_files; for (file = files, files = NULL; file; file = next) { @@ -331,15 +331,15 @@ static void alter_database( gpre_req* request, act* action) //____________________________________________________________ -// +// // Generate dynamic DDL for CREATE DOMAIN action. -// +// static void alter_domain( gpre_req* request, const act* action) { const gpre_fld* field = (gpre_fld*) action->act_object; -// modify field info +// modify field info put_symbol(request, isc_dyn_mod_global_fld, field->fld_symbol); @@ -375,9 +375,9 @@ static void alter_domain( gpre_req* request, const act* action) //____________________________________________________________ -// +// // Generate dynamic DDL for ALTER INDEX statement -// +// static void alter_index( gpre_req* request, const act* action) { @@ -392,21 +392,21 @@ static void alter_index( gpre_req* request, const act* action) //____________________________________________________________ -// +// // Generate dynamic DDL for ALTER TABLE action. -// +// static void alter_table( gpre_req* request, const act* action) { -// add relation name +// add relation name const gpre_rel* relation = (gpre_rel*) action->act_object; put_symbol(request, isc_dyn_mod_rel, relation->rel_symbol); -// add field info +// add field info for (const gpre_fld* field = relation->rel_fields; field; - field = field->fld_next) + field = field->fld_next) { if (field->fld_flags & FLD_delete) { put_symbol(request, isc_dyn_delete_local_fld, field->fld_symbol); @@ -441,7 +441,7 @@ static void alter_table( gpre_req* request, const act* action) } } -// Check for any relation level ADD/DROP of constraints +// Check for any relation level ADD/DROP of constraints if (relation->rel_constraints) { for (const cnstrt* constraint = relation->rel_constraints; @@ -460,20 +460,20 @@ static void alter_table( gpre_req* request, const act* action) //____________________________________________________________ -// +// // Generate dyn for creating a CHECK constraint. -// +// static void create_check_constraint( gpre_req* request, const act* action, cnstrt* constraint) { gpre_trg* trigger = (gpre_trg*) MSC_alloc(TRG_LEN); -// create the INSERT trigger +// create the INSERT trigger trigger->trg_type = PRE_STORE_TRIGGER; -// "insert violates CHECK constraint on table" +// "insert violates CHECK constraint on table" trigger->trg_message = NULL; trigger->trg_boolean = constraint->cnstrt_boolean; @@ -481,26 +481,26 @@ static void create_check_constraint( gpre_req* request, const act* action, CPR_get_text(trigger->trg_source->str_string, constraint->cnstrt_text); create_trigger(request, action, trigger, CME_expr); -// create the UPDATE trigger +// create the UPDATE trigger trigger->trg_type = PRE_MODIFY_TRIGGER; -// "update violates CHECK constraint on table" +// "update violates CHECK constraint on table" create_trigger(request, action, trigger, CME_expr); } //____________________________________________________________ -// +// // Function // Generate blr to express: if (old.primary_key != new.primary_key). // do a column by column comparison. -// +// static void create_trg_firing_cond( gpre_req* request, const cnstrt* constraint) { -// count primary key columns +// count primary key columns const gpre_lls* prim_key_fld = constraint->cnstrt_referred_fields; const gpre_lls* field = prim_key_fld; @@ -514,7 +514,7 @@ static void create_trg_firing_cond( gpre_req* request, const cnstrt* constraint) fb_assert(prim_key_num_flds > 0); -// generate blr +// generate blr request->add_byte(blr_if); if (prim_key_num_flds > 1) request->add_byte(blr_or); @@ -541,12 +541,12 @@ static void create_trg_firing_cond( gpre_req* request, const cnstrt* constraint) //____________________________________________________________ -// +// // Function // Generate blr to express: foreign_key == primary_key // ie., for_key.column_1 = prim_key.column_1 and // for_key.column_2 = prim_key.column_2 and .... so on.. -// +// static void create_matching_blr(gpre_req* request, const cnstrt* constraint) { @@ -617,7 +617,7 @@ static void create_matching_blr(gpre_req* request, const cnstrt* constraint) // blr_version4 blr_literal ..... blr_eoc. // strip the blr_version4/blr_version5 and blr_eoc verbs and stuff the remaining // blr in the blr stream in the request. -// +// static void create_default_blr( gpre_req* request, @@ -636,10 +636,10 @@ static void create_default_blr( //____________________________________________________________ -// +// // Generate dyn for "on update cascade" trigger (for referential // integrity) along with the trigger blr. -// +// static void create_upd_cascade_trg( gpre_req* request, const act* action, cnstrt* constraint) @@ -648,7 +648,7 @@ static void create_upd_cascade_trg( gpre_req* request, const act* action, gpre_lls* prim_key_fld = constraint->cnstrt_referred_fields; gpre_rel* relation = (gpre_rel*) action->act_object; -// no trigger name is generated here. Let the engine make one up +// no trigger name is generated here. Let the engine make one up put_string(request, isc_dyn_def_trigger, "", (USHORT) 0); put_numeric(request, isc_dyn_trg_type, (SSHORT) POST_MODIFY_TRIGGER); @@ -659,7 +659,7 @@ static void create_upd_cascade_trg( gpre_req* request, const act* action, put_cstring(request, isc_dyn_rel_name, constraint->cnstrt_referred_rel->str_string); -// the trigger blr +// the trigger blr request->add_byte(isc_dyn_trg_blr); const USHORT offset = request->req_blr - request->req_base; @@ -678,15 +678,15 @@ static void create_upd_cascade_trg( gpre_req* request, const act* action, request->add_byte(blr_for); request->add_byte(blr_rse); -// the new context for the prim. key relation +// the new context for the prim. key relation request->add_byte(1); request->add_byte(blr_relation); put_cstring(request, 0, relation->rel_symbol->sym_string); -// the context for the foreign key relation +// the context for the foreign key relation request->add_byte(2); -// generate the blr for: foreign_key == primary_key +// generate the blr for: foreign_key == primary_key create_matching_blr(request, constraint); request->add_byte(blr_modify); @@ -696,7 +696,7 @@ static void create_upd_cascade_trg( gpre_req* request, const act* action, for (; for_key_fld && prim_key_fld; for_key_fld = for_key_fld->lls_next, prim_key_fld = - prim_key_fld->lls_next) + prim_key_fld->lls_next) { const str* for_key_fld_name = (STR) for_key_fld->lls_object; const str* prim_key_fld_name = (STR) prim_key_fld->lls_object; @@ -719,25 +719,25 @@ static void create_upd_cascade_trg( gpre_req* request, const act* action, const USHORT length = request->req_blr - request->req_base - offset - 2; request->req_base[offset] = (UCHAR) length; request->req_base[offset + 1] = (UCHAR) (length >> 8); -// end of the blr +// end of the blr -// no trg_source and no trg_description +// no trg_source and no trg_description request->add_byte(isc_dyn_end); } //____________________________________________________________ -// +// // Generate dyn for "on delete cascade" trigger (for referential // integrity) along with the trigger blr. -// +// static void create_del_cascade_trg( gpre_req* request, const act* action, cnstrt* constraint) { const gpre_rel* relation = (gpre_rel*) action->act_object; -// stuff a trigger_name of size 0. So the dyn-parser will make one up. +// stuff a trigger_name of size 0. So the dyn-parser will make one up. put_string(request, isc_dyn_def_trigger, "", (USHORT) 0); put_numeric(request, isc_dyn_trg_type, (SSHORT) POST_ERASE_TRIGGER); @@ -748,7 +748,7 @@ static void create_del_cascade_trg( gpre_req* request, const act* action, put_cstring(request, isc_dyn_rel_name, constraint->cnstrt_referred_rel->str_string); -// the trigger blr +// the trigger blr request->add_byte(isc_dyn_trg_blr); const USHORT offset = request->req_blr - request->req_base; @@ -761,12 +761,12 @@ static void create_del_cascade_trg( gpre_req* request, const act* action, request->add_byte(blr_for); request->add_byte(blr_rse); -// the context for the prim. key relation +// the context for the prim. key relation request->add_byte(1); request->add_byte(blr_relation); put_cstring(request, 0, relation->rel_symbol->sym_string); -// the context for the foreign key relation +// the context for the foreign key relation request->add_byte(2); create_matching_blr(request, constraint); @@ -777,20 +777,20 @@ static void create_del_cascade_trg( gpre_req* request, const act* action, const USHORT length = request->req_blr - request->req_base - offset - 2; request->req_base[offset] = (UCHAR) length; request->req_base[offset + 1] = (UCHAR) (length >> 8); -// end of the blr +// end of the blr -// no trg_source and no trg_description +// no trg_source and no trg_description request->add_byte(isc_dyn_end); } //____________________________________________________________ -// -// Generate dyn for "on delete|update set default" trigger (for +// +// Generate dyn for "on delete|update set default" trigger (for // referential integrity) along with the trigger blr. // The non_upd_trg parameter == true is an update trigger. -// +// static void create_set_default_trg(gpre_req* request, const act* action, @@ -809,7 +809,7 @@ static void create_set_default_trg(gpre_req* request, gpre_lls* for_key_fld = constraint->cnstrt_fields; const gpre_rel* relation = (gpre_rel*) action->act_object; -// no trigger name. It is generated by the engine +// no trigger name. It is generated by the engine put_string(request, isc_dyn_def_trigger, "", (USHORT) 0); put_numeric(request, isc_dyn_trg_type, @@ -822,7 +822,7 @@ static void create_set_default_trg(gpre_req* request, put_cstring(request, isc_dyn_rel_name, constraint->cnstrt_referred_rel->str_string); -// the trigger blr +// the trigger blr request->add_byte(isc_dyn_trg_blr); const USHORT offset = request->req_blr - request->req_base; @@ -835,7 +835,7 @@ static void create_set_default_trg(gpre_req* request, // for ON UPDATE TRIGGER only: generate the trigger firing condition: // if prim_key.old_value != prim_key.new value. -// Note that the key could consist of multiple columns +// Note that the key could consist of multiple columns if (on_upd_trg) { create_trg_firing_cond(request, constraint); @@ -846,12 +846,12 @@ static void create_set_default_trg(gpre_req* request, request->add_byte(blr_for); request->add_byte(blr_rse); -// the context for the prim. key relation +// the context for the prim. key relation request->add_byte(1); request->add_byte(blr_relation); put_cstring(request, 0, relation->rel_symbol->sym_string); -// the context for the foreign key relation +// the context for the foreign key relation request->add_byte(2); create_matching_blr(request, constraint); @@ -862,7 +862,7 @@ static void create_set_default_trg(gpre_req* request, request->add_byte(blr_begin); for (; for_key_fld; for_key_fld = for_key_fld->lls_next) { - // for every column in the foreign key .... + // for every column in the foreign key .... const str* for_key_fld_name = (STR) for_key_fld->lls_object; request->add_byte(blr_assignment); @@ -899,14 +899,14 @@ static void create_set_default_trg(gpre_req* request, } if (field) { - // Yes. The column is being created in this ddl statement + // Yes. The column is being created in this ddl statement if (field->fld_default_value) { // (1-a) CME_expr(field->fld_default_value, request); search_for_default = false; } else { - // check for domain default + // check for domain default if (field->fld_global) { // could be either (1-b) or (2) search_for_domain = field->fld_global->sym_string; @@ -918,14 +918,14 @@ static void create_set_default_trg(gpre_req* request, } } else { - // Nop. The column is not being created in this ddl statement + // Nop. The column is not being created in this ddl statement if (request->req_actions->act_type == ACT_create_table) { sprintf(s, "field \"%s\" does not exist in relation \"%s\"", for_key_fld_name->str_string, relation->rel_symbol->sym_string); CPR_error(s); } - // Thus we have an ALTER TABLE statement. + // Thus we have an ALTER TABLE statement. // If somebody is 'clever' enough to create table and then to alter it // within the same application ... @@ -938,7 +938,7 @@ static void create_set_default_trg(gpre_req* request, (strcmp(rel->rel_symbol->sym_string, relation->rel_symbol->sym_string) == 0)) { - // ... then try to check for the default in memory + // ... then try to check for the default in memory gpre_fld* fld; for (fld = (gpre_fld*) rel->rel_fields; fld; fld = fld->fld_next) @@ -956,7 +956,7 @@ static void create_set_default_trg(gpre_req* request, search_for_domain = fld->fld_global->sym_string; } else { - // default not found + // default not found request->add_byte(blr_null); search_for_default = false; } @@ -972,9 +972,9 @@ static void create_set_default_trg(gpre_req* request, } if (search_for_default && search_for_domain != NULL) { - // search for domain level default + // search for domain level default fb_assert(search_for_column == false); - // search for domain in memory + // search for domain in memory for (req = gpreGlob.requests; req; req = req->req_next) { gpre_fld* domain; if ((req->req_type == REQ_ddl) && @@ -986,13 +986,13 @@ static void create_set_default_trg(gpre_req* request, domain->fld_symbol->sym_string) == 0) && (domain->fld_default_value->nod_type != nod_erase)) { - // domain found in memory + // domain found in memory if (domain->fld_default_value) { // case (1-b) CME_expr(domain->fld_default_value, request); } else { - // default not found + // default not found request->add_byte(blr_null); } search_for_default = false; @@ -1001,7 +1001,7 @@ static void create_set_default_trg(gpre_req* request, } if (search_for_default) { - // search for domain in db system tables + // search for domain in db system tables if (MET_get_domain_default(relation->rel_database, search_for_domain, default_val, sizeof(default_val))) @@ -1014,10 +1014,10 @@ static void create_set_default_trg(gpre_req* request, } search_for_default = false; } - } // end of search for domain level default + } // end of search for domain level default if (search_for_default && search_for_column) { - // nothing is found in memory, try to check db system tables + // nothing is found in memory, try to check db system tables fb_assert(search_for_domain == NULL); if (MET_get_column_default(relation, for_key_fld_name->str_string, default_val, @@ -1030,7 +1030,7 @@ static void create_set_default_trg(gpre_req* request, } } - // the context for the foreign key relation + // the context for the foreign key relation request->add_byte(blr_field); request->add_byte((SSHORT) 2); put_cstring(request, 0, for_key_fld_name->str_string); @@ -1048,22 +1048,22 @@ static void create_set_default_trg(gpre_req* request, const USHORT length = request->req_blr - request->req_base - offset - 2; request->req_base[offset] = (UCHAR) length; request->req_base[offset + 1] = (UCHAR) (length >> 8); -// end of the blr +// end of the blr -// no trg_source and no trg_description +// no trg_source and no trg_description request->add_byte(isc_dyn_end); } //____________________________________________________________ -// -// Generate dyn for "on delete|update set null" trigger (for +// +// Generate dyn for "on delete|update set null" trigger (for // referential integrity). The trigger blr is the same for // both the delete and update cases. Only differences is its // TRIGGER_TYPE (ON DELETE or ON UPDATE). // The non_upd_trg parameter == true is an update trigger. -// +// static void create_set_null_trg(gpre_req* request, const act* action, @@ -1073,7 +1073,7 @@ static void create_set_null_trg(gpre_req* request, gpre_lls* for_key_fld = constraint->cnstrt_fields; const gpre_rel* relation = (gpre_rel*) action->act_object; -// no trigger name. It is generated by the engine +// no trigger name. It is generated by the engine put_string(request, isc_dyn_def_trigger, "", (USHORT) 0); put_numeric(request, isc_dyn_trg_type, @@ -1086,7 +1086,7 @@ static void create_set_null_trg(gpre_req* request, put_cstring(request, isc_dyn_rel_name, constraint->cnstrt_referred_rel->str_string); -// the trigger blr +// the trigger blr request->add_byte(isc_dyn_trg_blr); const USHORT offset = request->req_blr - request->req_base; @@ -1099,7 +1099,7 @@ static void create_set_null_trg(gpre_req* request, // for ON UPDATE TRIGGER only: generate the trigger firing condition: // if prim_key.old_value != prim_key.new value. -// Note that the key could consist of multiple columns +// Note that the key could consist of multiple columns if (on_upd_trg) { create_trg_firing_cond(request, constraint); @@ -1110,12 +1110,12 @@ static void create_set_null_trg(gpre_req* request, request->add_byte(blr_for); request->add_byte(blr_rse); -// the context for the prim. key relation +// the context for the prim. key relation request->add_byte(1); request->add_byte(blr_relation); put_cstring(request, 0, relation->rel_symbol->sym_string); -// the context for the foreign key relation +// the context for the foreign key relation request->add_byte(2); create_matching_blr(request, constraint); @@ -1146,17 +1146,17 @@ static void create_set_null_trg(gpre_req* request, const USHORT length = request->req_blr - request->req_base - offset - 2; request->req_base[offset] = (UCHAR) length; request->req_base[offset + 1] = (UCHAR) (length >> 8); -// end of the blr +// end of the blr -// no trg_source and no trg_description +// no trg_source and no trg_description request->add_byte(isc_dyn_end); } //____________________________________________________________ -// +// // Get referred fields from memory/system tables -// +// static void get_referred_fields(const act* action, cnstrt* constraint) { @@ -1172,9 +1172,9 @@ static void get_referred_fields(const act* action, cnstrt* constraint) request_action->act_type == ACT_alter_table) && (rel = (gpre_rel*) request_action->act_object) && (strcmp(rel->rel_symbol->sym_string, - constraint->cnstrt_referred_rel->str_string) == 0)) + constraint->cnstrt_referred_rel->str_string) == 0)) { - for (const cnstrt* cns = rel->rel_constraints; cns; + for (const cnstrt* cns = rel->rel_constraints; cns; cns = cns->cnstrt_next) { if (cns->cnstrt_type == CNSTRT_PRIMARY_KEY) { @@ -1197,20 +1197,20 @@ static void get_referred_fields(const act* action, cnstrt* constraint) } if (constraint->cnstrt_referred_fields == NULL) - // Nothing is in memory. Try to find in system tables + // Nothing is in memory. Try to find in system tables constraint->cnstrt_referred_fields = MET_get_primary_key(relation->rel_database, constraint->cnstrt_referred_rel->str_string); if (constraint->cnstrt_referred_fields == NULL) { - // Nothing is in system tables. + // Nothing is in system tables. sprintf(s, "\"REFERENCES %s\" without \"(column list)\" requires PRIMARY KEY on referenced table", constraint->cnstrt_referred_rel->str_string); CPR_error(s); } else { - // count both primary key and foreign key columns + // count both primary key and foreign key columns USHORT prim_key_num_flds = 0, for_key_num_flds = 0; const gpre_lls* field = constraint->cnstrt_referred_fields; while (field) { @@ -1234,9 +1234,9 @@ static void get_referred_fields(const act* action, cnstrt* constraint) //____________________________________________________________ -// +// // Generate dyn for creating a constraint. -// +// static void create_constraint( gpre_req* request, const act* action, cnstrt* constraint) @@ -1300,7 +1300,7 @@ static void create_constraint( gpre_req* request, const act* action, create_set_null_trg(request, action, constraint, true); break; default: - // just in case + // just in case fb_assert(0); request->add_byte(isc_dyn_foreign_key_none); break; @@ -1325,7 +1325,7 @@ static void create_constraint( gpre_req* request, const act* action, create_set_null_trg(request, action, constraint, false); break; default: - // just in case + // just in case fb_assert(0); request->add_byte(isc_dyn_foreign_key_none); break; @@ -1336,7 +1336,7 @@ static void create_constraint( gpre_req* request, const act* action, put_numeric(request, isc_dyn_idx_unique, 1); for (const gpre_lls* field = constraint->cnstrt_fields; field; - field = field->lls_next) + field = field->lls_next) { const str* string = (STR) field->lls_object; put_cstring(request, isc_dyn_fld_name, string->str_string); @@ -1345,7 +1345,7 @@ static void create_constraint( gpre_req* request, const act* action, put_cstring(request, isc_dyn_idx_foreign_key, constraint->cnstrt_referred_rel->str_string); for (const gpre_lls* field = constraint->cnstrt_referred_fields; field; - field = field->lls_next) + field = field->lls_next) { const str* string = (STR) field->lls_object; put_cstring(request, isc_dyn_idx_ref_column, string->str_string); @@ -1357,9 +1357,9 @@ static void create_constraint( gpre_req* request, const act* action, //____________________________________________________________ -// +// // Generate parameter buffer for CREATE DATABASE action. -// +// static void create_database( gpre_req* request, const act* action) { @@ -1435,9 +1435,9 @@ static void create_database( gpre_req* request, const act* action) //____________________________________________________________ -// +// // Generate dynamic DDL for second stage of create database -// +// static void create_database_modify_dyn( gpre_req* request, act* action) { @@ -1445,7 +1445,7 @@ static void create_database_modify_dyn( gpre_req* request, act* action) request->add_byte(isc_dyn_mod_database); -// Reverse the order of files (parser left them backwards) +// Reverse the order of files (parser left them backwards) FIL files = db->dbb_files; FIL file, next; @@ -1484,15 +1484,15 @@ static void create_database_modify_dyn( gpre_req* request, act* action) //____________________________________________________________ -// +// // Generate dynamic DDL for CREATE DOMAIN action. -// +// static void create_domain( gpre_req* request, const act* action) { const gpre_fld* field = (gpre_fld*) action->act_object; -// add field info +// add field info put_symbol(request, isc_dyn_def_global_fld, field->fld_symbol); put_field_attributes(request, field); @@ -1514,9 +1514,9 @@ static void create_domain( gpre_req* request, const act* action) //____________________________________________________________ -// +// // Generate dyn for creating a constraints for domains. -// +// static void create_domain_constraint(gpre_req* request, const act* action, const cnstrt* constraint) @@ -1525,7 +1525,7 @@ static void create_domain_constraint(gpre_req* request, const act* action, if (constraint->cnstrt_flags & CNSTRT_delete) continue; -// **** this will be used later +// **** this will be used later // put_cstring (request, isc_dyn_rel_constraint, constraint->cnstrt_name->str_string); //*** @@ -1542,9 +1542,9 @@ static void create_domain_constraint(gpre_req* request, const act* action, //____________________________________________________________ -// +// // Generate dynamic DDL for creating a generator. -// +// static void create_generator( gpre_req* request, const act* action) { @@ -1555,16 +1555,16 @@ static void create_generator( gpre_req* request, const act* action) //____________________________________________________________ -// +// // Generate dynamic DDL for CREATE INDEX action. -// +// static void create_index( gpre_req* request, const ind* index) { if (index->ind_symbol) put_symbol(request, isc_dyn_def_idx, index->ind_symbol); else { - // An index created because of the UNIQUE constraint on this field. + // An index created because of the UNIQUE constraint on this field. put_cstring(request, isc_dyn_def_idx, ""); } @@ -1577,7 +1577,7 @@ static void create_index( gpre_req* request, const ind* index) put_numeric(request, isc_dyn_idx_type, 1); if (index->ind_symbol) { - for (const gpre_fld* field = index->ind_fields; field; + for (const gpre_fld* field = index->ind_fields; field; field = field->fld_next) { put_symbol(request, isc_dyn_fld_name, field->fld_symbol); @@ -1594,15 +1594,15 @@ static void create_index( gpre_req* request, const ind* index) //____________________________________________________________ -// +// // Generate dynamic DDL for creating a shadow -// +// static void create_shadow( gpre_req* request, act* action) { fil* files = (FIL) action->act_object; -// Reverse the order of files (parser left them backwards) +// Reverse the order of files (parser left them backwards) FIL file, next; for (file = files, files = NULL; file; file = next) { next = file->fil_next; @@ -1632,25 +1632,25 @@ static void create_shadow( gpre_req* request, act* action) //____________________________________________________________ -// +// // Generate dynamic DDL for CREATE TABLE action. -// +// static void create_table( gpre_req* request, const act* action) { -// add relation name +// add relation name const gpre_rel* relation = (gpre_rel*) action->act_object; put_symbol(request, isc_dyn_def_rel, relation->rel_symbol); -// If the relation is defined as an external file, add dyn for that +// If the relation is defined as an external file, add dyn for that if (relation->rel_ext_file) put_cstring(request, isc_dyn_rel_ext_file, relation->rel_ext_file); put_numeric(request, isc_dyn_rel_sql_protection, 1); -// add field info +// add field info const gpre_fld* field; USHORT position = 0; for (field = relation->rel_fields; field; field = field->fld_next) { @@ -1685,7 +1685,7 @@ static void create_table( gpre_req* request, const act* action) request->add_end(); // Need to create an index for any fields (columns) declared with -// the UNIQUE constraint. +// the UNIQUE constraint. for (field = relation->rel_fields; field; field = field->fld_next) if (field->fld_index) @@ -1694,9 +1694,9 @@ static void create_table( gpre_req* request, const act* action) //____________________________________________________________ -// +// // Generate dynamic DDL for a trigger. -// +// static void create_trigger(gpre_req* request, const act* action, @@ -1704,7 +1704,7 @@ static void create_trigger(gpre_req* request, { const gpre_rel* relation = (gpre_rel*) action->act_object; -// Name of trigger to be generated +// Name of trigger to be generated put_cstring(request, isc_dyn_def_trigger, ""); @@ -1724,7 +1724,7 @@ static void create_trigger(gpre_req* request, request->add_byte(isc_dyn_end); } -// Generate the BLR for firing the trigger +// Generate the BLR for firing the trigger put_trigger_blr(request, isc_dyn_trg_blr, trigger->trg_boolean, routine); @@ -1733,35 +1733,35 @@ static void create_trigger(gpre_req* request, //____________________________________________________________ -// +// // Generate dynamic DDL for CREATE VIEW action. -// +// static bool create_view(gpre_req* request, act* action) { -// add relation name +// add relation name gpre_rel* relation = (gpre_rel*) action->act_object; put_symbol(request, isc_dyn_def_view, relation->rel_symbol); put_numeric(request, isc_dyn_rel_sql_protection, 1); -// write out blr +// write out blr put_blr(request, isc_dyn_view_blr, (GPRE_NOD) relation->rel_view_rse, reinterpret_cast(CME_rse)); -// write out view source +// write out view source TEXT* view_source = (TEXT *) MSC_alloc(relation->rel_view_text->txt_length + 1); CPR_get_text(view_source, relation->rel_view_text); put_cstring(request, isc_dyn_view_source, view_source); -// Write out view context info +// Write out view context info gpre_rel* sub_relation = 0; gpre_ctx* context; for (context = request->req_contexts; context; - context = context->ctx_next) + context = context->ctx_next) { sub_relation = context->ctx_relation; if (!sub_relation) @@ -1774,7 +1774,7 @@ static bool create_view(gpre_req* request, request->add_end(); } -// add the mapping from the rse to the view fields +// add the mapping from the rse to the view fields gpre_fld* field = relation->rel_fields; gpre_nod* fields = relation->rel_view_rse->rse_fields; @@ -1785,7 +1785,7 @@ static bool create_view(gpre_req* request, const gpre_nod* const* end; for (ptr = fields->nod_arg, end = ptr + fields->nod_count; ptr < end; - ptr++, field = (field) ? field->fld_next : NULL) + ptr++, field = (field) ? field->fld_next : NULL) { const gpre_fld* fld = NULL; gpre_nod* value = *ptr; @@ -1830,8 +1830,8 @@ static bool create_view(gpre_req* request, request->add_end(); } - if (relation->rel_flags & REL_view_check) { // VIEW WITH CHECK OPTION - // Make sure VIEW is updateable + if (relation->rel_flags & REL_view_check) { // VIEW WITH CHECK OPTION + // Make sure VIEW is updateable gpre_rse* select = relation->rel_view_rse; if ((select->rse_aggregate) || (non_updateable) || (select->rse_count != 1)) { @@ -1846,30 +1846,30 @@ static bool create_view(gpre_req* request, gpre_trg* trigger = (gpre_trg*) MSC_alloc(TRG_LEN); - // For the triggers, the OLD, NEW contexts are reserved + // For the triggers, the OLD, NEW contexts are reserved request->req_internal = 0; request->req_contexts = 0; gpre_ctx* contexts[3]; - // Make the OLD context for the trigger + // Make the OLD context for the trigger contexts[0] = request->req_contexts = context = MSC_context(request); context->ctx_relation = relation; - // Make the NEW context for the trigger + // Make the NEW context for the trigger contexts[1] = request->req_contexts = context = MSC_context(request); context->ctx_relation = relation; - // Make the context for the base relation + // Make the context for the base relation contexts[2] = select->rse_context[0] = request->req_contexts = context = MSC_context(request); context->ctx_relation = sub_relation; - // Make lists to assign from NEW fields to fields in the base relation. + // Make lists to assign from NEW fields to fields in the base relation. /* Also make sure rows in base relation correspond to rows in VIEW by making sure values in fields inherited by the VIEW are same as values in base relation. */ @@ -1881,7 +1881,7 @@ static bool create_view(gpre_req* request, SSHORT count = 0; gpre_lls* stack = NULL; for (ptr = fields->nod_arg, end = ptr + fields->nod_count; ptr < end; - ptr++, field = (field) ? field->fld_next : NULL) + ptr++, field = (field) ? field->fld_next : NULL) { gpre_fld* fld = NULL; gpre_nod* value = *ptr; @@ -1938,22 +1938,22 @@ static bool create_view(gpre_req* request, MSC_binary(nod_and, (and_nod) ? and_nod : or_node, select->rse_boolean); - // create the UPDATE trigger + // create the UPDATE trigger trigger->trg_type = PRE_MODIFY_TRIGGER; - // "update violates CHECK constraint on view" + // "update violates CHECK constraint on view" trigger->trg_message = NULL; trigger->trg_boolean = (GPRE_NOD) select; create_view_trigger(request, action, trigger, view_boolean, contexts, set_list); - // create the Pre-store trigger + // create the Pre-store trigger trigger->trg_type = PRE_STORE_TRIGGER; - // "insert violates CHECK constraint on view" + // "insert violates CHECK constraint on view" create_view_trigger(request, action, trigger, view_boolean, contexts, set_list); @@ -1966,9 +1966,9 @@ static bool create_view(gpre_req* request, //____________________________________________________________ -// +// // Generate dynamic DDL for a trigger. -// +// static void create_view_trigger(gpre_req* request, const act* action, @@ -1978,7 +1978,7 @@ static void create_view_trigger(gpre_req* request, { const gpre_rel* relation = (gpre_rel*) action->act_object; -// Name of trigger to be generated +// Name of trigger to be generated put_cstring(request, isc_dyn_def_trigger, ""); @@ -1997,7 +1997,7 @@ static void create_view_trigger(gpre_req* request, request->add_byte(isc_dyn_end); } -// Generate the BLR for firing the trigger +// Generate the BLR for firing the trigger put_view_trigger_blr(request, relation, isc_dyn_trg_blr, trigger, view_boolean, contexts, set_list); @@ -2007,9 +2007,9 @@ static void create_view_trigger(gpre_req* request, //____________________________________________________________ -// +// // Generate dynamic DDL for DECLARE FILTER action. -// +// static void declare_filter( gpre_req* request, const act* action) { @@ -2026,9 +2026,9 @@ static void declare_filter( gpre_req* request, const act* action) //____________________________________________________________ -// +// // Generate dynamic DDL for DECLARE EXTERNAL -// +// static void declare_udf( gpre_req* request, const act* action) { @@ -2038,23 +2038,23 @@ static void declare_udf( gpre_req* request, const act* action) put_cstring(request, isc_dyn_func_entry_point, udf_declaration->decl_udf_entry_point); put_cstring(request, isc_dyn_func_module_name, udf_declaration->decl_udf_module_name); -// Reverse the order of arguments which parse left backwords. +// Reverse the order of arguments which parse left backwords. -// +// //for (field = udf_declaration->decl_udf_arg_list, udf_declaration->decl_udf_arg_list = NULL; field; field = next) // { // next = field->fld_next; -// field->fld_next = udf_declaration->decl_udf_arg_list; +// field->fld_next = udf_declaration->decl_udf_arg_list; // udf_declaration->decl_udf_arg_list = field; // } -// +// SSHORT position, blob_position = 0; const gpre_fld* field = udf_declaration->decl_udf_return_type; if (field) { - // Function returns a value + // Function returns a value - // Some data types can not be returned as value + // Some data types can not be returned as value if ((udf_declaration->decl_udf_return_mode == FUN_value) && (field->fld_dtype == dtype_text || field->fld_dtype == dtype_varying || @@ -2086,13 +2086,13 @@ static void declare_udf( gpre_req* request, const act* action) else { position = 1; - // Function modifies an argument whose value is the function return value + // Function modifies an argument whose value is the function return value put_numeric(request, isc_dyn_func_return_argument, udf_declaration->decl_udf_return_parameter); } -// Now define all the arguments +// Now define all the arguments if (!position) { if (field->fld_dtype == dtype_blob) { @@ -2132,10 +2132,10 @@ static void declare_udf( gpre_req* request, const act* action) //____________________________________________________________ -// +// // Generate dynamic DDL for GRANT or // REVOKE privileges action. -// +// static void grant_revoke_privileges( gpre_req* request, const act* action) { @@ -2164,11 +2164,11 @@ static void grant_revoke_privileges( gpre_req* request, const act* action) *p = 0; // If there are any select, insert, or delete privileges to be granted -// or revoked output the necessary DYN strings +// or revoked output the necessary DYN strings if (p != privileges) for (priv_block = (PRV) action->act_object; priv_block; - priv_block = priv_block->prv_next) + priv_block = priv_block->prv_next) { if (action->act_type == ACT_dyn_grant) put_cstring(request, isc_dyn_grant, privileges); @@ -2190,7 +2190,7 @@ static void grant_revoke_privileges( gpre_req* request, const act* action) request->add_end(); } -// If there are no UPDATE privileges to be granted or revoked, we've finished +// If there are no UPDATE privileges to be granted or revoked, we've finished if (!(((PRV) action->act_object)->prv_privileges & PRV_update)) return; @@ -2200,11 +2200,11 @@ static void grant_revoke_privileges( gpre_req* request, const act* action) *p = 0; for (priv_block = (PRV) action->act_object; priv_block; - priv_block = priv_block->prv_next) + priv_block = priv_block->prv_next) { if (priv_block->prv_fields) { for (const gpre_lls* field = priv_block->prv_fields; field; - field = field->lls_next) + field = field->lls_next) { if (action->act_type == ACT_dyn_grant) put_cstring(request, isc_dyn_grant, privileges); @@ -2223,7 +2223,7 @@ static void grant_revoke_privileges( gpre_req* request, const act* action) !(request->req_database->dbb_flags & DBB_v3))) { put_numeric(request, isc_dyn_grant_options, 1); - } + } request->add_end(); } @@ -2254,9 +2254,9 @@ static void grant_revoke_privileges( gpre_req* request, const act* action) //____________________________________________________________ -// -// -// +// +// +// static void init_field_struct( gpre_fld* field) { @@ -2289,9 +2289,9 @@ static void init_field_struct( gpre_fld* field) //____________________________________________________________ -// +// // Put dimensions for the array field. -// +// static void put_array_info( gpre_req* request, const gpre_fld* field) { @@ -2314,9 +2314,9 @@ static void put_array_info( gpre_req* request, const gpre_fld* field) //____________________________________________________________ -// +// // Put an expression expressed in BLR. -// +// static void put_blr(gpre_req* request, USHORT blr_operator, GPRE_NOD node, pfn_local_trigger_cb routine) @@ -2337,16 +2337,16 @@ static void put_blr(gpre_req* request, //____________________________________________________________ -// +// // Generate dynamic DDL for a computed field. -// +// static void put_computed_blr( gpre_req* request, const gpre_fld* field) { const act* action = request->req_actions; const gpre_rel* relation = (gpre_rel*) action->act_object; -// Computed field context has to be 0 - so force it +// Computed field context has to be 0 - so force it gpre_ctx* context = request->req_contexts; const USHORT save_ctx_int = context->ctx_internal; @@ -2371,9 +2371,9 @@ static void put_computed_blr( gpre_req* request, const gpre_fld* field) //____________________________________________________________ -// +// // Generate dynamic DDL for a computed field. -// +// static void put_computed_source( gpre_req* request, const gpre_fld* field) { @@ -2390,9 +2390,9 @@ static void put_computed_source( gpre_req* request, const gpre_fld* field) //____________________________________________________________ -// +// // Put a null-terminated string valued attributed to the output string. -// +// static void put_cstring(gpre_req* request, USHORT ddl_operator, const TEXT* string) @@ -2406,10 +2406,10 @@ static void put_cstring(gpre_req* request, USHORT ddl_operator, //____________________________________________________________ -// +// // Generate dynamic DDL to create a field for CREATE // or ALTER TABLE action. -// +// static void put_dtype( gpre_req* request, const gpre_fld* field) { @@ -2428,7 +2428,7 @@ static void put_dtype( gpre_req* request, const gpre_fld* field) dtype = blr_cstring; else { - // Correct the length of C string for meta data operations + // Correct the length of C string for meta data operations if (gpreGlob.sw_cstring && field->fld_sub_type != dsc_text_type_fixed) length--; @@ -2438,7 +2438,7 @@ static void put_dtype( gpre_req* request, const gpre_fld* field) case dtype_text: if (field->fld_dtype == dtype_text) dtype = blr_text; - // Fall into + // Fall into case dtype_varying: fb_assert(length); @@ -2559,14 +2559,14 @@ static void put_dtype( gpre_req* request, const gpre_fld* field) //____________________________________________________________ -// +// // Generate dynamic DDL to create a field for CREATE // or ALTER TABLE action. -// +// // Emit the DDL that is appopriate for a local instance // of a field. eg: that can vary from the local fields // global field (DOMAIN in SQL). -// +// static void put_field_attributes( gpre_req* request, const gpre_fld* field) { @@ -2577,7 +2577,7 @@ static void put_field_attributes( gpre_req* request, const gpre_fld* field) if (!field->fld_global) put_dtype(request, field); -// Put the DDL for local field instances +// Put the DDL for local field instances if (field->fld_array_info) put_array_info(request, field); @@ -2597,9 +2597,9 @@ static void put_field_attributes( gpre_req* request, const gpre_fld* field) //____________________________________________________________ -// +// // Put a numeric valued attributed to the output string. -// +// static void put_numeric( gpre_req* request, USHORT blr_operator, SSHORT number) { @@ -2611,10 +2611,10 @@ static void put_numeric( gpre_req* request, USHORT blr_operator, SSHORT number) //____________________________________________________________ -// +// // Put a counted string valued attributed to the output string. // Count value is BYTE instead of WORD like put_cstring & put_string -// +// static void put_short_cstring(gpre_req* request, USHORT ddl_operator, const TEXT* string) @@ -2636,9 +2636,9 @@ static void put_short_cstring(gpre_req* request, USHORT ddl_operator, //____________________________________________________________ -// +// // Put a counted string valued attributed to the output string. -// +// static void put_string(gpre_req* request, USHORT ddl_operator, const TEXT* string, USHORT length) @@ -2662,9 +2662,9 @@ static void put_string(gpre_req* request, USHORT ddl_operator, //____________________________________________________________ -// +// // Put a symbol valued attribute. -// +// static void put_symbol(gpre_req* request, int ddl_operator, const gpre_sym* symbol) @@ -2674,10 +2674,10 @@ static void put_symbol(gpre_req* request, int ddl_operator, //____________________________________________________________ -// +// // Generate BLR for a trigger whose action is to abort. // Abort with a gds_error code error. -// +// static void put_trigger_blr(gpre_req* request, USHORT blr_operator, @@ -2696,11 +2696,11 @@ static void put_trigger_blr(gpre_req* request, request->add_byte(blr_begin); request->add_byte(blr_end); -// Generate the action for the trigger to be abort +// Generate the action for the trigger to be abort request->add_byte(blr_abort); put_short_cstring(request, blr_gds_code, "check_constraint"); - request->add_byte(blr_end); // for if + request->add_byte(blr_end); // for if request->add_byte(blr_eoc); const USHORT length = request->req_blr - request->req_base - offset - 2; request->req_base[offset] = (UCHAR) length; @@ -2709,15 +2709,15 @@ static void put_trigger_blr(gpre_req* request, //____________________________________________________________ -// +// // Generate BLR for a trigger for a VIEW WITH CHECK OPTION. // This is messy, the gpre_rse passed in is mutilated by the end. // Fields in the where clause and in the VIEW definition, are replaced // by the VIEW fields. // For fields in the where clause but not in the VIEW definition, // the fields are set to NULL node for the PRE STORE trigger. -// -// +// +// static void put_view_trigger_blr(gpre_req* request, const gpre_rel* relation, @@ -2753,14 +2753,14 @@ static void put_view_trigger_blr(gpre_req* request, request->add_byte(blr_begin); request->add_byte(blr_end); - // Generate the action for the trigger to be abort + // Generate the action for the trigger to be abort request->add_byte(blr_abort); put_short_cstring(request, blr_gds_code, "check_constraint"); request->add_byte(blr_end); request->add_byte(blr_end); request->add_byte(blr_eoc); - } // end of PRE_MODIFY_TRIGGER trigger + } // end of PRE_MODIFY_TRIGGER trigger if (trigger->trg_type == PRE_STORE_TRIGGER) { replace_field_names(view_boolean, node->rse_fields, @@ -2772,14 +2772,14 @@ static void put_view_trigger_blr(gpre_req* request, request->add_byte(blr_begin); request->add_byte(blr_end); - // Generate the action for the trigger to be abort + // Generate the action for the trigger to be abort request->add_byte(blr_abort); put_short_cstring(request, blr_gds_code, "check_constraint"); request->add_byte(blr_end); request->add_byte(blr_eoc); - } // end of PRE_STORE_TRIGGER trigger + } // end of PRE_STORE_TRIGGER trigger const USHORT length = request->req_blr - request->req_base - offset - 2; request->req_base[offset] = (UCHAR) length; @@ -2788,7 +2788,7 @@ static void put_view_trigger_blr(gpre_req* request, //____________________________________________________________ -// +// // Replace fields in given rse by fields referenced in VIEW. // if fields in gpre_rse are not part of VIEW definition, then they // are not changed. @@ -2797,7 +2797,7 @@ static void put_view_trigger_blr(gpre_req* request, // If null_them is true, then fields in rse but not in VIEW definition // are converted to null nodes, this is used for PRE STORE trigger // verification. -// +// static void replace_field_names(gpre_nod* const input, const gpre_nod* const search_list, @@ -2810,7 +2810,7 @@ static void replace_field_names(gpre_nod* const input, if (((input->nod_type == nod_via) || (input->nod_type == nod_any) || (input->nod_type == nod_unique)) && (search_list == 0) && - (replace_with == 0) && (input->nod_count == 0)) + (replace_with == 0) && (input->nod_count == 0)) { CPR_error("Invalid view WITH CHECK OPTION - no subqueries permitted"); return; @@ -2855,9 +2855,9 @@ static void replace_field_names(gpre_nod* const input, //____________________________________________________________ -// +// // Generate dynamic DDL for a set statistics -// +// static void set_statistics( gpre_req* request, const act* action) { diff --git a/src/gpre/cme.cpp b/src/gpre/cme.cpp index 23f3faf1cc..93d8d106cc 100644 --- a/src/gpre/cme.cpp +++ b/src/gpre/cme.cpp @@ -1,23 +1,23 @@ //____________________________________________________________ -// +// // PROGRAM: C preprocessor // MODULE: cme.cpp // DESCRIPTION: Request expression compiler -// +// // The contents of this file are subject to the Interbase Public // License Version 1.0 (the "License"); you may not use this file // except in compliance with the License. You may obtain a copy // of the License at http://www.Inprise.com/IPL.html -// +// // Software distributed under the License is distributed on an // "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express // or implied. See the License for the specific language governing // rights and limitations under the License. -// +// // The Original Code was created by Inprise Corporation // and its predecessors. Portions created by Inprise Corporation are // Copyright (C) Inprise Corporation. -// +// // All Rights Reserved. // Contributor(s): ______________________________________. // @@ -110,7 +110,7 @@ const op_table operators[] = { nod_user_name , blr_user_name }, // { count2 } // { nod_count, blr_count2 }, -// +// { nod_count , blr_count }, { nod_max , blr_maximum }, { nod_min , blr_minimum }, @@ -160,9 +160,9 @@ static inline bool is_date_and_time(const USHORT d1, const USHORT d2) } //____________________________________________________________ -// +// // Compile a random expression. -// +// void CME_expr(GPRE_NOD node, gpre_req* request) { @@ -312,7 +312,7 @@ void CME_expr(GPRE_NOD node, gpre_req* request) // STUFF (blr_count); // CME_rse (node->nod_arg [0], request); // return; -// +// case nod_agg_total: if (node->nod_arg[1] && !(request->req_database->dbb_flags & DBB_v3)) @@ -336,8 +336,8 @@ void CME_expr(GPRE_NOD node, gpre_req* request) case nod_dom_value: request->add_byte(blr_fid); - request->add_byte(0); // Context - request->add_word(0); // Field id + request->add_byte(0); // Context + request->add_word(0); // Field id return; case nod_map_ref: @@ -480,7 +480,7 @@ void CME_expr(GPRE_NOD node, gpre_req* request) case nod_ansi_any: case nod_ansi_all: case nod_unique: -// count2 next line would be deleted +// count2 next line would be deleted case nod_count: CME_rse((gpre_rse*) node->nod_arg[0], request); break; @@ -490,9 +490,9 @@ void CME_expr(GPRE_NOD node, gpre_req* request) case nod_average: case nod_total: case nod_from: -// +// // case nod_count: -// +// CME_rse((gpre_rse*) node->nod_arg[0], request); CME_expr(node->nod_arg[1], request); break; @@ -506,9 +506,9 @@ void CME_expr(GPRE_NOD node, gpre_req* request) //____________________________________________________________ -// +// // Compute datatype, length, and scale of an expression. -// +// void CME_get_dtype(const gpre_nod* node, gpre_fld* f) { @@ -534,12 +534,12 @@ void CME_get_dtype(const gpre_nod* node, gpre_fld* f) * SELECT NULL FROM TABLE1; * As we don't have a datatype pairing, * we don't know how to map this NULL to a host-language - * datatype. Therefore we now describe it as a + * datatype. Therefore we now describe it as a * CHAR(1) CHARACTER SET NONE type. * No value will ever be sent back, as the value of the select * will be NULL - this is only for purposes of allocating * values in the message DESCRIBING - * the statement. + * the statement. * Other parts of gpre aren't too happy with a dtype_unknown datatype */ f->fld_dtype = dtype_text; @@ -710,7 +710,7 @@ void CME_get_dtype(const gpre_nod* node, gpre_fld* f) CPR_error("expression evaluation not supported"); } } - + switch (dtype_max) { case dtype_short: @@ -1057,7 +1057,7 @@ void CME_get_dtype(const gpre_nod* node, gpre_fld* f) f->fld_length = strlen(string) - 2; if (gpreGlob.sw_cstring) { - // add 1 back for the NULL byte + // add 1 back for the NULL byte f->fld_length += 1; f->fld_dtype = dtype_cstring; @@ -1138,9 +1138,9 @@ void CME_get_dtype(const gpre_nod* node, gpre_fld* f) //____________________________________________________________ -// +// // Generate a relation reference. -// +// void CME_relation(gpre_ctx* context, gpre_req* request) { @@ -1214,9 +1214,9 @@ void CME_relation(gpre_ctx* context, gpre_req* request) //____________________________________________________________ -// +// // Generate blr for an rse node. -// +// void CME_rse(gpre_rse* selection, gpre_req* request) { @@ -1234,7 +1234,7 @@ void CME_rse(gpre_rse* selection, gpre_req* request) else request->add_byte(blr_rs_stream); - // Process unions, if any, otherwise process relations + // Process unions, if any, otherwise process relations gpre_rse* sub_rse = 0; gpre_nod* union_node = selection->rse_union; @@ -1284,7 +1284,7 @@ void CME_rse(gpre_rse* selection, gpre_req* request) request->add_byte(blr_writelock); } - // Process the clauses present + // Process the clauses present if (selection->rse_first) { @@ -1351,11 +1351,11 @@ void CME_rse(gpre_rse* selection, gpre_req* request) } #ifdef SCROLLABLE_CURSORS - // generate a statement to be executed if the user scrolls - // in a direction other than forward; a message is sent outside - // the normal send/receive protocol to specify the direction - // and offset to scroll; note that we do this only on a SELECT - // type statement and only when talking to a 4.1 engine or greater + // generate a statement to be executed if the user scrolls + // in a direction other than forward; a message is sent outside + // the normal send/receive protocol to specify the direction + // and offset to scroll; note that we do this only on a SELECT + // type statement and only when talking to a 4.1 engine or greater if (request->req_flags & REQ_sql_cursor && request->req_database->dbb_base_level >= 5) @@ -1372,17 +1372,17 @@ void CME_rse(gpre_rse* selection, gpre_req* request) } #endif - // Finish up by making a BLR_END + // Finish up by making a BLR_END request->add_byte(blr_end); } //____________________________________________________________ -// +// // Compile up an array reference putting // out sdl (slice description language) -// +// static void cmp_array( GPRE_NOD node, gpre_req* request) { @@ -1412,11 +1412,11 @@ static void cmp_array( GPRE_NOD node, gpre_req* request) reference->add_byte(isc_sdl_struct); reference->add_byte(1); - // The datatype of the array elements + // The datatype of the array elements cmp_sdl_dtype(field->fld_array, reference); - // The relation and field identifiers or strings + // The relation and field identifiers or strings if (gpreGlob.sw_ids) { @@ -1438,11 +1438,11 @@ static void cmp_array( GPRE_NOD node, gpre_req* request) reference->add_byte(*p); } - // The loops for the dimensions + // The loops for the dimensions stuff_sdl_loops(reference, field); - // The array element and its "subscripts" + // The array element and its "subscripts" stuff_sdl_element(reference, field); @@ -1459,10 +1459,10 @@ static void cmp_array( GPRE_NOD node, gpre_req* request) //____________________________________________________________ -// +// // Compile up a subscripted array reference // from an gpre_rse and output blr for this reference -// +// static void cmp_array_element( GPRE_NOD node, gpre_req* request) { @@ -1480,8 +1480,8 @@ static void cmp_array_element( GPRE_NOD node, gpre_req* request) //____________________________________________________________ -// -// +// +// static void cmp_cast( GPRE_NOD node, gpre_req* request) { @@ -1493,9 +1493,9 @@ static void cmp_cast( GPRE_NOD node, gpre_req* request) //____________________________________________________________ -// +// // Compile up a field reference. -// +// static void cmp_field( const gpre_nod* node, gpre_req* request) { @@ -1554,9 +1554,9 @@ static void cmp_field( const gpre_nod* node, gpre_req* request) //____________________________________________________________ -// +// // Handle a literal expression. -// +// static void cmp_literal( const gpre_nod* node, gpre_req* request) { @@ -1584,7 +1584,7 @@ static void cmp_literal( const gpre_nod* node, gpre_req* request) if (!(request->req_database->dbb_flags & DBB_v3)) request->add_byte(blr_double); else if (gpreGlob.sw_know_interp) - { // then must be using blr_version5 + { // then must be using blr_version5 request->add_byte(blr_text2); request->add_word(ttype_ascii); } @@ -1631,7 +1631,7 @@ static void cmp_literal( const gpre_nod* node, gpre_req* request) else long_val = (long) uint64_val; request->add_byte(blr_long); - request->add_byte(scale); // scale factor + request->add_byte(scale); // scale factor request->add_word(long_val); request->add_word(long_val >> 16); } @@ -1644,7 +1644,7 @@ static void cmp_literal( const gpre_nod* node, gpre_req* request) else sint64_val = (SINT64) uint64_val; request->add_byte(blr_int64); - request->add_byte(scale); // scale factor + request->add_byte(scale); // scale factor request->add_word(sint64_val); request->add_word(sint64_val >> 16); request->add_word(sint64_val >> 32); @@ -1657,18 +1657,18 @@ static void cmp_literal( const gpre_nod* node, gpre_req* request) } else { - // Remove surrounding quotes from string, etc. + // Remove surrounding quotes from string, etc. char buffer[MAX_SYM_SIZE]; char* p = buffer; - // Skip introducing quote mark + // Skip introducing quote mark if (*string) string++; while (*string) *p++ = *string++; - // Zap out terminating quote mark + // Zap out terminating quote mark *--p = 0; const SSHORT length = p - buffer; @@ -1738,9 +1738,9 @@ static void cmp_literal( const gpre_nod* node, gpre_req* request) //____________________________________________________________ -// +// // Generate a map for a union or aggregate rse. -// +// static void cmp_map(map* a_map, gpre_req* request) { @@ -1756,13 +1756,13 @@ static void cmp_map(map* a_map, gpre_req* request) //____________________________________________________________ -// +// // Generate an access plan for a query. -// +// static void cmp_plan(const gpre_nod* plan_expression, gpre_req* request) { -// stuff the join type +// stuff the join type const gpre_nod* list = plan_expression->nod_arg[1]; if (list->nod_count > 1) @@ -1775,7 +1775,7 @@ static void cmp_plan(const gpre_nod* plan_expression, gpre_req* request) request->add_byte(list->nod_count); } -// stuff one or more plan items +// stuff one or more plan items gpre_nod* const* ptr = list->nod_arg; for (gpre_nod* const* const end = ptr + list->nod_count; ptr < end; ptr++) @@ -1787,16 +1787,16 @@ static void cmp_plan(const gpre_nod* plan_expression, gpre_req* request) continue; } - // if we're here, it must be a nod_plan_item + // if we're here, it must be a nod_plan_item request->add_byte(blr_retrieve); - /* stuff the relation--the relation id itself is redundant except + /* stuff the relation--the relation id itself is redundant except when there is a need to differentiate the base tables of views */ CME_relation((gpre_ctx*) node->nod_arg[2], request); - // now stuff the access method for this stream + // now stuff the access method for this stream const gpre_nod* arg = node->nod_arg[1]; switch (arg->nod_type) @@ -1829,17 +1829,17 @@ static void cmp_plan(const gpre_nod* plan_expression, gpre_req* request) //____________________________________________________________ -// +// // Print out the correct blr for // this datatype. -// +// static void cmp_sdl_dtype( const gpre_fld* field, REF reference) { switch (field->fld_dtype) { case dtype_cstring: - // 3.2j has new, tagged blr intruction for cstring + // 3.2j has new, tagged blr intruction for cstring if (gpreGlob.sw_know_interp) { @@ -1855,7 +1855,7 @@ static void cmp_sdl_dtype( const gpre_fld* field, REF reference) break; case dtype_text: - // 3.2j has new, tagged blr intruction for text too + // 3.2j has new, tagged blr intruction for text too if (gpreGlob.sw_know_interp) { @@ -1871,7 +1871,7 @@ static void cmp_sdl_dtype( const gpre_fld* field, REF reference) break; case dtype_varying: - // 3.2j has new, tagged blr intruction for varying also + // 3.2j has new, tagged blr intruction for varying also if (gpreGlob.sw_know_interp) { @@ -1940,9 +1940,9 @@ static void cmp_sdl_dtype( const gpre_fld* field, REF reference) //____________________________________________________________ -// +// // Compile a reference to a user defined function. -// +// static void cmp_udf( GPRE_NOD node, gpre_req* request) { @@ -1974,9 +1974,9 @@ static void cmp_udf( GPRE_NOD node, gpre_req* request) //____________________________________________________________ -// +// // Process a random value expression. -// +// static void cmp_value( const gpre_nod* node, gpre_req* request) { @@ -2008,9 +2008,9 @@ static void cmp_value( const gpre_nod* node, gpre_req* request) //____________________________________________________________ -// +// // Figure out a text length from a datatype and a length -// +// static USHORT get_string_len( const gpre_fld* field) { @@ -2028,17 +2028,17 @@ static USHORT get_string_len( const gpre_fld* field) } //____________________________________________________________ -// +// // Write to the sdl string, the do // loop for a particular dimension. -// +// static void stuff_sdl_dimension(const dim* dimension, ref* reference, SSHORT dimension_count) { // In the future, when we support slices, new code to handle the -// user-defined slice ranges will be here. +// user-defined slice ranges will be here. if (dimension->dim_lower == 1) { @@ -2057,11 +2057,11 @@ static void stuff_sdl_dimension(const dim* dimension, //____________________________________________________________ -// +// // Write the element information // (including the subscripts) to // the SDL string for the array. -// +// static void stuff_sdl_element(ref* reference, const gpre_fld* field) { @@ -2072,7 +2072,7 @@ static void stuff_sdl_element(ref* reference, const gpre_fld* field) reference->add_byte(field->fld_array_info->ary_dimension_count); -// Fortran needs the array in column-major order +// Fortran needs the array in column-major order if (gpreGlob.sw_language == lang_fortran) { @@ -2095,10 +2095,10 @@ static void stuff_sdl_element(ref* reference, const gpre_fld* field) //____________________________________________________________ -// +// // Write loop information to the SDL // string for the array dimensions. -// +// static void stuff_sdl_loops(ref* reference, const gpre_fld* field) { @@ -2129,10 +2129,10 @@ static void stuff_sdl_loops(ref* reference, const gpre_fld* field) //____________________________________________________________ -// +// // Write the number in the 'smallest' // form possible to the SDL string. -// +// static void stuff_sdl_number(const SLONG number, REF reference) { @@ -2218,21 +2218,21 @@ static void get_dtype_of_case(const gpre_nod* node, gpre_fld* f) // (dtype_text, dtype_cstring, dtype_varying, dtype_blob sub_type TEXT) // !! Currently engine cannot convert string to BLOB therefor BLOB isn't allowed. !! // - first character-set and collation are used as output descriptor. -// - if all types have datatype CHAR then output should be CHAR else +// - if all types have datatype CHAR then output should be CHAR else // VARCHAR and with the maximum length used from the given list. -// -// If all of the datatypes are EXACT numeric then the output descriptor -// shall be EXACT numeric with the maximum scale and the maximum precision +// +// If all of the datatypes are EXACT numeric then the output descriptor +// shall be EXACT numeric with the maximum scale and the maximum precision // used. (dtype_byte, dtype_short, dtype_long, dtype_int64) -// +// // If any of the datatypes is APPROXIMATE numeric then each datatype in the -// list shall be numeric else a error is thrown and the output descriptor +// list shall be numeric else a error is thrown and the output descriptor // shall be APPROXIMATE numeric. (dtype_real, dtype_double, dtype_d_float) -// +// // If any of the datatypes is a datetime type then each datatype in the // list shall be the same datetime type else a error is thrown. // numeric. (dtype_sql_date, dtype_sql_time, dtype_timestamp) -// +// // If any of the datatypes is a BLOB datatype then : // - all types should be a BLOB else throw error. // - all types should have the same sub_type else throw error. @@ -2274,7 +2274,7 @@ static void get_dtype_of_list(const gpre_nod* node, gpre_fld* f) const gpre_fld& field = field_aux; // Trick to avoid more assignment mistakes. // Initialize some values if this is the first time - if (firstarg) + if (firstarg) { max_scale = field.fld_scale; max_length = max_dtype_length = field.fld_length; @@ -2404,7 +2404,7 @@ static void get_dtype_of_list(const gpre_nod* node, gpre_fld* f) any_text_blob = true; } } - else + else all_blob = false; } @@ -2427,7 +2427,7 @@ static void get_dtype_of_list(const gpre_nod* node, gpre_fld* f) f->fld_dtype = dtype_cstring; else f->fld_dtype = dtype_text; - + f->fld_ttype = ttype; f->fld_length = maxtextlength; f->fld_scale = 0; diff --git a/src/gpre/cmp.cpp b/src/gpre/cmp.cpp index 1c46f6ec9f..a502a3eb7c 100644 --- a/src/gpre/cmp.cpp +++ b/src/gpre/cmp.cpp @@ -1,27 +1,27 @@ //____________________________________________________________ -// +// // PROGRAM: C preprocessor // MODULE: cmp.cpp // DESCRIPTION: Request compiler -// +// // The contents of this file are subject to the Interbase Public // License Version 1.0 (the "License"); you may not use this file // except in compliance with the License. You may obtain a copy // of the License at http://www.Inprise.com/IPL.html -// +// // Software distributed under the License is distributed on an // "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express // or implied. See the License for the specific language governing // rights and limitations under the License. -// +// // The Original Code was created by Inprise Corporation // and its predecessors. Portions created by Inprise Corporation are // Copyright (C) Inprise Corporation. -// +// // All Rights Reserved. // Contributor(s): ______________________________________. // TMN (Mike Nordell) 11.APR.2001 - Reduce compiler warnings -// +// // //____________________________________________________________ // @@ -84,11 +84,11 @@ static ULONG next_ident; const int MAX_TPB = 4000; //____________________________________________________________ -// +// // Check to make sure that generated blr string is not about to // over the memory allocated for it. If so, allocate an extra // couple of hundred bytes to be safe. -// +// void CMP_check( gpre_req* request, SSHORT min_reqd) { @@ -112,11 +112,11 @@ void CMP_check( gpre_req* request, SSHORT min_reqd) //____________________________________________________________ -// +// // Compile a single request, but do not generate any text. // Generate port blocks, assign parameter numbers, message // numbers, and internal idents. Compute length of request. -// +// void CMP_compile_request( gpre_req* request) { @@ -135,7 +135,7 @@ void CMP_compile_request( gpre_req* request) request->req_ident = CMP_next_ident(); -// If this is an SQL blob cursor, compile the blob and get out fast. +// If this is an SQL blob cursor, compile the blob and get out fast. if (request->req_flags & (REQ_sql_blob_open | REQ_sql_blob_create)) { for (blb* blob = request->req_blobs; blob; blob = blob->blb_next) @@ -144,7 +144,7 @@ void CMP_compile_request( gpre_req* request) } // Before we get too far, make sure an eof field has been -// constructed. If not, do so now. +// constructed. If not, do so now. ref* reference; if (!eof_field) { @@ -162,7 +162,7 @@ void CMP_compile_request( gpre_req* request) lit1 = MSC_unary(nod_literal, (GPRE_NOD) reference); } -// Handle different request types differently +// Handle different request types differently switch (request->req_type) { case REQ_create_database: @@ -180,12 +180,12 @@ void CMP_compile_request( gpre_req* request) cmp_procedure(request); return; } -// expand any incomplete references or values +// expand any incomplete references or values expand_references(request->req_references); expand_references(request->req_values); -// Initialize the blr string +// Initialize the blr string request->req_blr = request->req_base = MSC_alloc(500); request->req_length = 500; @@ -195,13 +195,13 @@ void CMP_compile_request( gpre_req* request) request->add_byte(blr_version5); // If there are values to be transmitted, make a port -// to hold them +// to hold them if (request->req_values) request->req_vport = make_port(request, request->req_values); #ifdef SCROLLABLE_CURSORS -// If there is an asynchronous message to be sent, make a port for it +// If there is an asynchronous message to be sent, make a port for it if (request->req_flags & REQ_sql_cursor && request->req_database->dbb_base_level >= 5) @@ -221,7 +221,7 @@ void CMP_compile_request( gpre_req* request) #endif // If this is a FOR type request, an eof field reference needs -// to be generated. Do it. +// to be generated. Do it. if (request->req_type == REQ_for || request->req_type == REQ_cursor || request->req_type == REQ_any) @@ -238,7 +238,7 @@ void CMP_compile_request( gpre_req* request) else reference = request->req_references; -// Assume that a general port needs to be constructed. +// Assume that a general port needs to be constructed. gpre_port* port; if ((request->req_type != REQ_insert) && (request->req_type != REQ_store2) @@ -249,7 +249,7 @@ void CMP_compile_request( gpre_req* request) // Loop thru actions looking for something interesting to do. Not // all action types are "interesting", so don't worry about missing -// ones. +// ones. upd* update; for (act* action = request->req_actions; action; action = action->act_next) @@ -286,12 +286,12 @@ void CMP_compile_request( gpre_req* request) cmp_blr(request); request->add_byte(blr_eoc); -// Compute out final blr lengths +// Compute out final blr lengths request->req_length = request->req_blr - request->req_base; request->req_blr = request->req_base; -// Finally, assign identifiers to any blobs that may have been referenced +// Finally, assign identifiers to any blobs that may have been referenced for (blb* blob = request->req_blobs; blob; blob = blob->blb_next) cmp_blob(blob, false); @@ -299,12 +299,12 @@ void CMP_compile_request( gpre_req* request) //____________________________________________________________ -// +// // Stuff field datatype info into request. // Text fields are not remapped to process text type. // This is used by the CAST & COLLATE operators to // indicate cast datatypes. -// +// void CMP_external_field( gpre_req* request, const gpre_fld* field) { @@ -336,10 +336,10 @@ void CMP_external_field( gpre_req* request, const gpre_fld* field) //____________________________________________________________ -// +// // Initialize (or re-initialize) for request compilation. This is // called at most once per module. -// +// void CMP_init(void) { @@ -351,9 +351,9 @@ void CMP_init(void) //____________________________________________________________ -// +// // Give out next identifier. -// +// ULONG CMP_next_ident(void) { @@ -362,9 +362,9 @@ ULONG CMP_next_ident(void) //____________________________________________________________ -// +// // Stuff a symbol. -// +// void CMP_stuff_symbol( gpre_req* request, const gpre_sym* symbol) { @@ -376,17 +376,17 @@ void CMP_stuff_symbol( gpre_req* request, const gpre_sym* symbol) //____________________________________________________________ -// +// // Take a transaction block with (potentially) a // lot of relation lock blocks, and generate TPBs -// +// // We'll always generate TPB's, and link them // into the DBB for that database so they get // generated. If there's no lock list, we generate -// a simple TPB for every database in the program. +// a simple TPB for every database in the program. // If there is a lock list, we generate a more complex // TPB for each database referenced. -// +// void CMP_t_start( gpre_tra* trans) { @@ -394,7 +394,7 @@ void CMP_t_start( gpre_tra* trans) char tpb_buffer[MAX_TRA_OPTIONS + 1]; // fill out a standard tpb buffer ahead of time so we know -// how large it is +// how large it is char* text = tpb_buffer; *text++ = isc_tpb_version1; @@ -421,7 +421,7 @@ void CMP_t_start( gpre_tra* trans) for (dbb* database = gpreGlob.isc_databases; database; database = database->dbb_next) { - /* + /* * figure out if this is a simple transaction or a reserving * transaction. Allocate a TPB of the right size in either * case. @@ -459,7 +459,7 @@ void CMP_t_start( gpre_tra* trans) new_tpb->tpb_length = buff_len + tpb_len; database->dbb_rrls = NULL; } - else // this database isn't referenced + else // this database isn't referenced continue; /* link this into the TPB chains (gpre_tra and DBB) */ @@ -471,7 +471,7 @@ void CMP_t_start( gpre_tra* trans) trans->tra_tpb = new_tpb; trans->tra_db_count++; - // fill in the standard TPB and concatenate the relation names + // fill in the standard TPB and concatenate the relation names new_tpb->tpb_ident = CMP_next_ident(); @@ -485,9 +485,9 @@ void CMP_t_start( gpre_tra* trans) //____________________________________________________________ -// +// // Generate blr tree for free standing ANY expression. -// +// static void cmp_any( gpre_req* request) { @@ -502,7 +502,7 @@ static void cmp_any( gpre_req* request) gpre_nod* value = MSC_unary(nod_value, (GPRE_NOD) port->por_references); -// Make a send to signal end of file +// Make a send to signal end of file request->add_byte(blr_assignment); CME_expr(lit1, request); @@ -526,9 +526,9 @@ static void cmp_any( gpre_req* request) //____________________________________________________________ -// +// // Compile a build assignment statement. -// +// static void cmp_assignment( GPRE_NOD node, gpre_req* request) { @@ -540,9 +540,9 @@ static void cmp_assignment( GPRE_NOD node, gpre_req* request) //____________________________________________________________ -// +// // Compile a blob parameter block, if required. -// +// static void cmp_blob(blb* blob, bool sql_flag) @@ -588,7 +588,7 @@ static void cmp_blob(blb* blob, } if (blob->blb_from_charset) { - // create bpb instruction for source character set + // create bpb instruction for source character set *p++ = isc_bpb_source_interp; *p++ = 2; @@ -598,7 +598,7 @@ static void cmp_blob(blb* blob, if (blob->blb_to_charset) { - // create bpb instruction for target character set + // create bpb instruction for target character set *p++ = isc_bpb_target_interp; *p++ = 2; @@ -611,21 +611,21 @@ static void cmp_blob(blb* blob, //____________________________________________________________ -// +// // Build a request tree for a request. -// +// static void cmp_blr( gpre_req* request) { request->add_byte(blr_begin); -// build message definition for each port +// build message definition for each port gpre_port* port; for (port = request->req_ports; port; port = port->por_next) cmp_port(port, request); -// See if there is a receive to be built +// See if there is a receive to be built if ((request->req_type == REQ_store) || (request->req_type == REQ_store2)) port = request->req_primary; @@ -635,7 +635,7 @@ static void cmp_blr( gpre_req* request) if (port) make_receive(port, request); -// Compile up request +// Compile up request switch (request->req_type) { case REQ_cursor: @@ -670,9 +670,9 @@ static void cmp_blr( gpre_req* request) //____________________________________________________________ -// +// // Generate blr for ERASE action. -// +// static void cmp_erase( act* action, gpre_req* request) { @@ -689,11 +689,11 @@ static void cmp_erase( act* action, gpre_req* request) //____________________________________________________________ -// +// // Go over an SQL fetch list and expand // references to indicator variables. // Not tough. -// +// static void cmp_fetch( act* action) { @@ -717,9 +717,9 @@ static void cmp_fetch( act* action) //____________________________________________________________ -// +// // Stuff field datatype info into request. -// +// static void cmp_field( gpre_req* request, const gpre_fld* field, const ref* reference) @@ -741,7 +741,7 @@ static void cmp_field( gpre_req* request, const gpre_fld* field, request->add_word(field->fld_length); } else { - // 3.2j has new, tagged blr instruction for cstring + // 3.2j has new, tagged blr instruction for cstring request->add_byte(blr_cstring2); request->add_word(field->fld_ttype); @@ -755,7 +755,7 @@ static void cmp_field( gpre_req* request, const gpre_fld* field, request->add_word(field->fld_length); } else { - // 3.2j has new, tagged blr instruction for text too + // 3.2j has new, tagged blr instruction for text too request->add_byte(blr_text2); request->add_word(field->fld_ttype); @@ -769,7 +769,7 @@ static void cmp_field( gpre_req* request, const gpre_fld* field, request->add_word(field->fld_length); } else { - // 3.2j has new, tagged blr instruction for varying also + // 3.2j has new, tagged blr instruction for varying also request->add_byte(blr_varying2); request->add_word(field->fld_ttype); @@ -834,9 +834,9 @@ static void cmp_field( gpre_req* request, const gpre_fld* field, //____________________________________________________________ -// +// // Generate blr tree for for statement -// +// static void cmp_for( gpre_req* request) { @@ -863,7 +863,7 @@ static void cmp_for( gpre_req* request) CME_rse(request->req_rse, request); // Loop thru actions looking for primary port. While we're at it, -// count the number of update actions. +// count the number of update actions. bool updates = false; @@ -877,11 +877,11 @@ static void cmp_for( gpre_req* request) break; } } - + if (updates) request->add_byte(blr_begin); -// Build the primary send statement +// Build the primary send statement gpre_port* port = request->req_primary; make_send(port, request); @@ -916,7 +916,7 @@ static void cmp_for( gpre_req* request) } request->add_byte(blr_end); -// If there are any actions, handle them here +// If there are any actions, handle them here if (updates) { request->add_byte(blr_label); @@ -943,7 +943,7 @@ static void cmp_for( gpre_req* request) request->add_byte(blr_end); } -// Make a send to signal end of file +// Make a send to signal end of file make_send(port, request); request->add_byte(blr_assignment); @@ -956,9 +956,9 @@ static void cmp_for( gpre_req* request) //____________________________________________________________ -// +// // Compile a mass looping update statement. -// +// static void cmp_loop( gpre_req* request) { @@ -972,7 +972,7 @@ static void cmp_loop( gpre_req* request) for (ref* reference = primary->por_references; reference; reference = reference->ref_next) { - if (reference->ref_field == count_field) + if (reference->ref_field == count_field) counter->nod_arg[0] = (GPRE_NOD) reference; } @@ -1041,9 +1041,9 @@ static void cmp_loop( gpre_req* request) //____________________________________________________________ -// +// // Generate a receive and modify tree for a modify action. -// +// static void cmp_modify( act* action, gpre_req* request) { @@ -1058,7 +1058,7 @@ static void cmp_modify( act* action, gpre_req* request) request->add_byte(update->upd_source->ctx_internal); request->add_byte(update->upd_update->ctx_internal); -// count the references and build an assignment block +// count the references and build an assignment block gpre_nod* list = update->upd_assignments; request->add_byte(blr_begin); @@ -1078,9 +1078,9 @@ static void cmp_modify( act* action, gpre_req* request) //____________________________________________________________ -// +// // Build a request tree for a request. -// +// static void cmp_port( gpre_port* port, gpre_req* request) { @@ -1100,9 +1100,9 @@ static void cmp_port( gpre_port* port, gpre_req* request) //____________________________________________________________ -// -// Compile a EXECUTE PROCEDURE request. -// +// +// Compile a EXECUTE PROCEDURE request. +// static void cmp_procedure( gpre_req* request) { @@ -1111,7 +1111,7 @@ static void cmp_procedure( gpre_req* request) // Remember the order of the references. The exec_proc blr verb // requires parameters to be in parameter order which may be changed -// when there references are expanded. +// when there references are expanded. gpre_lls* outputs = NULL; ref* reference = request->req_references; @@ -1122,7 +1122,7 @@ static void cmp_procedure( gpre_req* request) } } -// Expand any incomplete references or values. +// Expand any incomplete references or values. expand_references(request->req_values); expand_references(request->req_references); @@ -1144,7 +1144,7 @@ static void cmp_procedure( gpre_req* request) request->req_primary = make_port(request, request->req_references); request->req_references = request->req_primary->por_references; -// build message definition for each port +// build message definition for each port for (gpre_port* port = request->req_ports; port; port = port->por_next) cmp_port(port, request); @@ -1196,10 +1196,10 @@ static void cmp_procedure( gpre_req* request) //____________________________________________________________ -// +// // Generate parameter buffer for READY with // buffercount. -// +// static void cmp_ready( gpre_req* request) { @@ -1241,10 +1241,10 @@ static void cmp_ready( gpre_req* request) request->add_byte(4); request->add_long(db->dbb_users); } - + const TEXT* p; SSHORT l; - + if (db->dbb_c_user && !db->dbb_r_user) { request->add_byte(isc_dpb_user_name); l = strlen(db->dbb_c_user); @@ -1273,7 +1273,7 @@ static void cmp_ready( gpre_req* request) } if (db->dbb_c_lc_messages && !db->dbb_r_lc_messages) { - // Language must be an ASCII string + // Language must be an ASCII string request->add_byte(isc_dpb_lc_messages); l = strlen(db->dbb_c_lc_messages); request->add_byte(l); @@ -1283,7 +1283,7 @@ static void cmp_ready( gpre_req* request) } if (db->dbb_c_lc_ctype && !db->dbb_r_lc_ctype) { - // Character Format must be an ASCII string + // Character Format must be an ASCII string request->add_byte(isc_dpb_lc_ctype); l = strlen(db->dbb_c_lc_ctype); request->add_byte(l); @@ -1301,10 +1301,10 @@ static void cmp_ready( gpre_req* request) //____________________________________________________________ -// +// // Build in a fudge to bias the language specific subscript to the // declared array subscript [i.e. C subscripts are zero based]. -// +// static void cmp_sdl_fudge( gpre_req* request, SLONG lower_bound) { @@ -1329,11 +1329,11 @@ static void cmp_sdl_fudge( gpre_req* request, SLONG lower_bound) } //____________________________________________________________ -// +// // Build an SDL loop for GET_SLICE/PUT_SLICE unless the upper and // lower bounds are constant. Return true if a loop has been built, // otherwise false. -// +// static bool cmp_sdl_loop(gpre_req* request, USHORT index, @@ -1361,10 +1361,10 @@ static bool cmp_sdl_loop(gpre_req* request, //____________________________________________________________ -// +// // Write the number in the 'smallest' // form possible to the SDL string. -// +// static void cmp_sdl_number( gpre_req* request, SLONG number) { @@ -1385,10 +1385,10 @@ static void cmp_sdl_number( gpre_req* request, SLONG number) //____________________________________________________________ -// +// // Build an SDL loop for GET_SLICE/PUT_SLICE unless the upper and // lower bounds are constant. -// +// static void cmp_sdl_subscript(gpre_req* request, USHORT index, const slc* slice, const ary* array) @@ -1407,9 +1407,9 @@ static void cmp_sdl_subscript(gpre_req* request, USHORT index, const slc* slice, //____________________________________________________________ -// +// // Stuff a slice description language value. -// +// static void cmp_sdl_value( gpre_req* request, const gpre_nod* node) { @@ -1432,9 +1432,9 @@ static void cmp_sdl_value( gpre_req* request, const gpre_nod* node) //____________________________________________________________ -// +// // generate blr for set generator -// +// static void cmp_set_generator( gpre_req* request) { @@ -1467,8 +1467,8 @@ static void cmp_set_generator( gpre_req* request) //____________________________________________________________ -// -// +// +// static void cmp_slice( gpre_req* request) { @@ -1478,7 +1478,7 @@ static void cmp_slice( gpre_req* request) gpre_fld* element = field->fld_array; const ary* array = field->fld_array_info; -// Process variable references +// Process variable references for (ref* reference = request->req_values; reference; reference = reference->ref_next) @@ -1507,7 +1507,7 @@ static void cmp_slice( gpre_req* request) for (bool* p = loop_flags; n < slice->slc_dimensions; n++, p++) *p = cmp_sdl_loop(request, n, slice, array); } // end scope block - + request->add_byte(isc_sdl_element); request->add_byte(1); request->add_byte(isc_sdl_scalar); @@ -1529,9 +1529,9 @@ static void cmp_slice( gpre_req* request) //____________________________________________________________ -// +// // Generate blr for a store request. -// +// static void cmp_store( gpre_req* request) { @@ -1544,7 +1544,7 @@ static void cmp_store( gpre_req* request) CME_relation(request->req_contexts, request); -// Make an assignment list +// Make an assignment list gpre_nod* list = request->req_node; request->add_byte(blr_begin); @@ -1559,7 +1559,7 @@ static void cmp_store( gpre_req* request) request->add_byte(blr_end); if (request->req_type == REQ_store2) { - // whip through actions to find return list + // whip through actions to find return list act* action; for (action = request->req_actions;; action = action->act_next) { @@ -1585,13 +1585,13 @@ static void cmp_store( gpre_req* request) //____________________________________________________________ -// +// // During the parsing of an SQL statement // we may have run into an indicator variable. // If so, all we've got now is its name, and // we really ought to build a full reference // block for it before we forget. -// +// static void expand_references( REF reference) { @@ -1609,10 +1609,10 @@ static void expand_references( REF reference) //____________________________________________________________ -// +// // Make up a port block and process a linked list // of field references. -// +// static gpre_port* make_port( gpre_req* request, REF reference) { @@ -1622,8 +1622,8 @@ static gpre_port* make_port( gpre_req* request, REF reference) port->por_next = request->req_ports; request->req_ports = port; -// Hmmm -- no references. Not going to fly. -// Make up a dummy reference. +// Hmmm -- no references. Not going to fly. +// Make up a dummy reference. if (!reference) { reference = (REF) MSC_alloc(REF_LEN); @@ -1684,9 +1684,9 @@ static gpre_port* make_port( gpre_req* request, REF reference) //____________________________________________________________ -// +// // Make a receive node for a given port. -// +// static void make_receive( gpre_port* port, gpre_req* request) { @@ -1696,9 +1696,9 @@ static void make_receive( gpre_port* port, gpre_req* request) //____________________________________________________________ -// +// // Make a receive node for a given port. -// +// static void make_send( gpre_port* port, gpre_req* request) { @@ -1708,10 +1708,10 @@ static void make_send( gpre_port* port, gpre_req* request) //____________________________________________________________ -// +// // where a duplicate reference list is used // to build the port, fix request_references -// +// static void update_references( REF references) { diff --git a/src/gpre/cob.cpp b/src/gpre/cob.cpp index a344a35b60..0009847483 100644 --- a/src/gpre/cob.cpp +++ b/src/gpre/cob.cpp @@ -1,29 +1,29 @@ //____________________________________________________________ -// +// // PROGRAM: General preprocessor // MODULE: cob.cpp // DESCRIPTION: COBOL text generator -// +// // The contents of this file are subject to the Interbase Public // License Version 1.0 (the "License"); you may not use this file // except in compliance with the License. You may obtain a copy // of the License at http://www.Inprise.com/IPL.html -// +// // Software distributed under the License is distributed on an // "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express // or implied. See the License for the specific language governing // rights and limitations under the License. -// +// // The Original Code was created by Inprise Corporation // and its predecessors. Portions created by Inprise Corporation are // Copyright (C) Inprise Corporation. -// +// // All Rights Reserved. // Contributor(s): ______________________________________. // Solaris x86 changes - Konstantin Kuznetsov, Neil McCalden // 8-Mar-2002 FSG (Frank Schlottmann-Gödde) tiny cobol support // fixed Bug No. 526204* -// +// // //____________________________________________________________ // @@ -273,13 +273,13 @@ static const TEXT* vnames[] = { "ISC_HEIGHT", "RDB_K_DB_TYPE_GDS", "ISC_ARRAY_LENGTH", - " ", // column - "* ", // comment - "- ", // continue - "- \"", // continue quote - "- \'", // continue single quote - "", // column0 - " ", // column indent + " ", // column + "* ", // comment + "- ", // continue + "- \"", // continue quote + "- \'", // continue single quote + "", // column0 + " ", // column indent "ISC_SQLCODE", "ISC_EVENTS_VECTOR", "ISC_EVENTS", @@ -306,13 +306,13 @@ static const TEXT* anames[] = { "ISC-HEIGHT", "RDB-K-DB-TYPE-GDS", "ISC-ARRAY-LENGTH", - " ", // column - " * ", // comment - " ", // continue - " - \"", // continue quote - " - \'", // continue single quote - " ", // column0 - " ", // column indent + " ", // column + " * ", // comment + " ", // continue + " - \"", // continue quote + " - \'", // continue single quote + " ", // column0 + " ", // column indent "ISC-SQL-CODE", "ISC-EVENTS-VECTOR", "ISC-EVENTS", @@ -359,8 +359,8 @@ static const char* const INDENT = " "; //____________________________________________________________ -// -// +// +// void COB_action(const act* action, int column) { @@ -616,10 +616,10 @@ void COB_action(const act* action, int column) //____________________________________________________________ -// +// // point 'names' at the appropriate list // ANSI has no underscores. -// +// void COB_name_init(bool ansi) { @@ -629,13 +629,13 @@ void COB_name_init(bool ansi) //____________________________________________________________ -// +// // Print a statment, breaking it into // reasonable 80 character hunks. This // function now works for COBOL statements // which are function calls and non-function // calls. -// +// void COB_print_buffer(TEXT* output_bufferL, bool function_call) @@ -673,7 +673,7 @@ void COB_print_buffer(TEXT* output_bufferL, save_open_quote = open_quote; save_single_quote = single_quote; if (function_call) { - // Back up until we reach a comma + // Back up until we reach a comma for (p--; (p > s); p--, q--) { if (*(p + 1) == '\"' || *(p + 1) == '\'') { /* If we have a single or double quote, toggle the @@ -719,7 +719,7 @@ void COB_print_buffer(TEXT* output_bufferL, *++p = 0; } else { - // back up to a blank + // back up to a blank for (p--; p > s; p--, q--) { if (*(p + 1) == '\"' || *(p + 1) == '\'') { /* If we have a single or double quote, toggle the @@ -763,10 +763,10 @@ void COB_print_buffer(TEXT* output_bufferL, #ifdef NOT_USED_OR_REPLACED //____________________________________________________________ -// +// // Align output to a specific column for output. If the // column is negative, don't do anything. -// +// static void align( int column) { @@ -786,10 +786,10 @@ static void align( int column) //____________________________________________________________ -// +// // Build an assignment from a host language variable to // a port variable. -// +// static void asgn_from( const act* action, const ref* reference) { @@ -835,10 +835,10 @@ static void asgn_from( const act* action, const ref* reference) } //____________________________________________________________ -// +// // Build an assignment to a host language variable from // a port variable. -// +// static void asgn_to( const act* action, ref* reference) { @@ -859,7 +859,7 @@ static void asgn_to( const act* action, ref* reference) names[COLUMN], s, reference->ref_value); COB_print_buffer(output_buffer, false); -// Pick up NULL value if one is there +// Pick up NULL value if one is there if (reference = reference->ref_null) { sprintf(output_buffer, "%sMOVE %s TO %s\n", @@ -871,10 +871,10 @@ static void asgn_to( const act* action, ref* reference) //____________________________________________________________ -// +// // Build an assignment to a host language variable from // a port variable. -// +// static void asgn_to_proc( const ref* reference) { @@ -893,10 +893,10 @@ static void asgn_to_proc( const ref* reference) //____________________________________________________________ -// +// // Generate a function call for free standing ANY. Somebody else // will need to generate the actual function. -// +// static void gen_any( const act* action) { @@ -918,9 +918,9 @@ static void gen_any( const act* action) //____________________________________________________________ -// +// // Generate code for AT END clause of FETCH. -// +// static void gen_at_end( const act* action) { @@ -934,9 +934,9 @@ static void gen_at_end( const act* action) //____________________________________________________________ -// +// // Substitute for a BASED ON clause. -// +// static void gen_based( const act* action) { @@ -954,14 +954,14 @@ static void gen_based( const act* action) else if (field->fld_array_info) { CPR_error("Based on currently not implemented for arrays."); return; // silence non initialized warning -// +// // TBD - messy // datatype = field->fld_array_info->ary_dtype; // for (dimension = field->fld_array_info->ary_dimension; dimension; // dimension = dimension->dim_next) -// { +// { // fprintf (gpreGlob.out_file, " -// +// } else datatype = field->fld_dtype; @@ -1030,9 +1030,9 @@ static void gen_based( const act* action) //____________________________________________________________ -// +// // Make a blob FOR loop. -// +// static void gen_blob_close( const act* action) { @@ -1058,9 +1058,9 @@ static void gen_blob_close( const act* action) //____________________________________________________________ -// +// // End a blob FOR loop. -// +// static void gen_blob_end( const act* action) { @@ -1083,9 +1083,9 @@ static void gen_blob_end( const act* action) //____________________________________________________________ -// +// // Make a blob FOR loop. -// +// static void gen_blob_for( const act* action) { @@ -1099,9 +1099,9 @@ static void gen_blob_for( const act* action) //____________________________________________________________ -// +// // Generate the call to open (or create) a blob. -// +// static void gen_blob_open( const act* action) { @@ -1168,9 +1168,9 @@ static void gen_blob_open( const act* action) //____________________________________________________________ -// +// // Callback routine for BLR pretty printer. -// +// static void gen_blr(void* user_arg, SSHORT offset, const char* string) { @@ -1238,9 +1238,9 @@ static void gen_blr(void* user_arg, SSHORT offset, const char* string) //____________________________________________________________ -// +// // Zap all know handles. -// +// static void gen_clear_handles( const act* action) { @@ -1252,9 +1252,9 @@ static void gen_clear_handles( const act* action) //____________________________________________________________ -// +// // Generate text to compile a request. -// +// static void gen_compile( const act* action) { @@ -1262,17 +1262,17 @@ static void gen_compile( const act* action) const dbb* db = request->req_database; const gpre_sym* symbol = db->dbb_name; -// generate automatic ready if appropriate +// generate automatic ready if appropriate if (gpreGlob.sw_auto) t_start_auto(request, status_vector(action), action, true); -// +// // always generate a compile, a test for the success of the compile, // and an end to the 'if not compiled test -// +// -// generate an 'if not compiled' +// generate an 'if not compiled' printa(names[COLUMN], false, "IF %s = 0 THEN", request->req_handle); @@ -1296,7 +1296,7 @@ static void gen_compile( const act* action) printa(names[COLUMN], false, "END-IF"); // If blobs are present, zero out all of the blob handles. After this -// point, the handles are the user's responsibility +// point, the handles are the user's responsibility const blb* blob = request->req_blobs; if (blob) @@ -1310,9 +1310,9 @@ static void gen_compile( const act* action) //____________________________________________________________ -// +// // Generate a call to create a database. -// +// static void gen_create_database( const act* action) { @@ -1328,7 +1328,7 @@ static void gen_create_database( const act* action) sprintf(s2, "%s%d", names[isc_b_pos], request->req_ident); /* if the dpb needs to be extended at runtime to include items - in host variables, do so here; this assumes that there is + in host variables, do so here; this assumes that there is always a request generated for runtime variables */ if (request->req_flags & REQ_extend_dpb) { @@ -1433,7 +1433,7 @@ static void gen_create_database( const act* action) (request->req_length) ? s2Tmp : OMITTED, BY_VALUE, END_VALUE); COB_print_buffer(output_buffer, true); -// if the dpb was extended, free it here +// if the dpb was extended, free it here if (request && request->req_flags & REQ_extend_dpb) { if (request->req_length) { @@ -1446,7 +1446,7 @@ static void gen_create_database( const act* action) "%sCALL \"%s\" USING %s\n", names[COLUMN], ISC_FREE, s2Tmp); COB_print_buffer(output_buffer, true); - // reset the length of the dpb + // reset the length of the dpb sprintf(output_buffer, "%sMOVE %d to %s", names[COLUMN], request->req_length, s1); COB_print_buffer(output_buffer, true); @@ -1462,9 +1462,9 @@ static void gen_create_database( const act* action) //____________________________________________________________ -// +// // Generate substitution text for END_STREAM. -// +// static void gen_cursor_close( const act* action, const gpre_req* request) { @@ -1481,15 +1481,15 @@ static void gen_cursor_close( const act* action, const gpre_req* request) //____________________________________________________________ -// +// // Generate text to initialize a cursor. -// +// static void gen_cursor_init( const act* action) { // If blobs are present, zero out all of the blob handles. After this -// point, the handles are the user's responsibility +// point, the handles are the user's responsibility if (action->act_request->req_flags & (REQ_sql_blob_open | REQ_sql_blob_create)) { @@ -1500,9 +1500,9 @@ static void gen_cursor_init( const act* action) //____________________________________________________________ -// +// // Generate text to open an embedded SQL cursor. -// +// static void gen_cursor_open( const act* action, const gpre_req* request) { @@ -1529,7 +1529,7 @@ static void gen_cursor_open( const act* action, const gpre_req* request) if (gpreGlob.sw_auto) printa(names[COLUMN], false, "IF %s NOT = 0 THEN", request_trans(action, request)); - + TEXT s[MAX_CURSOR_SIZE]; make_name_formatted(s, "ISC-CONST-%s", ((open_cursor*) action->act_object)->opn_cursor); @@ -1553,9 +1553,9 @@ static void gen_cursor_open( const act* action, const gpre_req* request) //____________________________________________________________ -// +// // Generate insertion text for the database statement. -// +// static void gen_database( const act* action) { @@ -1584,7 +1584,7 @@ static void gen_database( const act* action) (all_static) ? "" : (all_extern) ? " IS EXTERNAL" : " IS GLOBAL", (all_extern) ? "" : " VALUE IS 0"); - // generate variables to hold database name strings for attach call + // generate variables to hold database name strings for attach call db->dbb_id = ++count; if (db->dbb_runtime) { @@ -1606,7 +1606,7 @@ static void gen_database( const act* action) } } -// loop through actions: find readys to generate vars for quoted strings +// loop through actions: find readys to generate vars for quoted strings TEXT fname[80], s1[MAX_CURSOR_SIZE]; bool dyn_immed = false; @@ -1649,11 +1649,11 @@ static void gen_database( const act* action) else cur_stmt = ((open_cursor*) local_act->act_object)->opn_cursor; - // Only generate one declaration per cursor or statement name + // Only generate one declaration per cursor or statement name const act* chck_dups; for (chck_dups = local_act->act_rest; chck_dups; - chck_dups = chck_dups->act_rest) + chck_dups = chck_dups->act_rest) { const gpre_sym* dup; if (chck_dups->act_type == ACT_dyn_cursor) @@ -1738,7 +1738,7 @@ static void gen_database( const act* action) names[isc_a_pos], blob->blb_len_ident, COMP_VALUE); } - // Array declarations + // Array declarations if (port = request->req_primary) for (REF reference = port->por_references; reference; @@ -1749,7 +1749,7 @@ static void gen_database( const act* action) } } -// Generate event parameter block for each event +// Generate event parameter block for each event USHORT max_count = 0; for (const gpre_lls* stack_ptr = gpreGlob.events; stack_ptr; stack_ptr = stack_ptr->lls_next) @@ -1779,9 +1779,9 @@ static void gen_database( const act* action) //____________________________________________________________ -// +// // Generate a call to update metadata. -// +// static void gen_ddl( const act* action) { @@ -1824,9 +1824,9 @@ static void gen_ddl( const act* action) //____________________________________________________________ -// +// // Generate a dynamic SQL statement. -// +// static void gen_dyn_close( const act* action) { @@ -1842,9 +1842,9 @@ static void gen_dyn_close( const act* action) //____________________________________________________________ -// +// // Generate a dynamic SQL statement. -// +// static void gen_dyn_declare( const act* action) { @@ -1863,9 +1863,9 @@ static void gen_dyn_declare( const act* action) //____________________________________________________________ -// +// // Generate a dynamic SQL statement. -// +// static void gen_dyn_describe(const act* action, bool bind_flag) @@ -1887,9 +1887,9 @@ static void gen_dyn_describe(const act* action, //____________________________________________________________ -// +// // Generate a dynamic SQL statement. -// +// static void gen_dyn_execute( const act* action) { @@ -1938,9 +1938,9 @@ static void gen_dyn_execute( const act* action) //____________________________________________________________ -// +// // Generate a dynamic SQL statement. -// +// static void gen_dyn_fetch( const act* action) { @@ -1967,9 +1967,9 @@ static void gen_dyn_fetch( const act* action) //____________________________________________________________ -// +// // Generate code for an EXECUTE IMMEDIATE dynamic SQL statement. -// +// static void gen_dyn_immediate( const act* action) { @@ -2023,9 +2023,9 @@ static void gen_dyn_immediate( const act* action) //____________________________________________________________ -// +// // Generate a dynamic SQL statement. -// +// static void gen_dyn_insert( const act* action) { @@ -2049,9 +2049,9 @@ static void gen_dyn_insert( const act* action) //____________________________________________________________ -// +// // Generate a dynamic SQL statement. -// +// static void gen_dyn_open( const act* action) { @@ -2100,9 +2100,9 @@ static void gen_dyn_open( const act* action) //____________________________________________________________ -// +// // Generate a dynamic SQL statement. -// +// static void gen_dyn_prepare( const act* action) { @@ -2157,9 +2157,9 @@ static void gen_dyn_prepare( const act* action) //____________________________________________________________ -// +// // Generate substitution text for END_MODIFY. -// +// static void gen_emodify( const act* action) { @@ -2195,9 +2195,9 @@ static void gen_emodify( const act* action) //____________________________________________________________ -// +// // Generate substitution text for END_STORE. -// +// static void gen_estore( const act* action) { @@ -2207,9 +2207,9 @@ static void gen_estore( const act* action) //____________________________________________________________ -// +// // Generate end-if for AT_END if statement -// +// static void gen_end_fetch( const act* action) { @@ -2220,9 +2220,9 @@ static void gen_end_fetch( const act* action) //____________________________________________________________ -// +// // Generate definitions associated with a single request. -// +// static void gen_endfor( const act* action) { @@ -2236,9 +2236,9 @@ static void gen_endfor( const act* action) //____________________________________________________________ -// +// // Generate substitution text for ERASE. -// +// static void gen_erase( const act* action) { @@ -2248,10 +2248,10 @@ static void gen_erase( const act* action) //____________________________________________________________ -// +// // Generate event parameter blocks for use // with a particular call to isc_event_wait. -// +// static SSHORT gen_event_block( const act* action) { @@ -2274,9 +2274,9 @@ static SSHORT gen_event_block( const act* action) //____________________________________________________________ -// +// // Generate substitution text for EVENT_INIT. -// +// static void gen_event_init( const act* action) { @@ -2309,7 +2309,7 @@ static void gen_event_init( const act* action) args.pat_string5 = names[ISC_EVENTS_VECTOR]; args.pat_string6 = names[ISC_EVENT_NAMES_VECTOR]; -// generate call to dynamically generate event blocks +// generate call to dynamically generate event blocks TEXT variable[MAX_REF_SIZE]; const gpre_nod *const *ptr, *const *end; @@ -2335,11 +2335,11 @@ static void gen_event_init( const act* action) PATTERN_expand(column, pattern1, &args); -// generate actual call to event_wait +// generate actual call to event_wait PATTERN_expand(column, pattern2, &args); -// get change in event counts, copying event parameter block for reuse +// get change in event counts, copying event parameter block for reuse PATTERN_expand(column, pattern3, &args); set_sqlcode(action); @@ -2347,9 +2347,9 @@ static void gen_event_init( const act* action) //____________________________________________________________ -// +// // Generate substitution text for EVENT_WAIT. -// +// static void gen_event_wait( const act* action) { @@ -2361,7 +2361,7 @@ static void gen_event_wait( const act* action) gpre_sym* event_name = (gpre_sym*) action->act_object; // go through the stack of gpreGlob.events, checking to see if the -// event has been initialized and getting the event identifier +// event has been initialized and getting the event identifier const dbb* database = NULL; int ident = -1; @@ -2395,7 +2395,7 @@ static void gen_event_wait( const act* action) args.pat_string4 = names[isc_a_pos]; args.pat_string5 = names[ISC_EVENTS_VECTOR]; -// generate calls to wait on the event and to fill out the gpreGlob.events array +// generate calls to wait on the event and to fill out the gpreGlob.events array PATTERN_expand(column, pattern1, &args); PATTERN_expand(column, pattern2, &args); @@ -2404,11 +2404,11 @@ static void gen_event_wait( const act* action) //____________________________________________________________ -// +// // Generate replacement text for the SQL FETCH statement. The // epilog FETCH statement is handled by GEN_S_FETCH (generate // stream fetch). -// +// static void gen_fetch( const act* action) { @@ -2417,8 +2417,8 @@ static void gen_fetch( const act* action) #ifdef SCROLLABLE_CURSORS gpre_port* port = request->req_aport; if (port) { - /* set up the reference to point to the correct value - in the linked list of values, and prepare for the + /* set up the reference to point to the correct value + in the linked list of values, and prepare for the next FETCH statement if applicable */ REF reference; @@ -2430,23 +2430,23 @@ static void gen_fetch( const act* action) reference->ref_values = value->val_next; } - // find the direction and offset parameters + // find the direction and offset parameters reference = port->por_references; const char* offset = reference->ref_value; reference = reference->ref_next; const char* direction = reference->ref_value; - /* the direction in which the engine will scroll is sticky, so check to see - the last direction passed to the engine; if the direction is the same and - the offset is 1, then there is no need to pass the message; this prevents + /* the direction in which the engine will scroll is sticky, so check to see + the last direction passed to the engine; if the direction is the same and + the offset is 1, then there is no need to pass the message; this prevents extra packets and allows for batch fetches in either direction */ printa(names[COLUMN], false, "IF %s%dDI MOD 2 NOT = %s || %s NOT = 1 THEN", names[isc_a_pos], request->req_ident, direction, offset); - /* assign the direction and offset parameters to the appropriate message, + /* assign the direction and offset parameters to the appropriate message, then send the message to the engine */ asgn_from(action, port->por_references); @@ -2483,9 +2483,9 @@ static void gen_fetch( const act* action) //____________________________________________________________ -// +// // Generate substitution text for FINISH -// +// static void gen_finish( const act* action) { @@ -2502,7 +2502,7 @@ static void gen_finish( const act* action) printa(names[COLUMN], false, "END-IF"); } -// the user may have supplied one or more handles +// the user may have supplied one or more handles const dbb* db = NULL; for (const rdy* ready = (rdy*) action->act_object; ready; ready = ready->rdy_next) { @@ -2516,7 +2516,7 @@ static void gen_finish( const act* action) printa(names[COLUMN], false, "END-IF"); } -// no handles, so finish all known databases +// no handles, so finish all known databases if (!db) for (db = gpreGlob.isc_databases; db; db = db->dbb_next) { @@ -2533,9 +2533,9 @@ static void gen_finish( const act* action) //____________________________________________________________ -// +// // Generate substitution text for FOR statement. -// +// static void gen_for( const act* action) { @@ -2559,9 +2559,9 @@ static void gen_for( const act* action) //____________________________________________________________ -// +// // Generate a function for free standing ANY or statistical. -// +// static void gen_function( const act* function) { @@ -2659,10 +2659,10 @@ static void gen_function( const act* function) //____________________________________________________________ -// +// // Generate a call to isc_get_slice // or isc_put_slice for an array. -// +// static void gen_get_or_put_slice(const act* action, const ref* reference, @@ -2688,18 +2688,18 @@ static void gen_get_or_put_slice(const act* action, gen_name(s1, reference, true); // blob handle args.pat_string2 = s1; - args.pat_value1 = reference->ref_sdl_length; // slice descr length + args.pat_value1 = reference->ref_sdl_length; // slice descr length TEXT s2[MAX_REF_SIZE]; - sprintf(s2, "%s%d", names[isc_a_pos], reference->ref_sdl_ident); // slice description + sprintf(s2, "%s%d", names[isc_a_pos], reference->ref_sdl_ident); // slice description args.pat_string3 = s2; - args.pat_value2 = 0; // parameter length + args.pat_value2 = 0; // parameter length - args.pat_string4 = "0"; // parameter + args.pat_string4 = "0"; // parameter args.pat_long1 = reference->ref_field->fld_array_info->ary_size; - // slice size + // slice size TEXT s4[MAX_REF_SIZE + 2]; if (action->act_flags & ACT_sql) { args.pat_string5 = reference->ref_value; @@ -2707,10 +2707,10 @@ static void gen_get_or_put_slice(const act* action, else { sprintf(s4, "%s%dL", names[isc_a_pos], reference->ref_field->fld_array_info->ary_ident); - args.pat_string5 = s4; // array name + args.pat_string5 = s4; // array name } - args.pat_string6 = names[ISC_ARRAY_LENGTH]; // return length + args.pat_string6 = names[ISC_ARRAY_LENGTH]; // return length args.pat_string7 = (get) ? ISC_GET_SLICE : ISC_PUT_SLICE; PATTERN_expand(column, (get) ? pattern1 : pattern2, &args); @@ -2719,9 +2719,9 @@ static void gen_get_or_put_slice(const act* action, //____________________________________________________________ -// +// // Generate the code to do a get segment. -// +// static void gen_get_segment( const act* action) { @@ -2761,10 +2761,10 @@ static void gen_get_segment( const act* action) //____________________________________________________________ -// -// Generate text to compile and start a SQL mass update. -// -// +// +// Generate text to compile and start a SQL mass update. +// +// static void gen_loop( const act* action) { @@ -2784,10 +2784,10 @@ static void gen_loop( const act* action) //____________________________________________________________ -// +// // Generate a name for a reference. Name is constructed from // port and parameter idents. -// +// static TEXT* gen_name(TEXT* const string, const ref* reference, @@ -2806,9 +2806,9 @@ static TEXT* gen_name(TEXT* const string, //____________________________________________________________ -// +// // Generate a block to handle errors. -// +// static void gen_on_error( const act* action) { @@ -2819,9 +2819,9 @@ static void gen_on_error( const act* action) //____________________________________________________________ -// +// // Generate code for an EXECUTE PROCEDURE. -// +// static void gen_procedure( const act* action) { @@ -2848,16 +2848,16 @@ static void gen_procedure( const act* action) "CALL \"isc_transact_request\" USING %V1, %RF%DH%RE, %RF%RT%RE, %VF%RS%VE, %RI, %VF0%VE, 0, %VF%QL%VE, %RF%QI%RE\n"; } -// Get database attach and transaction started +// Get database attach and transaction started if (gpreGlob.sw_auto) t_start_auto(0, status_vector(action), action, true); -// Move in input values +// Move in input values asgn_from(action, request->req_values); -// Execute the procedure +// Execute the procedure const USHORT column = strlen(names[COLUMN]); PATTERN_expand(column, pattern, &args); @@ -2866,7 +2866,7 @@ static void gen_procedure( const act* action) printa(names[COLUMN], false, "IF SQLCODE = 0 THEN"); -// Move out output values +// Move out output values asgn_to_proc(request->req_references); printa(names[COLUMN], false, "END-IF"); @@ -2874,9 +2874,9 @@ static void gen_procedure( const act* action) //____________________________________________________________ -// +// // Generate the code to do a put segment. -// +// static void gen_put_segment( const act* action) { @@ -2910,9 +2910,9 @@ static void gen_put_segment( const act* action) //____________________________________________________________ -// +// // Generate BLR in raw, numeric form. Ughly but dense. -// +// static void gen_raw( const UCHAR* blr, @@ -2960,13 +2960,13 @@ static void gen_raw( //____________________________________________________________ -// +// // Generate substitution text for READY // This becomes baroque for mpexl where we // must generate a variable if the user gives us // a string literal. mpexl cobol doesn't take // string literals as CALL parameters. -// +// static void gen_ready( const act* action) { @@ -3012,7 +3012,7 @@ static void gen_ready( const act* action) //____________________________________________________________ -// +// // Generate substitution text for RELEASE_REQUESTS // For active databases, call isc_release_request. // for all others, just zero the handle. For the @@ -3020,7 +3020,7 @@ static void gen_ready( const act* action) // are likely if the request was compiled on a database // which has been released and re-readied. If there is // a serious error, it will be caught on the next statement. -// +// static void gen_release( const act* action) { @@ -3045,9 +3045,9 @@ static void gen_release( const act* action) //____________________________________________________________ -// +// // Generate a send or receive call for a port. -// +// static void gen_receive( const act* action, const gpre_port* port) { @@ -3069,13 +3069,13 @@ static void gen_receive( const act* action, const gpre_port* port) //____________________________________________________________ -// +// // Generate definitions associated with a single request. -// Requests are generated as raw BLR in longword chunks +// Requests are generated as raw BLR in longword chunks // because COBOL is a miserable excuse for a language // and doesn't allow byte value assignments to character // fields. -// +// static void gen_request( gpre_req* request) { @@ -3094,8 +3094,8 @@ static void gen_request( gpre_req* request) request->req_ident, COMP_VALUE, request->req_length); // check the case where we need to extend the dpb dynamically at runtime, -// in which case we need dpb length and a pointer to be defined even if -// there is no static dpb defined +// in which case we need dpb length and a pointer to be defined even if +// there is no static dpb defined if (request->req_flags & REQ_extend_dpb) { printa(names[COLUMN_0], false, @@ -3108,7 +3108,7 @@ static void gen_request( gpre_req* request) "01 %s%dS PIC S9(9) USAGE COMP VALUE IS 0.", names[isc_a_pos], request->req_ident); -// generate the request as BLR long words +// generate the request as BLR long words if (request->req_length) { if (request->req_flags & REQ_sql_cursor) @@ -3125,7 +3125,7 @@ static void gen_request( gpre_req* request) names[isc_a_pos], request->req_ident); gen_raw(request->req_blr, request->req_type, request->req_length, request->req_ident); - + const char* string_type; if (!gpreGlob.sw_raw) { printa(names[COMMENT], false, " "); @@ -3180,7 +3180,7 @@ static void gen_request( gpre_req* request) string_type, names[isc_a_pos], request->req_ident); } -// Print out slice description language if there are arrays associated with request +// Print out slice description language if there are arrays associated with request for (gpre_port* port = request->req_ports; port; port = port->por_next) for (const ref* reference = port->por_references; reference; @@ -3202,7 +3202,7 @@ static void gen_request( gpre_req* request) } } -// Print out any blob parameter blocks required +// Print out any blob parameter blocks required for (const blb* blob = request->req_blobs; blob; blob = blob->blb_next) if (blob->blb_const_from_type || blob->blb_const_to_type) { printa(names[COLUMN_0], false, "01 %s%d.", @@ -3211,7 +3211,7 @@ static void gen_request( gpre_req* request) (int) (IPTR) request); printa(names[COMMENT], false, " "); } -// If this is a GET_SLICE/PUT_slice, allocate some variables +// If this is a GET_SLICE/PUT_slice, allocate some variables if (request->req_type == REQ_slice) { printa(names[COLUMN_0], false, "01 %s%dv.", names[isc_b_pos], @@ -3227,9 +3227,9 @@ static void gen_request( gpre_req* request) //____________________________________________________________ -// +// // Generate substitution text for END_STREAM. -// +// static void gen_s_end( const act* action) { @@ -3255,9 +3255,9 @@ static void gen_s_end( const act* action) //____________________________________________________________ -// +// // Generate substitution text for FETCH. -// +// static void gen_s_fetch( const act* action) { @@ -3270,10 +3270,10 @@ static void gen_s_fetch( const act* action) //____________________________________________________________ -// +// // Generate text to compile and start a stream. This is // used both by START_STREAM and FOR -// +// static void gen_s_start( const act* action) { @@ -3288,7 +3288,7 @@ static void gen_s_start( const act* action) if (action->act_type == ACT_open) gen_cursor_open(action, request); -// Do not call "gen_start" in case if "gen_compile" failed +// Do not call "gen_start" in case if "gen_compile" failed if (action->act_error || (action->act_flags & ACT_sql)) { if (gpreGlob.sw_auto) @@ -3316,9 +3316,9 @@ static void gen_s_start( const act* action) //____________________________________________________________ -// +// // Generate a send call for a port. -// +// static void gen_send( const act* action, const gpre_port* port) { @@ -3341,9 +3341,9 @@ static void gen_send( const act* action, const gpre_port* port) //____________________________________________________________ -// +// // Generate support for get/put slice statement. -// +// static void gen_slice( const act* action) { @@ -3357,7 +3357,7 @@ static void gen_slice( const act* action) const slc* slice = (slc*) action->act_object; const gpre_req* parent_request = slice->slc_parent_request; -// Compute array size +// Compute array size fprintf(gpreGlob.out_file, " COMPUTE %s%ds = %d", names[isc_b_pos], @@ -3379,7 +3379,7 @@ static void gen_slice( const act* action) } fprintf(gpreGlob.out_file, "\n"); -// Make assignments to variable vector +// Make assignments to variable vector const ref* reference; for (reference = request->req_values; reference; @@ -3392,16 +3392,16 @@ static void gen_slice( const act* action) PAT args; args.pat_reference = slice->slc_field_ref; - args.pat_request = parent_request; // blob id request - args.pat_vector1 = status_vector(action); // status vector - args.pat_database = parent_request->req_database; // database handle - args.pat_string1 = action->act_request->req_trans; // transaction handle - args.pat_value1 = request->req_length; // slice descr. length - args.pat_ident1 = request->req_ident; // request name - args.pat_value2 = slice->slc_parameters * sizeof(SLONG); // parameter length + args.pat_request = parent_request; // blob id request + args.pat_vector1 = status_vector(action); // status vector + args.pat_database = parent_request->req_database; // database handle + args.pat_string1 = action->act_request->req_trans; // transaction handle + args.pat_value1 = request->req_length; // slice descr. length + args.pat_ident1 = request->req_ident; // request name + args.pat_value2 = slice->slc_parameters * sizeof(SLONG); // parameter length reference = (REF) slice->slc_array->nod_arg[0]; - args.pat_string5 = reference->ref_value; // array name + args.pat_string5 = reference->ref_value; // array name args.pat_string6 = names[ISC_ARRAY_LENGTH]; args.pat_string7 = (action->act_type == ACT_get_slice) ? ISC_GET_SLICE : ISC_PUT_SLICE; @@ -3413,9 +3413,9 @@ static void gen_slice( const act* action) //____________________________________________________________ -// +// // Substitute for a segment, segment length, or blob handle. -// +// static void gen_segment( const act* action) { @@ -3430,8 +3430,8 @@ static void gen_segment( const act* action) //____________________________________________________________ -// -// +// +// static void gen_select( const act* action) { @@ -3443,7 +3443,7 @@ static void gen_select( const act* action) gen_s_start(action); -// BUG8321: Do not call "receive" in case if SQLCODE is not equal 0 +// BUG8321: Do not call "receive" in case if SQLCODE is not equal 0 printa(names[COLUMN], false, "IF SQLCODE = 0 THEN"); gen_receive(action, port); @@ -3472,10 +3472,10 @@ static void gen_select( const act* action) //____________________________________________________________ -// +// // Generate either a START or START_AND_SEND depending // on whether or a not a port is present. -// +// static void gen_start( const act* action, const gpre_port* port) { @@ -3519,17 +3519,17 @@ static void gen_start( const act* action, const gpre_port* port) //____________________________________________________________ -// +// // Generate text for STORE statement. This includes the compile // call and any variable initialization required. -// +// static void gen_store( const act* action) { const gpre_req* request = action->act_request; gen_compile(action); -// Initialize any blob fields +// Initialize any blob fields TEXT name[MAX_REF_SIZE]; const gpre_port* port = request->req_primary; @@ -3547,15 +3547,15 @@ static void gen_store( const act* action) //____________________________________________________________ -// +// // Generate substitution text for START_TRANSACTION. -// +// static void gen_t_start( const act* action) { TEXT dbname[80]; -// if this is a purely default transaction, just let it through +// if this is a purely default transaction, just let it through const gpre_tra* trans; if (!action || !(trans = (gpre_tra*) action->act_object)) { @@ -3563,7 +3563,7 @@ static void gen_t_start( const act* action) return; } -// build a complete statement, including tpb's. Ready db's as gpre_req. +// build a complete statement, including tpb's. Ready db's as gpre_req. const tpb* tpb_iterator; if (gpreGlob.sw_auto) @@ -3611,9 +3611,9 @@ static void gen_t_start( const act* action) //____________________________________________________________ -// +// // Initialize a TPB in the output file -// +// static void gen_tpb(const tpb* tpb_buffer) { @@ -3622,12 +3622,12 @@ static void gen_tpb(const tpb* tpb_buffer) SLONG longword_tpb; } tpb_hunk; -// -// TPBs are generated as raw BLR in longword chunks +// +// TPBs are generated as raw BLR in longword chunks // because COBOL is a miserable excuse for a language // and doesn't allow byte value assignments to character // fields. -// +// printa(names[COLUMN_0], false, "01 %s%d.", names[isc_tpb_pos], tpb_buffer->tpb_ident); @@ -3657,9 +3657,9 @@ static void gen_tpb(const tpb* tpb_buffer) //____________________________________________________________ -// +// // Generate substitution text for COMMIT, ROLLBACK, PREPARE, and SAVE -// +// static void gen_trans( const act* action) { @@ -3695,9 +3695,9 @@ static void gen_trans( const act* action) //____________________________________________________________ -// +// // Substitute for a variable reference. -// +// static void gen_type( const act* action) { @@ -3707,9 +3707,9 @@ static void gen_type( const act* action) //____________________________________________________________ -// +// // Generate substitution text for UPDATE ... WHERE CURRENT OF ... -// +// static void gen_update( const act* action) { @@ -3721,9 +3721,9 @@ static void gen_update( const act* action) //____________________________________________________________ -// +// // Substitute for a variable reference. -// +// static void gen_variable( const act* action) { @@ -3735,9 +3735,9 @@ static void gen_variable( const act* action) //____________________________________________________________ -// +// // Generate tests for any WHENEVER clauses that may have been declared. -// +// static void gen_whenever(const swe* label) { @@ -3773,17 +3773,17 @@ static void gen_whenever(const swe* label) //____________________________________________________________ -// +// // Generate a declaration of an array in the // output file. -// +// static void make_array_declaration( REF reference) { gpre_fld* field = reference->ref_field; const TEXT* name = field->fld_symbol->sym_string; -// Don't generate multiple declarations for the array. V3 Bug 569. +// Don't generate multiple declarations for the array. V3 Bug 569. if (field->fld_array_info->ary_declared) return; @@ -3796,7 +3796,7 @@ static void make_array_declaration( REF reference) TEXT space[128]; strcpy(space, " "); -// Print out the dimension part of the declaration +// Print out the dimension part of the declaration const dim* dimension = field->fld_array_info->ary_dimension; int i = 3; for (; dimension->dim_next; dimension = dimension->dim_next, i += 2) @@ -3817,7 +3817,7 @@ static void make_array_declaration( REF reference) p++; SSHORT digits, scale; - + switch (field->fld_array_info->ary_dtype) { case dtype_short: case dtype_long: @@ -3896,9 +3896,9 @@ static void make_array_declaration( REF reference) //____________________________________________________________ -// +// // Turn a symbol into a varying string. -// +// static void make_name(TEXT* const string, const gpre_sym* symbol) { @@ -3907,9 +3907,9 @@ static void make_name(TEXT* const string, const gpre_sym* symbol) //____________________________________________________________ -// +// // Turn a symbol into a varying string. -// +// static void make_name_formatted(TEXT* const string, const TEXT* format, const gpre_sym* symbol) @@ -3922,9 +3922,9 @@ static void make_name_formatted(TEXT* const string, const TEXT* format, //____________________________________________________________ -// +// // Insert a port record description in output. -// +// static void make_port(const gpre_port* port) { @@ -4011,9 +4011,9 @@ static void make_port(const gpre_port* port) //____________________________________________________________ -// +// // Generate the actual ready call. -// +// static void make_ready( const dbb* db, @@ -4032,7 +4032,7 @@ static void make_ready( sprintf(s2, "%s%d", names[isc_b_pos], request->req_ident); /* if the dpb needs to be extended at runtime to include items - in host variables, do so here; this assumes that there is + in host variables, do so here; this assumes that there is always a request generated for runtime variables */ if (request->req_flags & REQ_extend_dpb) { @@ -4139,7 +4139,7 @@ static void make_ready( COB_print_buffer(output_buffer, true); -// if the dpb was extended, free it here +// if the dpb was extended, free it here if (request && request->req_flags & REQ_extend_dpb) { if (request->req_length) { @@ -4152,7 +4152,7 @@ static void make_ready( "%sCALL \"%s\" USING %s\n", names[COLUMN], ISC_FREE, s2Tmp); COB_print_buffer(output_buffer, true); - // reset the length of the dpb + // reset the length of the dpb sprintf(output_buffer, "%sMOVE %d to %s\n", names[COLUMN], request->req_length, s1); COB_print_buffer(output_buffer, true); @@ -4161,9 +4161,9 @@ static void make_ready( //____________________________________________________________ -// +// // Print a fixed string at a particular COLUMN. -// +// static void printa(const TEXT* column, bool call, @@ -4185,9 +4185,9 @@ static void printa(const TEXT* column, #ifdef NOT_USED_OR_REPLACED //____________________________________________________________ -// +// // Print a fixed string at a particular column. -// +// static void printb(const TEXT* string, ...) { @@ -4200,9 +4200,9 @@ static void printb(const TEXT* string, ...) #endif //____________________________________________________________ -// +// // Generate the appropriate transaction handle. -// +// static const TEXT* request_trans( const act* action, const gpre_req* request) { @@ -4218,7 +4218,7 @@ static const TEXT* request_trans( const act* action, const gpre_req* request) //____________________________________________________________ -// +// // generate a CALL to the appropriate SQLCODE routine. // Note that not all COBOLs have the concept of a function. @@ -4235,10 +4235,10 @@ static void set_sqlcode( const act* action) //____________________________________________________________ -// +// // Generate the appropriate status vector parameter for a gds // call depending on where or not the action has an error clause. -// +// static const TEXT* status_vector( const act* action) { @@ -4251,11 +4251,11 @@ static const TEXT* status_vector( const act* action) //____________________________________________________________ -// +// // Generate substitution text for START_TRANSACTION, // when it's being generated automatically by a compile // call. -// +// static void t_start_auto(const gpre_req* request, const TEXT* vector, @@ -4266,15 +4266,15 @@ static void t_start_auto(const gpre_req* request, const TEXT* trname = request_trans(action, request); -// find out whether we're using a status vector or not +// find out whether we're using a status vector or not const bool stat = !strcmp(vector, names[isc_status_vector_pos]); -// this is a default transaction, make sure all databases are ready +// this is a default transaction, make sure all databases are ready const dbb* db; int count; - + if (gpreGlob.sw_auto) { buffer[0] = 0; for (count = 0, db = gpreGlob.isc_databases; db; db = db->dbb_next, count++) diff --git a/src/gpre/dyntable.cpp b/src/gpre/dyntable.cpp index 06dda5bb68..69d23d1ec7 100644 --- a/src/gpre/dyntable.cpp +++ b/src/gpre/dyntable.cpp @@ -1,30 +1,30 @@ //____________________________________________________________ -// +// // PROGRAM: BLR Pretty Printer // MODULE: dyntable.cpp // DESCRIPTION: Dynamic DDL to internal conversion table generator -// +// // The contents of this file are subject to the Interbase Public // License Version 1.0 (the "License"); you may not use this file // except in compliance with the License. You may obtain a copy // of the License at http://www.Inprise.com/IPL.html -// +// // Software distributed under the License is distributed on an // "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express // or implied. See the License for the specific language governing // rights and limitations under the License. -// +// // The Original Code was created by Inprise Corporation // and its predecessors. Portions created by Inprise Corporation are // Copyright (C) Inprise Corporation. -// +// // All Rights Reserved. // Contributor(s): ______________________________________. -// +// // //____________________________________________________________ // -// $Id: dyntable.cpp,v 1.10 2005-05-27 22:42:14 asfernandes Exp $ +// $Id: dyntable.cpp,v 1.11 2008-12-05 01:19:48 asfernandes Exp $ // // CVC: Strange, this file is only referenced in a MacOsX project and gpre // works directly with dyntable.h. @@ -117,9 +117,9 @@ struct dyn { //____________________________________________________________ -// +// // Spit out a conversion table. -// +// int main() { diff --git a/src/gpre/exp.cpp b/src/gpre/exp.cpp index b6e43d99c3..a56e3bb2be 100644 --- a/src/gpre/exp.cpp +++ b/src/gpre/exp.cpp @@ -1,27 +1,27 @@ //____________________________________________________________ -// +// // PROGRAM: C preprocessor // MODULE: exp.cpp // DESCRIPTION: Expression parser -// +// // The contents of this file are subject to the Interbase Public // License Version 1.0 (the "License"); you may not use this file // except in compliance with the License. You may obtain a copy // of the License at http://www.Inprise.com/IPL.html -// +// // Software distributed under the License is distributed on an // "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express // or implied. See the License for the specific language governing // rights and limitations under the License. -// +// // The Original Code was created by Inprise Corporation // and its predecessors. Portions created by Inprise Corporation are // Copyright (C) Inprise Corporation. -// +// // All Rights Reserved. // Contributor(s): ______________________________________. // TMN (Mike Nordell) 11.APR.2001 - Reduce compiler warnings -// +// // //____________________________________________________________ // @@ -112,9 +112,9 @@ static const dtypes data_types[] = { //____________________________________________________________ -// +// // Parse array subscript. -// +// GPRE_NOD EXP_array(gpre_req* request, gpre_fld* field, bool subscript_flag, bool sql_flag) { @@ -123,9 +123,9 @@ GPRE_NOD EXP_array(gpre_req* request, gpre_fld* field, bool subscript_flag, bool //____________________________________________________________ -// +// // Parse a datatype cast (sans leading period). -// +// gpre_fld* EXP_cast(gpre_fld* field) { @@ -225,7 +225,7 @@ gpre_ctx* EXP_context(gpre_req* request, gpre_sym* initial_symbol) // block. Then check for the keyword IN. If it's // missing, either complain or punt, depending on the // error flag. In either case, be sure to get rid of -// the symbol. If things look kosher, continue. +// the symbol. If things look kosher, continue. gpre_sym* symbol = initial_symbol; if (!symbol) { @@ -249,11 +249,11 @@ gpre_ctx* EXP_context(gpre_req* request, gpre_sym* initial_symbol) //____________________________________________________________ -// +// // Parse a qualified field clause. If recognized, // return both the field block (as value) and the // context block (by reference). -// +// gpre_fld* EXP_field(gpre_ctx** rcontext) { @@ -290,9 +290,9 @@ gpre_fld* EXP_field(gpre_ctx** rcontext) //____________________________________________________________ -// +// // Eat a left parenthesis, complain if not there. -// +// void EXP_left_paren(const TEXT* string) { @@ -302,9 +302,9 @@ void EXP_left_paren(const TEXT* string) //____________________________________________________________ -// +// // Parse a native literal constant value. -// +// GPRE_NOD EXP_literal(void) { @@ -361,7 +361,7 @@ GPRE_NOD EXP_literal(void) ((INTLSYM) (symbol->sym_object))->intlsym_ttype; } else if (gpreGlob.sw_language == lang_internal) { - // literals referenced in an Internal request are always correct charset + // literals referenced in an Internal request are always correct charset reference->ref_flags |= REF_ttype; reference->ref_ttype = ttype_metadata; } @@ -371,10 +371,10 @@ GPRE_NOD EXP_literal(void) //____________________________________________________________ -// +// // Parse and convert to binary a numeric token. // Restrict to LONG range. -// +// SINT64 EXP_SINT64_ordinal(bool advance_flag) { @@ -386,7 +386,7 @@ SINT64 EXP_SINT64_ordinal(bool advance_flag) const char format[8] = "%"SQUADFORMAT; SINT64 n; sscanf(gpreGlob.token_global.tok_string, format, &n); - + char buffer[64]; sprintf(buffer, format, n); if (strcmp(buffer, gpreGlob.token_global.tok_string) != 0) @@ -399,10 +399,10 @@ SINT64 EXP_SINT64_ordinal(bool advance_flag) } //____________________________________________________________ -// +// // Parse and convert to binary a numeric token. // Restrict to LONG range. -// +// SLONG EXP_SLONG_ordinal(bool advance_flag) { @@ -425,10 +425,10 @@ SLONG EXP_SLONG_ordinal(bool advance_flag) //____________________________________________________________ -// +// // Parse and convert to binary a numeric token. // A SSHORT is desired. -// +// SSHORT EXP_SSHORT_ordinal(bool advance_flag) { @@ -451,10 +451,10 @@ SSHORT EXP_SSHORT_ordinal(bool advance_flag) //____________________________________________________________ -// +// // Parse and convert to binary a numeric token. // Restrict to LONG range. -// +// ULONG EXP_ULONG_ordinal(bool advance_flag) { @@ -475,9 +475,9 @@ ULONG EXP_ULONG_ordinal(bool advance_flag) //____________________________________________________________ -// +// // Parse and convert to binary a numeric token. -// +// USHORT EXP_USHORT_ordinal(bool advance_flag) { @@ -496,10 +496,10 @@ USHORT EXP_USHORT_ordinal(bool advance_flag) //____________________________________________________________ -// +// // Parse and convert to binary a numeric token. // Which must be non-zero. -// +// USHORT EXP_pos_USHORT_ordinal(bool advance_flag) { @@ -512,10 +512,10 @@ USHORT EXP_pos_USHORT_ordinal(bool advance_flag) //____________________________________________________________ -// +// // We have a free reference to array. Make sure the whole damn thing // gets sucked up. -// +// void EXP_post_array( REF reference) { @@ -546,12 +546,12 @@ void EXP_post_array( REF reference) //____________________________________________________________ -// +// // Post a field reference to a request. This // can be called from either par_variable (free // standing field reference) or EXP\par_value // (cross request field reference). -// +// REF EXP_post_field(gpre_fld* field, gpre_ctx* context, bool null_flag) { @@ -559,7 +559,7 @@ REF EXP_post_field(gpre_fld* field, gpre_ctx* context, bool null_flag) gpre_req* request = context->ctx_request; -// If the reference is already posted, return the reference +// If the reference is already posted, return the reference ref* reference; for (reference = request->req_references; reference; @@ -594,7 +594,7 @@ REF EXP_post_field(gpre_fld* field, gpre_ctx* context, bool null_flag) } } -// This is first occurrence of field, make a new reference +// This is first occurrence of field, make a new reference reference = MSC_reference(&request->req_references); reference->ref_context = context; @@ -609,10 +609,10 @@ REF EXP_post_field(gpre_fld* field, gpre_ctx* context, bool null_flag) //____________________________________________________________ -// +// // Match a trailing parenthesis. If isn't one, generate an error // and return FALSE. -// +// bool EXP_match_paren(void) { @@ -625,9 +625,9 @@ bool EXP_match_paren(void) //____________________________________________________________ -// +// // Parse and look up a qualified relation name. -// +// gpre_rel* EXP_relation(void) { @@ -637,7 +637,7 @@ gpre_rel* EXP_relation(void) // The current token is (i.e. should be) either a relation // name or a database name. If it's a database name, search // it for the relation name. If it's an unqualified relation -// name, search all databases for the name +// name, search all databases for the name gpre_rel* relation = NULL; @@ -677,15 +677,15 @@ gpre_rel* EXP_relation(void) //____________________________________________________________ -// +// // Parse a record selection expression. If there is an // error, return NULL. This is slightly complicated by // the fact that PASCAL and FORTRAN have a native FOR // statement, and ADA has a FOR IN statement. -// +// // If an initial symbol is given, the caller has already // parsed the IN part of the expression. -// +// gpre_rse* EXP_rse(gpre_req* request, gpre_sym* initial_symbol) { @@ -698,7 +698,7 @@ gpre_rse* EXP_rse(gpre_req* request, gpre_sym* initial_symbol) first = par_value(request, global_count_field); } -// parse first context clause +// parse first context clause if (initial_symbol && gpreGlob.sw_language == lang_ada && !check_relation()) return NULL; @@ -706,7 +706,7 @@ gpre_rse* EXP_rse(gpre_req* request, gpre_sym* initial_symbol) gpre_ctx* context = EXP_context(request, initial_symbol); SSHORT count = 1; -// parse subsequent context clauses if this is a join +// parse subsequent context clauses if this is a join gpre_nod* boolean = NULL; while (MSC_match(KW_CROSS)) { context = EXP_context(request, 0); @@ -715,11 +715,11 @@ gpre_rse* EXP_rse(gpre_req* request, gpre_sym* initial_symbol) boolean = make_and(boolean, par_over(context)); } -// bug_3380 - could have an "over" clause without a "cross" clause +// bug_3380 - could have an "over" clause without a "cross" clause if (MSC_match(KW_OVER)) boolean = make_and(boolean, par_over(context)); -// build rse node +// build rse node gpre_rse* rec_expr = (gpre_rse*) MSC_alloc(RSE_LEN(count)); rec_expr->rse_count = count; @@ -733,14 +733,14 @@ gpre_rse* EXP_rse(gpre_req* request, gpre_sym* initial_symbol) } // parse boolean, if any. If there is an error, ignore the -// boolean, but keep the rse +// boolean, but keep the rse if (MSC_match(KW_WITH)) boolean = make_and(boolean, par_boolean(request)); rec_expr->rse_boolean = boolean; -// Parse SORT clause, if any. +// Parse SORT clause, if any. // CVC: It's not clear whether this var should be initialized at the same // level than "direction". @@ -793,7 +793,7 @@ gpre_rse* EXP_rse(gpre_req* request, gpre_sym* initial_symbol) } } - // Parse REDUCED clause, if any. + // Parse REDUCED clause, if any. else if (MSC_match(KW_REDUCED)) { MSC_match(KW_TO); @@ -822,10 +822,10 @@ gpre_rse* EXP_rse(gpre_req* request, gpre_sym* initial_symbol) //____________________________________________________________ -// +// // Remove any context variables from hash table for a record // selection expression. -// +// void EXP_rse_cleanup( gpre_rse* rs) { @@ -838,12 +838,12 @@ void EXP_rse_cleanup( gpre_rse* rs) if ((*context)->ctx_symbol) HSH_remove((*context)->ctx_symbol); -// If this is an aggregate, clean up the underlying rse +// If this is an aggregate, clean up the underlying rse if (rs->rse_aggregate) EXP_rse_cleanup(rs->rse_aggregate); -// If this is a union, clean up each of the primitive rse's +// If this is a union, clean up each of the primitive rse's gpre_nod* node = rs->rse_union; if (node) { @@ -854,16 +854,16 @@ void EXP_rse_cleanup( gpre_rse* rs) //____________________________________________________________ -// +// // Parse a subscript value. This is called by PAR\par_slice. -// +// GPRE_NOD EXP_subscript(gpre_req* request) { ref* reference = (REF) MSC_alloc(REF_LEN); gpre_nod* node = MSC_unary(nod_value, (GPRE_NOD) reference); -// Special case literals +// Special case literals if (gpreGlob.token_global.tok_type == tok_number) { node->nod_type = nod_literal; @@ -886,16 +886,16 @@ GPRE_NOD EXP_subscript(gpre_req* request) //____________________________________________________________ -// +// // Check current token for either a relation or database name. -// +// static bool check_relation(void) { // The current token is (i.e. should be) either a relation // name or a database name. If it's a database name, search // it for the relation name. If it's an unqualified relation -// name, search all databases for the name +// name, search all databases for the name gpre_sym* symbol = gpreGlob.token_global.tok_symbol; if (symbol && symbol->sym_type == SYM_database) @@ -911,11 +911,11 @@ static bool check_relation(void) //____________________________________________________________ -// +// // Check to see if the current token is a field name corresponding // to a given context. If so, return a field block (with reference // block) for field. -// +// static GPRE_NOD lookup_field(gpre_ctx* context) { @@ -933,11 +933,11 @@ static GPRE_NOD lookup_field(gpre_ctx* context) //____________________________________________________________ -// +// // Combine two (potention) conjuncts into a single, valid // boolean. Either or both on the conjunctions may be NULL. // If both are null, return null. -// +// static GPRE_NOD make_and( GPRE_NOD node1, GPRE_NOD node2) { @@ -952,9 +952,9 @@ static GPRE_NOD make_and( GPRE_NOD node1, GPRE_NOD node2) //____________________________________________________________ -// +// // Make a generic variable length node from a stack. -// +// static GPRE_NOD make_list( gpre_lls* stack) { @@ -972,13 +972,13 @@ static GPRE_NOD make_list( gpre_lls* stack) //____________________________________________________________ -// +// // "Normalize" the array index so that // the index used in the rse refers to // the same relative position in the // dimension in the database as it is // in the user's program. -// +// static GPRE_NOD normalize_index( dim* dimension, GPRE_NOD user_index, USHORT array_base) { @@ -1021,9 +1021,9 @@ static GPRE_NOD normalize_index( dim* dimension, GPRE_NOD user_index, USHORT arr //____________________________________________________________ -// +// // Parse a boolean AND. -// +// static GPRE_NOD par_and( gpre_req* request) { @@ -1037,11 +1037,11 @@ static GPRE_NOD par_and( gpre_req* request) //____________________________________________________________ -// +// // Parse a array element reference // (array name and subscript list) // in an gpre_rse. -// +// static GPRE_NOD par_array(gpre_req* request, gpre_fld* field, bool subscript_flag, bool sql_flag) @@ -1071,7 +1071,7 @@ static GPRE_NOD par_array(gpre_req* request, global_subscript_field = MET_make_field("gds_array_subscript", dtype_long, 4, false); - // Parse a commalist of subscripts and build a tree of index nodes + // Parse a commalist of subscripts and build a tree of index nodes int i = 1; for (dim* dimension = field->fld_array_info->ary_dimension; @@ -1095,7 +1095,7 @@ static GPRE_NOD par_array(gpre_req* request, case lang_c: case lang_cxx: case lang_internal: - index_node->nod_arg[0] = normalize_index(dimension, + index_node->nod_arg[0] = normalize_index(dimension, index_node->nod_arg[0], ZERO_BASED); break; @@ -1107,9 +1107,9 @@ static GPRE_NOD par_array(gpre_req* request, break; } - // Error checking of constants being out of range will be here in the future. + // Error checking of constants being out of range will be here in the future. - // Good ole Fortran's column major order needs to be accomodated. + // Good ole Fortran's column major order needs to be accomodated. if (gpreGlob.sw_language == lang_fortran) array_node->nod_arg[fortran_adjustment - i] = index_node; @@ -1120,7 +1120,7 @@ static GPRE_NOD par_array(gpre_req* request, CPR_s_error("Adequate number of subscripts for this array reference."); } - // Match the parenthesis or bracket + // Match the parenthesis or bracket if (paren && !MSC_match(KW_RIGHT_PAREN)) CPR_s_error("Missing parenthesis for array reference."); @@ -1133,10 +1133,10 @@ static GPRE_NOD par_array(gpre_req* request, //____________________________________________________________ -// +// // Parse a boolean expression. Actually, just parse // an OR node or anything of lower precedence. -// +// static GPRE_NOD par_boolean( gpre_req* request) { @@ -1150,16 +1150,16 @@ static GPRE_NOD par_boolean( gpre_req* request) //____________________________________________________________ -// +// // Parse a field reference. Anything else is an error. -// +// static GPRE_NOD par_field( gpre_req* request) { const gpre_sym* symbol = gpreGlob.token_global.tok_symbol; if (!symbol) CPR_s_error("qualified field reference"); - + bool upcase_flag = false; gpre_nod* prefix_node = 0; if (MSC_match(KW_UPPERCASE)) { @@ -1190,7 +1190,7 @@ static GPRE_NOD par_field( gpre_req* request) // There is a legit field reference. If the reference is // to a field in this request, make up a reference block -// and a field node, and return. +// and a field node, and return. if (!field->fld_array_info) node = MSC_node(nod_field, 1); @@ -1234,10 +1234,10 @@ static GPRE_NOD par_field( gpre_req* request) //____________________________________________________________ -// +// // Parse a value expression. In specific, handle the lowest // precedence operator plus/minus. -// +// static GPRE_NOD par_multiply( gpre_req* request, gpre_fld* field) { @@ -1259,15 +1259,15 @@ static GPRE_NOD par_multiply( gpre_req* request, gpre_fld* field) //____________________________________________________________ -// +// // Parse a native C value. -// +// static GPRE_NOD par_native_value( gpre_req* request, gpre_fld* field) { TEXT s[64]; -// Special case literals +// Special case literals if (gpreGlob.token_global.tok_type == tok_number || gpreGlob.token_global.tok_type == tok_sglquoted || (gpreGlob.token_global.tok_type == tok_dblquoted && gpreGlob.sw_sql_dialect == 1)) @@ -1281,7 +1281,7 @@ static GPRE_NOD par_native_value( gpre_req* request, gpre_fld* field) // Handle general native value references. Since these values will need // to be exported to the database system, make sure there is a reference -// field. +// field. reference->ref_value = PAR_native_value(false, false); @@ -1299,9 +1299,9 @@ static GPRE_NOD par_native_value( gpre_req* request, gpre_fld* field) //____________________________________________________________ -// +// // Parse either a boolean NOT or a boolean parenthetical. -// +// static GPRE_NOD par_not( gpre_req* request) { @@ -1323,9 +1323,9 @@ static GPRE_NOD par_not( gpre_req* request) //____________________________________________________________ -// +// // Parse the substance of an OVER clause (but not the leading keyword). -// +// static GPRE_NOD par_over( gpre_ctx* context) { @@ -1360,10 +1360,10 @@ static GPRE_NOD par_over( gpre_ctx* context) //____________________________________________________________ -// +// // Parse a value expression. In specific, handle the lowest // precedence operator plus/minus. -// +// static GPRE_NOD par_primitive_value( gpre_req* request, gpre_fld* field) { @@ -1398,7 +1398,7 @@ static GPRE_NOD par_primitive_value( gpre_req* request, gpre_fld* field) return node; } -// Check for user defined functions +// Check for user defined functions gpre_nod* node = par_udf(request, UDF_value, field); if (node) @@ -1413,9 +1413,9 @@ static GPRE_NOD par_primitive_value( gpre_req* request, gpre_fld* field) //____________________________________________________________ -// +// // Parse a relational expression. -// +// static GPRE_NOD par_relational( gpre_req* request) { @@ -1436,7 +1436,7 @@ static GPRE_NOD par_relational( gpre_req* request) } // That's right, three pointer dereferences to get to the reference -// structure if there's a UDF. V3 bug#531. MaryAnn 12/4/89 +// structure if there's a UDF. V3 bug#531. MaryAnn 12/4/89 gpre_nod* expr1 = par_udf(request, UDF_value, 0); ref* reference; @@ -1449,7 +1449,7 @@ static GPRE_NOD par_relational( gpre_req* request) gpre_fld* field = reference->ref_field; -// Check for any of the binary guys +// Check for any of the binary guys const bool negation = MSC_match(KW_NOT); @@ -1517,18 +1517,18 @@ static GPRE_NOD par_relational( gpre_req* request) //____________________________________________________________ -// +// // Parse a user defined function. If the current token isn't one, // return NULL. Otherwise try to parse one. If things go badly, // complain bitterly. -// +// static GPRE_NOD par_udf( gpre_req* request, USHORT type, gpre_fld* field) { if (!request) return NULL; -// Check for user defined functions +// Check for user defined functions udf* new_udf; for (gpre_sym* symbol = gpreGlob.token_global.tok_symbol; symbol; symbol = symbol->sym_homonym) @@ -1558,10 +1558,10 @@ static GPRE_NOD par_udf( gpre_req* request, USHORT type, gpre_fld* field) //____________________________________________________________ -// +// // Parse a value expression. In specific, handle the lowest // precedence operator plus/minus. -// +// static GPRE_NOD par_value( gpre_req* request, gpre_fld* field) { diff --git a/src/gpre/fbrmclib.cpp b/src/gpre/fbrmclib.cpp index 7ae1b4d02d..453fef34c2 100644 --- a/src/gpre/fbrmclib.cpp +++ b/src/gpre/fbrmclib.cpp @@ -1539,7 +1539,7 @@ EXPORT RM_ENTRY(rmc_ftoc) *(float *)arg_vector[-1].a_address = arg; else *(double *)arg_vector[-1].a_address = arg; - + return (0); } @@ -1552,7 +1552,7 @@ EXPORT RM_ENTRY(rmc_stoc) const int dlen = arg_vector[-1].a_length; const char* src = (char*) arg_vector[0].a_address; const int slen = arg_vector[0].a_length; - + int i = slen - 1; while (src[i] == ' ' && i >= 0) --i; diff --git a/src/gpre/ftn.cpp b/src/gpre/ftn.cpp index 1309257971..0dc33dfd96 100644 --- a/src/gpre/ftn.cpp +++ b/src/gpre/ftn.cpp @@ -1,26 +1,26 @@ //____________________________________________________________ -// +// // PROGRAM: General preprocessor // MODULE: ftn.cpp // DESCRIPTION: Fortran text generator -// +// // The contents of this file are subject to the Interbase Public // License Version 1.0 (the "License"); you may not use this file // except in compliance with the License. You may obtain a copy // of the License at http://www.Inprise.com/IPL.html -// +// // Software distributed under the License is distributed on an // "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express // or implied. See the License for the specific language governing // rights and limitations under the License. -// +// // The Original Code was created by Inprise Corporation // and its predecessors. Portions created by Inprise Corporation are // Copyright (C) Inprise Corporation. -// +// // All Rights Reserved. // Contributor(s): ______________________________________. -// +// // //____________________________________________________________ // @@ -312,8 +312,8 @@ const char* const NULL_SQLDA = "0"; //____________________________________________________________ -// -// +// +// void FTN_action(const act* action, int column) { @@ -572,12 +572,12 @@ void FTN_action(const act* action, int column) //____________________________________________________________ -// -// Create a block data module at the +// +// Create a block data module at the // head of a preprocessed fortran file // containing the initializations for // all databases not declared as extern -// +// void FTN_fini(void) { @@ -586,7 +586,7 @@ void FTN_fini(void) fprintf(gpreGlob.out_file, "\n"); printa(COLUMN, "BLOCK DATA"); - + const dbd* db_list = gpreGlob.global_db_list; for (const dbd* const end = gpreGlob.global_db_list + gpreGlob.global_db_count; db_list < end; ++db_list) @@ -605,10 +605,10 @@ void FTN_fini(void) //____________________________________________________________ -// +// // Print a statment, breaking it into // reasonable 72 character hunks. -// +// void FTN_print_buffer( TEXT* output_bufferL) { @@ -650,14 +650,14 @@ void FTN_print_buffer( TEXT* output_bufferL) } -// RRK_?: copy align from c_cxx +// RRK_?: copy align from c_cxx //____________________________________________________________ -// +// // Build an assignment from a host language variable to // a port variable. -// +// static void asgn_from(const act* action, const ref* reference) { @@ -676,7 +676,7 @@ static void asgn_from(const act* action, const ref* reference) if (!reference->ref_source && !reference->ref_value) continue; gen_name(variable, reference, true); - + const TEXT* value; if (reference->ref_source) value = gen_name(temp, reference->ref_source, true); @@ -711,10 +711,10 @@ static void asgn_from(const act* action, const ref* reference) //____________________________________________________________ -// +// // Build an assignment to a host language variable from // a port variable. -// +// static void asgn_to(const act* action, const ref* reference) { @@ -740,7 +740,7 @@ static void asgn_to(const act* action, const ref* reference) COLUMN, reference->ref_value, s); FTN_print_buffer(output_buffer); -// Pick up NULL value if one is there +// Pick up NULL value if one is there if (reference = reference->ref_null) { sprintf(output_buffer, "%s%s = %s\n", @@ -751,10 +751,10 @@ static void asgn_to(const act* action, const ref* reference) //____________________________________________________________ -// +// // Build an assignment to a host language variable from // a port variable. -// +// static void asgn_to_proc( const ref* reference) { @@ -780,9 +780,9 @@ static void asgn_to_proc( const ref* reference) //____________________________________________________________ -// +// // Generate code for AT END clause of FETCH. -// +// static void gen_at_end(const act* action) { @@ -796,9 +796,9 @@ static void gen_at_end(const act* action) //____________________________________________________________ -// +// // Substitute for a BASED ON clause. -// +// static void gen_based(const act* action) { @@ -858,7 +858,7 @@ static void gen_based(const act* action) } } -// print the first variable, then precede the rest with commas +// print the first variable, then precede the rest with commas bool first = true; @@ -869,7 +869,7 @@ static void gen_based(const act* action) fprintf(gpreGlob.out_file, "%s", variable); first = false; if (field->fld_array_info && !(based_on->bas_flags & BAS_segment)) { - // Print out the dimension part of the declaration + // Print out the dimension part of the declaration fprintf(gpreGlob.out_file, "("); for (dim* dimension = field->fld_array_info->ary_dimension; dimension; @@ -905,9 +905,9 @@ static void gen_based(const act* action) //____________________________________________________________ -// +// // Make a blob FOR loop. -// +// static void gen_blob_close(const act* action) { @@ -935,9 +935,9 @@ static void gen_blob_close(const act* action) //____________________________________________________________ -// +// // End a blob FOR loop. -// +// static void gen_blob_end(const act* action) { @@ -954,9 +954,9 @@ static void gen_blob_end(const act* action) //____________________________________________________________ -// +// // Make a blob FOR loop. -// +// static void gen_blob_for(const act* action) { @@ -977,9 +977,9 @@ static void gen_blob_for(const act* action) //____________________________________________________________ -// +// // Generate the call to open (or create) a blob. -// +// static void gen_blob_open(const act* action) { @@ -1023,7 +1023,7 @@ static void gen_blob_open(const act* action) } const USHORT column = 6; - + if (args.pat_value1 = blob->blb_bpb_length) PATTERN_expand(column, pattern1, &args); else @@ -1049,9 +1049,9 @@ static void gen_blob_open(const act* action) //____________________________________________________________ -// +// // Callback routine for BLR pretty printer. -// +// static void gen_blr(void* user_arg, SSHORT offset, const char* string) { @@ -1076,9 +1076,9 @@ static void gen_blr(void* user_arg, SSHORT offset, const char* string) //____________________________________________________________ -// +// // Generate text to compile a request. -// +// static void gen_compile(const act* action) { @@ -1086,17 +1086,17 @@ static void gen_compile(const act* action) DBB db = request->req_database; const gpre_sym* symbol = db->dbb_name; -// generate automatic ready if appropriate +// generate automatic ready if appropriate if (gpreGlob.sw_auto) t_start_auto(request, status_vector(action), action, true); -// +// // always generate a compile, a test for the success of the compile, // and an end to the 'if not compiled test -// +// -// generate an 'if not compiled' +// generate an 'if not compiled' if (gpreGlob.sw_auto && (action->act_error || (action->act_flags & ACT_sql))) printa(COLUMN, "IF (%s .EQ. 0 .AND. %s .NE. 0) THEN", @@ -1115,7 +1115,7 @@ static void gen_compile(const act* action) printa(COLUMN, "END IF"); // If blobs are present, zero out all of the blob handles. After this -// point, the handles are the user's responsibility +// point, the handles are the user's responsibility blb* blob = request->req_blobs; if (blob) { @@ -1130,9 +1130,9 @@ static void gen_compile(const act* action) //____________________________________________________________ -// +// // Generate a call to create a database. -// +// static void gen_create_database(const act* action) { @@ -1227,13 +1227,13 @@ static void gen_create_database(const act* action) sprintf(output_buffer, "%sCALL ISC_FREE (%s)\n", COLUMN, s2); FTN_print_buffer(output_buffer); - // reset the length of the dpb + // reset the length of the dpb sprintf(output_buffer, "%s%s = %d\n", COLUMN, s1, request->req_length); FTN_print_buffer(output_buffer); } - + const bool save_sw_auto = gpreGlob.sw_auto; gpreGlob.sw_auto = true; printa(COLUMN, "IF (isc_status(2) .eq. 0) THEN"); @@ -1245,9 +1245,9 @@ static void gen_create_database(const act* action) //____________________________________________________________ -// +// // Generate substitution text for END_STREAM. -// +// static void gen_cursor_close(const act* action, const gpre_req* request) { @@ -1261,14 +1261,14 @@ static void gen_cursor_close(const act* action, const gpre_req* request) //____________________________________________________________ -// +// // Generate text to initialize a cursor. -// +// static void gen_cursor_init(const act* action) { // If blobs are present, zero out all of the blob handles. After this -// point, the handles are the user's responsibility +// point, the handles are the user's responsibility if (action->act_request-> req_flags & (REQ_sql_blob_open | REQ_sql_blob_create)) @@ -1279,9 +1279,9 @@ static void gen_cursor_init(const act* action) //____________________________________________________________ -// +// // Generate text to open an embedded SQL cursor. -// +// static void gen_cursor_open(const act* action, const gpre_req* request) { @@ -1336,9 +1336,9 @@ static void gen_cursor_open(const act* action, const gpre_req* request) //____________________________________________________________ -// +// // Generate insertion text for the database statement. -// +// static void gen_database(const act* action) { @@ -1358,9 +1358,9 @@ static void gen_database(const act* action) //____________________________________________________________ -// +// // Generate insertion text for global DATA statements. -// +// static void gen_database_data(const act* action) { @@ -1408,10 +1408,10 @@ static void gen_database_data(const act* action) //____________________________________________________________ -// +// // Generate insertion text for global // data declarations. -// +// static void gen_database_decls(const act* action) { @@ -1428,7 +1428,7 @@ static void gen_database_decls(const act* action) "%sINTEGER*4 ISC_STATUS2(20) %s{ status vector }\n", COLUMN, INLINE_COMMENT); -// added for 3.3 compatibility +// added for 3.3 compatibility fprintf(gpreGlob.out_file, "%sINTEGER*4 GDS__STATUS(20) %s{ status vector }\n", COLUMN, INLINE_COMMENT); @@ -1438,7 +1438,7 @@ static void gen_database_decls(const act* action) printa(COLUMN, "EQUIVALENCE (ISC_STATUS(20), GDS__STATUS(20)) "); printa(COLUMN, "EQUIVALENCE (ISC_STATUS2(20), GDS__STATUS2(20)) "); -// end of code added for 3.3 compatibility +// end of code added for 3.3 compatibility fprintf(gpreGlob.out_file, "%sINTEGER*4 ISC_NULL %s{ dummy status vector }\n", @@ -1477,7 +1477,7 @@ static void gen_database_decls(const act* action) } #ifdef HPUX - // build fields to handle start_multiple + // build fields to handle start_multiple count++; fprintf(gpreGlob.out_file, @@ -1495,7 +1495,7 @@ static void gen_database_decls(const act* action) } #ifdef HPUX -// declare array and set up equivalence for start_multiple vector +// declare array and set up equivalence for start_multiple vector const SSHORT length = 12; fprintf(gpreGlob.out_file, @@ -1537,7 +1537,7 @@ static void gen_database_decls(const act* action) COLUMN, blob->blb_len_ident, INLINE_COMMENT); } - // Array declarations + // Array declarations if (port = request->req_primary) for (const ref* reference = port->por_references; reference; @@ -1548,12 +1548,12 @@ static void gen_database_decls(const act* action) } } -// Declare DATA statement index variable +// Declare DATA statement index variable if (dcl_ndx_var || gpreGlob.requests) printa(COLUMN, "INTEGER ISC_I"); -// generate event parameter block for each event in module +// generate event parameter block for each event in module SSHORT max_count = 0; for (gpre_lls* stack_ptr = gpreGlob.events; stack_ptr; stack_ptr = stack_ptr->lls_next) { @@ -1576,9 +1576,9 @@ static void gen_database_decls(const act* action) //____________________________________________________________ -// +// // Generate a call to update metadata. -// +// static void gen_ddl(const act* action) { @@ -1587,7 +1587,7 @@ static void gen_ddl(const act* action) printa(COLUMN, "if (gds__trans .ne. 0) then"); } -// Set up command type for call to RDB_DDL +// Set up command type for call to RDB_DDL const gpre_req* request = action->act_request; @@ -1614,9 +1614,9 @@ static void gen_ddl(const act* action) //____________________________________________________________ -// +// // Generate a call to create a database. -// +// static void gen_drop_database(const act* action) { @@ -1634,9 +1634,9 @@ static void gen_drop_database(const act* action) //____________________________________________________________ -// +// // Generate a dynamic SQL statement. -// +// static void gen_dyn_close(const act* action) { @@ -1651,9 +1651,9 @@ static void gen_dyn_close(const act* action) //____________________________________________________________ -// +// // Generate a dynamic SQL statement. -// +// static void gen_dyn_declare(const act* action) { @@ -1670,9 +1670,9 @@ static void gen_dyn_declare(const act* action) //____________________________________________________________ -// +// // Generate a dynamic SQL statement. -// +// static void gen_dyn_describe(const act* action, bool bind_flag) @@ -1692,9 +1692,9 @@ static void gen_dyn_describe(const act* action, //____________________________________________________________ -// +// // Generate a dynamic SQL statement. -// +// static void gen_dyn_execute(const act* action) { @@ -1751,9 +1751,9 @@ static void gen_dyn_execute(const act* action) //____________________________________________________________ -// +// // Generate a dynamic SQL statement. -// +// static void gen_dyn_fetch(const act* action) { @@ -1782,9 +1782,9 @@ static void gen_dyn_fetch(const act* action) //____________________________________________________________ -// +// // Generate code for an EXECUTE IMMEDIATE dynamic SQL statement. -// +// static void gen_dyn_immediate(const act* action) { @@ -1845,9 +1845,9 @@ static void gen_dyn_immediate(const act* action) //____________________________________________________________ -// +// // Generate a dynamic SQL statement. -// +// static void gen_dyn_insert(const act* action) { @@ -1875,9 +1875,9 @@ static void gen_dyn_insert(const act* action) //____________________________________________________________ -// +// // Generate a dynamic SQL statement. -// +// static void gen_dyn_open(const act* action) { @@ -1934,9 +1934,9 @@ static void gen_dyn_open(const act* action) //____________________________________________________________ -// +// // Generate a dynamic SQL statement. -// +// static void gen_dyn_prepare(const act* action) { @@ -1988,9 +1988,9 @@ static void gen_dyn_prepare(const act* action) //____________________________________________________________ -// +// // Generate substitution text for END_MODIFY. -// +// static void gen_emodify(const act* action) { @@ -2024,16 +2024,16 @@ static void gen_emodify(const act* action) //____________________________________________________________ -// +// // Generate substitution text for END_STORE. -// +// static void gen_estore(const act* action) { const gpre_req* request = action->act_request; // if this is a store...returning_values (aka store2) -// we already executed the store, so go home quietly +// we already executed the store, so go home quietly if (request->req_type == REQ_store2) return; @@ -2045,10 +2045,10 @@ static void gen_estore(const act* action) //____________________________________________________________ -// +// // Generate an END IF for the IF generated for // the AT_END clause. -// +// static void gen_end_fetch(void) { @@ -2057,9 +2057,9 @@ static void gen_end_fetch(void) //____________________________________________________________ -// +// // Generate definitions associated with a single request. -// +// static void gen_endfor(const act* action) { @@ -2074,9 +2074,9 @@ static void gen_endfor(const act* action) //____________________________________________________________ -// +// // Generate substitution text for ERASE. -// +// static void gen_erase(const act* action) { @@ -2086,10 +2086,10 @@ static void gen_erase(const act* action) //____________________________________________________________ -// +// // Generate event parameter blocks for use // with a particular call to isc_event_wait. -// +// static SSHORT gen_event_block(const act* action) { @@ -2109,9 +2109,9 @@ static SSHORT gen_event_block(const act* action) //____________________________________________________________ -// +// // Generate substitution text for EVENT_INIT. -// +// static void gen_event_init(const act* action) { @@ -2140,7 +2140,7 @@ static void gen_event_init(const act* action) args.pat_string3 = I2_1; args.pat_string4 = I2_2; -// generate call to dynamically generate event blocks +// generate call to dynamically generate event blocks TEXT variable[MAX_REF_SIZE]; SSHORT count = 0; @@ -2170,14 +2170,14 @@ static void gen_event_init(const act* action) } const SSHORT column = 6; - + PATTERN_expand(column, pattern1, &args); -// generate actual call to event_wait +// generate actual call to event_wait PATTERN_expand(column, pattern2, &args); -// get change in event counts, copying event parameter block for reuse +// get change in event counts, copying event parameter block for reuse PATTERN_expand(column, pattern3, &args); status_and_stop(action); @@ -2185,9 +2185,9 @@ static void gen_event_init(const act* action) //____________________________________________________________ -// +// // Generate substitution text for EVENT_WAIT. -// +// static void gen_event_wait(const act* action) { @@ -2199,7 +2199,7 @@ static void gen_event_wait(const act* action) const gpre_sym* event_name = (const gpre_sym*) action->act_object; // go through the stack of gpreGlob.events, checking to see if the -// event has been initialized and getting the event identifier +// event has been initialized and getting the event identifier int ident = -1; DBB database = NULL; @@ -2227,7 +2227,7 @@ static void gen_event_wait(const act* action) args.pat_string1 = ISC_EVENT_WAIT; args.pat_string2 = ISC_EVENT_COUNTS; -// generate calls to wait on the event and to fill out the gpreGlob.events array +// generate calls to wait on the event and to fill out the gpreGlob.events array const SSHORT column = 6; @@ -2238,11 +2238,11 @@ static void gen_event_wait(const act* action) //____________________________________________________________ -// +// // Generate replacement text for the SQL FETCH statement. The // epilog FETCH statement is handled by GEN_S_FETCH (generate // stream fetch). -// +// static void gen_fetch(const act* action) { @@ -2258,7 +2258,7 @@ static void gen_fetch(const act* action) printa(COLUMN, "IF (%s .NE. 0) THEN", gen_name(s, request->req_eof, true)); printa(COLUMN, "SQLCODE = 0"); - + GPRE_NOD var_list = (GPRE_NOD) action->act_object; if (var_list) { for (int i = 0; i < var_list->nod_count; i++) { @@ -2275,9 +2275,9 @@ static void gen_fetch(const act* action) //____________________________________________________________ -// +// // Generate substitution text for FINISH -// +// static void gen_finish(const act* action) { @@ -2294,7 +2294,7 @@ static void gen_finish(const act* action) printa(COLUMN, "END IF"); } -// the user supplied one or more db_handles +// the user supplied one or more db_handles for (rdy* ready = (rdy*) action->act_object; ready; ready = ready->rdy_next) { db = ready->rdy_database; @@ -2325,9 +2325,9 @@ static void gen_finish(const act* action) //____________________________________________________________ -// +// // Generate substitution text for FOR statement. -// +// static void gen_for(const act* action) { @@ -2340,7 +2340,7 @@ static void gen_for(const act* action) request->req_btm_label); printa("", "%-6dCONTINUE", request->req_top_label); - + SCHAR s[MAX_REF_SIZE]; gen_receive(action, request->req_primary); if (action->act_error || (action->act_flags & ACT_sql)) @@ -2363,10 +2363,10 @@ static void gen_for(const act* action) //____________________________________________________________ -// +// // Generate a call to isc_get_slice // or isc_put_slice for an array. -// +// static void gen_get_or_put_slice(const act* action, const ref* reference, @@ -2452,9 +2452,9 @@ static void gen_get_or_put_slice(const act* action, //____________________________________________________________ -// +// // Generate the code to do a get segment. -// +// static void gen_get_segment(const act* action) { @@ -2499,10 +2499,10 @@ static void gen_get_segment(const act* action) //____________________________________________________________ -// +// // Generate text to compile and start a stream. This is // used both by START_STREAM and FOR -// +// static void gen_loop(const act* action) { @@ -2521,10 +2521,10 @@ static void gen_loop(const act* action) //____________________________________________________________ -// +// // Generate a name for a reference. Name is constructed from // port and parameter idents. -// +// static TEXT* gen_name(SCHAR* const string, const ref* reference, @@ -2541,9 +2541,9 @@ static TEXT* gen_name(SCHAR* const string, //____________________________________________________________ -// +// // Generate a block to handle errors. -// +// static void gen_on_error(const act* action) { @@ -2561,9 +2561,9 @@ static void gen_on_error(const act* action) //____________________________________________________________ -// +// // Generate code for an EXECUTE PROCEDURE. -// +// static void gen_procedure(const act* action) { @@ -2579,7 +2579,7 @@ static void gen_procedure(const act* action) args.pat_request = request; args.pat_port = in_port; args.pat_port2 = out_port; - + const TEXT* pattern; if (in_port && in_port->por_length) pattern = @@ -2588,16 +2588,16 @@ static void gen_procedure(const act* action) pattern = "CALL ISC_TRANSACT_REQUEST (%V1, %RF%DH%RE, %RF%RT%RE, %VF%RS%VE, %RI, %VF0%VE, 0, %VF%QL%VE, %RF%QI%RE)\n"; -// Get database attach and transaction started +// Get database attach and transaction started if (gpreGlob.sw_auto) t_start_auto(0, status_vector(action), action, true); -// Move in input values +// Move in input values asgn_from(action, request->req_values); -// Execute the procedure +// Execute the procedure const USHORT column = 6; @@ -2607,7 +2607,7 @@ static void gen_procedure(const act* action) printa(COLUMN, "IF (SQLCODE .EQ. 0) THEN"); -// Move out output values +// Move out output values asgn_to_proc(request->req_references); printa(COLUMN, "END IF"); @@ -2615,9 +2615,9 @@ static void gen_procedure(const act* action) //____________________________________________________________ -// +// // Generate the code to do a put segment. -// +// static void gen_put_segment(const act* action) { @@ -2647,9 +2647,9 @@ static void gen_put_segment(const act* action) //____________________________________________________________ -// +// // Generate BLR in raw, numeric form. Ughly but dense. -// +// static void gen_raw( const UCHAR* blr, @@ -2663,7 +2663,7 @@ static void gen_raw( blr = blr + begin_c; int blr_length = end_c - begin_c + 1; - + TEXT buffer[80]; TEXT* p = buffer; @@ -2706,9 +2706,9 @@ static void gen_raw( //____________________________________________________________ -// +// // Generate substitution text for READY -// +// static void gen_ready(const act* action) { @@ -2730,9 +2730,9 @@ static void gen_ready(const act* action) //____________________________________________________________ -// +// // Generate a send or receive call for a port. -// +// static void gen_receive(const act* action, const gpre_port* port) { @@ -2752,7 +2752,7 @@ static void gen_receive(const act* action, const gpre_port* port) //____________________________________________________________ -// +// // Generate substitution text for RELEASE_REQUESTS // For active databases, call isc_release_request. // for all others, just zero the handle. For the @@ -2760,7 +2760,7 @@ static void gen_receive(const act* action, const gpre_port* port) // are likely if the request was compiled on a database // which has been released and re-readied. If there is // a serious error, it will be caught on the next statement. -// +// static void gen_release(const act* action) { @@ -2781,20 +2781,20 @@ static void gen_release(const act* action) //____________________________________________________________ -// +// // Generate definitions associated with a single request. -// +// static void gen_request_data( const gpre_req* request) { int begin_i, end_i; -// gpreGlob.requests are generated as raw BLR in longword chunks +// gpreGlob.requests are generated as raw BLR in longword chunks // because FORTRAN is a miserable excuse for a language // and doesn't allow byte value assignments to character -// fields. +// fields. - if (!(request->req_flags & (REQ_exp_hand | REQ_sql_blob_open + if (!(request->req_flags & (REQ_exp_hand | REQ_sql_blob_open | REQ_sql_blob_create)) && request->req_type != REQ_slice && request->req_type != REQ_procedure) { @@ -2816,11 +2816,11 @@ static void gen_request_data( const gpre_req* request) // Changed termination test in for-loop from <= to < to fix bug#840. // We were generating data statements with bad bounds on the last data // statement if the data size was divisible by 75. mao 4/3/89 -// +// if ((request->req_type == REQ_ready) || (request->req_type == REQ_create_database)) { - if (request->req_length || request->req_flags & REQ_extend_dpb) + if (request->req_length || request->req_flags & REQ_extend_dpb) { fprintf(gpreGlob.out_file, "%sDATA isc_%dl /%d/ %s{ request length }\n\n", @@ -2841,7 +2841,7 @@ static void gen_request_data( const gpre_req* request) gen_raw(request->req_blr, request->req_type, request->req_length, begin_i, end_i); } - + const TEXT* string_type; if (!gpreGlob.sw_raw) { printa(COMMENT, " "); @@ -2895,15 +2895,15 @@ static void gen_request_data( const gpre_req* request) string_type, request->req_ident); } -// Print out slice description language if there are arrays associated with request +// Print out slice description language if there are arrays associated with request for (const gpre_port* port = request->req_ports; port; port = port->por_next) for (const ref* reference = port->por_references; reference; - reference = reference->ref_next) + reference = reference->ref_next) { if (reference->ref_sdl) { for (begin_i = 0; begin_i < reference->ref_sdl_length; - begin_i = begin_i + (75 * sizeof(SLONG))) + begin_i = begin_i + (75 * sizeof(SLONG))) { end_i = MIN(reference->ref_sdl_length - 1, begin_i + (SLONG)(75 * sizeof(SLONG)) - 1); @@ -2925,12 +2925,12 @@ static void gen_request_data( const gpre_req* request) } } -// Print out any blob parameter blocks required +// Print out any blob parameter blocks required for (blb* blob = request->req_blobs; blob; blob = blob->blb_next) if (blob->blb_bpb_length) { for (begin_i = 0; begin_i < blob->blb_bpb_length; - begin_i = begin_i + (75 * sizeof(SLONG))) + begin_i = begin_i + (75 * sizeof(SLONG))) { end_i = MIN(blob->blb_bpb_length - 1, begin_i + (SLONG)(75 * sizeof(SLONG)) - 1); @@ -2947,9 +2947,9 @@ static void gen_request_data( const gpre_req* request) //____________________________________________________________ -// +// // Generate definitions associated with a single request. -// +// static void gen_request_decls( const gpre_req* request) { @@ -2961,7 +2961,7 @@ static void gen_request_decls( const gpre_req* request) "%sINTEGER*4 %s %s{ request handle }\n\n", COLUMN, request->req_handle, INLINE_COMMENT); } -// generate the request as BLR long words +// generate the request as BLR long words const int rlength = (request->req_length + (sizeof(SLONG) - 1)) / sizeof(SLONG); if (rlength) @@ -2971,7 +2971,7 @@ static void gen_request_decls( const gpre_req* request) COLUMN, request->req_ident, rlength, INLINE_COMMENT); } -// Generate declarations for the slice description language +// Generate declarations for the slice description language for (const gpre_port* port = request->req_ports; port; port = port->por_next) for (const ref* reference = port->por_references; reference; @@ -2988,7 +2988,7 @@ static void gen_request_decls( const gpre_req* request) } } -// Print out any blob parameter block variable declarations required +// Print out any blob parameter block variable declarations required for (blb* blob = request->req_blobs; blob; blob = blob->blb_next) if (blob->blb_const_from_type) { const int blength = @@ -3012,7 +3012,7 @@ static void gen_request_decls( const gpre_req* request) } -// If this is a GET_SLICE/PUT_slice, allocate some variables +// If this is a GET_SLICE/PUT_slice, allocate some variables if (request->req_type == REQ_slice) { printa(COLUMN, "INTEGER*4 isc_%dv (%d)", request->req_ident, @@ -3023,10 +3023,10 @@ static void gen_request_decls( const gpre_req* request) //____________________________________________________________ -// +// // Generate receive call for a port // in a store2 statement. -// +// static void gen_return_value(const act* action) { @@ -3043,10 +3043,10 @@ static void gen_return_value(const act* action) //____________________________________________________________ -// +// // Process routine head. If there are gpreGlob.requests in the // routine, insert local definitions. -// +// static void gen_routine(const act* action) { @@ -3072,9 +3072,9 @@ static void gen_routine(const act* action) //____________________________________________________________ -// +// // Generate substitution text for END_STREAM. -// +// static void gen_s_end(const act* action) { @@ -3097,9 +3097,9 @@ static void gen_s_end(const act* action) //____________________________________________________________ -// +// // Generate substitution text for FETCH. -// +// static void gen_s_fetch(const act* action) { @@ -3112,10 +3112,10 @@ static void gen_s_fetch(const act* action) //____________________________________________________________ -// +// // Generate text to compile and start a stream. This is // used both by START_STREAM and FOR -// +// static void gen_s_start(const act* action) { @@ -3148,9 +3148,9 @@ static void gen_s_start(const act* action) //____________________________________________________________ -// +// // Substitute for a segment, segment length, or blob handle. -// +// static void gen_segment(const act* action) { @@ -3166,8 +3166,8 @@ static void gen_segment(const act* action) //____________________________________________________________ -// -// +// +// static void gen_select(const act* action) { @@ -3205,9 +3205,9 @@ static void gen_select(const act* action) //____________________________________________________________ -// +// // Generate a send call for a port. -// +// static void gen_send(const act* action, const gpre_port* port) { @@ -3226,9 +3226,9 @@ static void gen_send(const act* action, const gpre_port* port) //____________________________________________________________ -// +// // Generate support for get/put slice statement. -// +// static void gen_slice(const act* action) { @@ -3244,7 +3244,7 @@ static void gen_slice(const act* action) slc* slice = (slc*) action->act_object; const gpre_req* parent_request = slice->slc_parent_request; -// Compute array size +// Compute array size sprintf(buffer, "isc_%ds = %d", request->req_ident, slice->slc_field->fld_array->fld_length); @@ -3266,7 +3266,7 @@ static void gen_slice(const act* action) } printa(COLUMN, buffer); -// Make assignments to variable vector +// Make assignments to variable vector const ref* reference; for (reference = request->req_values; reference; @@ -3280,16 +3280,16 @@ static void gen_slice(const act* action) PAT args; args.pat_reference = slice->slc_field_ref; - args.pat_request = parent_request; // blob id request - args.pat_vector1 = status_vector(action); // status vector - args.pat_database = parent_request->req_database; // database handle - args.pat_string1 = action->act_request->req_trans; // transaction handle - args.pat_value1 = request->req_length; // slice descr. length - args.pat_ident1 = request->req_ident; // request name - args.pat_value2 = slice->slc_parameters * sizeof(SLONG); // parameter length + args.pat_request = parent_request; // blob id request + args.pat_vector1 = status_vector(action); // status vector + args.pat_database = parent_request->req_database; // database handle + args.pat_string1 = action->act_request->req_trans; // transaction handle + args.pat_value1 = request->req_length; // slice descr. length + args.pat_ident1 = request->req_ident; // request name + args.pat_value2 = slice->slc_parameters * sizeof(SLONG); // parameter length reference = (const ref*) slice->slc_array->nod_arg[0]; - args.pat_string5 = reference->ref_value; // array name + args.pat_string5 = reference->ref_value; // array name args.pat_string6 = "isc_array_length"; const SSHORT column = 6; @@ -3301,10 +3301,10 @@ static void gen_slice(const act* action) //____________________________________________________________ -// +// // Generate either a START or START_AND_SEND depending // on whether or a not a port is present. -// +// static void gen_start(const act* action, const gpre_port* port) { @@ -3314,7 +3314,7 @@ static void gen_start(const act* action, const gpre_port* port) if (port) { for (const ref* reference = port->por_references; reference; reference = reference->ref_next) - { + { if (reference->ref_field-> fld_array_info) gen_get_or_put_slice(action, reference, false); } @@ -3341,10 +3341,10 @@ static void gen_start(const act* action, const gpre_port* port) //____________________________________________________________ -// +// // Generate text for STORE statement. This includes the compile // call and any variable initialization required. -// +// static void gen_store(const act* action) { @@ -3355,11 +3355,11 @@ static void gen_store(const act* action) if (action->act_error || (action->act_flags & ACT_sql)) make_ok_test(action, request); -// Initialize any blob fields +// Initialize any blob fields const gpre_port* port = request->req_primary; for (const ref* reference = port->por_references; reference; - reference = reference->ref_next) + reference = reference->ref_next) { const gpre_fld* field = reference->ref_field; if (field->fld_flags & FLD_blob) @@ -3370,9 +3370,9 @@ static void gen_store(const act* action) //____________________________________________________________ -// +// // Generate substitution text for START_TRANSACTION. -// +// static void gen_t_start(const act* action) { @@ -3383,7 +3383,7 @@ static void gen_t_start(const act* action) return; } -// build a complete statement, including tpb's. Ready db's as req. +// build a complete statement, including tpb's. Ready db's as req. const tpb* tpb_iterator; if (gpreGlob.sw_auto) @@ -3402,8 +3402,8 @@ static void gen_t_start(const act* action) } #ifdef HPUX -// If this is HPUX we should be building a teb vector here -// with the tpb address and length specified +// If this is HPUX we should be building a teb vector here +// with the tpb address and length specified int count = 0; for (tpb_iterator = trans->tra_tpb; @@ -3447,9 +3447,9 @@ static void gen_t_start(const act* action) //____________________________________________________________ -// +// // Initialize a TPB in the output file -// +// static void gen_tpb_data(const tpb* tpb_buffer) { @@ -3458,12 +3458,12 @@ static void gen_tpb_data(const tpb* tpb_buffer) SLONG longword_tpb; } tpb_hunk; -// -// TPBs are generated as raw BLR in longword chunks +// +// TPBs are generated as raw BLR in longword chunks // because FORTRAN is a miserable excuse for a language // and doesn't allow byte value assignments to character // fields. -// +// int length = (tpb_buffer->tpb_length + (sizeof(SLONG) - 1)) / sizeof(SLONG); @@ -3472,13 +3472,13 @@ static void gen_tpb_data(const tpb* tpb_buffer) const UCHAR* text = tpb_buffer->tpb_string; length = tpb_buffer->tpb_length; strcpy(output_buffer, CONTINUE); - + TEXT* p; for (p = output_buffer; *p; p++); while (length) { for (UCHAR* c = tpb_hunk.bytewise_tpb; - c < tpb_hunk.bytewise_tpb + sizeof(SLONG); c++) + c < tpb_hunk.bytewise_tpb + sizeof(SLONG); c++) { *c = *text++; if (!--length) @@ -3499,10 +3499,10 @@ static void gen_tpb_data(const tpb* tpb_buffer) //____________________________________________________________ -// +// // Generate the declaration for a // TPB in the output file -// +// static void gen_tpb_decls(const tpb* tpb_buffer) { @@ -3514,9 +3514,9 @@ static void gen_tpb_decls(const tpb* tpb_buffer) //____________________________________________________________ -// +// // Generate substitution text for COMMIT, ROLLBACK, PREPARE, and SAVE -// +// static void gen_trans(const act* action) { @@ -3548,9 +3548,9 @@ static void gen_trans(const act* action) //____________________________________________________________ -// +// // Generate substitution text for UPDATE ... WHERE CURRENT OF ... -// +// static void gen_update(const act* action) { @@ -3562,9 +3562,9 @@ static void gen_update(const act* action) //____________________________________________________________ -// +// // Substitute for a variable reference. -// +// static void gen_variable(const act* action) { @@ -3579,9 +3579,9 @@ static void gen_variable(const act* action) //____________________________________________________________ -// +// // Generate tests for any WHENEVER clauses that may have been declared. -// +// static void gen_whenever(const swe* label) { @@ -3608,10 +3608,10 @@ static void gen_whenever(const swe* label) } //____________________________________________________________ -// +// // Generate a declaration of an array in the // output file. -// +// static void make_array_declaration( const ref* reference) { @@ -3619,7 +3619,7 @@ static void make_array_declaration( const ref* reference) const SCHAR* const name = field->fld_symbol->sym_string; // Check to see if the array already has been -// declared in this routine or subroutine +// declared in this routine or subroutine if (array_decl_list) { for (adl* loop_array = array_decl_list; loop_array; loop_array = loop_array->adl_next) @@ -3631,7 +3631,7 @@ static void make_array_declaration( const ref* reference) } } -// If not, add it to the "declared" list and declare it +// If not, add it to the "declared" list and declare it adl* this_array = (adl*) MSC_alloc(ADL_LEN); this_array->adl_gds_ident = field->fld_array_info->ary_ident; if (array_decl_list) @@ -3677,12 +3677,12 @@ static void make_array_declaration( const ref* reference) } } -// Print out the dimension part of the declaration +// Print out the dimension part of the declaration fprintf(gpreGlob.out_file, "isc_%d", field->fld_array_info->ary_ident); fprintf(gpreGlob.out_file, "("); for (dim* dimension = field->fld_array_info->ary_dimension; dimension; - dimension = dimension->dim_next) + dimension = dimension->dim_next) { if (dimension->dim_lower != 1) fprintf(gpreGlob.out_file, "%"SLONGFORMAT":", dimension->dim_lower); @@ -3695,16 +3695,16 @@ static void make_array_declaration( const ref* reference) if (field->fld_dtype == dtype_quad || field->fld_dtype == dtype_date) fprintf(gpreGlob.out_file, ",2"); -// Print out the database field +// Print out the database field fprintf(gpreGlob.out_file, ") %s{ %s }\n", INLINE_COMMENT, name); } //____________________________________________________________ -// +// // Turn a symbol into a varying string. -// +// static TEXT* make_name( TEXT* const string, const gpre_sym* symbol) { @@ -3716,10 +3716,10 @@ static TEXT* make_name( TEXT* const string, const gpre_sym* symbol) //____________________________________________________________ -// +// // Generate code to test existence of compiled request with // active transaction -// +// static void make_ok_test(const act* action, const gpre_req* request) { @@ -3732,9 +3732,9 @@ static void make_ok_test(const act* action, const gpre_req* request) //____________________________________________________________ -// +// // Insert a port record description in output. -// +// static void make_port( const gpre_port* port) { @@ -3743,7 +3743,7 @@ static void make_port( const gpre_port* port) const ref* reference; for (reference = port->por_references; reference; - reference = reference->ref_next) + reference = reference->ref_next) { const gpre_fld* field = reference->ref_field; const gpre_sym* symbol = field->fld_symbol; @@ -3816,9 +3816,9 @@ static void make_port( const gpre_port* port) //____________________________________________________________ -// +// // Generate the actual ready call. -// +// static void make_ready( DBB db, const TEXT* filename, const TEXT* vector, const gpre_req* request) @@ -3833,7 +3833,7 @@ static void make_ready( DBB db, const TEXT* filename, const TEXT* vector, else sprintf(s2, "isc_%d", request->req_ident); /* if the dpb needs to be extended at runtime to include items - in host variables, do so here; this assumes that there is + in host variables, do so here; this assumes that there is always a request generated for runtime variables */ if (request->req_flags & REQ_extend_dpb) { @@ -3842,7 +3842,7 @@ static void make_ready( DBB db, const TEXT* filename, const TEXT* vector, COLUMN, s2, request->req_ident); FTN_print_buffer(output_buffer); } -// MMM +// MMM else { sprintf(output_buffer, "%s%s = 0\n", COLUMN, s2); FTN_print_buffer(output_buffer); @@ -3928,7 +3928,7 @@ static void make_ready( DBB db, const TEXT* filename, const TEXT* vector, sprintf(output_buffer, "%sCALL ISC_FREE (%s)\n", COLUMN, s2); FTN_print_buffer(output_buffer); - // reset the length of the dpb + // reset the length of the dpb sprintf(output_buffer, "%s%s = %d\n", COLUMN, s1, request->req_length); @@ -3938,11 +3938,11 @@ static void make_ready( DBB db, const TEXT* filename, const TEXT* vector, //____________________________________________________________ -// +// // Looks at the label bitmap and allocates // an unused label. Marks the current // label as used. -// +// static USHORT next_label(void) { @@ -3962,9 +3962,9 @@ static USHORT next_label(void) //____________________________________________________________ -// +// // Print a fixed string at a particular COLUMN. -// +// static void printa(const TEXT* column, const TEXT* string, ...) { @@ -3982,9 +3982,9 @@ static void printa(const TEXT* column, const TEXT* string, ...) //____________________________________________________________ -// +// // Generate the appropriate transaction handle. -// +// static const TEXT* request_trans(const act* action, const gpre_req* request) { @@ -4000,11 +4000,11 @@ static const TEXT* request_trans(const act* action, const gpre_req* request) //____________________________________________________________ -// +// // Do the error handling ourselves // until we figure out how to use the // ISC_NULL from FORTRAN -// +// static void status_and_stop(const act* action) { @@ -4020,25 +4020,25 @@ static void status_and_stop(const act* action) //____________________________________________________________ -// +// // Generate the appropriate status vector parameter for a gds // call depending on where or not the action has an error clause. -// +// static const TEXT* status_vector(const act* action) { return "ISC_STATUS"; -// return (!action || !action->act_error) ? "ISC_NULL" : "ISC_STATUS"; +// return (!action || !action->act_error) ? "ISC_NULL" : "ISC_STATUS"; } //____________________________________________________________ -// +// // Generate substitution text for START_TRANSACTION, // when it's being generated automatically by a compile // call or one of the DDL commands. Be careful not to // continue after errors as that destroys evidence. -// +// static void t_start_auto(const gpre_req* request, const TEXT* vector, @@ -4049,7 +4049,7 @@ static void t_start_auto(const gpre_req* request, buffer[0] = 0; const TEXT* trname = request_trans(action, request); -// this is a default transaction, make sure all databases are ready +// this is a default transaction, make sure all databases are ready int count = 0; for (DBB db = gpreGlob.isc_databases; db; db = db->dbb_next) { @@ -4115,10 +4115,10 @@ static void t_start_auto(const gpre_req* request, #ifdef NOT_USED_OR_REPLACED /* RRK_?: this column stuff was not used in 3.3 may be should not bother with it now */ //____________________________________________________________ -// +// // Align output to a specific column for output. If the // column is negative, don't do anything. -// +// static void align( int column) { @@ -4137,10 +4137,10 @@ static void align( int column) #endif /* RRK_?: end of comment out */ //____________________________________________________________ -// +// // Generate a function call for free standing ANY. Somebody else // will need to generate the actual function. -// +// static void gen_any(const act* action) { @@ -4162,9 +4162,9 @@ static void gen_any(const act* action) } //____________________________________________________________ -// +// // Zap all know handles. -// +// static void gen_clear_handles(const act* action) { @@ -4176,9 +4176,9 @@ static void gen_clear_handles(const act* action) #ifdef NOT_USED_OR_REPLACED //____________________________________________________________ -// +// // Generate a symbol to ease compatibility with V3. -// +// static void gen_compatibility_symbol( const TEXT* symbol, @@ -4193,9 +4193,9 @@ static void gen_compatibility_symbol( #endif //____________________________________________________________ -// +// // Generate a function for free standing ANY or statistical. -// +// static void gen_function(const act* function) { @@ -4227,18 +4227,18 @@ static void gen_function(const act* function) if (port) { for (const ref* reference = port->por_references; reference; - reference = reference->ref_next) + reference = reference->ref_next) { const gpre_fld* field = reference->ref_field; const TEXT* dtype; - + switch (field->fld_dtype) { case dtype_short: dtype = "short"; break; case dtype_long: -// RRK_?: dtype = DCL_LONG; +// RRK_?: dtype = DCL_LONG; break; case dtype_cstring: @@ -4247,7 +4247,7 @@ static void gen_function(const act* function) break; case dtype_quad: -// dtype = DCL_QUAD; +// dtype = DCL_QUAD; break; case dtype_date: @@ -4283,7 +4283,7 @@ static void gen_function(const act* function) for (port = request->req_ports; port; port = port->por_next) { for (const ref* reference = port->por_references; reference; - reference = reference->ref_next) + reference = reference->ref_next) { if (reference->ref_field-> fld_array_info) gen_get_or_put_slice(action, reference, true); @@ -4296,9 +4296,9 @@ static void gen_function(const act* function) } //____________________________________________________________ -// +// // Substitute for a variable reference. -// +// static void gen_type(const act* action) { @@ -4308,9 +4308,9 @@ static void gen_type(const act* action) #ifdef NOT_USED_OR_REPLACED //____________________________________________________________ -// +// // Print a fixed string at a particular column. -// +// static void printb(const TEXT* string, ...) { diff --git a/src/gpre/gpre.cpp b/src/gpre/gpre.cpp index 8378a8e792..2621d18f9c 100644 --- a/src/gpre/gpre.cpp +++ b/src/gpre/gpre.cpp @@ -1,42 +1,42 @@ //____________________________________________________________ -// +// // PROGRAM: Preprocessor // MODULE: gpre.cpp // DESCRIPTION: Main line routine -// +// // The contents of this file are subject to the Interbase Public // License Version 1.0 (the "License"); you may not use this file // except in compliance with the License. You may obtain a copy // of the License at http://www.Inprise.com/IPL.html -// +// // Software distributed under the License is distributed on an // "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express // or implied. See the License for the specific language governing // rights and limitations under the License. -// +// // The Original Code was created by Inprise Corporation // and its predecessors. Portions created by Inprise Corporation are // Copyright (C) Inprise Corporation. -// +// // All Rights Reserved. // Contributor(s): ______________________________________. // Revision 1.2 2000/11/16 15:54:29 fsg // Added new switch -verbose to gpre that will dump // parsed lines to stderr -// +// // Fixed gpre bug in handling row names in WHERE clauses // that are reserved words now (DATE etc) // (this caused gpre to dump core when parsing tan.e) -// +// // Fixed gpre bug in handling lower case table aliases // in WHERE clauses for sql dialect 2 and 3. // (cause a core dump in a test case from C.R. Zamana) -// +// // TMN (Mike Nordell) 11.APR.2001 - Reduce compiler warnings -// +// // FSG (Frank Schlottmann-Gödde) 8.Mar.2002 - tiny cobol support -// fixed Bug No. 526204 +// fixed Bug No. 526204 // // Stephen W. Boyd - Added support for new features. // @@ -96,7 +96,7 @@ static void remember_label(const TEXT*); static void return_char(SSHORT); static SSHORT skip_white(); -// Program wide globals +// Program wide globals static FILE* input_file; static FILE* trace_file; @@ -263,7 +263,7 @@ int main(int argc, char* argv[]) gpreGlob.ada_flags = 0; input_char = input_buffer; - // Initialize character class table + // Initialize character class table int i; for (i = 0; i <= 127; ++i) { set_classes(i, 0); @@ -291,11 +291,11 @@ int main(int argc, char* argv[]) set_classes('\"', CHR_DBLQUOTE); set_classes('#', CHR_IDENT); -// zorch 0 through 7 in the fortran label vector +// zorch 0 through 7 in the fortran label vector gpreGlob.fortran_labels[0] = 255; -// set switches and so on to default (C) values +// set switches and so on to default (C) values DBB db = NULL; @@ -333,13 +333,13 @@ int main(int argc, char* argv[]) gpreGlob.sw_know_interp = FALSE; gpreGlob.sw_interp = 0; -// FSG 14.Nov.2000 +// FSG 14.Nov.2000 sw_verbose = false; gpreGlob.sw_sql_dialect = gpreGlob.compiletime_db_dialect = SQL_DIALECT_V5; -// -// Call a subroutine to process the input line -// +// +// Call a subroutine to process the input line +// TEXT* filename_array[4] = { 0, 0, 0, 0 }; @@ -358,32 +358,32 @@ int main(int argc, char* argv[]) CPR_exit(FINI_ERROR); } -// -// Try to open the input file. +// +// Try to open the input file. // If the language wasn't supplied, maybe the kind user included a language // specific extension, and the file name fixer will find it. The file name // fixer returns FALSE if it can't add an extension, which means there's already // one of the right type there. -// +// TEXT spare_file_name[MAXPATHLEN]; if (gpreGlob.sw_language == lang_undef) for (ext_tab = dml_ext_table; gpreGlob.sw_language = ext_tab->ext_language; - ext_tab++) + ext_tab++) { strcpy(spare_file_name, file_name); if (!file_rename(spare_file_name, ext_tab->in, NULL)) break; } -// +// // Sigh. No such luck. Maybe there's a file lying around with a plausible // extension and we can use that. -// +// if (gpreGlob.sw_language == lang_undef) for (ext_tab = dml_ext_table; gpreGlob.sw_language = ext_tab->ext_language; - ext_tab++) + ext_tab++) { strcpy(spare_file_name, file_name); if (file_rename(spare_file_name, ext_tab->in, NULL) && @@ -394,10 +394,10 @@ int main(int argc, char* argv[]) } } -// +// // Well, if he won't tell me what language it is, or even give me a hint, I'm // not going to spend all day figuring out what he wants done. -// +// if (gpreGlob.sw_language == lang_undef) { fprintf(stderr, @@ -406,13 +406,13 @@ int main(int argc, char* argv[]) CPR_exit(FINI_ERROR); } -// +// // Having got here, we know the language, and might even have the file open. // Better check before reopening it on ourselves. Try the file with the // extension first (even if we have to add the extension). If we add an // extension, and find a file with that extension, we make the file name // point to the expanded file name string in a private buffer. -// +// if (!input_file) { strcpy(spare_file_name, file_name); @@ -440,10 +440,10 @@ int main(int argc, char* argv[]) } } -// +// // Now, apply the switches and defaults we've so painfully acquired; // adding in the language switch in case we inferred it rather than parsing it. -// +// const ext_table_t* src_ext_tab = dml_ext_table; @@ -479,30 +479,30 @@ int main(int argc, char* argv[]) break; case IN_SW_GPRE_D: - // allocate database block and link to db chain + // allocate database block and link to db chain db = (DBB) MSC_alloc_permanent(DBB_LEN); db->dbb_next = gpreGlob.isc_databases; - // put this one in line to be next + // put this one in line to be next gpreGlob.isc_databases = db; - // allocate symbol block + // allocate symbol block symbol = (gpre_sym*) MSC_alloc_permanent(SYM_LEN); - // make it a database, specifically this one + // make it a database, specifically this one symbol->sym_type = SYM_database; symbol->sym_object = (gpre_ctx*) db; symbol->sym_string = gpreGlob.database_name; - // database block points to the symbol block + // database block points to the symbol block db->dbb_name = symbol; - // give it the file name and try to open it + // give it the file name and try to open it db->dbb_filename = db_filename; if (!MET_database(db, true)) @@ -585,7 +585,7 @@ int main(int argc, char* argv[]) #endif comment_stop = " "; - // Change the patterns for v4.0 + // Change the patterns for v4.0 gpreGlob.ident_pattern = "isc_%d"; gpreGlob.long_ident_pattern = "isc_%ld"; @@ -663,7 +663,7 @@ int main(int argc, char* argv[]) gpreGlob.transaction_name = "gds_trans"; gpreGlob.sw_know_interp = FALSE; gpreGlob.sw_interp = 0; - gpreGlob.ident_pattern = "isc_%d"; + gpreGlob.ident_pattern = "isc_%d"; gpreGlob.long_ident_pattern = "isc_%ld"; gpreGlob.utility_name = "isc_utility"; gpreGlob.count_name = "isc_count"; @@ -699,7 +699,7 @@ int main(int argc, char* argv[]) case IN_SW_GPRE_T: sw_trace = true; break; -// FSG 14.Nov.2000 +// FSG 14.Nov.2000 case IN_SW_GPRE_VERBOSE: sw_verbose = true; break; @@ -713,10 +713,10 @@ int main(int argc, char* argv[]) { CPR_warn("gpre: -user, -password and -charset switches require -manual"); } -// +// // If one of the C++ variants was used/discovered, convert to C++ for // further internal use. -// +// if (gpreGlob.sw_language == lang_cpp || gpreGlob.sw_language == lang_cplusplus) gpreGlob.sw_language = lang_cxx; @@ -732,7 +732,7 @@ int main(int argc, char* argv[]) #if defined(GPRE_COBOL) && !defined(BOOT_BUILD) // if cobol is defined we need both sw_cobol and sw_cob_dialect to // determine how the string substitution table is set up -// +// if (gpreGlob.sw_language == lang_cobol) if (isAnsiCobol(gpreGlob.sw_cob_dialect)) { @@ -755,10 +755,10 @@ int main(int argc, char* argv[]) COB_name_init(isAnsiCobol(gpreGlob.sw_cob_dialect)); #endif -// +// // See if user has specified an interpretation on the command line, // as might be used for SQL access. -// +// if (gpreGlob.default_lc_ctype) { if (all_digits(gpreGlob.default_lc_ctype)) { @@ -768,19 +768,19 @@ int main(int argc, char* argv[]) gpreGlob.sw_know_interp = TRUE; } else if (compare_ASCII7z(gpreGlob.default_lc_ctype, "DYNAMIC") == 0) { - // Dynamic means use the interpretation declared at runtime + // Dynamic means use the interpretation declared at runtime gpreGlob.sw_interp = ttype_dynamic; gpreGlob.sw_know_interp = TRUE; } else if (gpreGlob.isc_databases) { - // Name resolution done by MET_load_hash_table + // Name resolution done by MET_load_hash_table gpreGlob.isc_databases->dbb_c_lc_ctype = gpreGlob.default_lc_ctype; } } -// +// // Finally, open the output file, if we're not using standard out. // If only one file name was given, make sure it has the preprocessor // extension, then back up to that extension, zorch it, and add @@ -789,7 +789,7 @@ int main(int argc, char* argv[]) // name, use it as is unless it doesn't have an extension in which // case use the default language extension. Finally, open the file. // What could be easier? -// +// TEXT spare_out_file_name[MAXPATHLEN]; if (!sw_standard_out) { @@ -842,7 +842,7 @@ int main(int argc, char* argv[]) } } -// Compile modules until end of file +// Compile modules until end of file sw_databases = gpreGlob.isc_databases; @@ -889,9 +889,9 @@ int main(int argc, char* argv[]) //____________________________________________________________ -// +// // Abort this silly program. -// +// void CPR_abort() { @@ -903,9 +903,9 @@ void CPR_abort() #ifdef DEV_BUILD //____________________________________________________________ -// +// // Report an assertion failure and abort this silly program. -// +// void CPR_assert(const TEXT* file, int line) { @@ -919,9 +919,9 @@ void CPR_assert(const TEXT* file, int line) //____________________________________________________________ -// +// // Issue an error message. -// +// void CPR_bugcheck(const TEXT* string) { @@ -932,9 +932,9 @@ void CPR_bugcheck(const TEXT* string) //____________________________________________________________ -// +// // Mark end of a text description. -// +// void CPR_end_text(gpre_txt* text) { @@ -943,9 +943,9 @@ void CPR_end_text(gpre_txt* text) //____________________________________________________________ -// +// // Issue an error message. -// +// int CPR_error(const TEXT* string) { @@ -957,9 +957,9 @@ int CPR_error(const TEXT* string) //____________________________________________________________ -// +// // Exit with status. -// +// void CPR_exit( int stat) { @@ -984,9 +984,9 @@ void CPR_exit( int stat) //____________________________________________________________ -// +// // Issue an warning message. -// +// void CPR_warn(const TEXT* string) { @@ -996,20 +996,20 @@ void CPR_warn(const TEXT* string) //____________________________________________________________ -// +// // Fortran, being a line oriented language, sometimes needs // to know when it is at end of line to avoid parsing into the // next statement. CPR_eol_token normally gets the next token, // but if the language is FORTRAN and there isn't anything else // on the line, it fakes a dummy token to indicate end of line. -// +// TOK CPR_eol_token() { if (gpreGlob.sw_language != lang_fortran) return CPR_token(); -// Save the information from the previous token +// Save the information from the previous token gpreGlob.prior_token = gpreGlob.token_global; gpreGlob.prior_token.tok_position = last_position; @@ -1020,7 +1020,7 @@ TOK CPR_eol_token() TEXT* p = gpreGlob.token_global.tok_string; SSHORT num_chars = 0; -// skip spaces +// skip spaces SSHORT c; for (c = nextchar(); c == ' '; c = nextchar()) { @@ -1028,7 +1028,7 @@ TOK CPR_eol_token() *p++ = (TEXT) c; } -// in-line comments are equivalent to end of line +// in-line comments are equivalent to end of line if (c == '!') while (c != '\n' && c != EOF) { @@ -1036,7 +1036,7 @@ TOK CPR_eol_token() num_chars++; } -// in-line SQL comments are equivalent to end of line +// in-line SQL comments are equivalent to end of line if (gpreGlob.sw_sql && (c == '-')) { const SSHORT peek = nextchar(); @@ -1057,7 +1057,7 @@ TOK CPR_eol_token() return NULL; } -// Not EOL so back up to the begining and try again +// Not EOL so back up to the begining and try again if (c != '\n') { return_char(c); @@ -1066,9 +1066,9 @@ TOK CPR_eol_token() return CPR_token(); } -// if we've got EOL, treat it like a semi-colon +// if we've got EOL, treat it like a semi-colon // NOTE: the fact that the length of this token is set to 0, is used as an -// indicator elsewhere that it was a faked token +// indicator elsewhere that it was a faked token gpreGlob.token_global.tok_string[0] = ';'; gpreGlob.token_global.tok_string[1] = 0; @@ -1087,9 +1087,9 @@ TOK CPR_eol_token() //____________________________________________________________ -// +// // Write text from the scratch trace file into a buffer. -// +// void CPR_get_text( TEXT* buffer, const gpre_txt* text) { @@ -1102,7 +1102,7 @@ void CPR_get_text( TEXT* buffer, const gpre_txt* text) // getc to position ourselves at the token position. // We should keep both character position and byte position // and use them appropriately. for now use getc () -// +// #if (defined WIN_NT) if (fseek(trace_file, 0L, 0)) @@ -1114,7 +1114,7 @@ void CPR_get_text( TEXT* buffer, const gpre_txt* text) CPR_error("fseek failed for trace file"); } #if (defined WIN_NT) -// move forward to actual position +// move forward to actual position while (start--) getc(trace_file); @@ -1128,12 +1128,12 @@ void CPR_get_text( TEXT* buffer, const gpre_txt* text) //____________________________________________________________ -// +// // A BASIC-specific function which resides here since it reads from // the input file. Look for a '\n' with no continuation character (&). // Eat tokens until previous condition is satisfied. // This function is used to "eat" a BASIC external function definition. -// +// void CPR_raw_read() { @@ -1172,9 +1172,9 @@ void CPR_raw_read() //____________________________________________________________ -// +// // Generate a syntax error. -// +// void CPR_s_error(const TEXT* string) { @@ -1188,9 +1188,9 @@ void CPR_s_error(const TEXT* string) //____________________________________________________________ -// +// // Make the current position to save description text. -// +// gpre_txt* CPR_start_text() { @@ -1202,12 +1202,12 @@ gpre_txt* CPR_start_text() //____________________________________________________________ -// +// // Parse and return the next token. // If the token is a charset introducer, gobble it, grab the // next token, and flag that token as being in a non-default // character set. -// +// TOK CPR_token() { @@ -1249,7 +1249,7 @@ TOK CPR_token() switch (gpreGlob.sw_sql_dialect) { case SQL_DIALECT_V5: if (isQuoted(token->tok_type)) { - token->tok_charset = MSC_find_symbol(HSH_lookup(gpreGlob.default_lc_ctype), + token->tok_charset = MSC_find_symbol(HSH_lookup(gpreGlob.default_lc_ctype), SYM_charset); } break; @@ -1266,9 +1266,9 @@ TOK CPR_token() //____________________________________________________________ -// +// // Return true if the string consists entirely of digits. -// +// static bool all_digits(const char* str1) { @@ -1283,11 +1283,11 @@ static bool all_digits(const char* str1) //____________________________________________________________ -// +// // Check the command line argument which follows // a switch which requires a string argument. // If there is a problem, explain and return. -// +// static bool arg_is_string(SLONG argc, TEXT** argvstring, @@ -1306,13 +1306,13 @@ static bool arg_is_string(SLONG argc, //____________________________________________________________ -// +// // Compare two ASCII 7-bit strings, case insensitive. // Strings are null-byte terminated. // Return 0 if strings are equal, -// (negative) if str1 < str2 +// (negative) if str1 < str2 // (positive) if str1 > str2 -// +// static SSHORT compare_ASCII7z(const char* str1, const char* str2) { @@ -1328,21 +1328,21 @@ static SSHORT compare_ASCII7z(const char* str1, const char* str2) //____________________________________________________________ -// +// // Switches have been processed and files have been opened. // Process a module and generate output. -// +// static SLONG compile_module( SLONG start_position, const TEXT* base_directory) { -// Reset miscellaneous pointers +// Reset miscellaneous pointers gpreGlob.isc_databases = sw_databases; gpreGlob.requests = NULL; gpreGlob.events = NULL; global_last_action = global_first_action = gpreGlob.global_functions = NULL; -// Position the input file and initialize various modules +// Position the input file and initialize various modules fseek(input_file, start_position, 0); input_char = input_buffer; @@ -1362,11 +1362,11 @@ static SLONG compile_module( SLONG start_position, const TEXT* base_directory) PAR_init(); CMP_init(); -// Take a first pass at the module +// Take a first pass at the module SLONG end_position = pass1(base_directory); -// finish up any based_ons that got deferred +// finish up any based_ons that got deferred #ifdef GPRE_FORTRAN if (gpreGlob.sw_language == lang_fortran) @@ -1395,12 +1395,12 @@ static SLONG compile_module( SLONG start_position, const TEXT* base_directory) //____________________________________________________________ -// +// // Add the appropriate extension to a file // name, if there's not one already. If // the "appropriate" one is there and a // new extension is given, use it. -// +// static bool file_rename(TEXT* file_nameL, const TEXT* extension, @@ -1408,13 +1408,13 @@ static bool file_rename(TEXT* file_nameL, { TEXT *p; -// go to the end of the file name +// go to the end of the file name for (p = file_nameL; *p; p++); TEXT* terminator = p; -// back up to the last extension (if any) +// back up to the last extension (if any) #ifdef WIN_NT while ((p != file_nameL) && (*p != '.') && (*p != '/') && (*p != '\\')) @@ -1424,21 +1424,21 @@ static bool file_rename(TEXT* file_nameL, --p; -// -// There's a match and the file spec has no extension, -// so add extension. -// +// +// There's a match and the file spec has no extension, +// so add extension. +// if (*p != '.') { while (*terminator++ = *extension++); return true; } -// -// There's a match and an extension. If the extension in -// the table matches the one on the file, we don't want +// +// There's a match and an extension. If the extension in +// the table matches the one on the file, we don't want // to add a duplicate. Otherwise add it. -// +// TEXT* ext = p; for (const TEXT* q = extension; *p == *q; p++, q++) @@ -1454,7 +1454,7 @@ static bool file_rename(TEXT* file_nameL, } } -// Didn't match extension, so add the extension +// Didn't match extension, so add the extension while (*terminator++ = *extension++) ; @@ -1464,11 +1464,11 @@ static bool file_rename(TEXT* file_nameL, #ifdef GPRE_FORTRAN //____________________________________________________________ -// +// // Scan through the based_on actions // looking for ones that were deferred // because we didn't have a database yet. -// +// // Look at each action in turn, and if it's // a based_on with a field name rather than a // field block pointer, complete the name parse. @@ -1476,7 +1476,7 @@ static bool file_rename(TEXT* file_nameL, // then the relation within the database, then // the field. Otherwise, look through all databases // for the relation. -// +// static void finish_based( act* action) { @@ -1596,9 +1596,9 @@ static void finish_based( act* action) #endif //____________________________________________________________ -// +// // Return a character to the input stream. -// +// static int get_char( FILE * file) { @@ -1619,14 +1619,14 @@ static int get_char( FILE * file) //____________________________________________________________ -// -// +// +// // Parse the input line arguments, saving // interesting switches in a switch table. -// The first entry in the switch table is +// The first entry in the switch table is // reserved for the language, and is set // later, even if specified here. -// +// static bool get_switches(int argc, TEXT** argv, @@ -1636,11 +1636,11 @@ static bool get_switches(int argc, { USHORT in_sw = 0; // silence uninitialized warning -// +// // Read all the switches and arguments, acting only on those // that apply immediately, since we may find out more when -// we try to open the file. -// +// we try to open the file. +// SW_TAB sw_table_iterator = sw_table; @@ -1668,7 +1668,7 @@ static bool get_switches(int argc, } else { - // iterate through the switch table, looking for matches + // iterate through the switch table, looking for matches sw_table_iterator++; sw_table_iterator->sw_in_sw = IN_SW_GPRE_0; @@ -1679,12 +1679,12 @@ static bool get_switches(int argc, { const TEXT* p = string + 1; - // handle orphaned hyphen case + // handle orphaned hyphen case if (!*p--) break; - // compare switch to switch name in table + // compare switch to switch name in table while (*p) { if (!*++p) { @@ -1694,7 +1694,7 @@ static bool get_switches(int argc, break; } } - // end of input means we got a match. stop looking + // end of input means we got a match. stop looking if (!*p) break; @@ -1767,7 +1767,7 @@ static bool get_switches(int argc, sw_table_iterator--; break; #endif - case IN_SW_GPRE_LANG_INTERNAL : + case IN_SW_GPRE_LANG_INTERNAL : gpreGlob.sw_language = lang_internal; /*sw_tab--;*/ break; @@ -1775,7 +1775,7 @@ static bool get_switches(int argc, case IN_SW_GPRE_D: if (!arg_is_string (--argc, argv, - "Command line syntax: -d requires database name:\n ")) + "Command line syntax: -d requires database name:\n ")) { return false; } @@ -1797,7 +1797,7 @@ static bool get_switches(int argc, case IN_SW_GPRE_BASE: if (!arg_is_string (--argc, argv, - "Command line syntax: -b requires database base directory:\n ")) + "Command line syntax: -b requires database base directory:\n ")) { return false; } @@ -1960,9 +1960,9 @@ static bool get_switches(int argc, //____________________________________________________________ -// +// // Parse and return the next token. -// +// static TOK get_token() { @@ -1981,7 +1981,7 @@ static TOK get_token() SSHORT c = skip_white(); #ifdef GPRE_COBOL -// Skip over cobol line continuation characters +// Skip over cobol line continuation characters if (gpreGlob.sw_language == lang_cobol && !isAnsiCobol(gpreGlob.sw_cob_dialect)) while (line_position == 1) { c = skip_white(); @@ -1989,7 +1989,7 @@ static TOK get_token() } #endif -// Skip fortran line continuation characters +// Skip fortran line continuation characters #ifdef GPRE_FORTRAN if (gpreGlob.sw_language == lang_fortran) { @@ -2011,7 +2011,7 @@ static TOK get_token() } } #endif -// Get token rolling +// Get token rolling TEXT* p = gpreGlob.token_global.tok_string; const TEXT* const end = p + sizeof(gpreGlob.token_global.tok_string); @@ -2099,7 +2099,7 @@ static TOK get_token() SSHORT next = nextchar(); if (gpreGlob.sw_language == lang_cobol && isAnsiCobol(gpreGlob.sw_cob_dialect) && next == '\n') { if (prior_line_position == 73) { - // should be a split literal + // should be a split literal next = skip_white(); if (next != '-' || line_position != 7) { CPR_error("unterminated quoted string"); @@ -2123,7 +2123,7 @@ static TOK get_token() { return_char(*p); - /* Decrement, then increment line counter, for accuracy of + /* Decrement, then increment line counter, for accuracy of the error message for an unterminated quoted string. */ line_global--; @@ -2206,8 +2206,8 @@ static TOK get_token() if (isQuoted(gpreGlob.token_global.tok_type)) { strip_quotes(gpreGlob.token_global); /** If the dialect is 1 then anything that is quoted is - a string. Don not lookup in the hash table to prevent - parsing confusion. + a string. Don not lookup in the hash table to prevent + parsing confusion. **/ if (gpreGlob.sw_sql_dialect != SQL_DIALECT_V5) gpreGlob.token_global.tok_symbol = symbol = HSH_lookup(gpreGlob.token_global.tok_string); @@ -2243,13 +2243,13 @@ static TOK get_token() gpreGlob.token_global.tok_keyword = KW_none; } -// ** Take care of GDML context variables. Context variables are inserted -//into the hash table as it is. There is no upper casing of the variable +// ** Take care of GDML context variables. Context variables are inserted +//into the hash table as it is. There is no upper casing of the variable //name done. Hence in all likelyhood we might have missed it while looking it //up if -e switch was specified. Hence //IF symbol is null AND it is not a quoted string AND -e switch was specified //THEN search again using HSH_lookup2(). -//* +//* if (gpreGlob.token_global.tok_symbol == NULL && !isQuoted(gpreGlob.token_global.tok_type) && gpreGlob.sw_case) { @@ -2260,7 +2260,7 @@ static TOK get_token() gpreGlob.token_global.tok_keyword = KW_none; } -// for FORTRAN, make note of the first token in a statement +// for FORTRAN, make note of the first token in a statement fb_assert(first_position <= MAX_USHORT); gpreGlob.token_global.tok_first = (USHORT) first_position; @@ -2274,10 +2274,10 @@ static TOK get_token() //____________________________________________________________ -// +// // Get the next character from the input stream. // Also, for Fortran, mark the beginning of a statement -// +// static int nextchar() { @@ -2292,7 +2292,7 @@ static int nextchar() // For silly fortran, mark the first token in a statement so // we can decide to start the database field substitution string -// with a continuation indicator if appropriate. +// with a continuation indicator if appropriate. if (line_position == 1) { first_position = TRUE; @@ -2307,7 +2307,7 @@ static int nextchar() } // if this is a continuation line, the next token is not -// the start of a statement. +// the start of a statement. #ifdef GPRE_FORTRAN if (gpreGlob.sw_language == lang_fortran && line_position == 6 && c != ' ' @@ -2336,14 +2336,14 @@ static int nextchar() //____________________________________________________________ -// +// // Make first pass at input file. This involves // passing thru tokens looking for keywords. When // a keyword is found, try to parse an action. If // the parse is successful (an action block is returned) // link the new action into the system data structures // for processing on pass 2. -// +// static SLONG pass1(const TEXT* base_directory) { @@ -2377,7 +2377,7 @@ static SLONG pass1(const TEXT* base_directory) global_first_action = action; } - // Allow for more than one action to be generated by a token. + // Allow for more than one action to be generated by a token. do { @@ -2428,17 +2428,17 @@ static SLONG pass1(const TEXT* base_directory) //____________________________________________________________ -// +// // Make a second pass thru the input file turning actions into // comments, substituting text for actions, and generating the // output file. -// +// static void pass2( SLONG start_position) { SSHORT c = 0; -// FSG 14.Nov.2000 +// FSG 14.Nov.2000 if (sw_verbose) { fprintf(stderr, "*********************** PASS 2 ***************************\n"); @@ -2451,7 +2451,7 @@ static void pass2( SLONG start_position) isLangCpp(gpreGlob.sw_language) || gpreGlob.sw_language == lang_pascal; -// Put out a distintive module header +// Put out a distintive module header if (!sw_first) { @@ -2490,7 +2490,7 @@ static void pass2( SLONG start_position) // //if (sw_lines) // fprintf (gpreGlob.out_file, "#line 1 \"%s\"\n", backlash_fixed_file_name); -// +// SLONG line = 0; bool line_pending = sw_lines; @@ -2500,7 +2500,7 @@ static void pass2( SLONG start_position) SSHORT comment_start_len = strlen(comment_start); SSHORT to_skip = 0; -// Dump text until the start of the next action, then process the action. +// Dump text until the start of the next action, then process the action. for (const act* action = global_first_action; action; action = action->act_rest) { @@ -2569,9 +2569,9 @@ static void pass2( SLONG start_position) fputs(comment_start, gpreGlob.out_file); } - // Next, dump the text of the action to the output stream. + // Next, dump the text of the action to the output stream. - for (SLONG i = 0; i <= action->act_length; ++i, ++current) + for (SLONG i = 0; i <= action->act_length; ++i, ++current) { if (c == EOF) { CPR_error("internal error -- unexpected EOF in action"); @@ -2580,7 +2580,7 @@ static void pass2( SLONG start_position) const SSHORT prior = c; c = get_char(input_file); if (!suppress_output) { - // close current comment to avoid nesting comments + // close current comment to avoid nesting comments if (sw_block_comments && !(action->act_flags & ACT_mark) && c == comment_start[0]) { @@ -2607,7 +2607,7 @@ static void pass2( SLONG start_position) } } - // reopen our comment at end of user's comment + // reopen our comment at end of user's comment if (sw_block_comments && !(action->act_flags & ACT_mark) && prior == comment_stop[0] && c == comment_stop[1]) @@ -2617,7 +2617,7 @@ static void pass2( SLONG start_position) } } - // Unless action was purely a marker, insert a comment terminator. + // Unless action was purely a marker, insert a comment terminator. if (!(action->act_flags & ACT_mark) && !suppress_output) { fputs(comment_stop, gpreGlob.out_file); @@ -2643,7 +2643,7 @@ static void pass2( SLONG start_position) to_skip = 0; } -// We're out of actions -- dump the remaining text to the output stream. +// We're out of actions -- dump the remaining text to the output stream. if (!line && line_pending) { fprintf(gpreGlob.out_file, "#line 1 \"%s\"\n", backlash_fixed_file_name); @@ -2663,7 +2663,7 @@ static void pass2( SLONG start_position) putc(c, gpreGlob.out_file); } -// Last but not least, generate any remaining functions +// Last but not least, generate any remaining functions for (; gpreGlob.global_functions; gpreGlob.global_functions = gpreGlob.global_functions->act_next) (*gen_routine) (gpreGlob.global_functions, 0); @@ -2671,10 +2671,10 @@ static void pass2( SLONG start_position) //____________________________________________________________ -// +// // Print out the switch table as an // aid to those who have forgotten or are fishing -// +// static void print_switches() { @@ -2705,11 +2705,11 @@ static void print_switches() //____________________________________________________________ -// +// // Set a bit in the label vector indicating // that a label has been used. If the label // is bigger than the vector, punt. -// +// static void remember_label(const TEXT* label_string) { @@ -2723,9 +2723,9 @@ static void remember_label(const TEXT* label_string) //____________________________________________________________ -// +// // Return a character to the input stream. -// +// static void return_char( SSHORT c) { @@ -2733,7 +2733,7 @@ static void return_char( SSHORT c) --position; --line_position; -// note putting back a new line results in incorrect line_position value +// note putting back a new line results in incorrect line_position value if (c == '\n') { --line_global; @@ -2744,9 +2744,9 @@ static void return_char( SSHORT c) //____________________________________________________________ -// +// // Skip over white space and comments in input stream -// +// static SSHORT skip_white() { @@ -2758,7 +2758,7 @@ static SSHORT skip_white() c = c & 0xff; - // skip Fortran comments + // skip Fortran comments #ifdef GPRE_FORTRAN if (gpreGlob.sw_language == lang_fortran && @@ -2771,13 +2771,13 @@ static SSHORT skip_white() #endif #ifdef GPRE_COBOL - // skip sequence numbers when ansi COBOL + // skip sequence numbers when ansi COBOL if (gpreGlob.sw_language == lang_cobol && isAnsiCobol(gpreGlob.sw_cob_dialect)) { while (line_position < 7 && (c = nextchar()) != '\n' && c != EOF); } - // skip COBOL comments and conditional compilation + // skip COBOL comments and conditional compilation if (gpreGlob.sw_language == lang_cobol && (!isAnsiCobol(gpreGlob.sw_cob_dialect) && line_position == 1 && @@ -2797,7 +2797,7 @@ static SSHORT skip_white() continue; } - // skip in-line SQL comments + // skip in-line SQL comments if (gpreGlob.sw_sql && (c == '-')) { const SSHORT c2 = nextchar(); @@ -2834,7 +2834,7 @@ static SSHORT skip_white() } #if !defined(sun) && defined(GPRE_FORTRAN) - // skip fortran embedded comments on hpux or sgi + // skip fortran embedded comments on hpux or sgi if (c == '!' && (gpreGlob.sw_language == lang_fortran)) @@ -2870,7 +2870,7 @@ static SSHORT skip_white() continue; } - // skip PASCAL comments - both types + // skip PASCAL comments - both types if (c == '{' && gpreGlob.sw_language == lang_pascal) { while ((c = nextchar()) != EOF && c != '}') diff --git a/src/gpre/gpre_meta_boot.cpp b/src/gpre/gpre_meta_boot.cpp index 908a4e27db..254e551ee3 100644 --- a/src/gpre/gpre_meta_boot.cpp +++ b/src/gpre/gpre_meta_boot.cpp @@ -1,28 +1,28 @@ /* * tab=4 *____________________________________________________________ - * + * * PROGRAM: C preprocessor * MODULE: gpre_meta_boot.cpp * DESCRIPTION: Meta data interface to system - * + * * The contents of this file are subject to the Interbase Public * License Version 1.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy * of the License at http://www.Inprise.com/IPL.html - * + * * Software distributed under the License is distributed on an * "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express * or implied. See the License for the specific language governing * rights and limitations under the License. - * + * * The Original Code was created by Inprise Corporation * and its predecessors. Portions created by Inprise Corporation are * Copyright (C) Inprise Corporation. - * + * * All Rights Reserved. * Contributor(s): ______________________________________. - * + * * *____________________________________________________________ * @@ -63,10 +63,10 @@ static int upcase(const TEXT*, TEXT* const); #endif /*____________________________________________________________ - * + * * Lookup a field by name in a context. * If found, return field block. If not, return NULL. - */ + */ gpre_fld* MET_context_field( gpre_ctx* context, const char* string) { @@ -102,16 +102,16 @@ gpre_fld* MET_context_field( gpre_ctx* context, const char* string) /*____________________________________________________________ - * + * * Initialize meta data access to database. If the * database can't be opened, return FALSE. - */ + */ bool MET_database(DBB db, bool print_version) { - /* - ** Each info item requested will return + /* + ** Each info item requested will return ** ** 1 byte for the info item tag ** 2 bytes for the length of the information that follows @@ -127,10 +127,10 @@ bool MET_database(DBB db, /*____________________________________________________________ - * + * * Lookup a domain by name. * Initialize the size of the field. - */ + */ bool MET_domain_lookup(gpre_req* request, gpre_fld* field, @@ -172,9 +172,9 @@ bool MET_domain_lookup(gpre_req* request, /*____________________________________________________________ - * + * * Gets the default value for a domain of an existing table - */ + */ bool MET_get_domain_default(DBB db, const TEXT* domain_name, @@ -187,16 +187,16 @@ bool MET_get_domain_default(DBB db, /*____________________________________________________________ - * + * * Gets the default value for a column of an existing table. * Will check the default for the column of the table, if that is * not present, will check for the default of the relevant domain - * + * * The default blr is returned in buffer. The blr is of the form * blr_version4 blr_literal ..... blr_eoc - * + * * Reads the system tables RDB$FIELDS and RDB$RELATION_FIELDS. - */ + */ bool MET_get_column_default(const gpre_rel* relation, const TEXT* column_name, @@ -209,11 +209,11 @@ bool MET_get_column_default(const gpre_rel* relation, /*____________________________________________________________ - * + * * Lookup the fields for the primary key * index on a relation, returning a list * of the fields. - */ + */ gpre_lls* MET_get_primary_key(DBB db, const TEXT* relation_name) { @@ -234,10 +234,10 @@ gpre_lls* MET_get_primary_key(DBB db, const TEXT* relation_name) /*____________________________________________________________ - * + * * Lookup a field by name in a relation. * If found, return field block. If not, return NULL. - */ + */ gpre_fld* MET_field(gpre_rel* relation, const char* string) { @@ -269,9 +269,9 @@ gpre_fld* MET_field(gpre_rel* relation, const char* string) /*____________________________________________________________ - * + * * Return a list of the fields in a relation - */ + */ GPRE_NOD MET_fields(gpre_ctx* context) { @@ -318,9 +318,9 @@ GPRE_NOD MET_fields(gpre_ctx* context) /*____________________________________________________________ - * + * * Shutdown all attached databases. - */ + */ void MET_fini( DBB end) { @@ -329,10 +329,10 @@ void MET_fini( DBB end) /*____________________________________________________________ - * + * * Lookup a generator by name. * If found, return string. If not, return NULL. - */ + */ const SCHAR* MET_generator(const TEXT* string, DBB db) { @@ -342,7 +342,7 @@ const SCHAR* MET_generator(const TEXT* string, DBB db) for (gpre_sym* symbol = HSH_lookup(name); symbol; symbol = symbol->sym_homonym) if ((symbol->sym_type == SYM_generator) && - (db == (DBB) (symbol->sym_object))) + (db == (DBB) (symbol->sym_object))) { return symbol->sym_string; } @@ -352,9 +352,9 @@ const SCHAR* MET_generator(const TEXT* string, DBB db) /*____________________________________________________________ - * + * * Compute internal datatype and length based on system relation field values. - */ + */ USHORT MET_get_dtype(USHORT blr_dtype, USHORT sub_type, USHORT* length) { @@ -441,12 +441,12 @@ USHORT MET_get_dtype(USHORT blr_dtype, USHORT sub_type, USHORT* length) /*____________________________________________________________ - * + * * Lookup a procedure (represented by a token) in a database. * Return a procedure block (if name is found) or NULL. - * + * * This function has been cloned into MET_get_udf - */ + */ gpre_prc* MET_get_procedure(DBB db, const TEXT* string, const TEXT* owner_name) { @@ -462,7 +462,7 @@ gpre_prc* MET_get_procedure(DBB db, const TEXT* string, const TEXT* owner_name) procedure->prc_database == db && (!owner[0] || (procedure->prc_owner - && !strcmp(owner, procedure->prc_owner->sym_string)))) + && !strcmp(owner, procedure->prc_owner->sym_string)))) { break; } @@ -479,16 +479,16 @@ gpre_prc* MET_get_procedure(DBB db, const TEXT* string, const TEXT* owner_name) /*____________________________________________________________ - * + * * Lookup a relation (represented by a token) in a database. * Return a relation block (if name is found) or NULL. - */ + */ gpre_rel* MET_get_relation(DBB db, const TEXT* string, const TEXT* owner_name) { gpre_rel* relation; SCHAR name[NAME_SIZE], owner[NAME_SIZE]; - + strcpy(name, string); strcpy(owner, owner_name); @@ -509,8 +509,8 @@ gpre_rel* MET_get_relation(DBB db, const TEXT* string, const TEXT* owner_name) /*____________________________________________________________ - * - */ + * + */ INTLSYM MET_get_text_subtype(SSHORT ttype) { @@ -523,12 +523,12 @@ INTLSYM MET_get_text_subtype(SSHORT ttype) /*____________________________________________________________ - * + * * Lookup a udf (represented by a token) in a database. * Return a udf block (if name is found) or NULL. - * + * * This function was cloned from MET_get_procedure - */ + */ udf* MET_get_udf(DBB db, const TEXT* string) { @@ -552,11 +552,11 @@ udf* MET_get_udf(DBB db, const TEXT* string) /*____________________________________________________________ - * - * Return relation if the passed view_name represents a - * view with the passed relation as a base table + * + * Return relation if the passed view_name represents a + * view with the passed relation as a base table * (the relation could be an alias). - */ + */ gpre_rel* MET_get_view_relation(gpre_req* request, const char* view_name, @@ -568,10 +568,10 @@ gpre_rel* MET_get_view_relation(gpre_req* request, /*____________________________________________________________ - * + * * Lookup an index for a database. * Return an index block (if name is found) or NULL. - */ + */ IND MET_index(DBB db, const TEXT* string) { @@ -594,11 +594,11 @@ IND MET_index(DBB db, const TEXT* string) /*____________________________________________________________ - * + * * Load all of the relation names * and user defined function names * into the symbol (hash) table. - */ + */ void MET_load_hash_table( DBB db) { @@ -611,9 +611,9 @@ void MET_load_hash_table( DBB db) /*____________________________________________________________ - * + * * Make a field symbol. - */ + */ gpre_fld* MET_make_field(const SCHAR* name, SSHORT dtype, @@ -634,9 +634,9 @@ gpre_fld* MET_make_field(const SCHAR* name, /*____________________________________________________________ - * + * * Make an index symbol. - */ + */ IND MET_make_index(const SCHAR* name) { @@ -648,9 +648,9 @@ IND MET_make_index(const SCHAR* name) /*____________________________________________________________ - * + * * Make an relation symbol. - */ + */ gpre_rel* MET_make_relation(const SCHAR* name) { @@ -663,9 +663,9 @@ gpre_rel* MET_make_relation(const SCHAR* name) /*____________________________________________________________ - * + * * Lookup a type name for a field. - */ + */ bool MET_type(gpre_fld* field, const TEXT* string, @@ -688,12 +688,12 @@ bool MET_type(gpre_fld* field, /*____________________________________________________________ - * + * * Lookup an index for a database. - * + * * Return: true if the trigger exists * false otherwise - */ + */ bool MET_trigger_exists(DBB db, const TEXT* trigger_name) @@ -708,16 +708,16 @@ bool MET_trigger_exists(DBB db, #ifdef NOT_USED_OR_REPLACED /*____________________________________________________________ - * + * * Compute and return the size of the array. - */ + */ static SLONG array_size( gpre_fld* field) { ary* array_block = field->fld_array_info; SLONG count = field->fld_array->fld_length; for (dim* dimension = array_block->ary_dimension; dimension; - dimension = dimension->dim_next) + dimension = dimension->dim_next) { count = count * (dimension->dim_upper - dimension->dim_lower + 1); @@ -728,9 +728,9 @@ static SLONG array_size( gpre_fld* field) /*____________________________________________________________ - * + * * See if field is array. - */ + */ static void get_array( DBB db, const TEXT* field_name, gpre_fld* field) { @@ -740,22 +740,22 @@ static void get_array( DBB db, const TEXT* field_name, gpre_fld* field) /*____________________________________________________________ - * + * * Character types can be specified as either: * b) A POSIX style locale name "." * or * c) A simple name (using default collation) * d) A simple name (use charset for collation) - * + * * Given an ASCII7 string which could be any of the above, try to * resolve the name in the order b, c, d. * b) is only tried iff the name contains a period. * (in which case c) and d) are not tried). - * + * * Return: * true if no errors (and *id is set). * false if the name could not be resolved. - */ + */ static bool get_intl_char_subtype(SSHORT* id, const UCHAR* name, @@ -772,31 +772,31 @@ static bool get_intl_char_subtype(SSHORT* id, /*____________________________________________________________ - * + * * Given ASCII7 name of charset & collation * resolve the specification to a ttype (id) that implements * it. - * + * * Inputs: - * (charset) + * (charset) * ASCII7z name of characterset. * NULL (implying unspecified) means use the character set * for defined for (collation). - * + * * (collation) * ASCII7z name of collation. * NULL means use the default collation for (charset). - * + * * Outputs: - * (*id) + * (*id) * Set to subtype specified by this name. - * + * * Return: * true if no errors (and *id is set). * false if either name not found. * or if names found, but the collation isn't for the specified * character set. - */ + */ static bool resolve_charset_and_collation( SSHORT* id, @@ -810,7 +810,7 @@ static bool resolve_charset_and_collation( /*____________________________________________________________ - * + * * Upcase a string into another string. Return * length of string. */ diff --git a/src/gpre/hsh.cpp b/src/gpre/hsh.cpp index 98a63a65af..4bdb3082b8 100644 --- a/src/gpre/hsh.cpp +++ b/src/gpre/hsh.cpp @@ -52,9 +52,9 @@ static struct word { //____________________________________________________________ -// +// // Release space used by keywords. -// +// void HSH_fini(void) { @@ -68,10 +68,10 @@ void HSH_fini(void) //____________________________________________________________ -// +// // Initialize the hash table. This mostly involves // inserting all known keywords. -// +// void HSH_init(void) { @@ -98,9 +98,9 @@ void HSH_init(void) //____________________________________________________________ -// +// // Insert a symbol into the hash table. -// +// void HSH_insert( gpre_sym* symbol) { @@ -115,7 +115,7 @@ void HSH_insert( gpre_sym* symbol) } if (scompare(symbol->sym_string, (*next)->sym_string)) { - /* insert in most recently seen order; + /* insert in most recently seen order; This is important for alias resolution in subqueries. BUT insert tokens AFTER keyword! In a lookup, keyword should be found first. @@ -143,16 +143,16 @@ void HSH_insert( gpre_sym* symbol) //____________________________________________________________ -// +// // Perform a string lookup against hash table. -// +// gpre_sym* HSH_lookup(const SCHAR* string) { for (gpre_sym* symbol = hash_table[hash(string)]; symbol; symbol = symbol->sym_collision) { - if (scompare(string, symbol->sym_string)) + if (scompare(string, symbol->sym_string)) return symbol; } @@ -160,18 +160,18 @@ gpre_sym* HSH_lookup(const SCHAR* string) } //____________________________________________________________ -// +// // Perform a string lookup against hash table. // Calls scompare2 which performs case insensitive // compare. -// +// gpre_sym* HSH_lookup2(const SCHAR* string) { for (gpre_sym* symbol = hash_table[hash(string)]; symbol; symbol = symbol->sym_collision) { - if (scompare2(string, symbol->sym_string)) + if (scompare2(string, symbol->sym_string)) return symbol; } @@ -180,9 +180,9 @@ gpre_sym* HSH_lookup2(const SCHAR* string) //____________________________________________________________ -// +// // Remove a symbol from the hash table. -// +// void HSH_remove( gpre_sym* symbol) { @@ -219,9 +219,9 @@ void HSH_remove( gpre_sym* symbol) //____________________________________________________________ -// +// // Returns the hash function of a string. -// +// static int hash(const SCHAR* string) { @@ -237,9 +237,9 @@ static int hash(const SCHAR* string) //____________________________________________________________ -// -// case sensitive Compare -// +// +// case sensitive Compare +// static bool scompare(const SCHAR* string1, const SCHAR* string2) @@ -248,9 +248,9 @@ static bool scompare(const SCHAR* string1, } //____________________________________________________________ -// +// // Compare two strings -// +// static bool scompare2(const SCHAR* string1, const SCHAR* string2) @@ -262,7 +262,7 @@ static bool scompare2(const SCHAR* string1, if (!(c2 = *string2++) || (UPPER(c1) != UPPER(c2))) return false; } - + if (*string2) return false; diff --git a/src/gpre/int_cxx.cpp b/src/gpre/int_cxx.cpp index 8147421086..2a56668efa 100644 --- a/src/gpre/int_cxx.cpp +++ b/src/gpre/int_cxx.cpp @@ -1,27 +1,27 @@ //____________________________________________________________ -// +// // PROGRAM: C preprocess // MODULE: int_cxx.cpp // DESCRIPTION: Code generate for internal JRD modules -// +// // The contents of this file are subject to the Interbase Public // License Version 1.0 (the "License"); you may not use this file // except in compliance with the License. You may obtain a copy // of the License at http://www.Inprise.com/IPL.html -// +// // Software distributed under the License is distributed on an // "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express // or implied. See the License for the specific language governing // rights and limitations under the License. -// +// // The Original Code was created by Inprise Corporation // and its predecessors. Portions created by Inprise Corporation are // Copyright (C) Inprise Corporation. -// +// // All Rights Reserved. // Contributor(s): ______________________________________. // TMN (Mike Nordell) 11.APR.2001 - Reduce compiler warnings in generated code -// +// // //____________________________________________________________ // @@ -86,13 +86,13 @@ static inline void endp(const int column) } //____________________________________________________________ -// -// +// +// void INT_CXX_action( const act* action, int column) { -// Put leading braces where required +// Put leading braces where required switch (action->act_type) { case ACT_for: @@ -156,16 +156,16 @@ void INT_CXX_action( const act* action, int column) return; } -// Put in a trailing brace for those actions still with us +// Put in a trailing brace for those actions still with us endp(column); } //____________________________________________________________ -// +// // Align output to a specific column for output. -// +// static void align(const int column) { @@ -185,10 +185,10 @@ static void align(const int column) //____________________________________________________________ -// +// // Build an assignment from a host language variable to // a port variable. -// +// static void asgn_from( REF reference, int column) { @@ -229,10 +229,10 @@ static void asgn_from( REF reference, int column) //____________________________________________________________ -// +// // Build an assignment to a host language variable from // a port variable. -// +// #ifdef NOT_USED_OR_REPLACED static void asgn_to( REF reference) { @@ -259,9 +259,9 @@ static void asgn_to( REF reference) #endif //____________________________________________________________ -// +// // Generate code for AT END clause of FETCH. -// +// static void gen_at_end( const act* action, int column) { @@ -273,9 +273,9 @@ static void gen_at_end( const act* action, int column) //____________________________________________________________ -// +// // Callback routine for BLR pretty printer. -// +// static void gen_blr(void* user_arg, SSHORT offset, const char* string) { @@ -284,9 +284,9 @@ static void gen_blr(void* user_arg, SSHORT offset, const char* string) //____________________________________________________________ -// +// // Generate text to compile a request. -// +// static void gen_compile( const gpre_req* request, int column) { @@ -302,9 +302,9 @@ static void gen_compile( const gpre_req* request, int column) //____________________________________________________________ -// +// // Generate insertion text for the database statement. -// +// static void gen_database( const act* action, int column) { @@ -319,9 +319,9 @@ static void gen_database( const act* action, int column) //____________________________________________________________ -// +// // Generate substitution text for END_MODIFY. -// +// static void gen_emodify( const act* action, int column) { @@ -358,9 +358,9 @@ static void gen_emodify( const act* action, int column) //____________________________________________________________ -// +// // Generate substitution text for END_STORE. -// +// static void gen_estore( const act* action, int column, bool special) { @@ -372,9 +372,9 @@ static void gen_estore( const act* action, int column, bool special) //____________________________________________________________ -// +// // Generate definitions associated with a single request. -// +// static void gen_endfor( const act* action, int column) { @@ -389,9 +389,9 @@ static void gen_endfor( const act* action, int column) //____________________________________________________________ -// +// // Generate substitution text for ERASE. -// +// static void gen_erase( const act* action, int column) { @@ -401,9 +401,9 @@ static void gen_erase( const act* action, int column) //____________________________________________________________ -// +// // Generate substitution text for FOR statement. -// +// static void gen_for( const act* action, int column) { @@ -424,10 +424,10 @@ static void gen_for( const act* action, int column) //____________________________________________________________ -// +// // Generate a name for a reference. Name is constructed from // port and parameter idents. -// +// static char* gen_name(char* const string, const ref* reference) { @@ -440,9 +440,9 @@ static char* gen_name(char* const string, const ref* reference) //____________________________________________________________ -// +// // Generate BLR in raw, numeric form. Ugly but dense. -// +// static void gen_raw( const gpre_req* request) { @@ -473,9 +473,9 @@ static void gen_raw( const gpre_req* request) //____________________________________________________________ -// +// // Generate a send or receive call for a port. -// +// static void gen_receive( const gpre_req* request, const gpre_port* port) { @@ -488,9 +488,9 @@ static void gen_receive( const gpre_req* request, const gpre_port* port) //____________________________________________________________ -// +// // Generate definitions associated with a single request. -// +// static void gen_request( const gpre_req* request) { @@ -514,15 +514,15 @@ static void gen_request( const gpre_req* request) //____________________________________________________________ -// +// // Process routine head. If there are gpreGlob.requests in the // routine, insert local definitions. -// +// static void gen_routine( const act* action, int column) { for (const gpre_req* request = (gpre_req*) action->act_object; request; - request = request->req_routine) + request = request->req_routine) { for (gpre_port* port = request->req_ports; port; port = port->por_next) make_port(port, column + INDENT); @@ -531,9 +531,9 @@ static void gen_routine( const act* action, int column) //____________________________________________________________ -// +// // Generate substitution text for END_STREAM. -// +// static void gen_s_end( const act* action, int column) { @@ -543,9 +543,9 @@ static void gen_s_end( const act* action, int column) //____________________________________________________________ -// +// // Generate substitution text for FETCH. -// +// static void gen_s_fetch( const act* action, int column) { @@ -558,10 +558,10 @@ static void gen_s_fetch( const act* action, int column) //____________________________________________________________ -// +// // Generate text to compile and start a stream. This is // used both by START_STREAM and FOR -// +// static void gen_s_start( const act* action, int column) { @@ -577,9 +577,9 @@ static void gen_s_start( const act* action, int column) //____________________________________________________________ -// +// // Generate a send or receive call for a port. -// +// static void gen_send( const gpre_req* request, const gpre_port* port, int column, bool special) @@ -599,9 +599,9 @@ static void gen_send( const gpre_req* request, const gpre_port* port, //____________________________________________________________ -// +// // Generate a START. -// +// static void gen_start( const gpre_req* request, const gpre_port* port, int column, bool special) @@ -617,9 +617,9 @@ static void gen_start( const gpre_req* request, const gpre_port* port, //____________________________________________________________ -// +// // Substitute for a variable reference. -// +// static void gen_type( const act* action, int column) { @@ -629,9 +629,9 @@ static void gen_type( const act* action, int column) //____________________________________________________________ -// +// // Substitute for a variable reference. -// +// static void gen_variable( const act* action, int column) { @@ -644,9 +644,9 @@ static void gen_variable( const act* action, int column) //____________________________________________________________ -// +// // Insert a port record description in output. -// +// static void make_port( gpre_port* port, int column) { @@ -697,7 +697,7 @@ static void make_port( gpre_port* port, int column) fprintf(gpreGlob.out_file, " ISC_QUAD jrd_%d;\t// %s ", reference->ref_ident, name); break; - + case dtype_blob: fprintf(gpreGlob.out_file, " bid jrd_%d;\t// %s ", reference->ref_ident, name); @@ -736,9 +736,9 @@ static void make_port( gpre_port* port, int column) //____________________________________________________________ -// +// // Print a fixed string at a particular column. -// +// static void printa(const int column, const TEXT* string, ...) { diff --git a/src/gpre/jrdmet.cpp b/src/gpre/jrdmet.cpp index 2dd4bf859d..f72176c8f9 100644 --- a/src/gpre/jrdmet.cpp +++ b/src/gpre/jrdmet.cpp @@ -1,28 +1,28 @@ //____________________________________________________________ -// +// // PROGRAM: JRD Access Method // MODULE: jrdmet.cpp // DESCRIPTION: Non-database meta data for internal JRD stuff -// +// // The contents of this file are subject to the Interbase Public // License Version 1.0 (the "License"); you may not use this file // except in compliance with the License. You may obtain a copy // of the License at http://www.Inprise.com/IPL.html -// +// // Software distributed under the License is distributed on an // "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express // or implied. See the License for the specific language governing // rights and limitations under the License. -// +// // The Original Code was created by Inprise Corporation // and its predecessors. Portions created by Inprise Corporation are // Copyright (C) Inprise Corporation. -// +// // All Rights Reserved. // Contributor(s): ______________________________________. // TMN (Mike Nordell) 11.APR.2001 - Reduce compiler warnings // There however is still a bunch of constness errors in this file -// +// // // @@ -42,9 +42,9 @@ //____________________________________________________________ -// +// // Initialize in memory meta data. -// +// void JRDMET_init( DBB db) { @@ -65,7 +65,7 @@ void JRDMET_init( DBB db) HSH_insert(symbol); const int* fld = relfld + RFLD_RPT; - for (int n = 0; fld[RFLD_F_NAME]; ++n, fld += RFLD_F_LENGTH) + for (int n = 0; fld[RFLD_F_NAME]; ++n, fld += RFLD_F_LENGTH) { const gfld* gfield = (fld[RFLD_F_UPD_MINOR]) ? &gfields[fld[RFLD_F_UPD_ID]] : diff --git a/src/gpre/movg.cpp b/src/gpre/movg.cpp index 7cc0dffced..ee0ef79316 100644 --- a/src/gpre/movg.cpp +++ b/src/gpre/movg.cpp @@ -1,23 +1,23 @@ //____________________________________________________________ -// +// // PROGRAM: Gpre support // MODULE: movg.cpp // DESCRIPTION: Data mover and converter and comparator, etc. -// +// // The contents of this file are subject to the Interbase Public // License Version 1.0 (the "License"); you may not use this file // except in compliance with the License. You may obtain a copy // of the License at http://www.Inprise.com/IPL.html -// +// // Software distributed under the License is distributed on an // "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express // or implied. See the License for the specific language governing // rights and limitations under the License. -// +// // The Original Code was created by Inprise Corporation // and its predecessors. Portions created by Inprise Corporation are // Copyright (C) Inprise Corporation. -// +// // All Rights Reserved. // Contributor(s): ______________________________________. // TMN (Mike Nordell) 11.APR.2001 - Reduce compiler warnings @@ -35,7 +35,7 @@ // the latter references a macro from the former, and doesn't include that // header file itself. We need to include gpre_proto.h since we use gpre // functions. -// +// #include "../gpre/gpre.h" #include "../gpre/gpre_proto.h" #include "../common/cvt.h" @@ -44,9 +44,9 @@ static void post_error(const Firebird::Arg::StatusVector&); //____________________________________________________________ -// +// // Move (and possible convert) something to something else. -// +// void MOVG_move(const dsc* from, dsc* to) { @@ -55,9 +55,9 @@ void MOVG_move(const dsc* from, dsc* to) //____________________________________________________________ -// +// // A conversion error occurred. Complain. -// +// static void post_error(const Firebird::Arg::StatusVector&) { diff --git a/src/gpre/msc.cpp b/src/gpre/msc.cpp index 76bc3801c9..672e8f8908 100644 --- a/src/gpre/msc.cpp +++ b/src/gpre/msc.cpp @@ -1,47 +1,47 @@ //____________________________________________________________ -// +// // PROGRAM: C preprocessor // MODULE: msc.cpp // DESCRIPTION: Miscellaneous little stuff -// +// // The contents of this file are subject to the Interbase Public // License Version 1.0 (the "License"); you may not use this file // except in compliance with the License. You may obtain a copy // of the License at http://www.Inprise.com/IPL.html -// +// // Software distributed under the License is distributed on an // "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express // or implied. See the License for the specific language governing // rights and limitations under the License. -// +// // The Original Code was created by Inprise Corporation // and its predecessors. Portions created by Inprise Corporation are // Copyright (C) Inprise Corporation. -// +// // All Rights Reserved. // Contributor(s): ______________________________________. // TMN (Mike Nordell) 11.APR.2001 - Reduce compiler warnings -// +// // //____________________________________________________________ // // -// -// +// +// // *************************************************** // THIS MODULE HAS SEVERAL KISSING COUSINS; IF YOU // SHOULD CHANGE ONE OF THE MODULES IN THE FOLLOWING // LIST, PLEASE BE SURE TO CHECK THE OTHERS FOR // SIMILAR CHANGES: -// +// // dsql/all.cpp // jrd/all.cpp // pipe/allp.cpp // qli/all.cpp // remote/allr.cpp // gpre/msc.cpp -// +// // - THANK YOU //************************************************** @@ -64,9 +64,9 @@ static gpre_lls* free_lls; //____________________________________________________________ -// +// // Make an action and link it to a request. -// +// act* MSC_action( gpre_req* request, enum act_t type) { @@ -84,8 +84,8 @@ act* MSC_action( gpre_req* request, enum act_t type) //____________________________________________________________ -// -// +// +// UCHAR* MSC_alloc(int size) { @@ -97,7 +97,7 @@ UCHAR* MSC_alloc(int size) if (!next) CPR_error("virtual memory exhausted"); #ifdef DEBUG_GDS_ALLOC - // For V4.0 we don't care about gpre specific memory leaks + // For V4.0 we don't care about gpre specific memory leaks gds_alloc_flag_unfreed(next); #endif next->spc_next = space; @@ -114,9 +114,9 @@ UCHAR* MSC_alloc(int size) //____________________________________________________________ -// +// // Allocate a block in permanent memory. -// +// UCHAR* MSC_alloc_permanent(int size) { @@ -128,7 +128,7 @@ UCHAR* MSC_alloc_permanent(int size) if (!next) CPR_error("virtual memory exhausted"); #ifdef DEBUG_GDS_ALLOC - // For V4.0 we don't care about gpre specific memory leaks + // For V4.0 we don't care about gpre specific memory leaks gds_alloc_flag_unfreed(next); #endif next->spc_next = permanent_space; @@ -146,9 +146,9 @@ UCHAR* MSC_alloc_permanent(int size) //____________________________________________________________ -// +// // Make a binary node. -// +// GPRE_NOD MSC_binary(NOD_T type, GPRE_NOD arg1, GPRE_NOD arg2) { @@ -161,9 +161,9 @@ GPRE_NOD MSC_binary(NOD_T type, GPRE_NOD arg1, GPRE_NOD arg2) //____________________________________________________________ -// +// // Make a new context for a request and link it up to the request. -// +// gpre_ctx* MSC_context(gpre_req* request) { @@ -174,7 +174,7 @@ gpre_ctx* MSC_context(gpre_req* request) context->ctx_internal = request->req_internal++; context->ctx_scope_level = request->req_scope_level; -// link in with the request block +// link in with the request block context->ctx_next = request->req_contexts; request->req_contexts = context; @@ -184,9 +184,9 @@ gpre_ctx* MSC_context(gpre_req* request) //____________________________________________________________ -// +// // Copy one string into another. -// +// void MSC_copy(const char* from, int length, char* to) { @@ -198,9 +198,9 @@ void MSC_copy(const char* from, int length, char* to) } //____________________________________________________________ -// +// // Copy two strings into another. -// +// void MSC_copy_cat(const char* from1, int length1, const char* from2, int length2, char* to) @@ -215,9 +215,9 @@ void MSC_copy_cat(const char* from1, int length1, const char* from2, int length2 } //____________________________________________________________ -// +// // Find a symbol of a particular type. -// +// gpre_sym* MSC_find_symbol(gpre_sym* symbol, enum sym_t type) { @@ -231,9 +231,9 @@ gpre_sym* MSC_find_symbol(gpre_sym* symbol, enum sym_t type) //____________________________________________________________ -// +// // Free a block. -// +// void MSC_free(void* block) { @@ -242,9 +242,9 @@ void MSC_free(void* block) //____________________________________________________________ -// +// // Get rid of an erroroneously allocated request block. -// +// void MSC_free_request( gpre_req* request) { @@ -256,10 +256,10 @@ void MSC_free_request( gpre_req* request) //____________________________________________________________ -// +// // Initialize (or more properly, re-initialize) the memory // allocator. -// +// void MSC_init(void) { @@ -274,11 +274,11 @@ void MSC_init(void) //____________________________________________________________ -// +// // Match the current token against a keyword. If successful, // advance the token stream and return true. Otherwise return // false. -// +// bool MSC_match(KWWORDS keyword) { @@ -289,7 +289,7 @@ bool MSC_match(KWWORDS keyword) symbol = symbol->sym_collision) { if ((strcmp(symbol->sym_string, gpreGlob.token_global.tok_string) == - 0) && symbol->sym_keyword != KW_none) + 0) && symbol->sym_keyword != KW_none) { gpreGlob.token_global.tok_symbol = symbol; gpreGlob.token_global.tok_keyword = static_cast < kwwords > (symbol->sym_keyword); @@ -307,10 +307,10 @@ bool MSC_match(KWWORDS keyword) #ifdef NOT_USED_OR_REPLACED //____________________________________________________________ -// +// // Determinate where a specific object is // represented on a linked list stack. -// +// bool MSC_member(GPRE_NOD object, gpre_lls* stack) { @@ -324,9 +324,9 @@ bool MSC_member(GPRE_NOD object, gpre_lls* stack) #endif //____________________________________________________________ -// +// // Allocate an initialize a syntax node. -// +// GPRE_NOD MSC_node(enum nod_t type, SSHORT count) { @@ -339,9 +339,9 @@ GPRE_NOD MSC_node(enum nod_t type, SSHORT count) //____________________________________________________________ -// +// // Pop an item off a linked list stack. Free the stack node. -// +// GPRE_NOD MSC_pop(gpre_lls** pointer) { @@ -357,9 +357,9 @@ GPRE_NOD MSC_pop(gpre_lls** pointer) //____________________________________________________________ -// +// // Allocate a new privilege (grant/revoke) block. -// +// PRV MSC_privilege_block(void) { @@ -375,9 +375,9 @@ PRV MSC_privilege_block(void) //____________________________________________________________ -// +// // Push an arbitrary object onto a linked list stack. -// +// void MSC_push( GPRE_NOD object, gpre_lls** pointer) { @@ -394,10 +394,10 @@ void MSC_push( GPRE_NOD object, gpre_lls** pointer) //____________________________________________________________ -// +// // Generate a reference and possibly link the reference into // a linked list. -// +// REF MSC_reference(REF* link) { @@ -413,10 +413,10 @@ REF MSC_reference(REF* link) //____________________________________________________________ -// +// // Set up for a new request. Make request and action // blocks, all linked up and ready to go. -// +// gpre_req* MSC_request(enum req_t type) { @@ -438,9 +438,9 @@ gpre_req* MSC_request(enum req_t type) //____________________________________________________________ -// +// // Copy a string into a permanent block. -// +// SCHAR* MSC_string(const TEXT* input) { @@ -452,9 +452,9 @@ SCHAR* MSC_string(const TEXT* input) //____________________________________________________________ -// +// // Allocate and initialize a symbol block. -// +// gpre_sym* MSC_symbol(enum sym_t type, const TEXT* string, USHORT length, gpre_ctx* object) { @@ -472,9 +472,9 @@ gpre_sym* MSC_symbol(enum sym_t type, const TEXT* string, USHORT length, gpre_ct //____________________________________________________________ -// +// // Make a unary node. -// +// GPRE_NOD MSC_unary(NOD_T type, GPRE_NOD arg) { @@ -486,9 +486,9 @@ GPRE_NOD MSC_unary(NOD_T type, GPRE_NOD arg) //____________________________________________________________ -// +// // Set up for a new username. -// +// gpre_usn* MSC_username(SCHAR* name, USHORT name_dyn) { diff --git a/src/gpre/par.cpp b/src/gpre/par.cpp index 3b5d3911f1..4532daa946 100644 --- a/src/gpre/par.cpp +++ b/src/gpre/par.cpp @@ -1,23 +1,23 @@ //____________________________________________________________ -// +// // PROGRAM: C preprocessor // MODULE: par.cpp // DESCRIPTION: Parser -// +// // The contents of this file are subject to the Interbase Public // License Version 1.0 (the "License"); you may not use this file // except in compliance with the License. You may obtain a copy // of the License at http://www.Inprise.com/IPL.html -// +// // Software distributed under the License is distributed on an // "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express // or implied. See the License for the specific language governing // rights and limitations under the License. -// +// // The Original Code was created by Inprise Corporation // and its predecessors. Portions created by Inprise Corporation are // Copyright (C) Inprise Corporation. -// +// // All Rights Reserved. // Contributor(s): ______________________________________. @@ -25,17 +25,17 @@ // Fixed bugs in gpre to handle PYXIS forms // and allow edit.e and fred.e to go through // gpre without errors (and correct result). -// +// // This is a partial fix until all // PYXIS datatypes are adjusted in frm_trn.c -// +// // removed some compiler warnings too -// +// // TMN (Mike Nordell) 11.APR.2001 - Reduce compiler warnings // TMN (Mike Nordell) APR-MAY.2001 - Conversion to C++ // SWB (Stepen Boyd) 2007/03/21 - Supressed parsing of QLI keywords if -noqli // switch given on the command line. -// +// // //____________________________________________________________ // @@ -124,10 +124,10 @@ static gpre_fld* flag_field; //____________________________________________________________ -// +// // We have a token with a symbolic meaning. If appropriate, // parse an action segment. If not, return NULL. -// +// act* PAR_action(const TEXT* base_dir) { @@ -161,7 +161,7 @@ act* PAR_action(const TEXT* base_dir) case KW_SUBROUTINE: CPR_eol_token(); break; - + case KW_EXTERNAL: set_external_flag(); return NULL; @@ -195,7 +195,7 @@ act* PAR_action(const TEXT* base_dir) case KW_DOUBLE: // *** // par_var_c (keyword); -//** +//** return NULL; case KW_ANY: @@ -260,7 +260,7 @@ act* PAR_action(const TEXT* base_dir) return par_function(); case KW_PROCEDURE: return par_procedure(); - + case KW_PROC: break; @@ -322,7 +322,7 @@ act* PAR_action(const TEXT* base_dir) return par_begin(); case KW_CASE: return par_case(); - + case KW_EXEC: { if (!MSC_match(KW_SQL)) @@ -451,9 +451,9 @@ act* PAR_action(const TEXT* base_dir) //____________________________________________________________ -// +// // Parse a blob subtype -- either a signed number or a symbolic name. -// +// SSHORT PAR_blob_subtype(DBB db) { @@ -467,7 +467,7 @@ SSHORT PAR_blob_subtype(DBB db) { PAR_error("error during BLOB SUB_TYPE lookup"); } - + SSHORT const_subtype; if (!MET_type(field, gpreGlob.token_global.tok_string, &const_subtype)) CPR_s_error("blob sub_type"); @@ -480,10 +480,10 @@ SSHORT PAR_blob_subtype(DBB db) //____________________________________________________________ -// +// // Parse a DATABASE declaration. If successful, return // an action block. -// +// act* PAR_database(bool sql, const TEXT* base_directory) { @@ -496,7 +496,7 @@ act* PAR_database(bool sql, const TEXT* base_directory) DBB db = (DBB) MSC_alloc(DBB_LEN); // Get handle name token, make symbol for handle, and -// insert symbol into hash table +// insert symbol into hash table gpre_sym* symbol = PAR_symbol(SYM_dummy); db->dbb_name = symbol; @@ -513,7 +513,7 @@ act* PAR_database(bool sql, const TEXT* base_directory) MSC_match(KW_COMPILETIME); -// parse the compiletime options +// parse the compiletime options TEXT* string; for (;;) { @@ -522,9 +522,9 @@ act* PAR_database(bool sql, const TEXT* base_directory) if (isQuoted(gpreGlob.token_global.tok_type)) { if (base_directory) { - db->dbb_filename = string = (TEXT *) MSC_alloc(gpreGlob.token_global.tok_length + + db->dbb_filename = string = (TEXT *) MSC_alloc(gpreGlob.token_global.tok_length + strlen(base_directory) + 1); - MSC_copy_cat(base_directory, strlen(base_directory), + MSC_copy_cat(base_directory, strlen(base_directory), gpreGlob.token_global.tok_string, gpreGlob.token_global.tok_length, string); } else { @@ -588,7 +588,7 @@ act* PAR_database(bool sql, const TEXT* base_directory) if (gpreGlob.default_lc_ctype && !db->dbb_c_lc_ctype) db->dbb_c_lc_ctype = gpreGlob.default_lc_ctype; -// parse the runtime options +// parse the runtime options if (MSC_match(KW_RUNTIME)) { if (MSC_match(KW_FILENAME)) @@ -652,7 +652,7 @@ act* PAR_database(bool sql, const TEXT* base_directory) // meaningful message. CPR_error(exc.what()); } - + if (found_error) { fb_utils::snprintf(s, sizeof(s), "Couldn't access database %s = '%s'", @@ -665,7 +665,7 @@ act* PAR_database(bool sql, const TEXT* base_directory) gpreGlob.isc_databases = db; HSH_insert(symbol); -// Load up the symbol (hash) table with relation names from this databases. +// Load up the symbol (hash) table with relation names from this databases. MET_load_hash_table(db); #ifdef FTN_BLK_DATA @@ -674,7 +674,7 @@ act* PAR_database(bool sql, const TEXT* base_directory) #endif // Since we have a real DATABASE statement, get rid of any artificial -// databases that were created because of an INCLUDE SQLCA statement. +// databases that were created because of an INCLUDE SQLCA statement. for (DBB* db_ptr = &gpreGlob.isc_databases; *db_ptr;) if ((*db_ptr)->dbb_flags & DBB_sqlca) @@ -687,13 +687,13 @@ act* PAR_database(bool sql, const TEXT* base_directory) //____________________________________________________________ -// +// // Parse end of statement. All languages except ADA leave // the trailing semi-colon dangling. ADA, however, must // eat the semi-colon as part of the statement. In any case, // return TRUE is a semi-colon is/was there, otherwise return // FALSE. -// +// bool PAR_end() { @@ -709,9 +709,9 @@ bool PAR_end() //____________________________________________________________ -// +// // Report an error during parse and unwind. -// +// void PAR_error(const TEXT* string) { @@ -721,16 +721,16 @@ void PAR_error(const TEXT* string) //____________________________________________________________ -// +// // Parse an event init statement, preparing // to wait on a number of named gpreGlob.events. -// +// act* PAR_event_init(bool sql) { // char req_name[128]; -// make up statement node +// make up statement node SQL_resolve_identifier("", NULL, MAX_EVENT_SIZE); //SQL_resolve_identifier("", req_name, sizeof(req_name)); @@ -742,7 +742,7 @@ act* PAR_event_init(bool sql) act* action = MSC_action(0, ACT_event_init); action->act_object = (REF) init; -// parse optional database handle +// parse optional database handle if (!MSC_match(KW_LEFT_PAREN)) { gpre_sym* symbol = gpreGlob.token_global.tok_symbol; @@ -757,12 +757,12 @@ act* PAR_event_init(bool sql) } // eat any number of event strings until a right paren is found, -// pushing the gpreGlob.events onto a stack +// pushing the gpreGlob.events onto a stack GPRE_NOD node; gpre_lls* stack = NULL; int count = 0; - + while (true) { if (MSC_match(KW_RIGHT_PAREN)) break; @@ -790,7 +790,7 @@ act* PAR_event_init(bool sql) MSC_match(KW_COMMA); } -// pop the event strings off the stack +// pop the event strings off the stack gpre_nod* event_list = init->nod_arg[1] = MSC_node(nod_list, (SSHORT) count); gpre_nod** ptr = event_list->nod_arg + count; @@ -806,16 +806,16 @@ act* PAR_event_init(bool sql) //____________________________________________________________ -// +// // Parse an event wait statement, preparing // to wait on a number of named gpreGlob.events. -// +// act* PAR_event_wait(bool sql) { // char req_name[132]; -// this is a simple statement, just add a handle +// this is a simple statement, just add a handle act* action = MSC_action(0, ACT_event_wait); SQL_resolve_identifier("", NULL, MAX_EVENT_SIZE); @@ -830,9 +830,9 @@ act* PAR_event_wait(bool sql) //____________________________________________________________ -// +// // Perform any last minute stuff necessary at the end of pass1. -// +// void PAR_fini() { @@ -854,10 +854,10 @@ void PAR_fini() //____________________________________________________________ -// +// // Get a token or unwind the parse // if we hit end of file -// +// TOK PAR_get_token() { @@ -870,19 +870,19 @@ TOK PAR_get_token() //____________________________________________________________ -// +// // Do any initialization necessary. // For one thing, set all current indicators // to null, since nothing is current. Also, // set up a block to hold the current routine, -// +// // (The 'routine' indicator tells the code // generator where to put ports to support // recursive routines and Fortran's strange idea // of separate sub-modules. For PASCAL only, we // keep a stack of routines, and pay special attention // to the main routine.) -// +// void PAR_init() { @@ -904,15 +904,15 @@ void PAR_init() static inline void gobble(SCHAR*& string) { const SCHAR* s1 = gpreGlob.token_global.tok_string; - while (*s1) - *string++ = *s1++; + while (*s1) + *string++ = *s1++; PAR_get_token(); } //____________________________________________________________ -// +// // Parse a native expression as a string. -// +// TEXT* PAR_native_value(bool array_ref, bool handle_ref) @@ -922,7 +922,7 @@ TEXT* PAR_native_value(bool array_ref, SCHAR* string = buffer; while (true) { - /** PAR_native_values copies the string constants. These are + /** PAR_native_values copies the string constants. These are passed to api calls. Make sure to enclose these with double quotes. **/ @@ -1029,10 +1029,10 @@ TEXT* PAR_native_value(bool array_ref, //____________________________________________________________ -// +// // Find a pseudo-field for null. If there isn't one, // make one. -// +// gpre_fld* PAR_null_field() { @@ -1048,18 +1048,18 @@ gpre_fld* PAR_null_field() //____________________________________________________________ -// +// // Parse the RESERVING clause of the start_transaction & set transaction // statements, creating a partial TPB in the process. The // TPB just hangs off the end of the transaction block. -// +// void PAR_reserving( USHORT flags, bool parse_sql) { DBB database; while (true) { - // find a relation name, or maybe a list of them + // find a relation name, or maybe a list of them if (!parse_sql && terminator()) break; @@ -1120,9 +1120,9 @@ void PAR_reserving( USHORT flags, bool parse_sql) //____________________________________________________________ -// +// // Initialize the request and the ready. -// +// gpre_req* PAR_set_up_dpb_info(rdy* ready, act* action, USHORT buffercount) { @@ -1137,12 +1137,12 @@ gpre_req* PAR_set_up_dpb_info(rdy* ready, act* action, USHORT buffercount) //____________________________________________________________ -// +// // Make a symbol from the current token, and advance // to the next token. If a symbol type other than // SYM_dummy, the symbol can be overloaded, but not // redefined. -// +// gpre_sym* PAR_symbol(enum sym_t type) { @@ -1151,7 +1151,7 @@ gpre_sym* PAR_symbol(enum sym_t type) for (symbol = gpreGlob.token_global.tok_symbol; symbol; symbol = symbol->sym_homonym) if (type == SYM_dummy || symbol->sym_type == type) { TEXT s[ERROR_LENGTH]; - fb_utils::snprintf(s, sizeof(s), + fb_utils::snprintf(s, sizeof(s), "symbol %s is already in use", gpreGlob.token_global.tok_string); PAR_error(s); } @@ -1164,9 +1164,9 @@ gpre_sym* PAR_symbol(enum sym_t type) //____________________________________________________________ -// +// // There's been a parse error, so unwind out. -// +// void PAR_unwind() { @@ -1175,10 +1175,10 @@ void PAR_unwind() //____________________________________________________________ -// +// // mark databases specified in start_transaction and set transaction // statements. -// +// void PAR_using_db() { @@ -1199,12 +1199,12 @@ void PAR_using_db() #ifdef FTN_BLK_DATA //____________________________________________________________ -// -// +// +// // Damn fortran sometimes only allows global // initializations in block data. This collects -// names of dbs to be so handled. -// +// names of dbs to be so handled. +// static void block_data_list( const dbb* db) { @@ -1237,12 +1237,12 @@ static void block_data_list( const dbb* db) //____________________________________________________________ -// -// +// +// // For reasons best left unnamed, we need // to skip the contents of a parenthesized -// list -// +// list +// static bool match_parentheses() { @@ -1267,9 +1267,9 @@ static bool match_parentheses() //____________________________________________________________ -// +// // Parse a free standing ANY expression. -// +// static act* par_any() { @@ -1280,7 +1280,7 @@ static act* par_any() gpre_sym* symbol = NULL; // Make up request block. Since this might not be a database statement, -// stay ready to back out if necessay. +// stay ready to back out if necessay. gpre_req* request = MSC_request(REQ_any); @@ -1304,11 +1304,11 @@ static act* par_any() //____________________________________________________________ -// +// // Parse a free reference to a database field in general // program context. If the next keyword isn't a context // varying, this isn't an array element reference. -// +// static act* par_array_element() { @@ -1335,9 +1335,9 @@ static act* par_array_element() //____________________________________________________________ -// +// // Parse an AT END clause. -// +// static act* par_at() { @@ -1351,7 +1351,7 @@ static act* par_at() //____________________________________________________________ -// +// // Parse a BASED ON clause. If this // is fortran and we don't have a database // declared yet, don't parse it completely. @@ -1359,7 +1359,7 @@ static act* par_at() // a semi colon to avoid stomping a // DECLARE i FIXED BIN BASED (X); // or DECLARE LIST (10) FIXED BINARY BASED; -// +// static act* par_based() { @@ -1379,7 +1379,7 @@ static act* par_based() SQL_resolve_identifier("", NULL, NAME_SIZE + 1); if (gpreGlob.token_global.tok_length >= NAME_SIZE) PAR_error("Field length too long"); - + gpre_fld* field = MET_field(relation, gpreGlob.token_global.tok_string); if (!field) { fb_utils::snprintf(s, sizeof(s), @@ -1466,9 +1466,9 @@ static act* par_based() MSC_push((GPRE_NOD) PAR_native_value(false, false), &based_on->bas_variables); } while (MSC_match(KW_COMMA)); - /* + /* ** bug_4031. based_on->bas_variables are now in reverse order. - ** we must reverse the order so we can output them to the .c + ** we must reverse the order so we can output them to the .c ** file correctly. */ if (based_on->bas_variables->lls_next) { @@ -1476,25 +1476,25 @@ static act* par_based() gpre_lls* t2 = NULL; // last one in the new list gpre_lls* hold = t2; // beginning of new list - // while we still have a next one, keep going thru + // while we still have a next one, keep going thru while (t1->lls_next) { - // now find the last one in the list + // now find the last one in the list while (t1->lls_next->lls_next) t1 = t1->lls_next; - // if this is the first time thru, set hold + // if this is the first time thru, set hold if (hold == NULL) { hold = t1->lls_next; t2 = hold; } else { - /* not first time thru, add this one to the end + /* not first time thru, add this one to the end ** of the new list */ t2->lls_next = t1->lls_next; t2 = t2->lls_next; } - // now null out the last one, and start again + // now null out the last one, and start again t1->lls_next = NULL; t1 = based_on->bas_variables; } @@ -1523,14 +1523,14 @@ static act* par_based() //____________________________________________________________ -// +// // If this is a PASCAL program, and we're -// in a code block, then increment the +// in a code block, then increment the // brace count. If we're in a routine // declaration, then we've reached the start // of the code block and should mark it as // a new routine. -// +// static act* par_begin() { @@ -1544,9 +1544,9 @@ static act* par_begin() //____________________________________________________________ -// +// // Parse a blob handle and return the blob. -// +// static blb* par_blob() { @@ -1562,9 +1562,9 @@ static blb* par_blob() //____________________________________________________________ -// +// // Parse a GET_SEGMENT, PUT_SEGMENT, CLOSE_BLOB or CANCEL_BLOB. -// +// static act* par_blob_action( ACT_T type) { @@ -1572,7 +1572,7 @@ static act* par_blob_action( ACT_T type) act* action = MSC_action(blob->blb_request, type); action->act_object = (REF) blob; -// Need to eat the semicolon if present +// Need to eat the semicolon if present if (gpreGlob.sw_language == lang_c) MSC_match(KW_SEMI_COLON); @@ -1584,9 +1584,9 @@ static act* par_blob_action( ACT_T type) //____________________________________________________________ -// -// Parse a blob segment or blob field reference. -// +// +// Parse a blob segment or blob field reference. +// static act* par_blob_field() { @@ -1618,12 +1618,12 @@ static act* par_blob_field() //____________________________________________________________ -// +// // If this is a PASCAL program, and we're // in a code block, then a case statement // will end with an END, so it adds to the // begin count. -// +// static act* par_case() { @@ -1636,9 +1636,9 @@ static act* par_case() //____________________________________________________________ -// +// // Parse degenerate CLEAR_HANDLES command. -// +// static act* par_clear_handles() { @@ -1648,10 +1648,10 @@ static act* par_clear_handles() //____________________________________________________________ -// +// // Parse a DERIVED_FROM clause. Like // BASED ON but for C/C++ prototypes. -// +// static act* par_derived_from() { @@ -1668,7 +1668,7 @@ static act* par_derived_from() CPR_s_error("dot in qualified field reference"); SQL_resolve_identifier("", NULL, NAME_SIZE); - + gpre_fld* field = MET_field(relation, gpreGlob.token_global.tok_string); if (!field) { TEXT s[ERROR_LENGTH]; @@ -1693,15 +1693,15 @@ static act* par_derived_from() //____________________________________________________________ -// -// +// +// // If the language is PASCAL, and if we're // the body of a routine, every END counts // against the number of BEGIN's and CASE's // and when the count comes to zero, we SHOULD // be at the end of the current routine, so // pop it off the routine stack. -// +// static act* par_end_block() { @@ -1716,15 +1716,15 @@ static act* par_end_block() //____________________________________________________________ -// +// // Parse an END_ERROR statement. Piece of cake. -// +// static act* par_end_error() { // avoid parsing an ada exception end_error - -// check for a semicolon +// check for a semicolon if (!PAR_end() && gpreGlob.sw_language == lang_ada) return NULL; @@ -1735,7 +1735,7 @@ static act* par_end_error() if (!((act*) MSC_pop(&cur_error))) return NULL; -// Need to eat the semicolon for c if present +// Need to eat the semicolon for c if present if (gpreGlob.sw_language == lang_c) MSC_match(KW_SEMI_COLON); @@ -1745,9 +1745,9 @@ static act* par_end_error() //____________________________________________________________ -// +// // Parse END_FETCH statement (clause?). -// +// static act* par_end_fetch() { @@ -1766,9 +1766,9 @@ static act* par_end_fetch() //____________________________________________________________ -// +// // Parse a FOR loop terminator. -// +// static act* par_end_for() { @@ -1782,7 +1782,7 @@ static act* par_end_for() PAR_end(); gpre_req* request = begin_action->act_request; -// If the action is a blob for, make up a blob end. +// If the action is a blob for, make up a blob end. if (begin_action->act_type == ACT_blob_for) { blb* blob = (blb*) begin_action->act_object; @@ -1796,7 +1796,7 @@ static act* par_end_for() } // If there isn't a database assigned, the FOR statement itself -// failed. Since an error has been given, just return quietly. +// failed. Since an error has been given, just return quietly. if (!request->req_database) return NULL; @@ -1817,10 +1817,10 @@ static act* par_end_for() //____________________________________________________________ -// +// // Parse and process END_MODIFY. The processing mostly includes // copying field references to proper context at proper level. -// +// static act* par_end_modify() { @@ -1840,7 +1840,7 @@ static act* par_end_modify() while ((upd*) begin_action->act_object != modify) begin_action = begin_action->act_next; -// Build assignments for all fields and null flags referenced +// Build assignments for all fields and null flags referenced gpre_lls* stack = NULL; int count = 0; @@ -1881,7 +1881,7 @@ static act* par_end_modify() } } -// Build a list node of the assignments +// Build a list node of the assignments gpre_nod* assignments = MSC_node(nod_list, (SSHORT) count); modify->upd_assignments = assignments; @@ -1900,9 +1900,9 @@ static act* par_end_modify() //____________________________________________________________ -// +// // Parse a stream END statement. -// +// static act* par_end_stream() { @@ -1922,9 +1922,9 @@ static act* par_end_stream() //____________________________________________________________ -// +// // Process an END_STORE. -// +// static act* par_end_store(bool special) { @@ -1942,7 +1942,7 @@ static act* par_end_store(bool special) if (gpreGlob.errors_global) return NULL; - // Make up an assignment list for all field references + // Make up an assignment list for all field references int count = 0; for (reference = request->req_references; reference; @@ -1976,7 +1976,7 @@ static act* par_end_store(bool special) act* action2 = (act*) MSC_pop(&cur_store); upd* return_values = (upd*) action2->act_object; - // Build assignments for all fields and null flags referenced + // Build assignments for all fields and null flags referenced gpre_lls* stack = NULL; int count = 0; @@ -2002,7 +2002,7 @@ static act* par_end_store(bool special) } } - // Build a list node of the assignments + // Build a list node of the assignments gpre_nod* const assignments = MSC_node(nod_list, (SSHORT) count); return_values->upd_assignments = assignments; @@ -2011,7 +2011,7 @@ static act* par_end_store(bool special) while (stack) *--ptr = (GPRE_NOD) MSC_pop(&stack); } - + gpre_ctx* context = request->req_contexts; if (context) HSH_remove(context->ctx_symbol); @@ -2028,9 +2028,9 @@ static act* par_end_store(bool special) //____________________________________________________________ -// +// // Parse a ERASE statement. -// +// static act* par_erase() { @@ -2046,7 +2046,7 @@ static act* par_erase() PAR_get_token(); PAR_end(); -// Make an update block to hold everything known about the modify +// Make an update block to hold everything known about the modify upd* erase = (upd*) MSC_alloc(UPD_LEN); erase->upd_request = request; @@ -2060,9 +2060,9 @@ static act* par_erase() //____________________________________________________________ -// +// // Parse a stream FETCH statement. -// +// static act* par_fetch() { @@ -2082,9 +2082,9 @@ static act* par_fetch() //____________________________________________________________ -// +// // Parse a FINISH statement. -// +// static act* par_finish() { @@ -2116,12 +2116,12 @@ static act* par_finish() //____________________________________________________________ -// +// // Parse a FOR clause, returning an action. // We don't know where we are a host language FOR, a record looping // FOR, or a blob FOR. Parse a little ahead and try to find out. // Avoid stepping on user routines that use GDML keywords -// +// static act* par_for() { @@ -2153,7 +2153,7 @@ static act* par_for() } // Make up request block. Since this might not be a database statement, -// stay ready to back out if necessay. +// stay ready to back out if necessay. gpre_req* request = MSC_request(REQ_for); @@ -2184,7 +2184,7 @@ static act* par_for() } //____________________________________________________________ -// +// // A function declaration is interesting in // FORTRAN because it starts a new sub-module // and we have to begin everything all over. @@ -2192,7 +2192,7 @@ static act* par_for() // indicate a good place to put message declarations. // Unfortunately that requires a loose parse of the // routine header, but what the hell... -// +// static act* par_function() { @@ -2208,10 +2208,10 @@ static act* par_function() //____________________________________________________________ -// +// // Check a left brace (or whatever) for start of a new // routine. -// +// static act* par_left_brace() { @@ -2227,20 +2227,20 @@ static act* par_left_brace() //____________________________________________________________ -// +// // Parse a MODIFY statement. -// +// static act* par_modify() { // Set up modify and action blocks. This is done here to leave the -// structure in place to cleanly handle END_MODIFY under error conditions. +// structure in place to cleanly handle END_MODIFY under error conditions. upd* modify = (upd*) MSC_alloc(UPD_LEN); MSC_push((GPRE_NOD) modify, &cur_modify); -// If the next token isn't a context variable, we can't continue +// If the next token isn't a context variable, we can't continue gpre_sym* symbol = gpreGlob.token_global.tok_symbol; if (!symbol || symbol->sym_type != SYM_context) { @@ -2260,13 +2260,13 @@ static act* par_modify() PAR_get_token(); MSC_match(KW_USING); -// Make an update context by cloning the source context +// Make an update context by cloning the source context gpre_ctx* update = MSC_context(request); update->ctx_symbol = source->ctx_symbol; update->ctx_relation = source->ctx_relation; -// Make an update block to hold everything known about the modify +// Make an update block to hold everything known about the modify modify->upd_request = request; modify->upd_source = source; @@ -2278,14 +2278,14 @@ static act* par_modify() //____________________________________________________________ -// +// // This rather degenerate routine exists to allow both: -// +// // ON_ERROR // ON ERROR -// +// // so the more dim of our users avoid mistakes. -// +// static act* par_on() { @@ -2297,10 +2297,10 @@ static act* par_on() //____________________________________________________________ -// +// // Parse a trailing ON_ERROR clause. -// +// static act* par_on_error() { @@ -2322,15 +2322,15 @@ static act* par_on_error() //____________________________________________________________ -// +// // Parse an "open blob" type statement. These include OPEN_BLOB, // CREATE_BLOB, and blob FOR. -// +// static act* par_open_blob( ACT_T act_op, gpre_sym* symbol) { // If somebody hasn't already parsed up a symbol for us, parse the -// symbol and the mandatory IN now. +// symbol and the mandatory IN now. if (!symbol) { symbol = PAR_symbol(SYM_dummy); @@ -2338,7 +2338,7 @@ static act* par_open_blob( ACT_T act_op, gpre_sym* symbol) CPR_s_error("IN"); } -// The next thing we should find is a field reference. Get it. +// The next thing we should find is a field reference. Get it. gpre_ctx* context; gpre_fld* field = EXP_field(&context); if (!field) @@ -2365,7 +2365,7 @@ static act* par_open_blob( ACT_T act_op, gpre_sym* symbol) blob->blb_symbol = symbol; blob->blb_reference = reference; -// See if we need a blob filter (do we have a subtype to subtype clause?) +// See if we need a blob filter (do we have a subtype to subtype clause?) bool filter_is_defined = false; for (;;) @@ -2393,9 +2393,9 @@ static act* par_open_blob( ACT_T act_op, gpre_sym* symbol) symbol->sym_object = (gpre_ctx*) blob; HSH_insert(symbol); // ** You just inserted the context variable into the hash table. -//The current token however might be the same context variable. +//The current token however might be the same context variable. //If so, get the symbol for it. -//* +//* if (gpreGlob.token_global.tok_keyword == KW_none) gpreGlob.token_global.tok_symbol = HSH_lookup(gpreGlob.token_global.tok_string); @@ -2405,7 +2405,7 @@ static act* par_open_blob( ACT_T act_op, gpre_sym* symbol) if (act_op == ACT_blob_for) MSC_push((GPRE_NOD) action, &cur_for); -// Need to eat the semicolon if present +// Need to eat the semicolon if present if (gpreGlob.sw_language == lang_c) MSC_match(KW_SEMI_COLON); @@ -2417,10 +2417,10 @@ static act* par_open_blob( ACT_T act_op, gpre_sym* symbol) //____________________________________________________________ -// +// // Parse request options. Return true if successful, otherwise // false. If a flag is set, don't give an error on false. -// +// static bool par_options(gpre_req* request, bool flag) @@ -2450,18 +2450,18 @@ static bool par_options(gpre_req* request, //____________________________________________________________ -// +// // If this is PLI, then we've got a new procedure. -// +// // If this is PASCAL, then we've come upon -// a program, module, function, or procedure header. +// a program, module, function, or procedure header. // Alas and alack, we have to decide if this is // a real header or a forward/external declaration. -// +// // In either case, we make a mark-only action block, // because that's real cheap. If it's a real routine, // we make the action the current routine. -// +// static act* par_procedure() { @@ -2482,9 +2482,9 @@ static act* par_procedure() //____________________________________________________________ -// +// // Parse a READY statement. -// +// static act* par_ready() { @@ -2500,9 +2500,9 @@ static act* par_ready() CPR_s_error("database name or handle"); while (!terminator()) { - /* this default mechanism is left here for backwards + /* this default mechanism is left here for backwards compatibility, but it is no longer documented and - is not something we should maintain for all ready + is not something we should maintain for all ready options since it needlessly complicates the ready statement without providing any extra functionality */ @@ -2540,7 +2540,7 @@ static act* par_ready() break; CPR_eol_token(); - // pick up the possible parameters, in any order + // pick up the possible parameters, in any order USHORT buffers = 0; db = ready->rdy_database; @@ -2568,8 +2568,8 @@ static act* par_ready() if (buffers) request = PAR_set_up_dpb_info(ready, action, buffers); - /* if there are any options that take host variables as arguments, - make sure that we generate variables for the request so that the + /* if there are any options that take host variables as arguments, + make sure that we generate variables for the request so that the dpb can be extended at runtime */ if (db->dbb_r_user || db->dbb_r_password || @@ -2605,7 +2605,7 @@ static act* par_ready() return action; } -// No explicit databases -- pick up all known +// No explicit databases -- pick up all known for (db = gpreGlob.isc_databases; db; db = db->dbb_next) if (db->dbb_runtime || !(db->dbb_flags & DBB_sqlca)) { @@ -2623,13 +2623,13 @@ static act* par_ready() if (default_buffers && !ready->rdy_request) request = PAR_set_up_dpb_info(ready, action, default_buffers); - /* if there are any options that take host variables as arguments, - make sure that we generate variables for the request so that the + /* if there are any options that take host variables as arguments, + make sure that we generate variables for the request so that the dpb can be extended at runtime */ db = ready->rdy_database; if (db->dbb_r_user || db->dbb_r_password || - db->dbb_r_lc_messages || db->dbb_r_lc_ctype) + db->dbb_r_lc_messages || db->dbb_r_lc_ctype) { if (!request) request = PAR_set_up_dpb_info(ready, action, default_buffers); @@ -2651,12 +2651,12 @@ static act* par_ready() //____________________________________________________________ -// +// // Parse a returning values clause in a STORE -// returning an action. +// returning an action. // Act as if we were at end_store, then set up // for a further set of fields for returned values. -// +// static act* par_returning_values() { @@ -2671,7 +2671,7 @@ static act* par_returning_values() // First take care of the impending store: // Make up an assignment list for all field references and -// clone the references while we are at it +// clone the references while we are at it int count = 0; for (reference = request->req_references; reference; @@ -2702,7 +2702,7 @@ static act* par_returning_values() assignments->nod_arg[count++] = item; } -// Next make an updated context for post_store actions +// Next make an updated context for post_store actions upd* new_values = (upd*) MSC_alloc(UPD_LEN); gpre_ctx* source = request->req_contexts; @@ -2714,7 +2714,7 @@ static act* par_returning_values() new_ctx->ctx_symbol->sym_object = new_ctx; // pointing to itself? // make an update block to hold everything known about referenced -// fields +// fields act* action = MSC_action(request, ACT_store2); action->act_object = (REF) new_values; @@ -2724,7 +2724,7 @@ static act* par_returning_values() new_values->upd_update = new_ctx; new_values->upd_level = ++request->req_level; -// both actions go on the cur_store stack, the store topmost +// both actions go on the cur_store stack, the store topmost MSC_push((GPRE_NOD) action, &cur_store); MSC_push((GPRE_NOD) begin_action, &cur_store); @@ -2733,9 +2733,9 @@ static act* par_returning_values() //____________________________________________________________ -// +// // Do something about a right brace. -// +// static act* par_right_brace() { @@ -2753,9 +2753,9 @@ static act* par_right_brace() //____________________________________________________________ -// +// // Parse a RELEASE_REQUEST statement. -// +// static act* par_release() { @@ -2776,9 +2776,9 @@ static act* par_release() //____________________________________________________________ -// +// // Handle a GET_SLICE or PUT_SLICE statement. -// +// static act* par_slice( ACT_T type) { @@ -2839,9 +2839,9 @@ static act* par_slice( ACT_T type) //____________________________________________________________ -// +// // Parse a STORE clause, returning an action. -// +// static act* par_store() { @@ -2855,9 +2855,9 @@ static act* par_store() request->req_database = relation->rel_database; HSH_insert(context->ctx_symbol); // ** You just inserted the context variable into the hash table. -//The current token however might be the same context variable. +//The current token however might be the same context variable. //If so, get the symbol for it. -//* +//* if (gpreGlob.token_global.tok_keyword == KW_none) gpreGlob.token_global.tok_symbol = HSH_lookup(gpreGlob.token_global.tok_string); MSC_match(KW_USING); @@ -2867,9 +2867,9 @@ static act* par_store() //____________________________________________________________ -// +// // Parse a start stream statement. -// +// static act* par_start_stream() { @@ -2905,11 +2905,11 @@ static act* par_start_stream() //____________________________________________________________ -// +// // Parse a START_TRANSACTION statement, including // transaction handle, transaction options, and // reserving list. -// +// static act* par_start_transaction() { @@ -2922,15 +2922,15 @@ static act* par_start_transaction() gpre_tra* trans = (gpre_tra*) MSC_alloc(TRA_LEN); -// get the transaction handle +// get the transaction handle if (!gpreGlob.token_global.tok_symbol) trans->tra_handle = PAR_native_value(false, true); -// loop reading the various transaction options +// loop reading the various transaction options - while (!(gpreGlob.token_global.tok_keyword == KW_RESERVING) && !(gpreGlob.token_global.tok_keyword == KW_USING) && - !terminator()) + while (!(gpreGlob.token_global.tok_keyword == KW_RESERVING) && !(gpreGlob.token_global.tok_keyword == KW_USING) && + !terminator()) { if (MSC_match(KW_READ_ONLY)) { trans->tra_flags |= TRA_ro; @@ -2945,7 +2945,7 @@ static act* par_start_transaction() } // *** if (MSC_match (KW_READ_COMMITTED)) -// { +// { // trans->tra_flags |= TRA_read_committed; // continue; // } ** @@ -2972,7 +2972,7 @@ static act* par_start_transaction() CPR_s_error("transaction keyword"); } -// send out for the list of reserved relations +// send out for the list of reserved relations if (MSC_match(KW_RESERVING)) { trans->tra_flags |= TRA_rrl; @@ -2992,10 +2992,10 @@ static act* par_start_transaction() //____________________________________________________________ -// +// // We have hit either a function or subroutine declaration. // If the language is fortran, make the position with a break. -// +// static act* par_subroutine() { @@ -3010,10 +3010,10 @@ static act* par_subroutine() //____________________________________________________________ -// +// // Parse a transaction termination statement: commit, // prepare, rollback, or save (commit retaining context). -// +// static act* par_trans( ACT_T act_op) { @@ -3042,13 +3042,13 @@ static act* par_trans( ACT_T act_op) //____________________________________________________________ -// +// // Parse something of the form: -// +// // . . -// +// // where is currently an enumerated type. -// +// static act* par_type() { @@ -3059,11 +3059,11 @@ static act* par_type() //symbol = gpreGlob.token_global.tok_symbol; //relation = (gpre_rel*) symbol->sym_object; //PAR_get_token(); -//** +//** gpre_rel* relation = EXP_relation(); -// No dot and we give up +// No dot and we give up if (!MSC_match(KW_DOT)) return NULL; @@ -3080,7 +3080,7 @@ static act* par_type() if (!MSC_match(KW_DOT)) CPR_s_error("period"); -// Lookup type. If we can't find it, complain bitterly +// Lookup type. If we can't find it, complain bitterly SSHORT type; if (!MET_type(field, gpreGlob.token_global.tok_string, &type)) { @@ -3098,17 +3098,17 @@ static act* par_type() } //____________________________________________________________ -// +// // Parse a free reference to a database field in general // program context. -// +// static act* par_variable() { // // Since fortran is fussy about continuations and the like, // see if this variable token is the first thing in a statement. -// +// const USHORT first = gpreGlob.token_global.tok_first; gpre_ctx* context; @@ -3147,14 +3147,14 @@ static act* par_variable() // We've got a explicit null flag reference rather than a field // reference. If there's already a null reference for the field, -// use it; otherwise make one up. +// use it; otherwise make one up. if (reference->ref_null) { action->act_object = reference->ref_null; return action; } -// Check to see if the flag field has been allocated. If not, sigh, allocate it +// Check to see if the flag field has been allocated. If not, sigh, allocate it ref* flag = MSC_reference(&request->req_references); flag->ref_context = reference->ref_context; @@ -3171,22 +3171,22 @@ static act* par_variable() //____________________________________________________________ -// -// This is PASCAL, and we've got a function, or procedure header. -// Alas and alack, we have to decide if this is a real header or +// +// This is PASCAL, and we've got a function, or procedure header. +// Alas and alack, we have to decide if this is a real header or // a forward/external declaration. -// +// // Basically we scan the thing, skipping parenthesized bits, // looking for a semi-colon. We look at the next token, which may // be OPTIONS followed by a parenthesized list of options, or it // may be just some options, or it may be nothing. If the options // are EXTERN or FORWARD, we've got a reference, otherwise its a real -// routine (or possibly program or module). -// +// routine (or possibly program or module). +// // Fortunately all of these are of the form: -// [( blah, blah )] [: type] ; [;] -// -// +// [( blah, blah )] [: type] ; [;] +// +// static act* scan_routine_header() { @@ -3228,11 +3228,11 @@ static act* scan_routine_header() //____________________________________________________________ -// +// // If this is a external declaration in // a BASIC program, set a flag to indicate // the situation. -// +// static void set_external_flag() { @@ -3241,19 +3241,19 @@ static void set_external_flag() //____________________________________________________________ -// +// // Check the current token for a logical terminator. Terminators // are semi-colon, ELSE, or ON_ERROR. -// +// static bool terminator() { // For C, changed keyword (KW_SEMICOLON) to MSC_match (KW_SEMICOLON) to eat a // semicolon if it is present so as to allow it to be there or not be there. -// Bug#833. mao 6/21/89 +// Bug#833. mao 6/21/89 -// For C, right brace ("}") must also be a terminator. +// For C, right brace ("}") must also be a terminator. if (gpreGlob.sw_language == lang_c) { if (MSC_match(KW_SEMI_COLON) || gpreGlob.token_global.tok_keyword == KW_ELSE || @@ -3263,7 +3263,7 @@ static bool terminator() } } else if (gpreGlob.sw_language == lang_ada) { - if (MSC_match(KW_SEMI_COLON) || gpreGlob.token_global.tok_keyword == KW_ELSE || + if (MSC_match(KW_SEMI_COLON) || gpreGlob.token_global.tok_keyword == KW_ELSE || gpreGlob.token_global.tok_keyword == KW_ON_ERROR) { return true; diff --git a/src/gpre/pas.cpp b/src/gpre/pas.cpp index 5141353cb9..d77eba5a7f 100644 --- a/src/gpre/pas.cpp +++ b/src/gpre/pas.cpp @@ -1,26 +1,26 @@ //____________________________________________________________ -// +// // PROGRAM: PASCAL preprocesser // MODULE: pas.cpp // DESCRIPTION: Inserted text generator for Domain Pascal -// +// // The contents of this file are subject to the Interbase Public // License Version 1.0 (the "License"); you may not use this file // except in compliance with the License. You may obtain a copy // of the License at http://www.Inprise.com/IPL.html -// +// // Software distributed under the License is distributed on an // "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express // or implied. See the License for the specific language governing // rights and limitations under the License. -// +// // The Original Code was created by Inprise Corporation // and its predecessors. Portions created by Inprise Corporation are // Copyright (C) Inprise Corporation. -// +// // All Rights Reserved. // Contributor(s): ______________________________________. -// +// // //____________________________________________________________ // @@ -168,15 +168,15 @@ static inline void set_sqlcode(const act* action, const int column) } //____________________________________________________________ -// +// // Code generator for Domain Pascal. Not to be confused with // the language "Pascal". -// +// void PAS_action(const act* action, int column) { -// Put leading braces where required +// Put leading braces where required switch (action->act_type) { case ACT_alter_database: @@ -496,7 +496,7 @@ void PAS_action(const act* action, int column) return; } -// Put in a trailing brace for those actions still with us +// Put in a trailing brace for those actions still with us if (action->act_flags & ACT_sql) gen_whenever(action->act_whenever, column); @@ -509,9 +509,9 @@ void PAS_action(const act* action, int column) //____________________________________________________________ -// +// // Align output to a specific column for output. -// +// static void align(const int column) { @@ -531,10 +531,10 @@ static void align(const int column) //____________________________________________________________ -// +// // Build an assignment from a host language variable to // a port variable. -// +// static void asgn_from( const act* action, const ref* reference, int column) { @@ -581,10 +581,10 @@ static void asgn_from( const act* action, const ref* reference, int column) //____________________________________________________________ -// +// // Build an assignment from a host language variable to // a sqlda variable. -// +// static void asgn_sqlda_from( const ref* reference, int number, TEXT* string, int column) { @@ -605,10 +605,10 @@ static void asgn_sqlda_from( const ref* reference, int number, TEXT* string, int //____________________________________________________________ -// +// // Build an assignment to a host language variable from // a port variable. -// +// static void asgn_to(const act* action, const ref* reference, int column) { @@ -633,7 +633,7 @@ static void asgn_to(const act* action, const ref* reference, int column) fprintf(gpreGlob.out_file, "%s := %s;", reference->ref_value, gen_name(s, source, true)); -// Pick up NULL value if one is there +// Pick up NULL value if one is there if (reference = reference->ref_null) fprintf(gpreGlob.out_file, "%s := %s;", reference->ref_value, @@ -642,10 +642,10 @@ static void asgn_to(const act* action, const ref* reference, int column) //____________________________________________________________ -// +// // Build an assignment to a host language variable from // a port variable. -// +// static void asgn_to_proc(const ref* reference, int column) { @@ -672,9 +672,9 @@ static void asgn_to_proc(const ref* reference, int column) //____________________________________________________________ -// +// // Generate code for AT END clause of FETCH. -// +// static void gen_at_end( const act* action, int column) { @@ -687,9 +687,9 @@ static void gen_at_end( const act* action, int column) //____________________________________________________________ -// +// // Substitute for a BASED ON clause. -// +// static void gen_based( const act* action, int column) { @@ -772,9 +772,9 @@ static void gen_based( const act* action, int column) //____________________________________________________________ -// +// // Make a blob FOR loop. -// +// static void gen_blob_close( const act* action, USHORT column) { @@ -806,9 +806,9 @@ static void gen_blob_close( const act* action, USHORT column) //____________________________________________________________ -// +// // End a blob FOR loop. -// +// static void gen_blob_end(const act* action, USHORT column) { @@ -828,9 +828,9 @@ static void gen_blob_end(const act* action, USHORT column) //____________________________________________________________ -// +// // Make a blob FOR loop. -// +// static void gen_blob_for( const act* action, USHORT column) { @@ -847,9 +847,9 @@ static void gen_blob_for( const act* action, USHORT column) //____________________________________________________________ -// +// // Generate the call to open (or create) a blob. -// +// static void gen_blob_open( const act* action, USHORT column) { @@ -925,9 +925,9 @@ static void gen_blob_open( const act* action, USHORT column) //____________________________________________________________ -// +// // Callback routine for BLR pretty printer. -// +// static void gen_blr(void* user_arg, SSHORT offset, const char* string) { @@ -940,7 +940,7 @@ static void gen_blr(void* user_arg, SSHORT offset, const char* string) indent++; } -// Limit indentation to 192 characters +// Limit indentation to 192 characters indent = MIN(indent, 192); @@ -973,9 +973,9 @@ static void gen_blr(void* user_arg, SSHORT offset, const char* string) //____________________________________________________________ -// +// // Generate text to compile a request. -// +// static void gen_compile( const act* action, int column) { @@ -1013,7 +1013,7 @@ static void gen_compile( const act* action, int column) request->req_length, request->req_ident); // If blobs are present, zero out all of the blob handles. After this -// point, the handles are the user's responsibility +// point, the handles are the user's responsibility for (const blb* blob = request->req_blobs; blob; blob = blob->blb_next) printa(column - INDENT, "gds__%d := nil;", blob->blb_ident); @@ -1021,9 +1021,9 @@ static void gen_compile( const act* action, int column) //____________________________________________________________ -// +// // Generate a call to create a database. -// +// static void gen_create_database( const act* action, int column) { @@ -1059,9 +1059,9 @@ static void gen_create_database( const act* action, int column) //____________________________________________________________ -// +// // Generate substitution text for END_STREAM. -// +// static int gen_cursor_close( const act* action, const gpre_req* request, int column) { @@ -1086,15 +1086,15 @@ static int gen_cursor_close( const act* action, const gpre_req* request, int col //____________________________________________________________ -// +// // Generate text to initialize a cursor. -// +// static void gen_cursor_init( const act* action, int column) { // If blobs are present, zero out all of the blob handles. After this -// point, the handles are the user's responsibility +// point, the handles are the user's responsibility if (action->act_request-> req_flags & (REQ_sql_blob_open | REQ_sql_blob_create)) @@ -1105,9 +1105,9 @@ static void gen_cursor_init( const act* action, int column) //____________________________________________________________ -// +// // Generate text to open an embedded SQL cursor. -// +// static int gen_cursor_open( const act* action, const gpre_req* request, int column) { @@ -1150,11 +1150,11 @@ static int gen_cursor_open( const act* action, const gpre_req* request, int colu //____________________________________________________________ -// +// // Generate insertion text for the database statement, // including the definitions of all gpreGlob.requests, and blob // ans port declarations for gpreGlob.requests in the main routine. -// +// static void gen_database( const act* action, int column) { @@ -1233,7 +1233,7 @@ static void gen_database( const act* action, int column) "gds__teb\t: array [1..%d] of gds__teb_t;\t(* transaction vector *)", count); -// generate event parameter block for each event in module +// generate event parameter block for each event in module max_count = 0; for (stack_ptr = gpreGlob.events; stack_ptr; stack_ptr = stack_ptr->lls_next) { @@ -1256,7 +1256,7 @@ static void gen_database( const act* action, int column) bool array_flag = false; for (request = gpreGlob.requests; request; request = request->req_next) { gen_request(request, indent); - // Array declarations + // Array declarations if (request->req_type == REQ_slice) array_flag = true; @@ -1335,9 +1335,9 @@ static void gen_database( const act* action, int column) //____________________________________________________________ -// +// // Generate a call to update metadata. -// +// static void gen_ddl( const act* action, int column) { @@ -1350,7 +1350,7 @@ static void gen_ddl( const act* action, int column) column -= INDENT; } -// Set up command type for call to RDB$DDL +// Set up command type for call to RDB$DDL request = action->act_request; @@ -1380,9 +1380,9 @@ static void gen_ddl( const act* action, int column) //____________________________________________________________ -// +// // Generate a call to create a database. -// +// static void gen_drop_database( const act* action, int column) { @@ -1400,9 +1400,9 @@ static void gen_drop_database( const act* action, int column) //____________________________________________________________ -// +// // Generate a dynamic SQL statement. -// +// static void gen_dyn_close( const act* action, int column) { @@ -1418,9 +1418,9 @@ static void gen_dyn_close( const act* action, int column) //____________________________________________________________ -// +// // Generate a dynamic SQL statement. -// +// static void gen_dyn_declare( const act* action, int column) { @@ -1437,9 +1437,9 @@ static void gen_dyn_declare( const act* action, int column) //____________________________________________________________ -// +// // Generate a dynamic SQL statement. -// +// static void gen_dyn_describe(const act* action, int column, @@ -1458,9 +1458,9 @@ static void gen_dyn_describe(const act* action, //____________________________________________________________ -// +// // Generate a dynamic SQL statement. -// +// static void gen_dyn_execute( const act* action, int column) { @@ -1512,9 +1512,9 @@ static void gen_dyn_execute( const act* action, int column) //____________________________________________________________ -// +// // Generate a dynamic SQL statement. -// +// static void gen_dyn_fetch( const act* action, int column) { @@ -1534,9 +1534,9 @@ static void gen_dyn_fetch( const act* action, int column) //____________________________________________________________ -// +// // Generate code for an EXECUTE IMMEDIATE dynamic SQL statement. -// +// static void gen_dyn_immediate( const act* action, int column) { @@ -1580,9 +1580,9 @@ static void gen_dyn_immediate( const act* action, int column) //____________________________________________________________ -// +// // Generate a dynamic SQL statement. -// +// static void gen_dyn_insert( const act* action, int column) { @@ -1602,9 +1602,9 @@ static void gen_dyn_insert( const act* action, int column) //____________________________________________________________ -// +// // Generate a dynamic SQL statement. -// +// static void gen_dyn_open( const act* action, int column) { @@ -1658,9 +1658,9 @@ static void gen_dyn_open( const act* action, int column) //____________________________________________________________ -// +// // Generate a dynamic SQL statement. -// +// static void gen_dyn_prepare( const act* action, int column) { @@ -1701,9 +1701,9 @@ static void gen_dyn_prepare( const act* action, int column) //____________________________________________________________ -// +// // Generate substitution text for END_MODIFY. -// +// static void gen_emodify( const act* action, int column) { @@ -1713,7 +1713,7 @@ static void gen_emodify( const act* action, int column) upd* modify = (upd*) action->act_object; for (const ref* reference = modify->upd_port->por_references; reference; - reference = reference->ref_next) + reference = reference->ref_next) { const ref* source = reference->ref_source; if (!source) @@ -1731,9 +1731,9 @@ static void gen_emodify( const act* action, int column) //____________________________________________________________ -// +// // Generate substitution text for END_STORE. -// +// static void gen_estore( const act* action, int column) { @@ -1741,7 +1741,7 @@ static void gen_estore( const act* action, int column) request = action->act_request; // if we did a store ... returning_values aka store2 -// just wrap up pending error +// just wrap up pending error if (request->req_type == REQ_store2) { if (action->act_error || (action->act_flags & ACT_sql)) endp(column); @@ -1756,9 +1756,9 @@ static void gen_estore( const act* action, int column) //____________________________________________________________ -// +// // Generate definitions associated with a single request. -// +// static void gen_endfor( const act* action, int column) { @@ -1779,9 +1779,9 @@ static void gen_endfor( const act* action, int column) //____________________________________________________________ -// +// // Generate substitution text for ERASE. -// +// static void gen_erase( const act* action, int column) { @@ -1799,10 +1799,10 @@ static void gen_erase( const act* action, int column) //____________________________________________________________ -// +// // Generate event parameter blocks for use // with a particular call to gds__event_wait. -// +// static SSHORT gen_event_block( const act* action) { @@ -1828,9 +1828,9 @@ static SSHORT gen_event_block( const act* action) //____________________________________________________________ -// +// // Generate substitution text for EVENT_INIT. -// +// static void gen_event_init( const act* action, int column) { @@ -1857,7 +1857,7 @@ static void gen_event_init( const act* action, int column) args.pat_string1 = GDS_EVENT_WAIT; args.pat_string2 = GDS_EVENT_COUNTS; -// generate call to dynamically generate event blocks +// generate call to dynamically generate event blocks TEXT variable[MAX_REF_SIZE]; for (ptr = event_list->nod_arg, count = 0, end = @@ -1880,11 +1880,11 @@ static void gen_event_init( const act* action, int column) PATTERN_expand(column, pattern1, &args); -// generate actual call to event_wait +// generate actual call to event_wait PATTERN_expand(column, pattern2, &args); -// get change in event counts, copying event parameter block for reuse +// get change in event counts, copying event parameter block for reuse PATTERN_expand(column, pattern3, &args); @@ -1895,9 +1895,9 @@ static void gen_event_init( const act* action, int column) //____________________________________________________________ -// +// // Generate substitution text for EVENT_WAIT. -// +// static void gen_event_wait( const act* action, int column) { @@ -1920,7 +1920,7 @@ static void gen_event_wait( const act* action, int column) event_name = (gpre_sym*) action->act_object; // go through the stack of gpreGlob.events, checking to see if the -// event has been initialized and getting the event identifier +// event has been initialized and getting the event identifier ident = -1; for (stack_ptr = gpreGlob.events; stack_ptr; stack_ptr = stack_ptr->lls_next) { @@ -1945,7 +1945,7 @@ static void gen_event_wait( const act* action, int column) args.pat_string1 = GDS_EVENT_WAIT; args.pat_string2 = GDS_EVENT_COUNTS; -// generate calls to wait on the event and to fill out the gpreGlob.events array +// generate calls to wait on the event and to fill out the gpreGlob.events array PATTERN_expand(column, pattern1, &args); PATTERN_expand(column, pattern2, &args); @@ -1957,11 +1957,11 @@ static void gen_event_wait( const act* action, int column) //____________________________________________________________ -// +// // Generate replacement text for the SQL FETCH statement. The // epilog FETCH statement is handled by GEN_S_FETCH (generate // stream fetch). -// +// static void gen_fetch( const act* action, int column) { @@ -1979,8 +1979,8 @@ static void gen_fetch( const act* action, int column) const TEXT* offset; if (port = request->req_aport) { - /* set up the reference to point to the correct value - in the linked list of values, and prepare for the + /* set up the reference to point to the correct value + in the linked list of values, and prepare for the next FETCH statement if applicable */ for (reference = port->por_references; reference; @@ -1991,16 +1991,16 @@ static void gen_fetch( const act* action, int column) reference->ref_values = value->val_next; } - // find the direction and offset parameters + // find the direction and offset parameters reference = port->por_references; offset = reference->ref_value; reference = reference->ref_next; direction = reference->ref_value; - /* the direction in which the engine will scroll is sticky, so check to see - the last direction passed to the engine; if the direction is the same and - the offset is 1, then there is no need to pass the message; this prevents + /* the direction in which the engine will scroll is sticky, so check to see + the last direction passed to the engine; if the direction is the same and + the offset is 1, then there is no need to pass the message; this prevents extra packets and allows for batch fetches in either direction */ printa(column, "if (isc_%ddirection MOD 2 <> %s) or (%s <> 1) then", @@ -2008,7 +2008,7 @@ static void gen_fetch( const act* action, int column) column += INDENT; begin(column); - /* assign the direction and offset parameters to the appropriate message, + /* assign the direction and offset parameters to the appropriate message, then send the message to the engine */ asgn_from(action, port->por_references, column); @@ -2063,9 +2063,9 @@ static void gen_fetch( const act* action, int column) //____________________________________________________________ -// +// // Generate substitution text for FINISH -// +// static void gen_finish( const act* action, int column) { @@ -2084,7 +2084,7 @@ static void gen_finish( const act* action, int column) } // Got rid of tests of gds__trans <> nil which were causing the skipping -// of trying to detach the databases. Related to bug#935. mao 6/22/89 +// of trying to detach the databases. Related to bug#935. mao 6/22/89 for (ready = (rdy*) action->act_object; ready; ready = ready->rdy_next) { db = ready->rdy_database; @@ -2108,9 +2108,9 @@ static void gen_finish( const act* action, int column) //____________________________________________________________ -// +// // Generate substitution text for FOR statement. -// +// static void gen_for( const act* action, int column) { @@ -2146,10 +2146,10 @@ static void gen_for( const act* action, int column) //____________________________________________________________ -// +// // Generate a call to gds__get_slice // or gds__put_slice for an array. -// +// static void gen_get_or_put_slice(const act* action, const ref* reference, @@ -2165,26 +2165,26 @@ static void gen_get_or_put_slice(const act* action, if (!(reference->ref_flags & REF_fetch_array)) return; - args.pat_vector1 = status_vector(action); // status vector - args.pat_database = action->act_request->req_database; // database handle - args.pat_string1 = action->act_request->req_trans; // transaction handle + args.pat_vector1 = status_vector(action); // status vector + args.pat_database = action->act_request->req_database; // database handle + args.pat_string1 = action->act_request->req_trans; // transaction handle TEXT s1[MAX_REF_SIZE], s2[MAX_REF_SIZE], s3[MAX_REF_SIZE], s4[MAX_REF_SIZE]; gen_name(s1, reference, true); // blob handle args.pat_string2 = s1; - args.pat_value1 = reference->ref_sdl_length; // slice descr. length + args.pat_value1 = reference->ref_sdl_length; // slice descr. length - sprintf(s2, "gds__%d", reference->ref_sdl_ident); // slice description + sprintf(s2, "gds__%d", reference->ref_sdl_ident); // slice description args.pat_string3 = s2; - args.pat_value2 = 0; // parameter length + args.pat_value2 = 0; // parameter length - sprintf(s3, "0"); // parameter + sprintf(s3, "0"); // parameter args.pat_string4 = s3; args.pat_long1 = reference->ref_field->fld_array_info->ary_size; - // slice size + // slice size if (action->act_flags & ACT_sql) { args.pat_string5 = reference->ref_value; @@ -2192,10 +2192,10 @@ static void gen_get_or_put_slice(const act* action, else { sprintf(s4, "gds__%d", reference->ref_field->fld_array_info->ary_ident); - args.pat_string5 = s4; // array name + args.pat_string5 = s4; // array name } - args.pat_string6 = "gds__array_length"; // return length + args.pat_string6 = "gds__array_length"; // return length if (get) PATTERN_expand(column, pattern1, &args); @@ -2205,9 +2205,9 @@ static void gen_get_or_put_slice(const act* action, //____________________________________________________________ -// +// // Generate the code to do a get segment. -// +// static void gen_get_segment( const act* action, int column) { @@ -2255,10 +2255,10 @@ static void gen_get_segment( const act* action, int column) //____________________________________________________________ -// +// // Generate text to compile and start a stream. This is // used both by START_STREAM and FOR -// +// static void gen_loop( const act* action, int column) { @@ -2282,10 +2282,10 @@ static void gen_loop( const act* action, int column) //____________________________________________________________ -// +// // Generate a name for a reference. Name is constructed from // port and parameter idents. -// +// static TEXT *gen_name(TEXT* const string, const ref* reference, @@ -2304,9 +2304,9 @@ static TEXT *gen_name(TEXT* const string, //____________________________________________________________ -// +// // Generate a block to handle errors. -// +// static void gen_on_error( const act* action, USHORT column) { @@ -2324,9 +2324,9 @@ static void gen_on_error( const act* action, USHORT column) //____________________________________________________________ -// +// // Generate code for an EXECUTE PROCEDURE. -// +// static void gen_procedure( const act* action, int column) { @@ -2342,7 +2342,7 @@ static void gen_procedure( const act* action, int column) args.pat_request = request; args.pat_port = in_port; args.pat_port2 = out_port; - + const TEXT* pattern; if (in_port && in_port->por_length) pattern = @@ -2352,16 +2352,16 @@ static void gen_procedure( const act* action, int column) "isc_transact_request (%V1, %RF%DH%RE, %RF%RT%RE, %VF%RS%VE, %RI, %VF0%VE, 0, %VF%QL%VE, %RF%QI%RE);"; -// Get database attach and transaction started +// Get database attach and transaction started if (gpreGlob.sw_auto) t_start_auto(action, 0, status_vector(action), column); -// Move in input values +// Move in input values asgn_from(action, request->req_values, column); -// Execute the procedure +// Execute the procedure PATTERN_expand(column, pattern, &args); @@ -2371,7 +2371,7 @@ static void gen_procedure( const act* action, int column) column += INDENT; begin(column); -// Move out output values +// Move out output values asgn_to_proc(request->req_references, column); endp(column); @@ -2379,9 +2379,9 @@ static void gen_procedure( const act* action, int column) //____________________________________________________________ -// +// // Generate the code to do a put segment. -// +// static void gen_put_segment( const act* action, int column) { @@ -2425,9 +2425,9 @@ static void gen_put_segment( const act* action, int column) //____________________________________________________________ -// +// // Generate BLR in raw, numeric form. Ughly but dense. -// +// static void gen_raw(const UCHAR* blr, int request_length, int column) { @@ -2459,9 +2459,9 @@ static void gen_raw(const UCHAR* blr, int request_length, int column) //____________________________________________________________ -// +// // Generate substitution text for READY -// +// static void gen_ready( const act* action, int column) { @@ -2490,9 +2490,9 @@ static void gen_ready( const act* action, int column) //____________________________________________________________ -// +// // Generate receive call for a port. -// +// static void gen_receive( const act* action, int column, const gpre_port* port) { @@ -2511,7 +2511,7 @@ static void gen_receive( const act* action, int column, const gpre_port* port) //____________________________________________________________ -// +// // Generate substitution text for RELEASE_REQUESTS // For active databases, call gds__release_request. // for all others, just zero the handle. For the @@ -2519,7 +2519,7 @@ static void gen_receive( const act* action, int column, const gpre_port* port) // are likely if the request was compiled on a database // which has been released and re-readied. If there is // a serious error, it will be caught on the next statement. -// +// static void gen_release( const act* action, int column) { @@ -2540,13 +2540,13 @@ static void gen_release( const act* action, int column) //____________________________________________________________ -// +// // Generate definitions associated with a single request. -// +// static void gen_request( const gpre_req* request, int column) { -// generate request handle, blob handles, and ports +// generate request handle, blob handles, and ports const TEXT* sw_volatile = FB_DP_VOLATILE; printa(column, " "); @@ -2564,7 +2564,7 @@ static void gen_request( const gpre_req* request, int column) "gds__%ds\t: %s gds__handle := nil;\t\t(* SQL statement handle *)", request->req_ident, sw_volatile); -// generate actual BLR string +// generate actual BLR string if (request->req_length) { printa(column, " "); @@ -2635,7 +2635,7 @@ static void gen_request( const gpre_req* request, int column) CLOSE_BRACKET, string_type, request->req_ident); } -// Print out slice description language if there are arrays associated with request +// Print out slice description language if there are arrays associated with request for (const gpre_port* port = request->req_ports; port; port = port->por_next) for (const ref* reference = port->por_references; reference; @@ -2655,7 +2655,7 @@ static void gen_request( const gpre_req* request, int column) } } -// Print out any blob parameter blocks required +// Print out any blob parameter blocks required for (const blb* blob = request->req_blobs; blob; blob = blob->blb_next) if (blob->blb_bpb_length) { @@ -2665,7 +2665,7 @@ static void gen_request( const gpre_req* request, int column) gen_raw(blob->blb_bpb, blob->blb_bpb_length, column); printa(column, "%s;\n", CLOSE_BRACKET); } -// If this is GET_SLICE/PUT_SLICE, allocate some variables +// If this is GET_SLICE/PUT_SLICE, allocate some variables if (request->req_type == REQ_slice) { printa(column, "gds__%dv\t: array [1..%d] of %s;", @@ -2677,10 +2677,10 @@ static void gen_request( const gpre_req* request, int column) //____________________________________________________________ -// +// // Generate receive call for a port // in a store2 statement. -// +// static void gen_return_value( const act* action, int column) { @@ -2699,10 +2699,10 @@ static void gen_return_value( const act* action, int column) //____________________________________________________________ -// +// // Process routine head. If there are gpreGlob.requests in the // routine, insert local definitions. -// +// static void gen_routine( const act* action, int column) { @@ -2711,7 +2711,7 @@ static void gen_routine( const act* action, int column) column += INDENT; for (const gpre_req* request = (const gpre_req*) action->act_object; request; - request = request->req_routine) + request = request->req_routine) { for (port = request->req_ports; port; port = port->por_next) { printa(column - INDENT, "type"); @@ -2744,9 +2744,9 @@ static void gen_routine( const act* action, int column) //____________________________________________________________ -// +// // Generate substitution text for END_STREAM. -// +// static void gen_s_end( const act* action, int column) { @@ -2774,9 +2774,9 @@ static void gen_s_end( const act* action, int column) //____________________________________________________________ -// +// // Generate substitution text for FETCH. -// +// static void gen_s_fetch( const act* action, int column) { @@ -2791,10 +2791,10 @@ static void gen_s_fetch( const act* action, int column) //____________________________________________________________ -// +// // Generate text to compile and start a stream. This is // used both by START_STREAM and FOR -// +// static void gen_s_start( const act* action, int column) { @@ -2833,9 +2833,9 @@ static void gen_s_start( const act* action, int column) //____________________________________________________________ -// +// // Substitute for a segment, segment length, or blob handle. -// +// static void gen_segment( const act* action, int column) { @@ -2849,8 +2849,8 @@ static void gen_segment( const act* action, int column) //____________________________________________________________ -// -// +// +// static void gen_select( const act* action, int column) { @@ -2892,9 +2892,9 @@ static void gen_select( const act* action, int column) //____________________________________________________________ -// +// // Generate a send or receive call for a port. -// +// static void gen_send( const act* action, const gpre_port* port, int column) { @@ -2912,9 +2912,9 @@ static void gen_send( const act* action, const gpre_port* port, int column) //____________________________________________________________ -// +// // Generate support for get/put slice statement. -// +// static void gen_slice( const act* action, int column) { @@ -2931,7 +2931,7 @@ static void gen_slice( const act* action, int column) slc* slice = (slc*) action->act_object; const gpre_req* parent_request = slice->slc_parent_request; -// Compute array size +// Compute array size printa(column, "gds__%ds := %d", request->req_ident, slice->slc_field->fld_array->fld_length); @@ -2950,11 +2950,11 @@ static void gen_slice( const act* action, int column) fprintf(gpreGlob.out_file, ";"); -// Make assignments to variable vector +// Make assignments to variable vector const ref* reference; for (reference = request->req_values; reference; reference = - reference->ref_next) + reference->ref_next) { printa(column, "gds__%dv [%d] := %s;", request->req_ident, reference->ref_id, @@ -2962,16 +2962,16 @@ static void gen_slice( const act* action, int column) } args.pat_reference = slice->slc_field_ref; - args.pat_request = parent_request; // blob id request - args.pat_vector1 = status_vector(action); // status vector - args.pat_database = parent_request->req_database; // database handle - args.pat_string1 = action->act_request->req_trans; // transaction handle - args.pat_value1 = request->req_length; // slice descr. length - args.pat_ident1 = request->req_ident; // request name - args.pat_value2 = slice->slc_parameters * sizeof(SLONG); // parameter length + args.pat_request = parent_request; // blob id request + args.pat_vector1 = status_vector(action); // status vector + args.pat_database = parent_request->req_database; // database handle + args.pat_string1 = action->act_request->req_trans; // transaction handle + args.pat_value1 = request->req_length; // slice descr. length + args.pat_ident1 = request->req_ident; // request name + args.pat_value2 = slice->slc_parameters * sizeof(SLONG); // parameter length reference = (const ref*) slice->slc_array->nod_arg[0]; - args.pat_string5 = reference->ref_value; // array name + args.pat_string5 = reference->ref_value; // array name args.pat_string6 = "gds__array_length"; PATTERN_expand(column, @@ -2981,10 +2981,10 @@ static void gen_slice( const act* action, int column) //____________________________________________________________ -// +// // Generate either a START or START_AND_SEND depending // on whether or a not a port is present. -// +// static void gen_start( const act* action, const gpre_port* port, int column) { @@ -3019,10 +3019,10 @@ static void gen_start( const act* action, const gpre_port* port, int column) //____________________________________________________________ -// +// // Generate text for STORE statement. This includes the compile // call and any variable initialization required. -// +// static void gen_store( const act* action, int column) { @@ -3040,7 +3040,7 @@ static void gen_store( const act* action, int column) begin(column); } -// Initialize any blob fields +// Initialize any blob fields TEXT name[MAX_REF_SIZE]; port = request->req_primary; @@ -3056,9 +3056,9 @@ static void gen_store( const act* action, int column) //____________________________________________________________ -// +// // Generate substitution text for START_TRANSACTION. -// +// static void gen_t_start( const act* action, int column) { @@ -3067,11 +3067,11 @@ static void gen_t_start( const act* action, int column) tpb* tpb_val; int count; -// +// // for automatically generated transactions, and transactions that are // explicitly started, but don't have any arguments so don't get a TPB, // generate something plausible. -// +// if (!action || !(trans = (gpre_tra*) action->act_object)) { t_start_auto(action, 0, status_vector(action), column); @@ -3080,7 +3080,7 @@ static void gen_t_start( const act* action, int column) // build a complete statement, including tpb's. // first generate any appropriate ready statements, -// On non-VMS machines, fill in the tpb vector (aka TEB). +// On non-VMS machines, fill in the tpb vector (aka TEB). count = 0; for (tpb_val = trans->tra_tpb; tpb_val; tpb_val = tpb_val->tpb_tra_next) { @@ -3114,9 +3114,9 @@ static void gen_t_start( const act* action, int column) //____________________________________________________________ -// +// // Generate a TPB in the output file -// +// static void gen_tpb( tpb* tpb_val, int column) { @@ -3145,7 +3145,7 @@ static void gen_tpb( tpb* tpb_val, int column) } } -// handle the last character +// handle the last character c = *text++; if ((c >= 'A' && c <= 'Z') || c == '$' || c == '_') @@ -3161,9 +3161,9 @@ static void gen_tpb( tpb* tpb_val, int column) //____________________________________________________________ -// +// // Generate substitution text for COMMIT, ROLLBACK, PREPARE, and SAVE -// +// static void gen_trans( const act* action, int column) { @@ -3197,9 +3197,9 @@ static void gen_trans( const act* action, int column) //____________________________________________________________ -// +// // Generate substitution text for UPDATE ... WHERE CURRENT OF ... -// +// static void gen_update( const act* action, int column) { @@ -3214,9 +3214,9 @@ static void gen_update( const act* action, int column) //____________________________________________________________ -// +// // Substitute for a variable reference. -// +// static void gen_variable( const act* action, int column) { @@ -3227,9 +3227,9 @@ static void gen_variable( const act* action, int column) //____________________________________________________________ -// +// // Generate tests for any WHENEVER clauses that may have been declared. -// +// static void gen_whenever( const swe* label, int column) { @@ -3260,10 +3260,10 @@ static void gen_whenever( const swe* label, int column) } //____________________________________________________________ -// +// // Generate a declaration of an array in the // output file. -// +// static void make_array_declaration( const ref* reference) { @@ -3273,7 +3273,7 @@ static void make_array_declaration( const ref* reference) field = reference->ref_field; const TEXT* name = field->fld_symbol->sym_string; -// Don't generate multiple declarations for the array. V3 Bug 569. +// Don't generate multiple declarations for the array. V3 Bug 569. if (field->fld_array_info->ary_declared) return; @@ -3287,7 +3287,7 @@ static void make_array_declaration( const ref* reference) fprintf(gpreGlob.out_file, "gds__%d : array [", field->fld_array_info->ary_ident); -// Print out the dimension part of the declaration +// Print out the dimension part of the declaration for (dimension = field->fld_array_info->ary_dimension; dimension; dimension = dimension->dim_next) { @@ -3341,16 +3341,16 @@ static void make_array_declaration( const ref* reference) } } -// Print out the database field +// Print out the database field fprintf(gpreGlob.out_file, ";\t(* %s *)\n", name); } //____________________________________________________________ -// +// // Turn a symbol into a varying string. -// +// static TEXT* make_name( TEXT* const string, const gpre_sym* symbol) { @@ -3362,10 +3362,10 @@ static TEXT* make_name( TEXT* const string, const gpre_sym* symbol) //____________________________________________________________ -// +// // Generate code to test existence of compiled request with // active transaction -// +// static void make_ok_test( const act* action, const gpre_req* request, int column) { @@ -3379,9 +3379,9 @@ static void make_ok_test( const act* action, const gpre_req* request, int column //____________________________________________________________ -// +// // Insert a port record description in output. -// +// static void make_port( const gpre_port* port, int column) { @@ -3457,10 +3457,10 @@ static void make_port( const gpre_port* port, int column) //____________________________________________________________ -// +// // Generate the actual insertion text for a // ready; -// +// static void make_ready( const dbb* db, @@ -3495,9 +3495,9 @@ static void make_ready( //____________________________________________________________ -// +// // Print a fixed string at a particular column. -// +// static void printa( int column, const char* string, ...) { @@ -3511,9 +3511,9 @@ static void printa( int column, const char* string, ...) //____________________________________________________________ -// +// // Generate the appropriate transaction handle. -// +// static const TEXT* request_trans( const act* action, const gpre_req* request) { @@ -3529,10 +3529,10 @@ static const TEXT* request_trans( const act* action, const gpre_req* request) //____________________________________________________________ -// +// // Generate the appropriate status vector parameter for a gds // call depending on where or not the action has an error clause. -// +// static const TEXT* status_vector( const act* action) { @@ -3545,14 +3545,14 @@ static const TEXT* status_vector( const act* action) //____________________________________________________________ -// +// // Generate substitution text for START_TRANSACTION. // The complications include the fact that all databases // must be readied, and that everything should stop if // any thing fails so we don't trash the status vector. -// +// -static void t_start_auto( const act* action, const gpre_req* request, +static void t_start_auto( const act* action, const gpre_req* request, const TEXT* vector, int column) { DBB db; @@ -3561,11 +3561,11 @@ static void t_start_auto( const act* action, const gpre_req* request, buffer[0] = 0; -// find out whether we're using a status vector or not +// find out whether we're using a status vector or not const bool stat = !strcmp(vector, "gds__status"); -// this is a default transaction, make sure all databases are ready +// this is a default transaction, make sure all databases are ready begin(column); diff --git a/src/gpre/pat.cpp b/src/gpre/pat.cpp index 17f78f17bb..0ebc1a8db8 100644 --- a/src/gpre/pat.cpp +++ b/src/gpre/pat.cpp @@ -1,26 +1,26 @@ //____________________________________________________________ -// +// // PROGRAM: Language Preprocessor // MODULE: pat.cpp // DESCRIPTION: Code generator pattern generator -// +// // The contents of this file are subject to the Interbase Public // License Version 1.0 (the "License"); you may not use this file // except in compliance with the License. You may obtain a copy // of the License at http://www.Inprise.com/IPL.html -// +// // Software distributed under the License is distributed on an // "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express // or implied. See the License for the specific language governing // rights and limitations under the License. -// +// // The Original Code was created by Inprise Corporation // and its predecessors. Portions created by Inprise Corporation are // Copyright (C) Inprise Corporation. -// +// // All Rights Reserved. // Contributor(s): ______________________________________. -// +// // //____________________________________________________________ // @@ -38,23 +38,23 @@ typedef enum { NL, - RH, RL, RT, RI, RS, // Request handle, level, transaction, ident, length - DH, DF, // Database handle, filename - TH, // Transaction handle - BH, BI, // Blob handle, blob_ident - FH, // Form handle - V1, V2, // Status vectors - I1, I2, // Identifier numbers - RF, RE, // OS- and language-dependent REF and REF-end character - VF, VE, // OS- and language-dependent VAL and VAL-end character + RH, RL, RT, RI, RS, // Request handle, level, transaction, ident, length + DH, DF, // Database handle, filename + TH, // Transaction handle + BH, BI, // Blob handle, blob_ident + FH, // Form handle + V1, V2, // Status vectors + I1, I2, // Identifier numbers + RF, RE, // OS- and language-dependent REF and REF-end character + VF, VE, // OS- and language-dependent VAL and VAL-end character S1, S2, S3, S4, S5, S6, S7, - // Arbitrary strings + // Arbitrary strings N1, N2, N3, N4, // Arbitrary number (SSHORT) L1, L2, // Arbitrary number (SLONG) - PN, PL, PI, // Port number, port length, port ident - QN, QL, QI, // Second port number, port length, port ident - IF, EL, EN, // If, else, end - FR // Field reference + PN, PL, PI, // Port number, port length, port ident + QN, QL, QI, // Second port number, port length, port ident + IF, EL, EN, // If, else, end + FR // Field reference } PAT_T; static const struct ops { @@ -109,9 +109,9 @@ static const struct ops { //____________________________________________________________ -// +// // Expand a pattern. -// +// void PATTERN_expand( USHORT column, const TEXT* pattern, PAT* args) { @@ -378,7 +378,7 @@ void PATTERN_expand( USHORT column, const TEXT* pattern, PAT* args) sprintf(p, gpreGlob.long_ident_pattern, long_value); else sprintf(p, gpreGlob.ident_pattern, value); - } + } else if (reference) { if (!reference->ref_port) sprintf(p, gpreGlob.ident_pattern, reference->ref_ident); diff --git a/src/gpre/pretty.cpp b/src/gpre/pretty.cpp index e6c7a3d963..8b037e69d2 100644 --- a/src/gpre/pretty.cpp +++ b/src/gpre/pretty.cpp @@ -1,27 +1,27 @@ //____________________________________________________________ -// +// // PROGRAM: BLR Pretty Printer // MODULE: pretty.cpp // DESCRIPTION: BLR Pretty Printer -// +// // The contents of this file are subject to the Interbase Public // License Version 1.0 (the "License"); you may not use this file // except in compliance with the License. You may obtain a copy // of the License at http://www.Inprise.com/IPL.html -// +// // Software distributed under the License is distributed on an // "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express // or implied. See the License for the specific language governing // rights and limitations under the License. -// +// // The Original Code was created by Inprise Corporation // and its predecessors. Portions created by Inprise Corporation are // Copyright (C) Inprise Corporation. -// +// // All Rights Reserved. // Contributor(s): ______________________________________. // TMN (Mike Nordell) 11.APR.2001 - Reduce compiler warnings -// +// // //____________________________________________________________ // @@ -48,10 +48,10 @@ typedef struct ctl { - UCHAR *ctl_blr; // Running blr string - UCHAR *ctl_blr_start; // Original start of blr string - FPTR_PRINT_CALLBACK ctl_routine; // Call back - void *ctl_user_arg; // User argument + UCHAR *ctl_blr; // Running blr string + UCHAR *ctl_blr_start; // Original start of blr string + FPTR_PRINT_CALLBACK ctl_routine; // Call back + void *ctl_user_arg; // User argument TEXT *ctl_ptr; SSHORT ctl_language; SSHORT ctl_level; @@ -102,9 +102,9 @@ const char *map_strings[] = { }; //____________________________________________________________ -// +// // Pretty print create database parameter buffer thru callback routine. -// +// int PRETTY_print_cdb( UCHAR* blr, FPTR_PRINT_CALLBACK routine, @@ -134,7 +134,7 @@ int PRETTY_print_cdb( UCHAR* blr, else sprintf(temp, "gds__dpb_version%d", i); blr_format(control, temp); - + SSHORT offset = 0; print_line(control, offset); @@ -167,11 +167,11 @@ int PRETTY_print_cdb( UCHAR* blr, int PRETTY_print_dyn( UCHAR* blr, //____________________________________________________________ -// +// // Pretty print dynamic DDL thru callback routine. -// +// - FPTR_PRINT_CALLBACK routine, + FPTR_PRINT_CALLBACK routine, void* user_arg, SSHORT language) { ctl ctl_buffer; @@ -215,9 +215,9 @@ int PRETTY_print_dyn( int PRETTY_print_sdl(UCHAR* blr, //____________________________________________________________ -// +// // Pretty print slice description language. -// +// FPTR_PRINT_CALLBACK routine, void *user_arg, SSHORT language) @@ -260,9 +260,9 @@ PRETTY_print_sdl(UCHAR* blr, //____________________________________________________________ -// +// // Format an utterance. -// +// static int blr_format(CTL control, const char *string, ...) { @@ -273,15 +273,15 @@ static int blr_format(CTL control, const char *string, ...) va_end(ptr); while (*control->ctl_ptr) control->ctl_ptr++; - + return 0; } //____________________________________________________________ -// +// // Put out an error msg and punt. -// +// static int error( CTL control, SSHORT offset, const TEXT * string, int arg) { @@ -297,9 +297,9 @@ static int error( CTL control, SSHORT offset, const TEXT * string, int arg) //____________________________________________________________ -// +// // Indent for pretty printing. -// +// static int indent( CTL control, SSHORT level) { @@ -312,10 +312,10 @@ static int indent( CTL control, SSHORT level) //____________________________________________________________ -// +// // Print a datatype sequence and return the length of the // data described. -// +// static int print_blr_dtype(CTL control, bool print_object) @@ -326,7 +326,7 @@ static int print_blr_dtype(CTL control, const USHORT dtype = BLR_BYTE; // Special case blob (261) to keep down the size of the -// jump table +// jump table switch (dtype) { case blr_short: @@ -418,7 +418,7 @@ static int print_blr_dtype(CTL control, if (!print_object) return length; - + // TMN: FIX FIX Note that offset is not initialized to anything useful // for e.g. print_word(control, (SSHORT)offset). I assume it's better to initialize it to zero // than letting it be random. @@ -470,9 +470,9 @@ static int print_blr_dtype(CTL control, //____________________________________________________________ -// +// // Print a line of pretty-printed BLR. -// +// static void print_blr_line(void* arg, SSHORT offset, const char* line) { @@ -498,9 +498,9 @@ static void print_blr_line(void* arg, SSHORT offset, const char* line) //____________________________________________________________ -// +// // Print a byte as a numeric value and return same. -// +// static int print_byte( CTL control, SSHORT offset) { @@ -514,9 +514,9 @@ static int print_byte( CTL control, SSHORT offset) //____________________________________________________________ -// +// // Print a byte as a numeric value and return same. -// +// static int print_char( CTL control, SSHORT offset) { @@ -536,9 +536,9 @@ static int print_char( CTL control, SSHORT offset) //____________________________________________________________ -// +// // Primary recursive routine to print dynamic DDL. -// +// static int print_dyn_verb( CTL control, SSHORT level) { @@ -560,7 +560,7 @@ static int print_dyn_verb( CTL control, SSHORT level) ++level; int length; - + switch (dyn_operator) { case isc_dyn_drop_difference: case isc_dyn_begin_backup: @@ -721,9 +721,9 @@ static int print_dyn_verb( CTL control, SSHORT level) //____________________________________________________________ -// +// // Invoke callback routine to print (or do something with) a line. -// +// static int print_line( CTL control, SSHORT offset) { @@ -736,9 +736,9 @@ static int print_line( CTL control, SSHORT offset) //____________________________________________________________ -// +// // Print a VAX word as a numeric value an return same. -// +// static SLONG print_long( CTL control, SSHORT offset) { @@ -757,9 +757,9 @@ static SLONG print_long( CTL control, SSHORT offset) //____________________________________________________________ -// +// // Primary recursive routine to print slice description language. -// +// static int print_sdl_verb( CTL control, SSHORT level) { @@ -865,9 +865,9 @@ static int print_sdl_verb( CTL control, SSHORT level) //____________________________________________________________ -// +// // Print a byte-counted string. -// +// static int print_string( CTL control, SSHORT offset) { @@ -881,9 +881,9 @@ static int print_string( CTL control, SSHORT offset) //____________________________________________________________ -// +// // Print a VAX word as a numeric value an return same. -// +// static int print_word( CTL control, SSHORT offset) { diff --git a/src/gpre/rmc.cpp b/src/gpre/rmc.cpp index eab9fabcc3..8d44c9812b 100644 --- a/src/gpre/rmc.cpp +++ b/src/gpre/rmc.cpp @@ -1,23 +1,23 @@ //____________________________________________________________ -// +// // PROGRAM: General preprocessor // MODULE: rmc.cpp // DESCRIPTION: RM/COBOL text generator -// +// // The contents of this file are subject to the Interbase Public // License Version 1.0 (the "License"); you may not use this file // except in compliance with the License. You may obtain a copy // of the License at http://www.Inprise.com/IPL.html -// +// // Software distributed under the License is distributed on an // "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express // or implied. See the License for the specific language governing // rights and limitations under the License. -// +// // The Original Code was created by Inprise Corporation // and its predecessors. Portions created by Inprise Corporation are // Copyright (C) Inprise Corporation. -// +// // All Rights Reserved. // Contributor(s): ______________________________________. // New module by Stephen W. Boyd 31.Aug.2006 @@ -75,7 +75,7 @@ static const char* const ISC_INSERT = "isc_embed_dsql_insert"; static const char* const ISC_OPEN = "isc_embed_dsql_open"; static const char* const ISC_OPEN2 = "isc_embed_dsql_open2"; static const char* const ISC_PREPARE = "isc_embed_dsql_prepare"; -// Never user isc_dsql_alloc_statement2 here. This will cause problems for +// Never user isc_dsql_alloc_statement2 here. This will cause problems for // cursors opened in Cobol subprograms that are subsequently CANCELed. When the // subprogram is CANCELed the buffer holding the statement handle is free. This // will cause the program to abort when detaching from the database. It can @@ -232,13 +232,13 @@ static const TEXT* anames[] = { "ISC-HEIGHT", "RDB-K-DB-TYPE-GDS", "ISC-ARRAY-LENGTH", - " ", // column - " * ", // comment - " ", // continue - " - \"", // continue quote - " - \'", // continue single quote - " ", // column0 - " ", // column indent + " ", // column + " * ", // comment + " ", // continue + " - \"", // continue quote + " - \'", // continue single quote + " ", // column0 + " ", // column indent "ISC-SQL-CODE", "ISC-EVENTS-VECTOR", "ISC-EVENTS", @@ -286,8 +286,8 @@ static const char* const INDENT = " "; //____________________________________________________________ -// -// +// +// void RMC_action(const act* action, int column) { @@ -543,13 +543,13 @@ void RMC_action(const act* action, int column) //____________________________________________________________ -// +// // Print a statment, breaking it into // reasonable 80 character hunks. This // function now works for COBOL statements // which are function calls and non-function // calls. -// +// void RMC_print_buffer(TEXT* output_bufferL, bool function_call) @@ -582,7 +582,7 @@ void RMC_print_buffer(TEXT* output_bufferL, save_open_quote = open_quote; save_single_quote = single_quote; if (function_call) { - // Back up until we reach a comma + // Back up until we reach a comma for (p--; (p > s); p--, q--) { if (*(p + 1) == '\"' || *(p + 1) == '\'') { /* If we have a single or double quote, toggle the @@ -628,7 +628,7 @@ void RMC_print_buffer(TEXT* output_bufferL, *++p = 0; } else { - // back up to a blank + // back up to a blank for (p--; p > s; p--, q--) { if (*(p + 1) == '\"' || *(p + 1) == '\'') { /* If we have a single or double quote, toggle the @@ -672,10 +672,10 @@ void RMC_print_buffer(TEXT* output_bufferL, #ifdef NOT_USED_OR_REPLACED //____________________________________________________________ -// +// // Align output to a specific column for output. If the // column is negative, don't do anything. -// +// static void align( int column) { @@ -695,10 +695,10 @@ static void align( int column) //____________________________________________________________ -// +// // Build an assignment from a host language variable to // a port variable. -// +// static void asgn_from( const act* action, const ref* reference) { @@ -781,7 +781,7 @@ static void asgn_from( const act* action, const ref* reference) { sprintf(output_buffer, "%sMOVE %s TO %s\n", names[COLUMN], value, variable); - + switch (reference->ref_field->fld_dtype) { case dtype_short: @@ -828,10 +828,10 @@ static void asgn_from( const act* action, const ref* reference) } //____________________________________________________________ -// +// // Build an assignment to a host language variable from // a port variable. -// +// static void asgn_to( const act* action, ref* reference) { @@ -941,7 +941,7 @@ static void asgn_to( const act* action, ref* reference) } } -// Pick up NULL value if one is there +// Pick up NULL value if one is there if (reference = reference->ref_null) { @@ -954,10 +954,10 @@ static void asgn_to( const act* action, ref* reference) //____________________________________________________________ -// +// // Build an assignment to a host language variable from // a port variable. -// +// static void asgn_to_proc( const ref* reference) { @@ -1054,10 +1054,10 @@ static void asgn_to_proc( const ref* reference) //____________________________________________________________ -// +// // Generate a function call for free standing ANY. Somebody else // will need to generate the actual function. -// +// static void gen_any( const act* action) { @@ -1079,9 +1079,9 @@ static void gen_any( const act* action) //____________________________________________________________ -// +// // Generate code for AT END clause of FETCH. -// +// static void gen_at_end( const act* action) { @@ -1095,9 +1095,9 @@ static void gen_at_end( const act* action) //____________________________________________________________ -// +// // Substitute for a BASED ON clause. -// +// static void gen_based( const act* action) { @@ -1115,14 +1115,14 @@ static void gen_based( const act* action) else if (field->fld_array_info) { CPR_error("Based on currently not implemented for arrays."); return; // silence non initialized warning -// +// // TBD - messy // datatype = field->fld_array_info->ary_dtype; // for (dimension = field->fld_array_info->ary_dimension; dimension; // dimension = dimension->dim_next) -// { +// { // fprintf (gpreGlob.out_file, " -// +// } else datatype = field->fld_dtype; @@ -1222,9 +1222,9 @@ static void gen_based( const act* action) //____________________________________________________________ -// +// // Make a blob FOR loop. -// +// static void gen_blob_close( const act* action) { @@ -1255,9 +1255,9 @@ static void gen_blob_close( const act* action) //____________________________________________________________ -// +// // End a blob FOR loop. -// +// static void gen_blob_end( const act* action) { @@ -1280,9 +1280,9 @@ static void gen_blob_end( const act* action) //____________________________________________________________ -// +// // Make a blob FOR loop. -// +// static void gen_blob_for( const act* action) { @@ -1296,9 +1296,9 @@ static void gen_blob_for( const act* action) //____________________________________________________________ -// +// // Generate the call to open (or create) a blob. -// +// static void gen_blob_open( const act* action) { @@ -1364,9 +1364,9 @@ static void gen_blob_open( const act* action) //____________________________________________________________ -// +// // Callback routine for BLR pretty printer. -// +// static void gen_blr(void* user_arg, SSHORT offset, const char* string) { @@ -1426,9 +1426,9 @@ static void gen_blr(void* user_arg, SSHORT offset, const char* string) //____________________________________________________________ -// +// // Zap all know handles. -// +// static void gen_clear_handles( const act* action) { @@ -1440,9 +1440,9 @@ static void gen_clear_handles( const act* action) //____________________________________________________________ -// +// // Generate text to compile a request. -// +// static void gen_compile( const act* action) { @@ -1450,24 +1450,24 @@ static void gen_compile( const act* action) const dbb* db = request->req_database; const gpre_sym* symbol = db->dbb_name; -// generate automatic ready if appropriate +// generate automatic ready if appropriate if (gpreGlob.sw_auto) t_start_auto(request, status_vector(action), action, true); -// +// // always generate a compile, a test for the success of the compile, // and an end to the 'if not compiled test -// +// -// generate an 'if not compiled' +// generate an 'if not compiled' printa(names[COLUMN], false, "IF %s = 0 THEN", request->req_handle); if (gpreGlob.sw_auto && action->act_error) printa(names[COLUMN], false, "IF %s NOT = 0 THEN", request_trans(action, request)); - // Never use isc_compile_request2 here because if the request is + // Never use isc_compile_request2 here because if the request is // generated in a subprogram and that subprogram is subsequently CANCELed // the buffer containing the request handle will be freed. This will cause // the main program to abort when detaching from the database. It can also @@ -1489,7 +1489,7 @@ static void gen_compile( const act* action) printa(names[COLUMN], false, "END-IF"); // If blobs are present, zero out all of the blob handles. After this -// point, the handles are the user's responsibility +// point, the handles are the user's responsibility const blb* blob = request->req_blobs; if (blob) @@ -1503,9 +1503,9 @@ static void gen_compile( const act* action) //____________________________________________________________ -// +// // Generate a call to create a database. -// +// static void gen_create_database( const act* action) { @@ -1521,7 +1521,7 @@ static void gen_create_database( const act* action) sprintf(s2, "%s%d", names[isc_b_pos], request->req_ident); /* if the dpb needs to be extended at runtime to include items - in host variables, do so here; this assumes that there is + in host variables, do so here; this assumes that there is always a request generated for runtime variables */ if (request->req_flags & REQ_extend_dpb) { @@ -1619,7 +1619,7 @@ static void gen_create_database( const act* action) (request->req_length) ? s2Tmp : OMITTED); RMC_print_buffer(output_buffer, true); -// if the dpb was extended, free it here +// if the dpb was extended, free it here if (request && request->req_flags & REQ_extend_dpb) { if (request->req_length) { @@ -1632,7 +1632,7 @@ static void gen_create_database( const act* action) "%sCALL \"%s\" USING %s\n", names[COLUMN], ISC_FREE, s2Tmp); RMC_print_buffer(output_buffer, true); - // reset the length of the dpb + // reset the length of the dpb sprintf(output_buffer, "%sMOVE %d to %s", names[COLUMN], request->req_length, s1); RMC_print_buffer(output_buffer, true); @@ -1648,9 +1648,9 @@ static void gen_create_database( const act* action) //____________________________________________________________ -// +// // Generate substitution text for END_STREAM. -// +// static void gen_cursor_close( const act* action, const gpre_req* request) { @@ -1667,15 +1667,15 @@ static void gen_cursor_close( const act* action, const gpre_req* request) //____________________________________________________________ -// +// // Generate text to initialize a cursor. -// +// static void gen_cursor_init( const act* action) { // If blobs are present, zero out all of the blob handles. After this -// point, the handles are the user's responsibility +// point, the handles are the user's responsibility if (action->act_request->req_flags & (REQ_sql_blob_open | REQ_sql_blob_create)) printa(names[COLUMN], false, "MOVE 0 TO %s%d", names[isc_a_pos], @@ -1684,9 +1684,9 @@ static void gen_cursor_init( const act* action) //____________________________________________________________ -// +// // Generate text to open an embedded SQL cursor. -// +// static void gen_cursor_open( const act* action, const gpre_req* request) { @@ -1713,7 +1713,7 @@ static void gen_cursor_open( const act* action, const gpre_req* request) if (gpreGlob.sw_auto) printa(names[COLUMN], false, "IF %s NOT = 0 THEN", request_trans(action, request)); - + TEXT s[MAX_CURSOR_SIZE]; make_name_formatted(s, "ISC-CONST-%s", ((open_cursor*) action->act_object)->opn_cursor); @@ -1736,9 +1736,9 @@ static void gen_cursor_open( const act* action, const gpre_req* request) //____________________________________________________________ -// +// // Generate insertion text for the database statement. -// +// static void gen_database( const act* action) { @@ -1773,7 +1773,7 @@ static void gen_database( const act* action) USAGE_BINARY4, (all_extern) ? "" : " VALUE IS 0"); - // generate variables to hold database name strings for attach call + // generate variables to hold database name strings for attach call db->dbb_id = ++count; if (db->dbb_runtime) { @@ -1795,7 +1795,7 @@ static void gen_database( const act* action) } } -// loop through actions: find readys to generate vars for quoted strings +// loop through actions: find readys to generate vars for quoted strings TEXT fname[80], s1[MAX_CURSOR_SIZE]; bool dyn_immed = false; @@ -1838,11 +1838,11 @@ static void gen_database( const act* action) else cur_stmt = ((open_cursor*) local_act->act_object)->opn_cursor; - // Only generate one declaration per cursor or statement name + // Only generate one declaration per cursor or statement name const act* chck_dups; for (chck_dups = local_act->act_rest; chck_dups; - chck_dups = chck_dups->act_rest) + chck_dups = chck_dups->act_rest) { const gpre_sym* dup; if (chck_dups->act_type == ACT_dyn_cursor) @@ -1932,7 +1932,7 @@ static void gen_database( const act* action) names[isc_a_pos], blob->blb_len_ident, USAGE_BINARY2); } - // Array declarations + // Array declarations if (port = request->req_primary) for (REF reference = port->por_references; reference; @@ -1943,7 +1943,7 @@ static void gen_database( const act* action) } } -// Generate event parameter block for each event +// Generate event parameter block for each event USHORT max_count = 0; for (const gpre_lls* stack_ptr = gpreGlob.events; stack_ptr; stack_ptr = stack_ptr->lls_next) @@ -1973,9 +1973,9 @@ static void gen_database( const act* action) //____________________________________________________________ -// +// // Generate a call to update metadata. -// +// static void gen_ddl( const act* action) { @@ -2018,9 +2018,9 @@ static void gen_ddl( const act* action) //____________________________________________________________ -// +// // Generate a dynamic SQL statement. -// +// static void gen_dyn_close( const act* action) { @@ -2036,9 +2036,9 @@ static void gen_dyn_close( const act* action) //____________________________________________________________ -// +// // Generate a dynamic SQL statement. -// +// static void gen_dyn_declare( const act* action) { @@ -2057,9 +2057,9 @@ static void gen_dyn_declare( const act* action) //____________________________________________________________ -// +// // Generate a dynamic SQL statement. -// +// static void gen_dyn_describe(const act* action, bool bind_flag) @@ -2081,9 +2081,9 @@ static void gen_dyn_describe(const act* action, //____________________________________________________________ -// +// // Generate a dynamic SQL statement. -// +// static void gen_dyn_execute( const act* action) { @@ -2130,9 +2130,9 @@ static void gen_dyn_execute( const act* action) //____________________________________________________________ -// +// // Generate a dynamic SQL statement. -// +// static void gen_dyn_fetch( const act* action) { @@ -2158,9 +2158,9 @@ static void gen_dyn_fetch( const act* action) //____________________________________________________________ -// +// // Generate code for an EXECUTE IMMEDIATE dynamic SQL statement. -// +// static void gen_dyn_immediate( const act* action) { @@ -2212,9 +2212,9 @@ static void gen_dyn_immediate( const act* action) //____________________________________________________________ -// +// // Generate a dynamic SQL statement. -// +// static void gen_dyn_insert( const act* action) { @@ -2237,9 +2237,9 @@ static void gen_dyn_insert( const act* action) //____________________________________________________________ -// +// // Generate a dynamic SQL statement. -// +// static void gen_dyn_open( const act* action) { @@ -2286,9 +2286,9 @@ static void gen_dyn_open( const act* action) //____________________________________________________________ -// +// // Generate a dynamic SQL statement. -// +// static void gen_dyn_prepare( const act* action) { @@ -2342,9 +2342,9 @@ static void gen_dyn_prepare( const act* action) //____________________________________________________________ -// +// // Generate substitution text for END_MODIFY. -// +// static void gen_emodify( const act* action) { @@ -2380,9 +2380,9 @@ static void gen_emodify( const act* action) //____________________________________________________________ -// +// // Generate substitution text for END_STORE. -// +// static void gen_estore( const act* action) { @@ -2392,9 +2392,9 @@ static void gen_estore( const act* action) //____________________________________________________________ -// +// // Generate end-if for AT_END if statement -// +// static void gen_end_fetch( const act* action) { @@ -2405,9 +2405,9 @@ static void gen_end_fetch( const act* action) //____________________________________________________________ -// +// // Generate definitions associated with a single request. -// +// static void gen_endfor( const act* action) { @@ -2421,9 +2421,9 @@ static void gen_endfor( const act* action) //____________________________________________________________ -// +// // Generate substitution text for ERASE. -// +// static void gen_erase( const act* action) { @@ -2433,10 +2433,10 @@ static void gen_erase( const act* action) //____________________________________________________________ -// +// // Generate event parameter blocks for use // with a particular call to isc_event_wait. -// +// static SSHORT gen_event_block( const act* action) { @@ -2459,9 +2459,9 @@ static SSHORT gen_event_block( const act* action) //____________________________________________________________ -// +// // Generate substitution text for EVENT_INIT. -// +// static void gen_event_init( const act* action) { @@ -2489,7 +2489,7 @@ static void gen_event_init( const act* action) args.pat_string5 = names[ISC_EVENTS_VECTOR]; args.pat_string6 = names[ISC_EVENT_NAMES_VECTOR]; -// generate call to dynamically generate event blocks +// generate call to dynamically generate event blocks TEXT variable[MAX_REF_SIZE]; const gpre_nod *const *ptr, *const *end; @@ -2515,11 +2515,11 @@ static void gen_event_init( const act* action) PATTERN_expand(column, pattern1, &args); -// generate actual call to event_wait +// generate actual call to event_wait PATTERN_expand(column, pattern2, &args); -// get change in event counts, copying event parameter block for reuse +// get change in event counts, copying event parameter block for reuse PATTERN_expand(column, pattern3, &args); fprintf(gpreGlob.out_file, "\n"); @@ -2528,9 +2528,9 @@ static void gen_event_init( const act* action) //____________________________________________________________ -// +// // Generate substitution text for EVENT_WAIT. -// +// static void gen_event_wait( const act* action) { @@ -2542,7 +2542,7 @@ static void gen_event_wait( const act* action) gpre_sym* event_name = (gpre_sym*) action->act_object; // go through the stack of gpreGlob.events, checking to see if the -// event has been initialized and getting the event identifier +// event has been initialized and getting the event identifier const dbb* database = NULL; int ident = -1; @@ -2576,7 +2576,7 @@ static void gen_event_wait( const act* action) args.pat_string4 = names[isc_a_pos]; args.pat_string5 = names[ISC_EVENTS_VECTOR]; -// generate calls to wait on the event and to fill out the gpreGlob.events array +// generate calls to wait on the event and to fill out the gpreGlob.events array PATTERN_expand(column, pattern1, &args); PATTERN_expand(column, pattern2, &args); @@ -2586,11 +2586,11 @@ static void gen_event_wait( const act* action) //____________________________________________________________ -// +// // Generate replacement text for the SQL FETCH statement. The // epilog FETCH statement is handled by GEN_S_FETCH (generate // stream fetch). -// +// static void gen_fetch( const act* action) { @@ -2599,8 +2599,8 @@ static void gen_fetch( const act* action) #ifdef SCROLLABLE_CURSORS gpre_port* port = request->req_aport; if (port) { - /* set up the reference to point to the correct value - in the linked list of values, and prepare for the + /* set up the reference to point to the correct value + in the linked list of values, and prepare for the next FETCH statement if applicable */ REF reference; @@ -2612,23 +2612,23 @@ static void gen_fetch( const act* action) reference->ref_values = value->val_next; } - // find the direction and offset parameters + // find the direction and offset parameters reference = port->por_references; const char* offset = reference->ref_value; reference = reference->ref_next; const char* direction = reference->ref_value; - /* the direction in which the engine will scroll is sticky, so check to see - the last direction passed to the engine; if the direction is the same and - the offset is 1, then there is no need to pass the message; this prevents + /* the direction in which the engine will scroll is sticky, so check to see + the last direction passed to the engine; if the direction is the same and + the offset is 1, then there is no need to pass the message; this prevents extra packets and allows for batch fetches in either direction */ printa(names[COLUMN], false, "IF %s%dDI MOD 2 NOT = %s || %s NOT = 1 THEN", names[isc_a_pos], request->req_ident, direction, offset); - /* assign the direction and offset parameters to the appropriate message, + /* assign the direction and offset parameters to the appropriate message, then send the message to the engine */ asgn_from(action, port->por_references); @@ -2665,9 +2665,9 @@ static void gen_fetch( const act* action) //____________________________________________________________ -// +// // Generate substitution text for FINISH -// +// static void gen_finish( const act* action) { @@ -2684,7 +2684,7 @@ static void gen_finish( const act* action) printa(names[COLUMN], false, "END-IF"); } -// the user may have supplied one or more handles +// the user may have supplied one or more handles const dbb* db = NULL; for (const rdy* ready = (rdy*) action->act_object; ready; ready = ready->rdy_next) { @@ -2698,7 +2698,7 @@ static void gen_finish( const act* action) printa(names[COLUMN], false, "END-IF"); } -// no handles, so finish all known databases +// no handles, so finish all known databases if (!db) for (db = gpreGlob.isc_databases; db; db = db->dbb_next) { @@ -2715,9 +2715,9 @@ static void gen_finish( const act* action) //____________________________________________________________ -// +// // Generate substitution text for FOR statement. -// +// static void gen_for( const act* action) { @@ -2741,9 +2741,9 @@ static void gen_for( const act* action) //____________________________________________________________ -// +// // Generate a function for free standing ANY or statistical. -// +// static void gen_function( const act* function) { @@ -2841,10 +2841,10 @@ static void gen_function( const act* function) //____________________________________________________________ -// +// // Generate a call to isc_get_slice // or isc_put_slice for an array. -// +// static void gen_get_or_put_slice(const act* action, const ref* reference, @@ -2870,18 +2870,18 @@ static void gen_get_or_put_slice(const act* action, gen_name(s1, reference, true); // blob handle args.pat_string2 = s1; - args.pat_value1 = reference->ref_sdl_length; // slice descr length + args.pat_value1 = reference->ref_sdl_length; // slice descr length TEXT s2[MAX_REF_SIZE]; - sprintf(s2, "%s%d", names[isc_a_pos], reference->ref_sdl_ident); // slice description + sprintf(s2, "%s%d", names[isc_a_pos], reference->ref_sdl_ident); // slice description args.pat_string3 = s2; - args.pat_value2 = 0; // parameter length + args.pat_value2 = 0; // parameter length - args.pat_string4 = "0"; // parameter + args.pat_string4 = "0"; // parameter args.pat_long1 = reference->ref_field->fld_array_info->ary_size; - // slice size + // slice size TEXT s4[MAX_REF_SIZE + 2]; if (action->act_flags & ACT_sql) { args.pat_string5 = reference->ref_value; @@ -2889,10 +2889,10 @@ static void gen_get_or_put_slice(const act* action, else { sprintf(s4, "%s%dL", names[isc_a_pos], reference->ref_field->fld_array_info->ary_ident); - args.pat_string5 = s4; // array name + args.pat_string5 = s4; // array name } - args.pat_string6 = names[ISC_ARRAY_LENGTH]; // return length + args.pat_string6 = names[ISC_ARRAY_LENGTH]; // return length args.pat_string7 = (get) ? ISC_GET_SLICE : ISC_PUT_SLICE; PATTERN_expand(column, (get) ? pattern1 : pattern2, &args); @@ -2901,9 +2901,9 @@ static void gen_get_or_put_slice(const act* action, //____________________________________________________________ -// +// // Generate the code to do a get segment. -// +// static void gen_get_segment( const act* action) { @@ -2943,10 +2943,10 @@ static void gen_get_segment( const act* action) //____________________________________________________________ -// -// Generate text to compile and start a SQL mass update. -// -// +// +// Generate text to compile and start a SQL mass update. +// +// static void gen_loop( const act* action) { @@ -2966,10 +2966,10 @@ static void gen_loop( const act* action) //____________________________________________________________ -// +// // Generate a name for a reference. Name is constructed from // port and parameter idents. -// +// static TEXT* gen_name(TEXT* const string, const ref* reference, @@ -2988,9 +2988,9 @@ static TEXT* gen_name(TEXT* const string, //____________________________________________________________ -// +// // Generate a block to handle errors. -// +// static void gen_on_error( const act* action) { @@ -3001,9 +3001,9 @@ static void gen_on_error( const act* action) //____________________________________________________________ -// +// // Generate code for an EXECUTE PROCEDURE. -// +// static void gen_procedure( const act* action) { @@ -3026,16 +3026,16 @@ static void gen_procedure( const act* action) pattern = "CALL \"isc_transact_request\" USING %V1, %DH, %RT, %RS, %RI, 0, 0, %QL, %QI\n"; -// Get database attach and transaction started +// Get database attach and transaction started if (gpreGlob.sw_auto) t_start_auto(0, status_vector(action), action, true); -// Move in input values +// Move in input values asgn_from(action, request->req_values); -// Execute the procedure +// Execute the procedure const USHORT column = strlen(names[COLUMN]); PATTERN_expand(column, pattern, &args); @@ -3044,7 +3044,7 @@ static void gen_procedure( const act* action) printa(names[COLUMN], false, "IF SQLCODE = 0 THEN"); -// Move out output values +// Move out output values asgn_to_proc(request->req_references); printa(names[COLUMN], false, "END-IF"); @@ -3052,9 +3052,9 @@ static void gen_procedure( const act* action) //____________________________________________________________ -// +// // Generate the code to do a put segment. -// +// static void gen_put_segment( const act* action) { @@ -3088,9 +3088,9 @@ static void gen_put_segment( const act* action) //____________________________________________________________ -// +// // Generate BLR in raw, hexadecmial form. Ugly but dense. -// +// static void gen_raw( const UCHAR* blr, @@ -3101,7 +3101,7 @@ static void gen_raw( int offset = 24; UCHAR c; TEXT s[256]; - + // Dump BLR to WORKING-STORAGE in 4 byte chunks. while (request_length--) { ltemp += (*(blr++) << offset); @@ -3136,13 +3136,13 @@ static void gen_raw( //____________________________________________________________ -// +// // Generate substitution text for READY // This becomes baroque for mpexl where we // must generate a variable if the user gives us // a string literal. mpexl cobol doesn't take // string literals as CALL parameters. -// +// static void gen_ready( const act* action) { @@ -3187,7 +3187,7 @@ static void gen_ready( const act* action) //____________________________________________________________ -// +// // Generate substitution text for RELEASE_REQUESTS // For active databases, call isc_release_request. // for all others, just zero the handle. For the @@ -3195,7 +3195,7 @@ static void gen_ready( const act* action) // are likely if the request was compiled on a database // which has been released and re-readied. If there is // a serious error, it will be caught on the next statement. -// +// static void gen_release( const act* action) { @@ -3221,9 +3221,9 @@ static void gen_release( const act* action) //____________________________________________________________ -// +// // Generate a send or receive call for a port. -// +// static void gen_receive( const act* action, const gpre_port* port) { @@ -3245,13 +3245,13 @@ static void gen_receive( const act* action, const gpre_port* port) //____________________________________________________________ -// +// // Generate definitions associated with a single request. -// Requests are generated as raw BLR in longword chunks +// Requests are generated as raw BLR in longword chunks // because COBOL is a miserable excuse for a language // and doesn't allow byte value assignments to character // fields. -// +// static void gen_request( gpre_req* request) { @@ -3270,8 +3270,8 @@ static void gen_request( gpre_req* request) request->req_ident, USAGE_BINARY2, request->req_length); // check the case where we need to extend the dpb dynamically at runtime, -// in which case we need dpb length and a pointer to be defined even if -// there is no static dpb defined +// in which case we need dpb length and a pointer to be defined even if +// there is no static dpb defined if (request->req_flags & REQ_extend_dpb) { printa(COLUMN8, false, @@ -3287,7 +3287,7 @@ static void gen_request( gpre_req* request) "01 %s%dS PIC S9(10) %s VALUE IS 0.", names[isc_a_pos], request->req_ident, USAGE_BINARY4); -// generate the request as BLR long words +// generate the request as BLR long words if (request->req_length) { if (request->req_flags & REQ_sql_cursor) @@ -3304,7 +3304,7 @@ static void gen_request( gpre_req* request) names[isc_a_pos], request->req_ident); gen_raw(request->req_blr, request->req_type, request->req_length, request->req_ident); - + const char* string_type; if (!gpreGlob.sw_raw) { printa(names[COMMENT], false, " "); @@ -3359,7 +3359,7 @@ static void gen_request( gpre_req* request) string_type, names[isc_a_pos], request->req_ident); } -// Print out slice description language if there are arrays associated with request +// Print out slice description language if there are arrays associated with request for (gpre_port* port = request->req_ports; port; port = port->por_next) for (const ref* reference = port->por_references; reference; @@ -3381,7 +3381,7 @@ static void gen_request( gpre_req* request) } } -// Print out any blob parameter blocks required +// Print out any blob parameter blocks required for (const blb* blob = request->req_blobs; blob; blob = blob->blb_next) if (blob->blb_const_from_type || blob->blb_const_to_type) { printa(COLUMN8, false, "01 %s%d.", @@ -3390,7 +3390,7 @@ static void gen_request( gpre_req* request) (int) (IPTR) request); printa(names[COMMENT], false, " "); } -// If this is a GET_SLICE/PUT_slice, allocate some variables +// If this is a GET_SLICE/PUT_slice, allocate some variables if (request->req_type == REQ_slice) { printa(COLUMN8, false, "01 %s%dv.", names[isc_b_pos], @@ -3408,9 +3408,9 @@ static void gen_request( gpre_req* request) //____________________________________________________________ -// +// // Generate substitution text for END_STREAM. -// +// static void gen_s_end( const act* action) { @@ -3436,9 +3436,9 @@ static void gen_s_end( const act* action) //____________________________________________________________ -// +// // Generate substitution text for FETCH. -// +// static void gen_s_fetch( const act* action) { @@ -3451,10 +3451,10 @@ static void gen_s_fetch( const act* action) //____________________________________________________________ -// +// // Generate text to compile and start a stream. This is // used both by START_STREAM and FOR -// +// static void gen_s_start( const act* action) { @@ -3469,7 +3469,7 @@ static void gen_s_start( const act* action) if (action->act_type == ACT_open) gen_cursor_open(action, request); -// Do not call "gen_start" in case if "gen_compile" failed +// Do not call "gen_start" in case if "gen_compile" failed if (action->act_error || (action->act_flags & ACT_sql)) { if (gpreGlob.sw_auto) @@ -3497,9 +3497,9 @@ static void gen_s_start( const act* action) //____________________________________________________________ -// +// // Generate a send call for a port. -// +// static void gen_send( const act* action, const gpre_port* port) { @@ -3522,9 +3522,9 @@ static void gen_send( const act* action, const gpre_port* port) //____________________________________________________________ -// +// // Generate support for get/put slice statement. -// +// static void gen_slice( const act* action) { @@ -3538,7 +3538,7 @@ static void gen_slice( const act* action) const slc* slice = (slc*) action->act_object; const gpre_req* parent_request = slice->slc_parent_request; -// Compute array size +// Compute array size fprintf(gpreGlob.out_file, " COMPUTE %s%ds = %d", names[isc_b_pos], @@ -3560,7 +3560,7 @@ static void gen_slice( const act* action) } fprintf(gpreGlob.out_file, "\n"); -// Make assignments to variable vector +// Make assignments to variable vector const ref* reference; for (reference = request->req_values; reference; @@ -3573,16 +3573,16 @@ static void gen_slice( const act* action) PAT args; args.pat_reference = slice->slc_field_ref; - args.pat_request = parent_request; // blob id request - args.pat_vector1 = status_vector(action); // status vector - args.pat_database = parent_request->req_database; // database handle - args.pat_string1 = action->act_request->req_trans; // transaction handle - args.pat_value1 = request->req_length; // slice descr. length - args.pat_ident1 = request->req_ident; // request name - args.pat_value2 = slice->slc_parameters * sizeof(SLONG); // parameter length + args.pat_request = parent_request; // blob id request + args.pat_vector1 = status_vector(action); // status vector + args.pat_database = parent_request->req_database; // database handle + args.pat_string1 = action->act_request->req_trans; // transaction handle + args.pat_value1 = request->req_length; // slice descr. length + args.pat_ident1 = request->req_ident; // request name + args.pat_value2 = slice->slc_parameters * sizeof(SLONG); // parameter length reference = (REF) slice->slc_array->nod_arg[0]; - args.pat_string5 = reference->ref_value; // array name + args.pat_string5 = reference->ref_value; // array name args.pat_string6 = names[ISC_ARRAY_LENGTH]; args.pat_string7 = (action->act_type == ACT_get_slice) ? ISC_GET_SLICE : ISC_PUT_SLICE; @@ -3594,9 +3594,9 @@ static void gen_slice( const act* action) //____________________________________________________________ -// +// // Substitute for a segment, segment length, or blob handle. -// +// static void gen_segment( const act* action) { @@ -3611,8 +3611,8 @@ static void gen_segment( const act* action) //____________________________________________________________ -// -// +// +// static void gen_select( const act* action) { @@ -3624,7 +3624,7 @@ static void gen_select( const act* action) gen_s_start(action); -// BUG8321: Do not call "receive" in case if SQLCODE is not equal 0 +// BUG8321: Do not call "receive" in case if SQLCODE is not equal 0 printa(names[COLUMN], false, "IF SQLCODE = 0 THEN"); gen_receive(action, port); @@ -3653,10 +3653,10 @@ static void gen_select( const act* action) //____________________________________________________________ -// +// // Generate either a START or START_AND_SEND depending // on whether or a not a port is present. -// +// static void gen_start( const act* action, const gpre_port* port) { @@ -3700,17 +3700,17 @@ static void gen_start( const act* action, const gpre_port* port) //____________________________________________________________ -// +// // Generate text for STORE statement. This includes the compile // call and any variable initialization required. -// +// static void gen_store( const act* action) { const gpre_req* request = action->act_request; gen_compile(action); -// Initialize any blob fields +// Initialize any blob fields TEXT name[MAX_REF_SIZE]; const gpre_port* port = request->req_primary; @@ -3726,15 +3726,15 @@ static void gen_store( const act* action) //____________________________________________________________ -// +// // Generate substitution text for START_TRANSACTION. -// +// static void gen_t_start( const act* action) { TEXT dbname[80]; -// if this is a purely default transaction, just let it through +// if this is a purely default transaction, just let it through const gpre_tra* trans; if (!action || !(trans = (gpre_tra*) action->act_object)) { @@ -3742,7 +3742,7 @@ static void gen_t_start( const act* action) return; } -// build a complete statement, including tpb's. Ready db's as gpre_req. +// build a complete statement, including tpb's. Ready db's as gpre_req. const tpb* tpb_iterator; if (gpreGlob.sw_auto) @@ -3790,9 +3790,9 @@ static void gen_t_start( const act* action) //____________________________________________________________ -// +// // Initialize a TPB in the output file -// +// static void gen_tpb(const tpb* tpb_buffer) { @@ -3821,8 +3821,8 @@ static void gen_tpb(const tpb* tpb_buffer) offset = 24; } } - // Dump last 4 bytes, if necessary - if (offset < 24) + // Dump last 4 bytes, if necessary + if (offset < 24) printa(COLUMN12, false, RAW_TPB_TEMPLATE, names[isc_tpb_pos], @@ -3837,9 +3837,9 @@ static void gen_tpb(const tpb* tpb_buffer) //____________________________________________________________ -// +// // Generate substitution text for COMMIT, ROLLBACK, PREPARE, and SAVE -// +// static void gen_trans( const act* action) { @@ -3872,9 +3872,9 @@ static void gen_trans( const act* action) //____________________________________________________________ -// +// // Substitute for a variable reference. -// +// static void gen_type( const act* action) { @@ -3884,9 +3884,9 @@ static void gen_type( const act* action) //____________________________________________________________ -// +// // Generate substitution text for UPDATE ... WHERE CURRENT OF ... -// +// static void gen_update( const act* action) { @@ -3898,9 +3898,9 @@ static void gen_update( const act* action) //____________________________________________________________ -// +// // Substitute for a variable reference. -// +// static void gen_variable( const act* action) { @@ -3912,9 +3912,9 @@ static void gen_variable( const act* action) //____________________________________________________________ -// +// // Generate tests for any WHENEVER clauses that may have been declared. -// +// static void gen_whenever(const swe* label) { @@ -3950,17 +3950,17 @@ static void gen_whenever(const swe* label) //____________________________________________________________ -// +// // Generate a declaration of an array in the // output file. -// +// static void make_array_declaration( REF reference) { gpre_fld* field = reference->ref_field; const TEXT* name = field->fld_symbol->sym_string; -// Don't generate multiple declarations for the array. V3 Bug 569. +// Don't generate multiple declarations for the array. V3 Bug 569. if (field->fld_array_info->ary_declared) return; @@ -3973,7 +3973,7 @@ static void make_array_declaration( REF reference) TEXT space[128]; strcpy(space, " "); -// Print out the dimension part of the declaration +// Print out the dimension part of the declaration const dim* dimension = field->fld_array_info->ary_dimension; int i = 3; for (; dimension->dim_next; dimension = dimension->dim_next, i += 2) @@ -3994,7 +3994,7 @@ static void make_array_declaration( REF reference) p++; SSHORT digits, scale; - + switch (field->fld_array_info->ary_dtype) { case dtype_short: case dtype_long: @@ -4106,9 +4106,9 @@ static void make_array_declaration( REF reference) //____________________________________________________________ -// +// // Turn a symbol into a varying string. -// +// static void make_name(TEXT* const string, const gpre_sym* symbol) { @@ -4118,9 +4118,9 @@ static void make_name(TEXT* const string, const gpre_sym* symbol) //____________________________________________________________ -// +// // Turn a symbol into a varying string. -// +// static void make_name_formatted(TEXT* const string, const TEXT* format, const gpre_sym* symbol) @@ -4133,9 +4133,9 @@ static void make_name_formatted(TEXT* const string, const TEXT* format, //____________________________________________________________ -// +// // Insert a port record description in output. -// +// static void make_port(const gpre_port* port) { @@ -4222,7 +4222,7 @@ static void make_port(const gpre_port* port) "%s.\n", (field->fld_dtype == dtype_real) ? USAGE_BINARY4 : USAGE_BINARY8); break; - + case dtype_sql_date: case dtype_sql_time: fprintf(gpreGlob.out_file, @@ -4250,9 +4250,9 @@ static void make_port(const gpre_port* port) //____________________________________________________________ -// +// // Generate the actual ready call. -// +// static void make_ready( const dbb* db, @@ -4271,7 +4271,7 @@ static void make_ready( sprintf(s2, "%s%d", names[isc_b_pos], request->req_ident); /* if the dpb needs to be extended at runtime to include items - in host variables, do so here; this assumes that there is + in host variables, do so here; this assumes that there is always a request generated for runtime variables */ if (request->req_flags & REQ_extend_dpb) { @@ -4384,7 +4384,7 @@ static void make_ready( RMC_print_buffer(output_buffer, true); -// if the dpb was extended, free it here +// if the dpb was extended, free it here if (request && request->req_flags & REQ_extend_dpb) { if (request->req_length) { @@ -4414,7 +4414,7 @@ static void make_ready( RMC_print_buffer(output_buffer, true); } - // reset the length of the dpb + // reset the length of the dpb sprintf(output_buffer, "%sMOVE %d to %s\n", names[COLUMN], request->req_length, s1); RMC_print_buffer(output_buffer, true); @@ -4423,9 +4423,9 @@ static void make_ready( //____________________________________________________________ -// +// // Print a fixed string at a particular COLUMN. -// +// static void printa(const TEXT* column, bool call, @@ -4447,9 +4447,9 @@ static void printa(const TEXT* column, #ifdef NOT_USED_OR_REPLACED //____________________________________________________________ -// +// // Print a fixed string at a particular column. -// +// static void printb(const TEXT* string, ...) { @@ -4462,9 +4462,9 @@ static void printb(const TEXT* string, ...) #endif //____________________________________________________________ -// +// // Generate the appropriate transaction handle. -// +// static const TEXT* request_trans( const act* action, const gpre_req* request) { @@ -4480,7 +4480,7 @@ static const TEXT* request_trans( const act* action, const gpre_req* request) //____________________________________________________________ -// +// // generate a CALL to the appropriate SQLCODE routine. // Note that not all COBOLs have the concept of a function. @@ -4497,10 +4497,10 @@ static void set_sqlcode( const act* action) //____________________________________________________________ -// +// // Generate the appropriate status vector parameter for a gds // call depending on where or not the action has an error clause. -// +// static const TEXT* status_vector( const act* action) { @@ -4513,11 +4513,11 @@ static const TEXT* status_vector( const act* action) //____________________________________________________________ -// +// // Generate substitution text for START_TRANSACTION, // when it's being generated automatically by a compile // call. -// +// static void t_start_auto(const gpre_req* request, const TEXT* vector, @@ -4528,15 +4528,15 @@ static void t_start_auto(const gpre_req* request, const TEXT* trname = request_trans(action, request); -// find out whether we're using a status vector or not +// find out whether we're using a status vector or not const bool stat = !strcmp(vector, names[isc_status_vector_pos]); -// this is a default transaction, make sure all databases are ready +// this is a default transaction, make sure all databases are ready const dbb* db; int count; - + if (gpreGlob.sw_auto) { buffer[0] = 0; for (count = 0, db = gpreGlob.isc_databases; db; db = db->dbb_next, count++) diff --git a/src/gpre/sqe.cpp b/src/gpre/sqe.cpp index 26577d8f2e..520260dfe1 100644 --- a/src/gpre/sqe.cpp +++ b/src/gpre/sqe.cpp @@ -1,38 +1,38 @@ //____________________________________________________________ -// +// // PROGRAM: C Preprocessor // MODULE: sqe.cpp // DESCRIPTION: SQL expression parser -// +// // The contents of this file are subject to the Interbase Public // License Version 1.0 (the "License"); you may not use this file // except in compliance with the License. You may obtain a copy // of the License at http://www.Inprise.com/IPL.html -// +// // Software distributed under the License is distributed on an // "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express // or implied. See the License for the specific language governing // rights and limitations under the License. -// +// // The Original Code was created by Inprise Corporation // and its predecessors. Portions created by Inprise Corporation are // Copyright (C) Inprise Corporation. -// +// // All Rights Reserved. // Contributor(s): ______________________________________. // // Revision 1.3 2000/11/16 15:54:29 fsg // Added new switch -verbose to gpre that will dump // parsed lines to stderr -// +// // Fixed gpre bug in handling row names in WHERE clauses // that are reserved words now (DATE etc) // (this caused gpre to dump core when parsing tan.e) -// +// // Fixed gpre bug in handling lower case table aliases // in WHERE clauses for sql dialect 2 and 3. // (cause a core dump in a test case from C.R. Zamana) -// +// // Mike Nordell - Reduce compiler warnings // Stephen W. Boyd - Added support for new features //____________________________________________________________ @@ -58,13 +58,13 @@ struct scope { gpre_ctx* req_contexts; - USHORT req_scope_level; // scope level for SQL subquery parsing - USHORT req_in_aggregate; // now processing value expr for aggr - USHORT req_in_select_list; // processing select list - USHORT req_in_where_clause; // processing where clause - USHORT req_in_having_clause; // processing having clause - USHORT req_in_order_by_clause; // processing order by clause - USHORT req_in_subselect; // processing a subselect clause + USHORT req_scope_level; // scope level for SQL subquery parsing + USHORT req_in_aggregate; // now processing value expr for aggr + USHORT req_in_select_list; // processing select list + USHORT req_in_where_clause; // processing where clause + USHORT req_in_having_clause; // processing having clause + USHORT req_in_order_by_clause; // processing order by clause + USHORT req_in_subselect; // processing a subselect clause }; static bool compare_expr(GPRE_NOD, GPRE_NOD); @@ -175,9 +175,9 @@ static const NOD_T relationals[] = { //____________________________________________________________ -// +// // Parse an OR boolean expression. -// +// GPRE_NOD SQE_boolean( gpre_req* request, USHORT * paren_count) { @@ -205,10 +205,10 @@ GPRE_NOD SQE_boolean( gpre_req* request, USHORT * paren_count) //____________________________________________________________ -// +// // Parse a reference to a relation name // and generate a context for it. -// +// gpre_ctx* SQE_context(gpre_req* request) { @@ -223,7 +223,7 @@ gpre_ctx* SQE_context(gpre_req* request) if (!(context->ctx_relation = SQL_relation(request, r_name, db_name, owner_name, false))) { - // check for a procedure + // check for a procedure gpre_prc* procedure = context->ctx_procedure = SQL_procedure(request, r_name, db_name, owner_name, false); if (procedure) @@ -231,7 +231,7 @@ gpre_ctx* SQE_context(gpre_req* request) if (procedure->prc_inputs) { if (!MSC_match(KW_LEFT_PAREN)) CPR_s_error("( )"); - // parse input references + // parse input references context->ctx_prc_inputs = SQE_list(SQE_value, request, false); USHORT local_count = 1; par_terminating_parens(&local_count, &local_count); @@ -260,7 +260,7 @@ gpre_ctx* SQE_context(gpre_req* request) // If the next token is recognized as a keyword, it can't be a SQL "alias". // It may, however, be an "end of line" token. If so, trade it in on the -// next "real" token. +// next "real" token. gpre_sym* symbol = gpreGlob.token_global.tok_symbol; if (symbol && symbol->sym_type == SYM_keyword) { @@ -269,15 +269,15 @@ gpre_ctx* SQE_context(gpre_req* request) return context; } -// we have what we assume to be an alias; check to make sure that +// we have what we assume to be an alias; check to make sure that // it does not conflict with any relation, procedure or context names -// at the same scoping level in this query +// at the same scoping level in this query gpre_ctx* conflict; for (conflict = request->req_contexts; conflict; conflict = conflict->ctx_next) { - if ((symbol = conflict->ctx_symbol) && + if ((symbol = conflict->ctx_symbol) && (symbol->sym_type == SYM_relation || symbol->sym_type == SYM_context || symbol->sym_type == SYM_procedure) && @@ -316,14 +316,14 @@ gpre_ctx* SQE_context(gpre_req* request) //____________________________________________________________ -// +// // Parse an item is a select list. This is particularly nasty // since neither the relations nor context variables have been // processed yet. So, rather than generating a simple field // reference, make up a more or less dummy block containing // a pointer to a field system and possible a qualifier symbol. // this will be turned into a reference later. -// +// GPRE_NOD SQE_field(gpre_req* request, bool aster_ok) @@ -343,15 +343,15 @@ GPRE_NOD SQE_field(gpre_req* request, return node; } -// if the token isn't an identifier, complain +// if the token isn't an identifier, complain SQL_resolve_identifier("", NULL, NAME_SIZE); // For domains we can't be resolving tokens to field names -// in the CHECK constraint. +// in the CHECK constraint. TEXT s[ERROR_LENGTH]; - + act* action; if (request && request->req_type == REQ_ddl && @@ -375,8 +375,8 @@ GPRE_NOD SQE_field(gpre_req* request, // Note that the case of request == NULL should never // occur, and request->req_contexts == NULL should only // occur for the very first select list in a request. -// 1994-October-03 David Schnepper -// +// 1994-October-03 David Schnepper +// // if the request is null, make a deferred name block @@ -406,7 +406,7 @@ GPRE_NOD SQE_field(gpre_req* request, CPR_token(); } if (MSC_match(KW_L_BRCKET)) { - // We have a complete array or an array slice here + // We have a complete array or an array slice here if (!MSC_match(KW_R_BRCKET)) { slice_req = MSC_request(REQ_slice); @@ -439,7 +439,7 @@ GPRE_NOD SQE_field(gpre_req* request, } node->nod_arg[2] = (GPRE_NOD) slice_req; - /* added this to assign the correct nod_count + /* added this to assign the correct nod_count The nod type is converted to nod_field in SQE_resolve() The nod_count is check to confirm if the array slice has been initialized in cmd.cpp @@ -463,7 +463,7 @@ GPRE_NOD SQE_field(gpre_req* request, gpre_sym* symbol = gpreGlob.token_global.tok_symbol; if (symbol) { /* if there is a homonym which is a context, use the context; - otherwise we may match with a relation or procedure which + otherwise we may match with a relation or procedure which is not in the request, resulting in a bogus error */ if (symbol->sym_type != SYM_field) @@ -483,7 +483,7 @@ GPRE_NOD SQE_field(gpre_req* request, { if (symbol->sym_type != SYM_relation) symbol = temp_symbol; - + continue; } } @@ -622,7 +622,7 @@ GPRE_NOD SQE_field(gpre_req* request, } } -// Hmmm. So it wasn't a qualified field. Try any field. +// Hmmm. So it wasn't a qualified field. Try any field. SQL_resolve_identifier("", NULL, NAME_SIZE); for (context = request->req_contexts; context; @@ -663,15 +663,15 @@ GPRE_NOD SQE_field(gpre_req* request, } CPR_s_error(""); - return NULL; // silence compiler + return NULL; // silence compiler } //____________________________________________________________ -// +// // Parse a list of "things", separated by commas. Return the // whole mess in a list node. -// +// GPRE_NOD SQE_list(pfn_SQE_list_cb routine, gpre_req* request, @@ -698,12 +698,12 @@ GPRE_NOD SQE_list(pfn_SQE_list_cb routine, //____________________________________________________________ -// +// // Parse procedure input parameters which are constants or // host variable reference and, perhaps, a missing // flag reference, which may be prefaced by the noiseword, // "INDICATOR". -// +// REF SQE_parameter(gpre_req* request, bool aster_ok) @@ -726,9 +726,9 @@ REF SQE_parameter(gpre_req* request, if ((isQuoted(gpreGlob.token_global.tok_type) && gpreGlob.sw_sql_dialect == 1) || gpreGlob.token_global.tok_type == tok_sglquoted) { - /** + /** Since we have stripped the quotes, it is time now to put it back - so that the host language will interpret it correctly as a string + so that the host language will interpret it correctly as a string literal. ***/ reference = (REF) MSC_alloc(REF_LEN); @@ -792,11 +792,11 @@ REF SQE_parameter(gpre_req* request, //____________________________________________________________ -// -// Given an expression node, for values that don't have a +// +// Given an expression node, for values that don't have a // field, post the given field. // Procedure called from EXP_array to post the "subscript field". -// +// void SQE_post_field( GPRE_NOD input, gpre_fld* field) { @@ -848,12 +848,12 @@ void SQE_post_field( GPRE_NOD input, gpre_fld* field) //____________________________________________________________ -// +// // Post an external reference to a request. If the expression // in question already exists, re-use it. If there isn't a field, // generate a pseudo-field to hold datatype information. If there // isn't a context, well, there isn't a context. -// +// REF SQE_post_reference(gpre_req* request, gpre_fld* field, gpre_ctx* context, GPRE_NOD node) @@ -863,7 +863,7 @@ REF SQE_post_reference(gpre_req* request, gpre_fld* field, gpre_ctx* context, assert_IS_REQ(request); assert_IS_NOD(node); -// If the beast is already a field reference, get component parts +// If the beast is already a field reference, get component parts if (node && node->nod_type == nod_field) { reference = (REF) node->nod_arg[0]; @@ -871,7 +871,7 @@ REF SQE_post_reference(gpre_req* request, gpre_fld* field, gpre_ctx* context, context = reference->ref_context; } -// See if there is already a reference to this guy. If so, return it. +// See if there is already a reference to this guy. If so, return it. for (reference = request->req_references; reference; reference = reference->ref_next) @@ -884,7 +884,7 @@ REF SQE_post_reference(gpre_req* request, gpre_fld* field, gpre_ctx* context, } } -// If there isn't a field given, make one up +// If there isn't a field given, make one up if (!field) { field = (gpre_fld*) MSC_alloc(FLD_LEN); @@ -893,7 +893,7 @@ REF SQE_post_reference(gpre_req* request, gpre_fld* field, gpre_ctx* context, field->fld_flags |= FLD_text; } -// No reference -- make one +// No reference -- make one reference = (REF) MSC_alloc(REF_LEN); reference->ref_context = context; @@ -908,16 +908,16 @@ REF SQE_post_reference(gpre_req* request, gpre_fld* field, gpre_ctx* context, //____________________________________________________________ -// +// // Resolve a kludgy field node build by par_s_item into // a bona fide field reference. If a request // is supplied, resolve the reference to any context available // in the request. Otherwise resolve the field to a given // record selection expression. -// +// // If the expression contains a global aggregate, return true, // otherwise false. -// +// bool SQE_resolve(GPRE_NOD node, gpre_req* request, @@ -1052,7 +1052,7 @@ bool SQE_resolve(GPRE_NOD node, } // Make sure that a dialect-1 program isn't trying to select a -// dialect-3-only field type. +// dialect-3-only field type. if ((SQL_DIALECT_V5 == gpreGlob.sw_sql_dialect) && ((dtype_sql_date == field->fld_dtype) || (dtype_sql_time == field->fld_dtype) || @@ -1066,7 +1066,7 @@ bool SQE_resolve(GPRE_NOD node, reference->ref_context = context; reference->ref_slice = (slc*) slice_action; -// donot reinit if this is a nod_deffered type +// donot reinit if this is a nod_deffered type if (node->nod_type != nod_deferred) node->nod_count = 0; @@ -1079,9 +1079,9 @@ bool SQE_resolve(GPRE_NOD node, //____________________________________________________________ -// +// // Parse a SELECT (sans keyword) expression. -// +// gpre_rse* SQE_select(gpre_req* request, bool view_flag) @@ -1095,13 +1095,13 @@ gpre_rse* SQE_select(gpre_req* request, map* const old_map = request->req_map; // Get components of union. Most likely there isn't one, so this is -// probably wasted work. +// probably wasted work. gpre_rse* select = NULL; gpre_rse* rse1 = NULL; select = rse1 = par_select(request, NULL); -// "Look for ... the UNION label ... " +// "Look for ... the UNION label ... " while (MSC_match(KW_UNION)) { have_union = true; @@ -1137,13 +1137,13 @@ gpre_rse* SQE_select(gpre_req* request, if (!union_all) select->rse_reduced = select->rse_fields; - // Result of this UNION might be the left side of the NEXT UNION + // Result of this UNION might be the left side of the NEXT UNION rse1 = select; } -// Restore the context lists that were forgotten +// Restore the context lists that were forgotten // holds the most recently allocated context, which is -// already linked into the request block +// already linked into the request block while (context_stack) { while (context->ctx_next) @@ -1151,7 +1151,7 @@ gpre_rse* SQE_select(gpre_req* request, context->ctx_next = (gpre_ctx*) MSC_pop(&context_stack); } -// Pick up any dangling ORDER clause +// Pick up any dangling ORDER clause ++request->req_in_order_by_clause; par_order(request, select, have_union, view_flag); @@ -1164,9 +1164,9 @@ gpre_rse* SQE_select(gpre_req* request, //____________________________________________________________ -// +// // Parse either of the low precedence operators + and -. -// +// GPRE_NOD SQE_value(gpre_req* request, bool aster_ok, @@ -1215,10 +1215,10 @@ GPRE_NOD SQE_value(gpre_req* request, //____________________________________________________________ -// +// // Parse either a literal NULL expression or a value // expression. -// +// GPRE_NOD SQE_value_or_null(gpre_req* request, bool aster_ok, @@ -1233,11 +1233,11 @@ GPRE_NOD SQE_value_or_null(gpre_req* request, //____________________________________________________________ -// +// // Parse host variable reference and, perhaps, a missing // flag reference, which may be prefaced by the noiseword, // "INDICATOR". -// +// GPRE_NOD SQE_variable(gpre_req* request, bool aster_ok, @@ -1275,10 +1275,10 @@ GPRE_NOD SQE_variable(gpre_req* request, //____________________________________________________________ -// +// // Compare two expressions symbollically. If they're the same, // return TRUE, otherwise FALSE. -// +// static bool compare_expr(GPRE_NOD node1, GPRE_NOD node2) @@ -1297,7 +1297,7 @@ static bool compare_expr(GPRE_NOD node1, ref2 = (REF) node2->nod_arg[0]; if (ref1->ref_context != ref2->ref_context || ref1->ref_field != ref2->ref_field || - ref1->ref_master != ref2->ref_master) + ref1->ref_master != ref2->ref_master) { return false; } @@ -1324,9 +1324,9 @@ static bool compare_expr(GPRE_NOD node1, //____________________________________________________________ -// +// // Copy a field list for a SELECT against an artificial context. -// +// static GPRE_NOD copy_fields( GPRE_NOD fields, map* fields_map) { @@ -1342,9 +1342,9 @@ static GPRE_NOD copy_fields( GPRE_NOD fields, map* fields_map) //____________________________________________________________ -// +// // Expand an '*' in a field list to the corresponding fields. -// +// static GPRE_NOD explode_asterisk( GPRE_NOD fields, int n, gpre_rse* selection) { @@ -1355,7 +1355,7 @@ static GPRE_NOD explode_asterisk( GPRE_NOD fields, int n, gpre_rse* selection) gpre_nod* node = fields->nod_arg[n]; TOK q_token = (TOK) node->nod_arg[0]; if (q_token) { - // expand for single relation + // expand for single relation gpre_ctx* context = resolve_asterisk(q_token, selection); if (context) fields = merge_fields(fields, MET_fields(context), n, true); @@ -1366,7 +1366,7 @@ static GPRE_NOD explode_asterisk( GPRE_NOD fields, int n, gpre_rse* selection) } } else { - // expand for all relations in context list + // expand for all relations in context list fields = explode_asterisk_all(fields, n, selection, true); } @@ -1376,10 +1376,10 @@ static GPRE_NOD explode_asterisk( GPRE_NOD fields, int n, gpre_rse* selection) //____________________________________________________________ -// +// // Expand an '*' for all relations // in the context list. -// +// static GPRE_NOD explode_asterisk_all(GPRE_NOD fields, int n, @@ -1405,10 +1405,10 @@ static GPRE_NOD explode_asterisk_all(GPRE_NOD fields, //____________________________________________________________ -// +// // Get an element of an expression to act as a reference // field for determining the data type of a host variable. -// +// static gpre_fld* get_ref( GPRE_NOD expr) { @@ -1425,7 +1425,7 @@ static gpre_fld* get_ref( GPRE_NOD expr) } ref* reference; - + switch (expr->nod_type) { case nod_field: reference = (ref*) expr->nod_arg[0]; @@ -1479,12 +1479,12 @@ static gpre_fld* get_ref( GPRE_NOD expr) //____________________________________________________________ -// +// // Finish off processing an implicit ANY clause. Assume that the word // "select" has already been recognized. If the outer thing is a group // by, so we're looking at a "having", re-resolve the input value to the // map. -// +// static GPRE_NOD implicit_any(gpre_req* request, GPRE_NOD value, @@ -1505,7 +1505,7 @@ static GPRE_NOD implicit_any(gpre_req* request, if (!(original->ctx_relation || original->ctx_procedure) && request->req_map) value = post_fields(value, request->req_map); -// Handle the ALL and DISTINCT options +// Handle the ALL and DISTINCT options const bool distinct = (!MSC_match(KW_ALL) && MSC_match(KW_DISTINCT)); request->req_in_select_list++; @@ -1570,9 +1570,9 @@ static GPRE_NOD implicit_any(gpre_req* request, //____________________________________________________________ -// +// // Merge two (possibly null) booleans into a single conjunct. -// +// static GPRE_NOD merge( GPRE_NOD expr1, GPRE_NOD expr2) { @@ -1591,12 +1591,12 @@ static GPRE_NOD merge( GPRE_NOD expr1, GPRE_NOD expr2) //____________________________________________________________ -// +// // Merge 2 field lists // 2nd list is added over nth entry in 1st list // if replace is TRUE, otherwise it is added // after the nth entry. -// +// static GPRE_NOD merge_fields(GPRE_NOD fields_1, GPRE_NOD fields_2, @@ -1637,9 +1637,9 @@ static GPRE_NOD merge_fields(GPRE_NOD fields_1, //____________________________________________________________ -// +// // Construct negation of expression. -// +// static GPRE_NOD negate( GPRE_NOD expr) { @@ -1651,12 +1651,12 @@ static GPRE_NOD negate( GPRE_NOD expr) //____________________________________________________________ -// +// // Given two value expressions associated in a relational // expression, see if one is a field reference and the other // is a host language variable.. If so, match the field to the // host language variable. -// +// static void pair( GPRE_NOD expr1, GPRE_NOD expr2) { @@ -1664,7 +1664,7 @@ static void pair( GPRE_NOD expr1, GPRE_NOD expr2) assert_IS_NOD(expr2); // Verify that an array field without subscripts is not -// being used inappropriately +// being used inappropriately if (expr1 && expr2) { if (expr1->nod_type == nod_array && !expr1->nod_arg[1]) @@ -1696,15 +1696,15 @@ static void pair( GPRE_NOD expr1, GPRE_NOD expr2) //____________________________________________________________ -// +// // The passed alias list fully specifies a relation. // The first alias represents a relation specified in // the from list at this scope levels. Subsequent // contexts, if there are any, represent base relations -// in a view stack. They are used to fully specify a -// base relation of a view. The aliases used in the +// in a view stack. They are used to fully specify a +// base relation of a view. The aliases used in the // view stack are those used in the view definition. -// +// static gpre_ctx* par_alias_list( gpre_req* request, GPRE_NOD alias_list) { @@ -1715,7 +1715,7 @@ static gpre_ctx* par_alias_list( gpre_req* request, GPRE_NOD alias_list) const gpre_nod* const* const end = alias_list->nod_arg + alias_list->nod_count; // check the first alias in the list with the relations -// in the current context for a match +// in the current context for a match gpre_rel* relation = 0; // unreliable test many lines below without initializing. gpre_ctx* context = par_alias(request, (const TEXT*) * arg); @@ -1726,10 +1726,10 @@ static gpre_ctx* par_alias_list( gpre_req* request, GPRE_NOD alias_list) } SCHAR error_string[ERROR_LENGTH]; - -// if the first alias didn't specify a table in the context stack, + +// if the first alias didn't specify a table in the context stack, // look through all contexts to find one which might be a view with -// a base table having a matching table name or alias +// a base table having a matching table name or alias if (!context) for (context = request->req_contexts; context; @@ -1755,7 +1755,7 @@ static gpre_ctx* par_alias_list( gpre_req* request, GPRE_NOD alias_list) } // find the base table using the specified alias list, skipping the first one -// since we already matched it to the context +// since we already matched it to the context for (arg++; arg < end; arg++) { @@ -1770,7 +1770,7 @@ static gpre_ctx* par_alias_list( gpre_req* request, GPRE_NOD alias_list) PAR_error(error_string); } -// make up a dummy context to hold the resultant relation +// make up a dummy context to hold the resultant relation gpre_ctx* new_context = (gpre_ctx*) MSC_alloc(CTX_LEN); new_context->ctx_request = request; @@ -1778,7 +1778,7 @@ static gpre_ctx* par_alias_list( gpre_req* request, GPRE_NOD alias_list) new_context->ctx_relation = relation; // concatenate all the contexts to form the alias name; -// calculate the length leaving room for spaces and a null +// calculate the length leaving room for spaces and a null USHORT alias_length = alias_list->nod_count; for (arg = alias_list->nod_arg; arg < end; arg++) @@ -1802,12 +1802,12 @@ static gpre_ctx* par_alias_list( gpre_req* request, GPRE_NOD alias_list) //____________________________________________________________ -// -// The passed relation or alias represents +// +// The passed relation or alias represents // a context which was previously specified -// in the from list. Find and return the +// in the from list. Find and return the // proper context. -// +// static gpre_ctx* par_alias( gpre_req* request, const TEXT* alias) { @@ -1817,7 +1817,7 @@ static gpre_ctx* par_alias( gpre_req* request, const TEXT* alias) // look through all contexts at this scope level // to find one that has a relation name or alias -// name which matches the identifier passed +// name which matches the identifier passed gpre_ctx* relation_context = NULL; for (gpre_ctx* context = request->req_contexts; context; @@ -1826,7 +1826,7 @@ static gpre_ctx* par_alias( gpre_req* request, const TEXT* alias) if (context->ctx_scope_level != request->req_scope_level) continue; - // check for matching alias + // check for matching alias if (context->ctx_alias) { const TEXT* p = context->ctx_alias; @@ -1862,10 +1862,10 @@ static gpre_ctx* par_alias( gpre_req* request, const TEXT* alias) //____________________________________________________________ -// +// // Check if the relation in the passed context // has a base table which matches the passed alias. -// +// static gpre_rel* par_base_table( gpre_req* request, const gpre_rel* relation, const TEXT* alias) @@ -1943,7 +1943,7 @@ static GPRE_NOD par_case(gpre_req* request) } // ELSE else_value END - if (MSC_match(KW_ELSE)) + if (MSC_match(KW_ELSE)) { count++; MSC_push(SQE_value_or_null(request, false, NULL, NULL), &stack); @@ -1965,9 +1965,9 @@ static GPRE_NOD par_case(gpre_req* request) return node; } //____________________________________________________________ -// +// // Parse an AND boolean expression. -// +// static GPRE_NOD par_and( gpre_req* request, USHORT * paren_count) { @@ -1983,8 +1983,8 @@ static GPRE_NOD par_and( gpre_req* request, USHORT * paren_count) //____________________________________________________________ -// -// +// +// static GPRE_NOD par_collate( gpre_req* request, GPRE_NOD arg) { @@ -1998,12 +1998,12 @@ static GPRE_NOD par_collate( gpre_req* request, GPRE_NOD arg) node->nod_arg[1] = (GPRE_NOD) field; CME_get_dtype(arg, field); if (field->fld_dtype > dtype_any_text) { - // cast expression to VARYING with implementation-defined - // maximum length + // cast expression to VARYING with implementation-defined + // maximum length field->fld_dtype = dtype_varying; field->fld_char_length = 30; - field->fld_length = 0; // calculated by SQL_adjust_field_dtype + field->fld_length = 0; // calculated by SQL_adjust_field_dtype field->fld_scale = 0; field->fld_sub_type = 0; } @@ -2018,12 +2018,12 @@ static GPRE_NOD par_collate( gpre_req* request, GPRE_NOD arg) //____________________________________________________________ -// +// // Parse a SQL "IN" expression. This comes in two flavors: -// +// // IN () // IN (SELECT ) -// +// static GPRE_NOD par_in( gpre_req* request, GPRE_NOD value) { @@ -2035,7 +2035,7 @@ static GPRE_NOD par_in( gpre_req* request, GPRE_NOD value) EXP_left_paren(0); -// If the next token isn't SELECT, we must have the comma list flavor. +// If the next token isn't SELECT, we must have the comma list flavor. if (MSC_match(KW_SELECT)) node = implicit_any(request, value, nod_eq, nod_ansi_any); @@ -2076,9 +2076,9 @@ static GPRE_NOD par_in( gpre_req* request, GPRE_NOD value) //____________________________________________________________ -// +// // Parse a join relation clause. -// +// static gpre_ctx* par_joined_relation( gpre_req* request, gpre_ctx* prior_context) { @@ -2098,9 +2098,9 @@ static gpre_ctx* par_joined_relation( gpre_req* request, gpre_ctx* prior_context //____________________________________________________________ -// +// // Parse a join relation clause. -// +// static gpre_ctx* par_join_clause( gpre_req* request, gpre_ctx* context1) { @@ -2134,9 +2134,9 @@ static gpre_ctx* par_join_clause( gpre_req* request, gpre_ctx* context1) //____________________________________________________________ -// +// // Parse a join type. -// +// static NOD_T par_join_type(void) { @@ -2166,9 +2166,9 @@ static NOD_T par_join_type(void) //____________________________________________________________ -// +// // Parse either of the high precedence operators * and /. -// +// static GPRE_NOD par_multiply(gpre_req* request, bool aster_ok, @@ -2202,9 +2202,9 @@ static GPRE_NOD par_multiply(gpre_req* request, //____________________________________________________________ -// +// // Parse an NOT boolean expression. -// +// static GPRE_NOD par_not( gpre_req* request, USHORT * paren_count) { @@ -2254,7 +2254,7 @@ static GPRE_NOD par_not( gpre_req* request, USHORT * paren_count) } //____________________________________________________________ -// +// // Parse NULLIF built-in function. // // NULLIF(exp1, exp2) is really just a shortcut for @@ -2277,11 +2277,11 @@ static GPRE_NOD par_nullif(gpre_req* request) } //____________________________________________________________ -// -// Parse ORDER clause of SELECT expression. This is +// +// Parse ORDER clause of SELECT expression. This is // particularly difficult since the ORDER clause can // refer to fields by position. -// +// static void par_order(gpre_req* request, gpre_rse* select, @@ -2346,16 +2346,16 @@ static void par_order(gpre_req* request, //____________________________________________________________ -// +// // Allow the user to specify the access plan // for a query as part of a select expression. -// +// static GPRE_NOD par_plan( gpre_req* request) { assert_IS_REQ(request); -// parse the join type +// parse the join type NOD_T nod_type; if (MSC_match(KW_JOIN)) @@ -2367,14 +2367,14 @@ static GPRE_NOD par_plan( gpre_req* request) else nod_type = nod_join; -// make up the plan expression node +// make up the plan expression node gpre_nod* plan_expression = MSC_node(nod_plan_expr, 2); if (nod_type != nod_join) plan_expression->nod_arg[0] = MSC_node(nod_type, 0); -// parse the plan items at this level +// parse the plan items at this level EXP_left_paren(0); @@ -2387,10 +2387,10 @@ static GPRE_NOD par_plan( gpre_req* request) //____________________________________________________________ -// -// Parse an individual plan item for an +// +// Parse an individual plan item for an // access plan. -// +// static GPRE_NOD par_plan_item(gpre_req* request, bool aster_ok, @@ -2399,7 +2399,7 @@ static GPRE_NOD par_plan_item(gpre_req* request, { assert_IS_REQ(request); -// check for a plan expression +// check for a plan expression if (gpreGlob.token_global.tok_keyword == KW_JOIN || gpreGlob.token_global.tok_keyword == KW_SORT || gpreGlob.token_global.tok_keyword == KW_MERGE || gpreGlob.token_global.tok_keyword == KW_LEFT_PAREN) @@ -2409,13 +2409,13 @@ static GPRE_NOD par_plan_item(gpre_req* request, // parse the list of one or more table names or // aliases (more than one is used when there is -// a need to differentiate base tables of a view) +// a need to differentiate base tables of a view) int count; gpre_lls* stack = NULL; for (count = 0; gpreGlob.token_global.tok_type == tok_ident; count++) { if (gpreGlob.token_global.tok_keyword == KW_NATURAL || - gpreGlob.token_global.tok_keyword == KW_ORDER || + gpreGlob.token_global.tok_keyword == KW_ORDER || gpreGlob.token_global.tok_keyword == KW_INDEX) { break; @@ -2434,11 +2434,11 @@ static GPRE_NOD par_plan_item(gpre_req* request, for (ptr = &alias_list->nod_arg[count]; stack;) *--ptr = (GPRE_NOD) MSC_pop(&stack); -// lookup the contexts for the aliases +// lookup the contexts for the aliases gpre_ctx* context = par_alias_list(request, alias_list); -// parse the access type +// parse the access type gpre_nod* access_type; if (gpreGlob.token_global.tok_keyword == KW_NATURAL) { @@ -2488,7 +2488,7 @@ static GPRE_NOD par_plan_item(gpre_req* request, } -// generate the plan item node +// generate the plan item node gpre_nod* plan_item = MSC_node(nod_plan_item, 3); plan_item->nod_count = 2; @@ -2501,10 +2501,10 @@ static GPRE_NOD par_plan_item(gpre_req* request, //____________________________________________________________ -// +// // Parse a value expression. The value could be any of the // following: -// +// // "quoted string" // _CHARSET"quoted string" // 123 @@ -2513,7 +2513,7 @@ static GPRE_NOD par_plan_item(gpre_req* request, // relation.field // context.field // user defined function -// +// static GPRE_NOD par_primitive_value(gpre_req* request, bool aster_ok, @@ -2545,7 +2545,7 @@ static GPRE_NOD par_primitive_value(gpre_req* request, } if (MSC_match(KW_VALUE)) { - /* If request is NULL we must be processing a subquery - and + /* If request is NULL we must be processing a subquery - and * without the request to refer to we're kinda hosed */ if (!request) @@ -2576,7 +2576,7 @@ static GPRE_NOD par_primitive_value(gpre_req* request, // Check for an aggregate statistical expression. If we already have a // map defined for the request, we're part of either HAVING or a trailing // ORDER clause. In this case, post only the complete expression, and not -// the sub-expressions. +// the sub-expressions. map* tmp_map = 0; for (const ops *op = stat_ops; (int) op->rel_kw != (int) KW_none; op++) { @@ -2606,7 +2606,7 @@ static GPRE_NOD par_primitive_value(gpre_req* request, node->nod_count = 0; else { node->nod_arg[0] = SQE_value(request, false, NULL, NULL); - // Disallow arrays as arguments to aggregate functions + // Disallow arrays as arguments to aggregate functions const gpre_nod* node_arg = node->nod_arg[0]; if (node_arg && node_arg->nod_type == nod_array) PAR_error @@ -2626,7 +2626,7 @@ static GPRE_NOD par_primitive_value(gpre_req* request, } } -// If it's a number or a quoted string, it's a literal +// If it's a number or a quoted string, it's a literal if (gpreGlob.token_global.tok_type == tok_number || (isQuoted(gpreGlob.token_global.tok_type) && gpreGlob.sw_sql_dialect == 1) || @@ -2639,10 +2639,10 @@ static GPRE_NOD par_primitive_value(gpre_req* request, // moved this timestamp support down some lines, because it caused // gpre to segfault when it was done here. // FSG 15.Nov.2000 -// +// -// If the next token is a colon, it is a variable reference +// If the next token is a colon, it is a variable reference if ((int) gpreGlob.token_global.tok_keyword == (int) KW_COLON) { if (!request) { @@ -2662,17 +2662,17 @@ static GPRE_NOD par_primitive_value(gpre_req* request, -// Must be a field or a udf. If there is a map, post the field to it. +// Must be a field or a udf. If there is a map, post the field to it. node = par_udf_or_field(request, aster_ok); -// +// //if (request && (map = request->req_map)) // return post_map (node, map); -// +// if (!node) -// I don't know what it's good for, but let's try it anyway if we haven't found -// anything that makes sense until now +// I don't know what it's good for, but let's try it anyway if we haven't found +// anything that makes sense until now { // ** Begin date/time/timestamp support * const KWWORDS kw_word = gpreGlob.token_global.tok_keyword; @@ -2692,9 +2692,9 @@ static GPRE_NOD par_primitive_value(gpre_req* request, //____________________________________________________________ -// +// // Parse relational expression. -// +// static GPRE_NOD par_relational(gpre_req* request, USHORT * paren_count) @@ -2719,7 +2719,7 @@ static GPRE_NOD par_relational(gpre_req* request, if (MSC_match(KW_NOT)) negation = true; -// Check for one of the binary operators +// Check for one of the binary operators GPRE_NOD node; if (MSC_match(KW_IN)) @@ -2852,11 +2852,11 @@ static bool resolve_fields(GPRE_NOD& fields, //____________________________________________________________ -// +// // Parse the SQL equivalent of a record selection expression -- // FROM, WHERE, and ORDER clauses. A field list may or may not // be present. -// +// static gpre_rse* par_rse(gpre_req* request, GPRE_NOD fields, @@ -2867,7 +2867,7 @@ static gpre_rse* par_rse(gpre_req* request, assert_IS_REQ(request); assert_IS_NOD(fields); -// Get list and count of relations +// Get list and count of relations if (!MSC_match(KW_FROM)) CPR_s_error("FROM"); @@ -2884,7 +2884,7 @@ static gpre_rse* par_rse(gpre_req* request, } while (MSC_match(KW_COMMA)); // Now allocate a record select expression -// block for the beast and fill in what we already know. +// block for the beast and fill in what we already know. gpre_rse* select = (gpre_rse*) MSC_alloc(RSE_LEN(count)); select->rse_count = count; @@ -2892,7 +2892,7 @@ static gpre_rse* par_rse(gpre_req* request, while (count--) select->rse_context[count] = (gpre_ctx*) MSC_pop(&stack); -// If a field list has been presented, resolve references now +// If a field list has been presented, resolve references now bool aggregate = false; @@ -2903,7 +2903,7 @@ static gpre_rse* par_rse(gpre_req* request, if (distinct) select->rse_reduced = fields; -// Handle a boolean, if present +// Handle a boolean, if present if (MSC_match(KW_WITH)) { ++request->req_in_where_clause; @@ -2952,7 +2952,7 @@ static gpre_rse* par_rse(gpre_req* request, } } -// parse a user-specified access plan +// parse a user-specified access plan if (MSC_match(KW_PLAN)) select->rse_plan = par_plan(request); @@ -2962,13 +2962,13 @@ static gpre_rse* par_rse(gpre_req* request, //____________________________________________________________ -// +// // Parse a SELECT (sans keyword) expression (except UNION). This // is called exclusively by SQE_select, which handles unions. Note: // if "union_rse" is non-null, we are a subsequent SELECT in a union. // In this case, check datatypes of the field against the rse field // list. -// +// static gpre_rse* par_select( gpre_req* request, gpre_rse* union_rse) { @@ -2989,18 +2989,18 @@ static gpre_rse* par_select( gpre_req* request, gpre_rse* union_rse) rse_skip->nod_arg[0] = SQE_value(request, false, NULL, NULL); } -// Handle the ALL and DISTINCT options +// Handle the ALL and DISTINCT options const bool distinct = (!MSC_match(KW_ALL) && MSC_match(KW_DISTINCT)); -// Make select list out of select items +// Make select list out of select items ++request->req_in_select_list; gpre_nod* s_list = SQE_list(SQE_value_or_null, request, true); --request->req_in_select_list; // If this is not a declare cursor statement and an INTO list is present, -// parse it. +// parse it. gpre_nod* into_list = NULL; if (!(request->req_flags & REQ_sql_declare_cursor)) @@ -3030,10 +3030,10 @@ static gpre_rse* par_select( gpre_req* request, gpre_rse* union_rse) //____________________________________________________________ -// +// // Parse a dumb SQL scalar statistical expression. Somebody else // has already eaten the SELECT on the front. -// +// static GPRE_NOD par_stat( gpre_req* request) { @@ -3073,9 +3073,9 @@ static GPRE_NOD par_stat( gpre_req* request) //____________________________________________________________ -// -// Parse a subscript value. -// +// +// Parse a subscript value. +// static GPRE_NOD par_subscript( gpre_req* request) { @@ -3084,7 +3084,7 @@ static GPRE_NOD par_subscript( gpre_req* request) ref* reference = (REF) MSC_alloc(REF_LEN); gpre_nod* node = MSC_unary(nod_value, (GPRE_NOD) reference); -// Special case literals +// Special case literals if (gpreGlob.token_global.tok_type == tok_number) { node->nod_type = nod_literal; @@ -3109,7 +3109,7 @@ static GPRE_NOD par_subscript( gpre_req* request) } //____________________________________________________________ -// +// // Parse the SUBSTRING built-in function // static GPRE_NOD par_substring(gpre_req* request) @@ -3155,9 +3155,9 @@ static GPRE_NOD par_substring(gpre_req* request) } //____________________________________________________________ -// +// // Match several trailing parentheses. -// +// static void par_terminating_parens( USHORT * paren_count, USHORT * local_count) @@ -3171,11 +3171,11 @@ static void par_terminating_parens( //____________________________________________________________ -// +// // Parse a user defined function. If the current token isn't one, // return NULL. Otherwise try to parse one. If things go badly, // complain bitterly. -// +// static GPRE_NOD par_udf( gpre_req* request) { @@ -3184,14 +3184,14 @@ static GPRE_NOD par_udf( gpre_req* request) assert_IS_REQ(request); -// Check for user defined functions +// Check for user defined functions // ** resolve only if an identifier * if ((isQuoted(gpreGlob.token_global.tok_type)) || gpreGlob.token_global.tok_type == tok_ident) SQL_resolve_identifier("", NULL, NAME_SIZE); GPRE_NOD node; USHORT local_count; - + udf* an_udf; if (request->req_database) an_udf = MET_get_udf(request->req_database, gpreGlob.token_global.tok_string); @@ -3205,7 +3205,7 @@ static GPRE_NOD par_udf( gpre_req* request) udf* tmp_udf = MET_get_udf(db, gpreGlob.token_global.tok_string); if (tmp_udf) if (an_udf) { - // udf was found in more than one database + // udf was found in more than one database SCHAR s[ERROR_LENGTH]; sprintf(s, "UDF %s is ambiguous", gpreGlob.token_global.tok_string); PAR_error(s); @@ -3232,13 +3232,13 @@ static GPRE_NOD par_udf( gpre_req* request) PAR_get_token(); EXP_left_paren(0); if (!(gpreGlob.token_global.tok_keyword == KW_RIGHT_PAREN)) { - // parse udf parameter references + // parse udf parameter references node->nod_arg[0] = SQE_list(SQE_value, request, false); if (an_udf->udf_args != node->nod_arg[0]->nod_count) PAR_error("count of UDF parameters doesn't match definition"); - // Match parameter types to the declared parameters + // Match parameter types to the declared parameters gpre_nod** input = node->nod_arg[0]->nod_arg; for (gpre_fld* field = an_udf->udf_inputs; field; @@ -3259,7 +3259,7 @@ static GPRE_NOD par_udf( gpre_req* request) if (!request) return NULL; -// Check for GEN_ID () +// Check for GEN_ID () if (MSC_match(KW_GEN_ID)) { TEXT* gen_name = (TEXT *) MSC_alloc(NAME_SIZE); node = MSC_node(nod_gen_id, 2); @@ -3276,7 +3276,7 @@ static GPRE_NOD par_udf( gpre_req* request) return node; } -// Check for context variables +// Check for context variables // ** Begin date/time/timestamp * @@ -3305,7 +3305,7 @@ static GPRE_NOD par_udf( gpre_req* request) // End context variables * -// Check for SQL II defined functions +// Check for SQL II defined functions // ** Begin date/time/timestamp * @@ -3399,9 +3399,9 @@ static GPRE_NOD par_udf( gpre_req* request) //____________________________________________________________ -// +// // Parse a user defined function or a field name. -// +// static GPRE_NOD par_udf_or_field(gpre_req* request, bool aster_ok) @@ -3417,10 +3417,10 @@ static GPRE_NOD par_udf_or_field(gpre_req* request, //____________________________________________________________ -// +// // Parse a user defined function or a field name. // Allow the collate clause to follow. -// +// static GPRE_NOD par_udf_or_field_with_collate(gpre_req* request, bool aster_ok, @@ -3478,12 +3478,12 @@ static void par_update(gpre_rse *select, bool have_union, bool view_flag) } //____________________________________________________________ -// +// // Post a field or aggregate to a map. This is used to references // to aggregates and unions. Return a reference to the map (rather // than the expression itself). Post only the aggregates and fields, // not the computations around them. -// +// static GPRE_NOD post_fields( GPRE_NOD node, map* to_map) { @@ -3491,12 +3491,12 @@ static GPRE_NOD post_fields( GPRE_NOD node, map* to_map) switch (node->nod_type) { /* Removed during fix to BUG_8021 - this would post a literal to - * the map record for each literal used in an expression - which + * the map record for each literal used in an expression - which * would result in unneccesary data movement as the literal is more * easily experssed in the assignment portion of the mapping select * operation. case nod_literal: - * 1995-Jul-10 David Schnepper + * 1995-Jul-10 David Schnepper */ case nod_field: case nod_agg_max: @@ -3543,11 +3543,11 @@ static GPRE_NOD post_fields( GPRE_NOD node, map* to_map) //____________________________________________________________ -// +// // Post a value expression to a map. This is used to references // to aggregates and unions. Return a reference to the map (rather // than the expression itself). -// +// static GPRE_NOD post_map( GPRE_NOD node, map* to_map) { @@ -3556,7 +3556,7 @@ static GPRE_NOD post_map( GPRE_NOD node, map* to_map) assert_IS_NOD(node); // Search existing map for equivalent expression. If we find one, -// return a reference to it. +// return a reference to it. if (node->nod_type == nod_map_ref) { element = (MEL) node->nod_arg[0]; @@ -3568,7 +3568,7 @@ static GPRE_NOD post_map( GPRE_NOD node, map* to_map) if (compare_expr(node, element->mel_expr)) return MSC_unary(nod_map_ref, (GPRE_NOD) element); -// We need to make up a new map reference +// We need to make up a new map reference element = (MEL) MSC_alloc(sizeof(mel)); element->mel_next = to_map->map_elements; @@ -3577,20 +3577,20 @@ static GPRE_NOD post_map( GPRE_NOD node, map* to_map) element->mel_expr = node; element->mel_context = to_map->map_context; -// Make up a reference to the map element +// Make up a reference to the map element return MSC_unary(nod_map_ref, (GPRE_NOD) element); } //____________________________________________________________ -// +// // Copy a selection list to the map generated for a UNION // construct. Note at this level we want the full expression // selected posted, not just the portions that come from the // stream. Thus CAST and other operations will be passed into // a UNION. See BUG_8021 & BUG_8000 for examples. -// +// static GPRE_NOD post_select_list( GPRE_NOD fields, map* to_map) { @@ -3606,9 +3606,9 @@ static GPRE_NOD post_select_list( GPRE_NOD fields, map* to_map) //____________________________________________________________ -// +// // Restore saved scoping information to the request block -// +// static void pop_scope(gpre_req* request, scope* save_scope) { @@ -3625,9 +3625,9 @@ static void pop_scope(gpre_req* request, scope* save_scope) //____________________________________________________________ -// +// // Save scoping information from the request block -// +// static void push_scope(gpre_req* request, scope* save_scope) { @@ -3652,11 +3652,11 @@ static void push_scope(gpre_req* request, scope* save_scope) //____________________________________________________________ -// +// // Attempt to resolve a field in a context. If successful, return // the field. Otherwise return NULL. Let somebody else worry about // errors. -// +// static gpre_fld* resolve( GPRE_NOD node, @@ -3685,17 +3685,17 @@ static gpre_fld* resolve( if (!(context->ctx_relation || context->ctx_procedure)) return NULL; -// Handle unqualified fields first for simplicity +// Handle unqualified fields first for simplicity if (!q_token) field = MET_context_field(context, f_token->tok_string); else { - // Now search alternatives for the qualifier + // Now search alternatives for the qualifier gpre_sym* symbol = HSH_lookup(q_token->tok_string); - /* This caused gpre to dump core if there are lower case - table aliases in a where clause used with dialect 2 or 3 + /* This caused gpre to dump core if there are lower case + table aliases in a where clause used with dialect 2 or 3 if ( (symbol == NULL) && (sw_case || gpreGlob.sw_sql_dialect == SQL_DIALECT_V5)) symbol = HSH_lookup2 (q_token->tok_string); @@ -3746,9 +3746,9 @@ static gpre_fld* resolve( if (field && found_context) *found_context = context; -// Check for valid array field -// Check dimensions -// Set remaining fields for slice +// Check for valid array field +// Check dimensions +// Set remaining fields for slice slc* slice; gpre_req* slice_req = (gpre_req*) node->nod_arg[2]; if (slice_req && (slice = slice_req->req_slice) && slice_action) @@ -3762,7 +3762,7 @@ static gpre_fld* resolve( slice->slc_field = field; slice->slc_parent_request = context->ctx_request; - /* The action type maybe ACT_get_slice or ACT_put_slice + /* The action type maybe ACT_get_slice or ACT_put_slice set as a place holder */ act* action = MSC_action(slice_req, ACT_get_slice); @@ -3782,10 +3782,10 @@ static gpre_fld* resolve( //____________________________________________________________ -// +// // Attempt to resolve an asterisk in a context. // If successful, return the context. Otherwise return NULL. -// +// static gpre_ctx* resolve_asterisk( TOK q_token, gpre_rse* selection) { @@ -3824,9 +3824,9 @@ static gpre_ctx* resolve_asterisk( TOK q_token, gpre_rse* selection) //____________________________________________________________ -// +// // Set field reference for any host variables in expr to field_ref. -// +// static void set_ref( GPRE_NOD expr, gpre_fld* field_ref) { @@ -3871,10 +3871,10 @@ static void set_ref( GPRE_NOD expr, gpre_fld* field_ref) //____________________________________________________________ -// +// // Return the uppercase version of // the input string. -// +// static char* upcase_string(const char* p) { @@ -3893,15 +3893,15 @@ static char* upcase_string(const char* p) //____________________________________________________________ -// +// // validate that top level field references // in a select with a group by, real or imagined, // resolve to grouping fields. Ignore constants // and aggregates. If there's no group_by list, // then it's an imaginary group by (a top level // aggregation, and nothing can be referenced -// directly. -// +// directly. +// static bool validate_references(const gpre_nod* fields, const gpre_nod* group_by) @@ -3943,7 +3943,7 @@ static bool validate_references(const gpre_nod* fields, } if (fields->nod_type == nod_any || fields->nod_type == nod_ansi_any || - fields->nod_type == nod_ansi_all) + fields->nod_type == nod_ansi_all) { const gpre_rse* any = (gpre_rse*) fields->nod_arg[0]; return validate_references(any->rse_boolean, group_by); diff --git a/src/gpre/sql.cpp b/src/gpre/sql.cpp index 1e90ca49cc..efb000ba19 100644 --- a/src/gpre/sql.cpp +++ b/src/gpre/sql.cpp @@ -1,27 +1,27 @@ //____________________________________________________________ -// +// // PROGRAM: C Preprocessor // MODULE: sql.cpp // DESCRIPTION: SQL parser -// +// // The contents of this file are subject to the Interbase Public // License Version 1.0 (the "License"); you may not use this file // except in compliance with the License. You may obtain a copy // of the License at http://www.Inprise.com/IPL.html -// +// // Software distributed under the License is distributed on an // "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express // or implied. See the License for the specific language governing // rights and limitations under the License. -// +// // The Original Code was created by Inprise Corporation // and its predecessors. Portions created by Inprise Corporation are // Copyright (C) Inprise Corporation. -// +// // All Rights Reserved. // Contributor(s): ______________________________________. // TMN (Mike Nordell) 11.APR.2001 - Reduce compiler warnings -// +// // //____________________________________________________________ // @@ -51,7 +51,7 @@ const int MIN_CACHE_BUFFERS = 250; const int DEF_CACHE_BUFFERS = 1000; #endif -const int DEFAULT_BLOB_SEGMENT_LENGTH = 80; // bytes +const int DEFAULT_BLOB_SEGMENT_LENGTH = 80; // bytes static act* act_alter(void); static act* act_alter_database(void); @@ -160,15 +160,15 @@ static inline bool range_positive_short_integer(const SLONG x) } //____________________________________________________________ -// +// // Parse and return a sequel action. -// +// act* SQL_action(const TEXT* base_directory) { act* action; const enum kwwords keyword = gpreGlob.token_global.tok_keyword; - + switch (keyword) { case KW_ALTER: case KW_COMMENT: @@ -338,16 +338,16 @@ act* SQL_action(const TEXT* base_directory) //____________________________________________________________ -// +// // Given a field datatype, remap it as needed to // a user datatype, and set the length field. -// +// void SQL_adjust_field_dtype( gpre_fld* field) { if (field->fld_dtype <= dtype_any_text) { ULONG field_length; - // Adjust the string data types and their lengths + // Adjust the string data types and their lengths if (field->fld_collate) { if (field->fld_char_length) field_length = (ULONG) field->fld_char_length * @@ -456,9 +456,9 @@ void SQL_adjust_field_dtype( gpre_fld* field) //____________________________________________________________ -// +// // Initialize (or re-initialize) to process a module. -// +// void SQL_init(void) { @@ -472,8 +472,8 @@ void SQL_init(void) //____________________________________________________________ -// -// +// +// void SQL_par_field_collate( gpre_req* request, gpre_fld* field) { @@ -492,7 +492,7 @@ void SQL_par_field_collate( gpre_req* request, gpre_fld* field) PAR_error("The named COLLATION was not found"); field->fld_collate = (INTLSYM) symbol->sym_object; - /* Is the collation valid for declared character set? + /* Is the collation valid for declared character set? * The character set is either declared (fld_character_set) or inferered * from the global domain (fld_global & fld_charset_id) */ @@ -512,11 +512,11 @@ void SQL_par_field_collate( gpre_req* request, gpre_fld* field) //____________________________________________________________ -// +// // Handle an SQL field datatype definition for // field CREATE, DECLARE or ALTER TABLE statement. // Also for CAST statement -// +// void SQL_par_field_dtype(gpre_req* request, gpre_fld* field, @@ -574,7 +574,7 @@ void SQL_par_field_dtype(gpre_req* request, case KW_COMPUTED: if (is_udf) CPR_s_error(""); - // just return - actual parse is done later + // just return - actual parse is done later return; default: @@ -662,7 +662,7 @@ void SQL_par_field_dtype(gpre_req* request, CPR_s_error("CHARACTER"); PAR_get_token(); field->fld_flags |= FLD_national; - // Fall into KW_CHAR + // Fall into KW_CHAR case KW_CHAR: if (MSC_match(KW_VARYING)) { field->fld_dtype = dtype_varying; @@ -754,7 +754,7 @@ void SQL_par_field_dtype(gpre_req* request, CPR_s_error(""); } -// Check for array declaration +// Check for array declaration if ((keyword != KW_BLOB) && !is_udf && (MSC_match(KW_L_BRCKET))) { field->fld_array_info = (ary*) MSC_alloc(sizeof(ary)); @@ -783,7 +783,7 @@ void SQL_par_field_dtype(gpre_req* request, CPR_s_error("SET"); if (gpreGlob.token_global.tok_type != tok_ident) CPR_s_error(""); - + gpre_sym* symbol2 = MSC_find_symbol(gpreGlob.token_global.tok_symbol, SYM_charset); if (!symbol2) PAR_error("The named CHARACTER SET was not found"); @@ -807,7 +807,7 @@ void SQL_par_field_dtype(gpre_req* request, && request->req_database && request->req_database->dbb_def_charset) { - // Use database default character set + // Use database default character set gpre_sym* symbol = MSC_find_symbol(HSH_lookup (request->req_database->dbb_def_charset), SYM_charset); @@ -822,10 +822,10 @@ void SQL_par_field_dtype(gpre_req* request, //____________________________________________________________ -// +// // Find procedure for request. If request already has a database, // find the procedure in that database only. -// +// gpre_prc* SQL_procedure(gpre_req* request, const TEXT* prc_string, @@ -851,7 +851,7 @@ gpre_prc* SQL_procedure(gpre_req* request, } gpre_prc* procedure = NULL; - + if (request->req_database) procedure = MET_get_procedure(request->req_database, prc_string, owner_string); @@ -895,10 +895,10 @@ gpre_prc* SQL_procedure(gpre_req* request, //____________________________________________________________ -// +// // Find relation for request. If request already has a database, // find the relation in that database only. -// +// gpre_rel* SQL_relation(gpre_req* request, const TEXT* rel_string, @@ -923,9 +923,9 @@ gpre_rel* SQL_relation(gpre_req* request, SCHAR s[ERROR_LENGTH]; gpre_rel* relation = NULL; - + if (request->req_database) - relation = MET_get_relation(request->req_database, rel_string, + relation = MET_get_relation(request->req_database, rel_string, owner_string); else { /* no database was specified, check the metadata for all the databases @@ -937,7 +937,7 @@ gpre_rel* SQL_relation(gpre_req* request, gpre_rel* tmp_relation = MET_get_relation(db, rel_string, owner_string); if (tmp_relation) { if (relation) { - // relation was found in more than one database + // relation was found in more than one database sprintf(s, "TABLE %s is ambiguous", rel_string); PAR_error(s); @@ -965,9 +965,9 @@ gpre_rel* SQL_relation(gpre_req* request, //____________________________________________________________ -// +// // Get a relation name (checking for database specifier) -// +// void SQL_relation_name(TEXT* r_name, TEXT* db_name, @@ -984,7 +984,7 @@ void SQL_relation_name(TEXT* r_name, if (symbol) { if (strlen(symbol->sym_name) >= unsigned(NAME_SIZE)) PAR_error("Database alias too long"); - + strcpy(db_name, symbol->sym_name); // this is the alias, not the path PAR_get_token(); if (!MSC_match(KW_DOT)) @@ -999,12 +999,12 @@ void SQL_relation_name(TEXT* r_name, PAR_get_token(); if (MSC_match(KW_DOT)) { - // the table name was really a owner specifier + // the table name was really a owner specifier strcpy(owner_name, r_name); SQL_resolve_identifier("", NULL, NAME_SIZE); if (gpreGlob.token_global.tok_length >= NAME_SIZE) PAR_error("TABLE name too long"); - + strcpy(r_name, gpreGlob.token_global.tok_string); PAR_get_token(); } @@ -1012,9 +1012,9 @@ void SQL_relation_name(TEXT* r_name, //____________________________________________________________ -// +// // Extract SQL var -// +// TEXT* SQL_var_or_string(bool string_only) { @@ -1032,9 +1032,9 @@ TEXT* SQL_var_or_string(bool string_only) //____________________________________________________________ -// +// // Handle an SQL alter statement. -// +// static act* act_alter(void) { @@ -1065,14 +1065,14 @@ static act* act_alter(void) default: PAR_error("Invalid ALTER request"); } - return NULL; // silence compiler + return NULL; // silence compiler } //____________________________________________________________ -// +// // Handle an SQL alter database statement -// +// static act* act_alter_database(void) { @@ -1084,7 +1084,7 @@ static act* act_alter_database(void) PAR_get_token(); - // create action block + // create action block act* action = MSC_action(request, ACT_alter_database); action->act_whenever = gen_whenever(); DBB database = (DBB) MSC_alloc(DBB_LEN); @@ -1106,7 +1106,7 @@ static act* act_alter_database(void) #else else PAR_error("only log file can be dropped"); -#endif // FLINT_CACHE +#endif // FLINT_CACHE } else if (MSC_match(KW_ADD)) { if (MSC_match(KW_FILE)) { @@ -1147,7 +1147,7 @@ static act* act_alter_database(void) #ifdef FLINT_CACHE else if (MSC_match(KW_CACHE)) database->dbb_cache_file = define_cache(); -#endif // FLINT_CACHE +#endif // FLINT_CACHE } else if (MSC_match(KW_SET)) { while (true) { @@ -1183,13 +1183,13 @@ static act* act_alter_database(void) //____________________________________________________________ -// -// Handle altering of a domain (global field). -// +// +// Handle altering of a domain (global field). +// static act* act_alter_domain(void) { -// create request block +// create request block gpre_req* request = MSC_request(REQ_ddl); if (gpreGlob.isc_databases && !gpreGlob.isc_databases->dbb_next) @@ -1197,7 +1197,7 @@ static act* act_alter_domain(void) else PAR_error("Can only ALTER a domain in context of single database"); -// create action block +// create action block act* action = MSC_action(request, ACT_alter_domain); @@ -1205,7 +1205,7 @@ static act* act_alter_domain(void) gpre_fld* field = make_field(0); cnstrt** cnstrt_ptr = &field->fld_constraints; -// Check if default value was specified +// Check if default value was specified while (!end_of_command()) { if (MSC_match(KW_SET)) { @@ -1270,9 +1270,9 @@ static act* act_alter_domain(void) //____________________________________________________________ -// +// // Handle an SQL alter index statement. -// +// static act* act_alter_index(void) { @@ -1284,7 +1284,7 @@ static act* act_alter_index(void) SQL_resolve_identifier("", i_name, NAME_SIZE + 1); if (gpreGlob.token_global.tok_length >= NAME_SIZE) PAR_error("Index name too long"); - + PAR_get_token(); IND index = make_index(request, i_name); @@ -1305,9 +1305,9 @@ static act* act_alter_index(void) //____________________________________________________________ -// +// // Handle an SQL alter table statement. -// +// static act* act_alter_table(void) { @@ -1315,30 +1315,30 @@ static act* act_alter_table(void) gpre_req* request = MSC_request(REQ_ddl); -// get table name and create relation block +// get table name and create relation block gpre_rel* relation = par_relation(request); // CHECK Constraints require the context to be set to the -// current relation +// current relation gpre_ctx* context = MSC_context(request); request->req_contexts = context; context->ctx_relation = relation; // Reserve context 1 for relation on which constraint is -// being defined +// being defined context->ctx_internal++; request->req_internal++; -// create action block +// create action block act* action = MSC_action(request, ACT_alter_table); action->act_whenever = gen_whenever(); action->act_object = (REF) relation; -// parse action list and create corresponding field blocks +// parse action list and create corresponding field blocks gpre_fld** ptr = &relation->rel_fields; cnstrt** cnstrt_ptr = &relation->rel_constraints; @@ -1374,7 +1374,7 @@ static act* act_alter_table(void) cnstrt_str->cnstrt_name->str_string, NAME_SIZE + 1); if (gpreGlob.token_global.tok_length >= NAME_SIZE) PAR_error("Constraint name too long"); - + *cnstrt_ptr = cnstrt_str; cnstrt_ptr = &cnstrt_str->cnstrt_next; PAR_get_token(); @@ -1414,23 +1414,23 @@ static act* act_alter_table(void) //____________________________________________________________ -// +// // Handle an SQL comment statement. // Reject -// +// static act* act_comment(void) { PAR_error("SQL COMMENT ON request not allowed"); - return NULL; // silence compiler + return NULL; // silence compiler } //____________________________________________________________ -// +// // Parse a CONNECT statement. -// +// static act* act_connect(void) { @@ -1469,7 +1469,7 @@ static act* act_connect(void) PAR_get_token(); } - // pick up the possible parameters, in any order + // pick up the possible parameters, in any order USHORT buffers = 0; dbb* db = ready->rdy_database; @@ -1481,8 +1481,8 @@ static act* act_connect(void) if (buffers) request = PAR_set_up_dpb_info(ready, action, buffers); - /* if there are any options that take host variables as arguments, - make sure that we generate variables for the request so that the + /* if there are any options that take host variables as arguments, + make sure that we generate variables for the request so that the dpb can be extended at runtime */ if (db->dbb_r_user || db->dbb_r_password || db->dbb_r_sql_role @@ -1511,7 +1511,7 @@ static act* act_connect(void) if (action->act_object) return action; -// No explicit databases -- pick up all known +// No explicit databases -- pick up all known const TEXT* lc_messages = NULL; const TEXT *user = NULL, *password = NULL, *sql_role = NULL; @@ -1542,8 +1542,8 @@ static act* act_connect(void) else request = ready->rdy_request; - /* if there are any options that take host variables as arguments, - make sure that we generate variables for the request so that the + /* if there are any options that take host variables as arguments, + make sure that we generate variables for the request so that the dpb can be extended at runtime */ dbb* db = ready->rdy_database; @@ -1572,9 +1572,9 @@ static act* act_connect(void) //____________________________________________________________ -// +// // Handle an SQL create statement. -// +// static act* act_create(void) { @@ -1625,14 +1625,14 @@ static act* act_create(void) } PAR_error("Invalid CREATE request"); - return NULL; // silence compiler + return NULL; // silence compiler } //____________________________________________________________ -// +// // Handle an SQLish create database statement. -// +// static act* act_create_database(void) { @@ -1643,22 +1643,22 @@ static act* act_create_database(void) ("CREATE DATABASE only allowed in context of a single database"); if (!gpreGlob.isc_databases) { - // generate a dummy db + // generate a dummy db dummy = true; gpreGlob.isc_databases = (DBB) MSC_alloc_permanent(DBB_LEN); - // allocate symbol block + // allocate symbol block gpre_sym* symbol = (gpre_sym*) MSC_alloc_permanent(SYM_LEN); - // make it the default database + // make it the default database symbol->sym_type = SYM_database; symbol->sym_object = (gpre_ctx*) gpreGlob.isc_databases; symbol->sym_string = gpreGlob.database_name; - // database block points to the symbol block + // database block points to the symbol block gpreGlob.isc_databases->dbb_name = symbol; gpreGlob.isc_databases->dbb_filename = NULL; @@ -1667,7 +1667,7 @@ static act* act_create_database(void) else dummy = false; -// get database name +// get database name DBB db = NULL; if (isQuoted(gpreGlob.token_global.tok_type)) { @@ -1682,14 +1682,14 @@ static act* act_create_database(void) else CPR_s_error(""); -// Create a request for generating DYN to add files to database. +// Create a request for generating DYN to add files to database. // gpre_req* request = MSC_request (REQ_create_database); gpre_req* request = MSC_request(REQ_ddl); request->req_flags |= REQ_sql_database_dyn; request->req_database = db; -// create action block +// create action block act* action = MSC_action(request, ACT_create_database); @@ -1699,17 +1699,17 @@ static act* act_create_database(void) action->act_whenever = gen_whenever(); if (dummy) { - // Create a ACT_database action + // Create a ACT_database action action->act_rest = MSC_action(0, ACT_database); action->act_rest->act_flags |= ACT_mark; } -// Get optional specifications +// Get optional specifications bool extend_dpb = tail_database(ACT_create_database, db); -// Create a request to generate dpb +// Create a request to generate dpb gpreGlob.ada_flags |= gpreGlob.ADA_create_database; @@ -1725,13 +1725,13 @@ static act* act_create_database(void) //____________________________________________________________ -// -// Handle creation of a domain (global field). -// +// +// Handle creation of a domain (global field). +// static act* act_create_domain(void) { -// create request block +// create request block gpre_req* request = MSC_request(REQ_ddl); if (gpreGlob.isc_databases && !gpreGlob.isc_databases->dbb_next) @@ -1739,7 +1739,7 @@ static act* act_create_domain(void) else PAR_error("Can only CREATE DOMAIN in context of single database"); -// create action block +// create action block act* action = MSC_action(request, ACT_create_domain); @@ -1747,7 +1747,7 @@ static act* act_create_domain(void) MSC_match(KW_AS); SQL_par_field_dtype(request, field, false); -// Check if default value was specified +// Check if default value was specified if (gpreGlob.token_global.tok_keyword == KW_DEFAULT) { field->fld_default_source = CPR_start_text(); @@ -1773,7 +1773,7 @@ static act* act_create_domain(void) } -// Check for any column level constraints +// Check for any column level constraints cnstrt** cnstrt_ptr = &field->fld_constraints; bool in_constraints = true; @@ -1804,9 +1804,9 @@ static act* act_create_domain(void) //____________________________________________________________ -// +// // Handle an SQL create generator statement -// +// static act* act_create_generator(void) { @@ -1814,7 +1814,7 @@ static act* act_create_generator(void) SQL_resolve_identifier("", generator_name, NAME_SIZE + 1); if (gpreGlob.token_global.tok_length >= NAME_SIZE) PAR_error("Generator name too long"); - + gpre_req* request = MSC_request(REQ_ddl); if (gpreGlob.isc_databases && !gpreGlob.isc_databases->dbb_next) request->req_database = gpreGlob.isc_databases; @@ -1832,18 +1832,18 @@ static act* act_create_generator(void) //____________________________________________________________ -// +// // Handle an SQL create index statement. -// +// static act* act_create_index(bool dups, bool descending) { -// create request block +// create request block gpre_req* request = MSC_request(REQ_ddl); -// get index and table names and create index and relation blocks +// get index and table names and create index and relation blocks SCHAR i_name[NAME_SIZE + 1]; SQL_resolve_identifier("", i_name, NAME_SIZE + 1); @@ -1862,13 +1862,13 @@ static act* act_create_index(bool dups, index->ind_flags |= dups ? IND_dup_flag : 0; index->ind_flags |= descending ? IND_descend : 0; -// create action block +// create action block act* action = MSC_action(request, ACT_create_index); action->act_whenever = gen_whenever(); action->act_object = (REF) index; -// parse field list and create corresponding field blocks +// parse field list and create corresponding field blocks EXP_left_paren(0); gpre_fld** ptr = &index->ind_fields; @@ -1887,9 +1887,9 @@ static act* act_create_index(bool dups, //____________________________________________________________ -// +// // Handle an SQL create shadow statement -// +// static act* act_create_shadow(void) { @@ -1945,9 +1945,9 @@ static act* act_create_shadow(void) //____________________________________________________________ -// +// // Handle an SQL create table statement. -// +// static act* act_create_table(void) { @@ -1967,22 +1967,22 @@ static act* act_create_table(void) CPR_s_error(""); if (!check_filename(string)) - PAR_error("node name not permitted"); // a node name is not permitted in external file name + PAR_error("node name not permitted"); // a node name is not permitted in external file name } // CHECK Constraints require the context to be set to the -// current relation +// current relation gpre_ctx* context = MSC_context(request); request->req_contexts = context; context->ctx_relation = relation; // Reserve context 1 for relation on which constraint is -// being defined +// being defined context->ctx_internal++; request->req_internal++; -// create action block +// create action block act* action = MSC_action(request, ACT_create_table); action->act_whenever = gen_whenever(); @@ -2004,7 +2004,7 @@ static act* act_create_table(void) break; default: - // parse field list and create corresponding field blocks + // parse field list and create corresponding field blocks *ptr = par_field(request, relation); ptr = &(*ptr)->fld_next; @@ -2019,22 +2019,22 @@ static act* act_create_table(void) //____________________________________________________________ -// +// // Handle an SQL create view statement. -// +// static act* act_create_view(void) { gpre_req* request = MSC_request(REQ_ddl); gpre_rel* relation = par_relation(request); -// create action block +// create action block act* action = MSC_action(request, ACT_create_view); action->act_whenever = gen_whenever(); action->act_object = (REF) relation; -// if field list is present parse it and create corresponding field blocks +// if field list is present parse it and create corresponding field blocks if (MSC_match(KW_LEFT_PAREN)) { gpre_fld** ptr = &relation->rel_fields; @@ -2047,7 +2047,7 @@ static act* act_create_view(void) } } -// skip 'AS SELECT' +// skip 'AS SELECT' if (!MSC_match(KW_AS)) CPR_s_error("AS"); @@ -2056,11 +2056,11 @@ static act* act_create_view(void) if (!MSC_match(KW_SELECT)) CPR_s_error("SELECT"); -// reserve context variable 0 for view +// reserve context variable 0 for view request->req_internal++; -// parse the view SELECT +// parse the view SELECT gpre_rse* select = SQE_select(request, true); relation->rel_view_rse = select; @@ -2081,11 +2081,11 @@ static act* act_create_view(void) //____________________________________________________________ -// -// Recognize BEGIN/END DECLARE SECTION, +// +// Recognize BEGIN/END DECLARE SECTION, // and mark it as a good place to put miscellaneous // global routine stuff. -// +// static act* act_d_section( enum act_t type) { @@ -2104,21 +2104,21 @@ static act* act_d_section( enum act_t type) gpreGlob.cur_routine = action; // Hmm, global var. if (!gpreGlob.isc_databases) { - // allocate database block and link to db chain + // allocate database block and link to db chain gpreGlob.isc_databases = (DBB) MSC_alloc_permanent(DBB_LEN); - // allocate symbol block + // allocate symbol block gpre_sym* symbol = (gpre_sym*) MSC_alloc_permanent(SYM_LEN); - // make it a database, specifically this one + // make it a database, specifically this one symbol->sym_type = SYM_database; symbol->sym_object = (gpre_ctx*) gpreGlob.isc_databases; symbol->sym_string = gpreGlob.database_name; - // database block points to the symbol block + // database block points to the symbol block gpreGlob.isc_databases->dbb_name = symbol; gpreGlob.isc_databases->dbb_filename = NULL; @@ -2155,16 +2155,16 @@ static act* act_d_section( enum act_t type) //____________________________________________________________ -// +// // Parse the SQL cursor declaration. -// +// static act* act_declare(void) { DBB db = NULL; if (gpreGlob.token_global.tok_symbol && (gpreGlob.token_global.tok_symbol->sym_type == SYM_database)) { - // must be a database specifier in a DECLARE TABLE statement + // must be a database specifier in a DECLARE TABLE statement db = (DBB) gpreGlob.token_global.tok_symbol->sym_object; PAR_get_token(); @@ -2293,14 +2293,14 @@ static act* act_declare(void) } CPR_s_error("CURSOR, STATEMENT or TABLE"); } - return NULL; // silence compiler + return NULL; // silence compiler } //____________________________________________________________ -// +// // Handle an SQL declare filter statement -// +// static act* act_declare_filter(void) { @@ -2320,7 +2320,7 @@ static act* act_declare_filter(void) PAR_get_token(); -// create action block +// create action block act* action = MSC_action(request, ACT_declare_filter); action->act_whenever = gen_whenever(); action->act_object = (REF) filter; @@ -2358,9 +2358,9 @@ static act* act_declare_filter(void) //____________________________________________________________ -// +// // Handle an SQL declare table statement. -// +// static act* act_declare_table( gpre_sym* symbol, DBB db) { @@ -2369,7 +2369,7 @@ static act* act_declare_table( gpre_sym* symbol, DBB db) gpre_req* request = (gpre_req*) MSC_alloc(REQ_LEN); request->req_type = REQ_ddl; -// create relation block +// create relation block gpre_rel* relation = make_relation(0, symbol->sym_string); @@ -2385,11 +2385,11 @@ static act* act_declare_table( gpre_sym* symbol, DBB db) dbkey->fld_flags |= FLD_dbkey | FLD_text | FLD_charset; dbkey->fld_ttype = ttype_binary; -// if relation name already in incore metadata, remove it & its fields +// if relation name already in incore metadata, remove it & its fields gpre_sym* old_symbol = HSH_lookup(relation->rel_symbol->sym_string); - while (old_symbol) + while (old_symbol) { if (old_symbol->sym_type == SYM_relation) { gpre_rel* tmp_relation = (gpre_rel*) old_symbol->sym_object; @@ -2408,18 +2408,18 @@ static act* act_declare_table( gpre_sym* symbol, DBB db) old_symbol = old_symbol->sym_homonym; } -// add new symbol to incore metadata +// add new symbol to incore metadata HSH_insert(relation->rel_symbol); -// create action block +// create action block act* action = (act*) MSC_alloc(ACT_LEN); action->act_type = ACT_noop; action->act_object = (REF) relation; -// parse field list and create corresponding field blocks -// include size information for message length calculations +// parse field list and create corresponding field blocks +// include size information for message length calculations PAR_get_token(); EXP_left_paren(0); @@ -2446,9 +2446,9 @@ static act* act_declare_table( gpre_sym* symbol, DBB db) //____________________________________________________________ -// +// // Handle an SQL declare external statement -// +// static act* act_declare_udf(void) { @@ -2465,11 +2465,11 @@ static act* act_declare_udf(void) SQL_resolve_identifier("", udf_name, NAME_SIZE + 1); if (gpreGlob.token_global.tok_length >= NAME_SIZE) PAR_error("External function name too long"); - + udf_declaration->decl_udf_name = udf_name; PAR_get_token(); -// create action block +// create action block act* action = MSC_action(request, ACT_declare_udf); action->act_whenever = gen_whenever(); action->act_object = (REF) udf_declaration; @@ -2524,11 +2524,11 @@ static act* act_declare_udf(void) //____________________________________________________________ -// +// // Parse an update action. This is a little more complicated // because SQL confuses the update of a cursor with a mass update. // The syntax, and therefor the code, I fear, is a mess. -// +// static act* act_delete(void) { @@ -2540,18 +2540,18 @@ static act* act_delete(void) CPR_s_error("FROM"); // First comes the relation. Unfortunately, there is no way to identify -// its database until the cursor is known. Sigh. Save the token. +// its database until the cursor is known. Sigh. Save the token. TEXT r_name[NAME_SIZE], db_name[NAME_SIZE], owner_name[NAME_SIZE]; SQL_relation_name(r_name, db_name, owner_name); -// Parse the optional alias (context variable) +// Parse the optional alias (context variable) gpre_sym* alias = (gpreGlob.token_global.tok_symbol) ? NULL : PAR_symbol(SYM_dummy); // Now the moment of truth. If the next few tokens are WHERE CURRENT OF // then this is a sub-action of an existing request. If not, then it is -// a free standing request +// a free standing request gpre_req* request = MSC_request(REQ_mass_update); upd* update = (upd*) MSC_alloc(UPD_LEN); @@ -2570,7 +2570,7 @@ static act* act_delete(void) { if (transaction) PAR_error("different transaction for select and delete"); - else { // does not specify transaction clause in + else { // does not specify transaction clause in // "delete ... where current of cursor" stmt const size_t trans_nm_len = strlen(request->req_trans); char* str_2 = (char*) MSC_alloc(trans_nm_len + 1); @@ -2603,7 +2603,7 @@ static act* act_delete(void) // How amusing. After all that work, it wasn't a sub-action at all. // Neat. Take the pieces and build a complete request. Start by -// figuring out what database is involved. +// figuring out what database is involved. gpre_rel* relation = SQL_relation(request, r_name, db_name, owner_name, true); @@ -2640,10 +2640,10 @@ static act* act_delete(void) //____________________________________________________________ -// +// // Handle an SQL describe statement. // Reject -// +// static act* act_describe(void) { @@ -2659,7 +2659,7 @@ static act* act_describe(void) DYN statement = par_statement(); if (!MSC_match(KW_INTO)) { - /* check for SQL2 syntax + /* check for SQL2 syntax "USING SQL DESCRIPTOR sqlda" */ if (!MSC_match(KW_USING) || !MSC_match(KW_SQL) || !MSC_match(KW_DESCRIPTOR)) @@ -2682,9 +2682,9 @@ static act* act_describe(void) //____________________________________________________________ -// +// // Parse a FINISH statement. -// +// static act* act_disconnect(void) { @@ -2723,9 +2723,9 @@ static act* act_disconnect(void) //____________________________________________________________ -// +// // Handle an SQL drop statement. -// +// static act* act_drop(void) { @@ -2770,7 +2770,7 @@ static act* act_drop(void) SQL_resolve_identifier("", identifier_name, NAME_SIZE + 1); if (gpreGlob.token_global.tok_length >= NAME_SIZE) PAR_error("Domain name too long"); - + action = MSC_action(request, ACT_drop_domain); action->act_whenever = gen_whenever(); action->act_object = (REF) identifier_name; @@ -2788,7 +2788,7 @@ static act* act_drop(void) SQL_resolve_identifier("", identifier_name, NAME_SIZE + 1); if (gpreGlob.token_global.tok_length >= NAME_SIZE) PAR_error("Filter name too long"); - + action = MSC_action(request, ACT_drop_filter); action->act_whenever = gen_whenever(); action->act_object = (REF) identifier_name; @@ -2811,7 +2811,7 @@ static act* act_drop(void) SQL_resolve_identifier("", identifier_name, NAME_SIZE + 1); if (gpreGlob.token_global.tok_length >= NAME_SIZE) PAR_error("External function name too long"); - + action = MSC_action(request, ACT_drop_udf); action->act_whenever = gen_whenever(); action->act_object = (REF) identifier_name; @@ -2825,7 +2825,7 @@ static act* act_drop(void) SQL_resolve_identifier("", NULL, NAME_SIZE + 1); if (gpreGlob.token_global.tok_length >= NAME_SIZE) PAR_error("Index name too long"); - + IND index = make_index(request, gpreGlob.token_global.tok_string); action = MSC_action(request, ACT_drop_index); action->act_whenever = gen_whenever(); @@ -2881,14 +2881,14 @@ static act* act_drop(void) default: PAR_error("Invalid DROP request"); } - return NULL; // silence compiler + return NULL; // silence compiler } //____________________________________________________________ -// +// // Handle an SQL event statement -// +// static act* act_event(void) { @@ -2906,17 +2906,17 @@ static act* act_event(void) //____________________________________________________________ -// +// // Handle an SQL execute statement. // Reject -// +// static act* act_execute(void) { if (MSC_match(KW_PROCEDURE)) return act_procedure(); -// EXECUTE IMMEDIATE is a different sort of duck +// EXECUTE IMMEDIATE is a different sort of duck if (MSC_match(KW_IMMEDIATE)) { if (gpreGlob.isc_databases && gpreGlob.isc_databases->dbb_next) { @@ -2954,7 +2954,7 @@ static act* act_execute(void) return action; } -// Ordinary form of EXECUTE +// Ordinary form of EXECUTE const TEXT* transaction; par_options(&transaction); @@ -2976,13 +2976,13 @@ static act* act_execute(void) //____________________________________________________________ -// +// // Parse the SQL fetch statement. -// +// static act* act_fetch(void) { -// Handle dynamic SQL statement, if appropriate +// Handle dynamic SQL statement, if appropriate DYN cursor = par_dynamic_cursor(); if (cursor) { @@ -3006,10 +3006,10 @@ static act* act_fetch(void) return action; } -// Statement is static SQL +// Statement is static SQL #ifdef SCROLLABLE_CURSORS -// parse the fetch orientation +// parse the fetch orientation USHORT direction = blr_forward; const TEXT* direction_string = NULL; @@ -3048,10 +3048,10 @@ static act* act_fetch(void) gpre_req* request = par_cursor(NULL); #ifdef SCROLLABLE_CURSORS -// if scrolling is required, set up the offset and direction parameters -// to be passed to the running request via the asynchronous message-- -// there could be multiple FETCH statements, so we need to store multiple -// value blocks, one for each FETCH statement +// if scrolling is required, set up the offset and direction parameters +// to be passed to the running request via the asynchronous message-- +// there could be multiple FETCH statements, so we need to store multiple +// value blocks, one for each FETCH statement if (direction != blr_forward) { if (!(request->req_flags & REQ_scroll)) @@ -3129,18 +3129,18 @@ static act* act_fetch(void) //____________________________________________________________ -// +// // Parse an SQL grant or revoke statement. Set up grant/revoke // blocks, fill in all of the privilege information, and // attach them to an action block of type GRANT or REVOKE. -// +// static act* act_grant_revoke( enum act_t type) { gpre_req* request = MSC_request(REQ_ddl); PRV priv_block = MSC_privilege_block(); -// if it is revoke action, parse the optional grant option for +// if it is revoke action, parse the optional grant option for if (type == ACT_dyn_revoke) { if (MSC_match(KW_GRANT)) { @@ -3155,7 +3155,7 @@ static act* act_grant_revoke( enum act_t type) bool execute_priv = false; if (MSC_match(KW_ALL)) { - MSC_match(KW_PRIVILEGES); // Keyword 'privileges' is optional + MSC_match(KW_PRIVILEGES); // Keyword 'privileges' is optional priv_block->prv_privileges = PRV_all; } else if (MSC_match(KW_EXECUTE)) { @@ -3179,7 +3179,7 @@ static act* act_grant_revoke( enum act_t type) SQL_resolve_identifier("", col_name, NAME_SIZE + 1); if (gpreGlob.token_global.tok_length >= NAME_SIZE) PAR_error("Field name too long"); - + STR field_name = (STR) MSC_string(col_name); MSC_push((GPRE_NOD) field_name, fields); fields = &(*fields)->lls_next; @@ -3212,7 +3212,7 @@ static act* act_grant_revoke( enum act_t type) priv_block->prv_object_dyn = isc_dyn_prc_name; } else { - MSC_match(KW_TABLE); // filler word + MSC_match(KW_TABLE); // filler word SQL_relation_name(r_name, db_name, owner_name); gpre_rel* relation = SQL_relation(request, r_name, db_name, owner_name, true); relation_name = (STR) MSC_string(r_name); @@ -3292,7 +3292,7 @@ static act* act_grant_revoke( enum act_t type) break; } -// If this is a grant, do we have the optional WITH GRANT OPTION specification? +// If this is a grant, do we have the optional WITH GRANT OPTION specification? if ((type == ACT_dyn_grant) && grant_option_legal) { @@ -3305,7 +3305,7 @@ static act* act_grant_revoke( enum act_t type) } } -// create action block +// create action block act* action = MSC_action(request, type); action->act_next = 0; @@ -3314,7 +3314,7 @@ static act* act_grant_revoke( enum act_t type) bool first = true; for (user = usernames; user; user = user->usn_next) { - // create and fill privilege block + // create and fill privilege block priv_block = MSC_privilege_block(); priv_block->prv_username = user->usn_name; @@ -3339,8 +3339,8 @@ static act* act_grant_revoke( enum act_t type) //____________________________________________________________ -// -// +// +// static act* act_include(void) { @@ -3352,21 +3352,21 @@ static act* act_include(void) gpreGlob.cur_routine = action; // Hmm, global var if (!gpreGlob.isc_databases) { - // allocate database block and link to db chain + // allocate database block and link to db chain gpreGlob.isc_databases = (DBB) MSC_alloc_permanent(DBB_LEN); - // allocate symbol block + // allocate symbol block gpre_sym* symbol = (gpre_sym*) MSC_alloc_permanent(SYM_LEN); - // make it a database, specifically this one + // make it a database, specifically this one symbol->sym_type = SYM_database; symbol->sym_object = (gpre_ctx*) gpreGlob.isc_databases; symbol->sym_string = gpreGlob.database_name; - // database block points to the symbol block + // database block points to the symbol block gpreGlob.isc_databases->dbb_name = symbol; gpreGlob.isc_databases->dbb_filename = NULL; @@ -3386,9 +3386,9 @@ static act* act_include(void) //____________________________________________________________ -// +// // Process SQL INSERT statement. -// +// static act* act_insert(void) { @@ -3409,7 +3409,7 @@ static act* act_insert(void) int count = 0, count2 = 0; gpre_lls* fields = NULL; -// Pick up a field list +// Pick up a field list if (!MSC_match(KW_LEFT_PAREN)) { GPRE_NOD list = MET_fields(context); @@ -3423,14 +3423,14 @@ static act* act_insert(void) if (node->nod_type == nod_array) { node->nod_type = nod_field; - // Make sure no subscripts are specified + // Make sure no subscripts are specified if (node->nod_arg[1]) { PAR_error("Partial insert of arrays not permitted"); } } - // Dialect 1 program may not insert new datatypes + // Dialect 1 program may not insert new datatypes if ((SQL_DIALECT_V5 == gpreGlob.sw_sql_dialect) && (nod_field == node->nod_type)) { @@ -3453,7 +3453,7 @@ static act* act_insert(void) gpre_lls* values = NULL; if (MSC_match(KW_VALUES)) { - // Now pick up a value list + // Now pick up a value list EXP_left_paren(0); for (;;) { @@ -3467,7 +3467,7 @@ static act* act_insert(void) } EXP_match_paren(); - // Make an assignment list + // Make an assignment list if (count != count2) PAR_error("count of values doesn't match count of columns"); @@ -3496,7 +3496,7 @@ static act* act_insert(void) // OK, we've got a mass insert on our hands. Start by picking // up the select statement. First, however, remove the INSERT -// context to avoid resolving SELECT fields to the insert relation. +// context to avoid resolving SELECT fields to the insert relation. request->req_type = REQ_mass_update; request->req_contexts = NULL; @@ -3506,7 +3506,7 @@ static act* act_insert(void) context->ctx_next = request->req_contexts; request->req_contexts = context; -// Build an assignment list from select expressions into target list +// Build an assignment list from select expressions into target list GPRE_NOD select_list = select->rse_fields; @@ -3540,15 +3540,15 @@ static act* act_insert(void) //____________________________________________________________ -// +// // Process SQL INSERT statement. -// +// // Do I miss anything here? The parameter is not used! // TEXT is supposedly to be transaction. static act* act_insert_blob(const TEXT* transaction) { -// Handle dynamic SQL statement, if appropriate +// Handle dynamic SQL statement, if appropriate DYN cursor = par_dynamic_cursor(); if (cursor) { @@ -3566,7 +3566,7 @@ static act* act_insert_blob(const TEXT* transaction) return action; } -// Statement is static SQL +// Statement is static SQL gpre_req* request = par_cursor(NULL); if (request->req_flags & REQ_sql_blob_open) @@ -3589,23 +3589,23 @@ static act* act_insert_blob(const TEXT* transaction) //____________________________________________________________ -// +// // Handle an SQL lock statement. // Reject -// +// static act* act_lock(void) { PAR_error("SQL LOCK TABLE request not allowed"); - return NULL; // silence compiler + return NULL; // silence compiler } //____________________________________________________________ -// +// // Handle the SQL actions OPEN and CLOSE cursors. -// +// static act* act_openclose( enum act_t type) { @@ -3614,7 +3614,7 @@ static act* act_openclose( enum act_t type) if (type == ACT_open) par_options(&transaction); -// Handle dynamic SQL statement, if appropriate +// Handle dynamic SQL statement, if appropriate DYN cursor = par_dynamic_cursor(); if (cursor) { @@ -3637,7 +3637,7 @@ static act* act_openclose( enum act_t type) return action; } -// Statement is static SQL +// Statement is static SQL gpre_sym* symbol = NULL; gpre_req* request = par_cursor(&symbol); @@ -3679,17 +3679,17 @@ static act* act_openclose( enum act_t type) //____________________________________________________________ -// +// // Parse an "open blob" type statement. // These include READ BLOB and INSERT BLOB. -// +// static act* act_open_blob( ACT_T act_op, gpre_sym* symbol) { if (!MSC_match(KW_BLOB)) CPR_s_error("BLOB"); -// if the token isn't an identifier, complain +// if the token isn't an identifier, complain TOK f_token = (TOK) MSC_alloc(TOK_LEN); f_token->tok_length = gpreGlob.token_global.tok_length; @@ -3698,7 +3698,7 @@ static act* act_open_blob( ACT_T act_op, gpre_sym* symbol) SQL_resolve_identifier("", f_token->tok_string, f_token->tok_length + 1); if (gpreGlob.token_global.tok_length >= NAME_SIZE) PAR_error("Field name too long"); - + CPR_token(); if (act_op == ACT_blob_open) { @@ -3805,7 +3805,7 @@ static act* act_open_blob( ACT_T act_op, gpre_sym* symbol) else blob->blb_to_charset = CS_dynamic; } - else { // No FILTER keyword seen + else { // No FILTER keyword seen /* * Even if no FILTER was specified, we set one up for the special @@ -3849,9 +3849,9 @@ static act* act_open_blob( ACT_T act_op, gpre_sym* symbol) //____________________________________________________________ -// +// // Handle an SQL prepare statement. -// +// static act* act_prepare(void) { @@ -3903,9 +3903,9 @@ static act* act_prepare(void) //____________________________________________________________ -// +// // Handle the EXECUTE PROCEDURE statement. -// +// static act* act_procedure(void) { @@ -3916,7 +3916,7 @@ static act* act_procedure(void) SQL_relation_name(p_name, db_name, owner_name); gpre_prc* procedure = SQL_procedure(request, p_name, db_name, owner_name, true); - + gpre_lls* values = NULL; SSHORT inputs = 0; @@ -3947,7 +3947,7 @@ static act* act_procedure(void) SSHORT outputs = 0; if (MSC_match(KW_RETURNING)) { - // parse output references + // parse output references const bool paren = MSC_match(KW_LEFT_PAREN); gpre_fld* field = procedure->prc_outputs; @@ -3982,7 +3982,7 @@ static act* act_procedure(void) return action; } //____________________________________________________________ -// +// // Parse a RELEASE_REQUESTS statement // static act* act_release(void) @@ -4000,9 +4000,9 @@ static act* act_release(void) return action; } //____________________________________________________________ -// +// // Handle the stand alone SQL select statement. -// +// static act* act_select(void) { @@ -4030,9 +4030,9 @@ static act* act_select(void) //____________________________________________________________ -// +// // Parse a SET -// +// static act* act_set(const TEXT* base_directory) { @@ -4059,14 +4059,14 @@ static act* act_set(const TEXT* base_directory) CPR_s_error ("TRANSACTION, NAMES, SCHEMA, DATABASE, GENERATOR, DIALECT or STATISTICS"); - return NULL; // silence compiler + return NULL; // silence compiler } //____________________________________________________________ -// +// // Parse a SET SQL DIALECT -// +// static act* act_set_dialect(void) { @@ -4098,7 +4098,7 @@ static act* act_set_dialect(void) action->act_object = (REF) MSC_alloc(SDT_LEN); ((SDT) action->act_object)->sdt_dialect = dialect; -// Needed because subsequent parsing pass1 looks at sw_Sql_dialect value +// Needed because subsequent parsing pass1 looks at sw_Sql_dialect value gpreGlob.sw_sql_dialect = dialect; gpreGlob.dialect_specified = true; @@ -4108,14 +4108,14 @@ static act* act_set_dialect(void) //____________________________________________________________ -// +// // Parse a SET generator -// +// static act* act_set_generator(void) { gpre_req* request = MSC_request(REQ_set_generator); - + if (gpreGlob.isc_databases && !gpreGlob.isc_databases->dbb_next) request->req_database = gpreGlob.isc_databases; else @@ -4126,7 +4126,7 @@ static act* act_set_generator(void) SQL_resolve_identifier("", setgen->sgen_name, NAME_SIZE + 1); if (gpreGlob.token_global.tok_length >= NAME_SIZE) PAR_error("Generator name too long"); - + if (!MET_generator(setgen->sgen_name, request->req_database)) { SCHAR s[ERROR_LENGTH]; fb_utils::snprintf(s, sizeof(s), @@ -4155,9 +4155,9 @@ static act* act_set_generator(void) //____________________________________________________________ -// +// // Parse a SET NAMES ; -// +// static act* act_set_names(void) { @@ -4185,8 +4185,8 @@ static act* act_set_names(void) } } else if (gpreGlob.token_global.tok_type == tok_ident) { - // User is specifying the name of a character set - // Make this the compile time character set + // User is specifying the name of a character set + // Make this the compile time character set TEXT* value = (TEXT*) MSC_alloc(gpreGlob.token_global.tok_length + 1); MSC_copy(gpreGlob.token_global.tok_string, gpreGlob.token_global.tok_length, value); @@ -4230,9 +4230,9 @@ static act* act_set_names(void) //____________________________________________________________ -// +// // Parse a SET statistics -// +// static act* act_set_statistics(void) { @@ -4250,7 +4250,7 @@ static act* act_set_statistics(void) SQL_resolve_identifier("", stats->sts_name->str_string, NAME_SIZE + 1); if (gpreGlob.token_global.tok_length >= NAME_SIZE) PAR_error("Index name too long"); - + PAR_get_token(); } else @@ -4263,9 +4263,9 @@ static act* act_set_statistics(void) //____________________________________________________________ -// +// // Generate a set transaction -// +// static act* act_set_transaction(void) { @@ -4274,7 +4274,7 @@ static act* act_set_transaction(void) if (MSC_match(KW_NAME)) trans->tra_handle = PAR_native_value(false, true); -// Get all the transaction parameters +// Get all the transaction parameters while (true) { if (MSC_match(KW_ISOLATION)) { @@ -4314,7 +4314,7 @@ static act* act_set_transaction(void) break; } -// send out for the list of reserved relations +// send out for the list of reserved relations if (MSC_match(KW_RESERVING)) { trans->tra_flags |= TRA_rrl; @@ -4337,9 +4337,9 @@ static act* act_set_transaction(void) //____________________________________________________________ -// +// // Generate a COMMIT, FINISH, or ROLLBACK. -// +// static act* act_transaction( enum act_t type) { @@ -4376,11 +4376,11 @@ static act* act_transaction( enum act_t type) //____________________________________________________________ -// +// // Parse an update action. This is a little more complicated // because SQL confuses the update of a cursor with a mass update. // The syntax, and therefor the code, I fear, is a mess. -// +// static act* act_update(void) { @@ -4389,16 +4389,16 @@ static act* act_update(void) par_options(&transaction); // First comes the relation. Unfortunately, there is no way to identify -// its database until the cursor is known. Sigh. Save the token. +// its database until the cursor is known. Sigh. Save the token. SCHAR r_name[NAME_SIZE], db_name[NAME_SIZE], owner_name[NAME_SIZE]; SQL_relation_name(r_name, db_name, owner_name); -// Parse the optional alias (context variable) +// Parse the optional alias (context variable) gpre_sym* alias = (gpreGlob.token_global.tok_symbol) ? NULL : PAR_symbol(SYM_dummy); -// Now we need the SET list list. Do this thru a linked list stack +// Now we need the SET list list. Do this thru a linked list stack if (!MSC_match(KW_SET)) CPR_s_error("SET"); @@ -4440,7 +4440,7 @@ static act* act_update(void) // Now the moment of truth. If the next few tokens are WHERE CURRENT OF // then this is a sub-action of an existing request. If not, then it is -// a free standing request +// a free standing request const bool where = MSC_match(KW_WITH); if (where && MSC_match(KW_CURRENT)) { @@ -4463,8 +4463,8 @@ static act* act_update(void) { if (transaction) PAR_error("different transaction for select and update"); - else { // does not specify transaction clause in - // "update ... where cuurent of cursor" stmt + else { // does not specify transaction clause in + // "update ... where cuurent of cursor" stmt SSHORT trans_nm_len = strlen(request->req_trans); SCHAR* str_2 = (SCHAR *) MSC_alloc(trans_nm_len + 1); transaction = str_2; @@ -4477,7 +4477,7 @@ static act* act_update(void) request->req_trans = transaction; relation = SQL_relation(request, r_name, db_name, owner_name, true); - // Given the target relation, find the input context for the modify + // Given the target relation, find the input context for the modify gpre_rse* select = request->req_rse; SSHORT i; @@ -4490,7 +4490,7 @@ static act* act_update(void) if (i == select->rse_count) PAR_error("table not in request"); - // Resolve input fields first + // Resolve input fields first if (alias) { alias->sym_type = SYM_context; @@ -4513,7 +4513,7 @@ static act* act_update(void) act* action = MSC_action(request, ACT_update); - // Resolve update fields next + // Resolve update fields next if (alias) alias->sym_object = update_context; @@ -4528,7 +4528,7 @@ static act* act_update(void) if (slice_action && (slice = (slc*) slice_action->act_object)) { - // These gpreGlob.requests got lost in freeing the main request + // These gpreGlob.requests got lost in freeing the main request gpre_req* slice_request = slice_action->act_request; slice_request->req_next = gpreGlob.requests; @@ -4577,9 +4577,9 @@ static act* act_update(void) // How amusing. After all that work, it wasn't a sub-action at all. // Neat. Take the pieces and build a complete request. Start by -// figuring out what database is involved. +// figuring out what database is involved. -// Generate record select expression, then resolve input values +// Generate record select expression, then resolve input values gpre_rse* select = (gpre_rse*) MSC_alloc(RSE_LEN(1)); request->req_rse = select; @@ -4587,7 +4587,7 @@ static act* act_update(void) select->rse_context[0] = input_context; if (!alias && !gpreGlob.token_global.tok_symbol) - // may have a relation name put parser didn't know it when it parsed it + // may have a relation name put parser didn't know it when it parsed it gpreGlob.token_global.tok_symbol = HSH_lookup(gpreGlob.token_global.tok_string); for (ptr = set_list->nod_arg; ptr < end_list; ptr++) { @@ -4595,12 +4595,12 @@ static act* act_update(void) SQE_resolve(set_item->nod_arg[0], request, select); } -// Process boolean, if any +// Process boolean, if any if (where) select->rse_boolean = SQE_boolean(request, 0); -// Resolve update fields to update context +// Resolve update fields to update context gpre_ctx* update_context = MSC_context(request); request->req_update = update_context; @@ -4616,7 +4616,7 @@ static act* act_update(void) act* slice_action = (act*) field_ref->ref_slice; if (slice_action) { - // Slices not allowed in searched updates + // Slices not allowed in searched updates PAR_error("Updates of slices not allowed in searched updates"); } @@ -4657,16 +4657,16 @@ static act* act_update(void) //____________________________________________________________ -// +// // Handle an SQL whenever statement. This is declaratory, // rather than a significant action. -// +// static act* act_whenever(void) { global_whenever_list = NULL; // global var -// Pick up condition +// Pick up condition USHORT condition; if (MSC_match(KW_SQLERROR)) @@ -4678,7 +4678,7 @@ static act* act_whenever(void) else CPR_s_error("WHENEVER condition"); -// Pick up action +// Pick up action swe* label; if (MSC_match(KW_CONTINUE)) @@ -4702,7 +4702,7 @@ static act* act_whenever(void) else CPR_s_error("GO TO or CONTINUE"); -// Set up condition vector +// Set up condition vector global_whenever[condition] = label; @@ -4715,10 +4715,10 @@ static act* act_whenever(void) //____________________________________________________________ -// +// // Make sure that a file path doesn't contain a // Decnet node name. -// +// static bool check_filename(const TEXT * name) { @@ -4743,9 +4743,9 @@ static bool check_filename(const TEXT * name) //____________________________________________________________ -// +// // Parse connect options -// +// static void connect_opts( const TEXT** user, @@ -4769,7 +4769,7 @@ static void connect_opts( // reserve extra bytes for quotes and NULL //TEXT* s = (TEXT*) MSC_alloc(gpreGlob.token_global.tok_length + 3); TEXT* s = (TEXT*) MSC_alloc(NAME_SIZE + 2); - + SQL_resolve_identifier("", s + 1, NAME_SIZE); s[0] = '\"'; strcat(s, "\""); @@ -4788,9 +4788,9 @@ static void connect_opts( #ifdef FLINT_CACHE //____________________________________________________________ -// +// // Add a shared cache to an existing database. -// +// static FIL define_cache(void) { @@ -4804,7 +4804,7 @@ static FIL define_cache(void) else CPR_s_error(""); if (!check_filename(file->fil_name)) - PAR_error("node name not permitted"); // a node name is not permitted in a shared cache file name + PAR_error("node name not permitted"); // a node name is not permitted in a shared cache file name if (MSC_match(KW_LENGTH)) { file->fil_length = EXP_ULONG_ordinal(true); @@ -4824,9 +4824,9 @@ static FIL define_cache(void) #endif //____________________________________________________________ -// +// // Add a new file to an existing database. -// +// static FIL define_file(void) { @@ -4842,7 +4842,7 @@ static FIL define_file(void) CPR_s_error(""); if (!check_filename(file->fil_name)) - PAR_error("node name not permitted"); // A node name is not permitted in a shadow or secondary file name + PAR_error("node name not permitted"); // A node name is not permitted in a shadow or secondary file name while (true) { if (MSC_match(KW_LENGTH)) { @@ -4865,9 +4865,9 @@ static FIL define_file(void) //____________________________________________________________ -// -// define a log file -// +// +// define a log file +// static FIL define_log_file(bool log_serial) { @@ -4882,7 +4882,7 @@ static FIL define_log_file(bool log_serial) CPR_s_error(""); if (!check_filename(file->fil_name)) - PAR_error("node name not permitted"); // A node name is not permitted in a shadow or secondary file name + PAR_error("node name not permitted"); // A node name is not permitted in a shadow or secondary file name while (true) { if (MSC_match(KW_SIZE)) { @@ -4901,15 +4901,15 @@ static dbb* dup_dbb(const dbb* db) { // **************************************** -// +// // d u p _ d b b -// +// // **************************************** -// +// // dirty duplication of a dbb. -// just memcpy as no memory +// just memcpy as no memory // is freed in gpre. -// +// // ************************************* if (!db) return NULL; @@ -4922,9 +4922,9 @@ static dbb* dup_dbb(const dbb* db) //____________________________________________________________ -// +// // Report an error with parameter -// +// static void error(const TEXT* format, const TEXT* string2) { @@ -4936,10 +4936,10 @@ static void error(const TEXT* format, const TEXT* string2) //____________________________________________________________ -// +// // Extract string from "string" in // token. -// +// static TEXT* extract_string(bool advance_token) { @@ -4965,10 +4965,10 @@ static TEXT* extract_string(bool advance_token) //____________________________________________________________ -// +// // Generate a linked list of SQL WHENEVER items for error // handling. -// +// static swe* gen_whenever(void) { @@ -5002,10 +5002,10 @@ static swe* gen_whenever(void) //____________________________________________________________ -// +// // Correlate the into list with the select expression list // to form full references (post same against request). -// +// static void into( gpre_req* request, GPRE_NOD field_list, GPRE_NOD var_list) { @@ -5040,7 +5040,7 @@ static void into( gpre_req* request, GPRE_NOD field_list, GPRE_NOD var_list) { EXP_post_array(field_ref); - // If field ref not posted yet, post it + // If field ref not posted yet, post it bool found = false; for (reference = request->req_references; reference; @@ -5066,9 +5066,9 @@ static void into( gpre_req* request, GPRE_NOD field_list, GPRE_NOD var_list) //____________________________________________________________ -// +// // Create field in a relation for a metadata request. -// +// static gpre_fld* make_field( gpre_rel* relation) { @@ -5085,9 +5085,9 @@ static gpre_fld* make_field( gpre_rel* relation) //____________________________________________________________ -// +// // Create index for metadata request. -// +// static IND make_index( gpre_req* request, const TEXT* string) { @@ -5112,9 +5112,9 @@ static IND make_index( gpre_req* request, const TEXT* string) //____________________________________________________________ -// +// // Create relation for a metadata request. -// +// static gpre_rel* make_relation( gpre_req* request, const TEXT * relation_name) { @@ -5140,14 +5140,14 @@ static gpre_rel* make_relation( gpre_req* request, const TEXT * relation_name) //____________________________________________________________ -// +// // Given two value expressions associated in a relational // expression, see if one is a field reference and the other // is a host language variable.. If so, match the field to the // host language variable. // In other words, here we are guessing what the datatype is // of a host language variable. -// +// static void pair( GPRE_NOD expr, GPRE_NOD field_expr) { @@ -5197,15 +5197,15 @@ static void pair( GPRE_NOD expr, GPRE_NOD field_expr) //____________________________________________________________ -// +// // Parse the multi-dimensional array specification. -// +// static void par_array( gpre_fld* field) { USHORT i = 0; -// Pick up ranges +// Pick up ranges ary* array_info = field->fld_array_info; @@ -5244,11 +5244,11 @@ static void par_array( gpre_fld* field) //____________________________________________________________ -// -// -// Read in the specified character set on +// +// +// Read in the specified character set on // a READ BLOB or an INSERT BLOB. -// +// static SSHORT par_char_set(void) { @@ -5272,9 +5272,9 @@ static SSHORT par_char_set(void) //____________________________________________________________ -// +// // Create a computed field -// +// static void par_computed( gpre_req* request, gpre_fld* field) { @@ -5283,10 +5283,10 @@ static void par_computed( gpre_req* request, gpre_fld* field) // If field size has been specified, save it. Then NULL it // till the new size is calculated from the specified expression. // This will catch self references. -// +// // The user specified values will be restored to override calculated // values. -// +// // Don't move this initialization below. const gpre_fld save_fld = *field; @@ -5300,7 +5300,7 @@ static void par_computed( gpre_req* request, gpre_fld* field) CME_get_dtype(field->fld_computed->cmpf_boolean, field); -// If there was user specified data type/size, restore it +// If there was user specified data type/size, restore it if (save_fld.fld_dtype) { field->fld_dtype = save_fld.fld_dtype; @@ -5316,29 +5316,29 @@ static void par_computed( gpre_req* request, gpre_fld* field) //____________________________________________________________ -// +// // Parse the next token as a cursor name. // If it is, return the request associated with the cursor. If // not, produce an error and return NULL. -// +// static gpre_req* par_cursor( gpre_sym** symbol_ptr) { -// ** +// ** // par_cursor() is called to use a previously declared cursor. // tok_symbol == NULL means one of the two things. // a) The name does not belong to a cursor. OR // b) get_token() function in gpre.cpp was not able to find the cursor // in hash table. -// +// // case a) is an error condition. // case b) Could have resulted because the cursor name was upcased and -// inserted into hash table since it was not quoted and it is +// inserted into hash table since it was not quoted and it is // now being refered as it was declared. -// +// // Hence, Try and lookup the cursor name after resolving it once more. If // it still cannot be located, Its an error -//* +//* SQL_resolve_identifier("", NULL, MAX_CURSOR_SIZE); gpre_sym* symbol = HSH_lookup(gpreGlob.token_global.tok_string); @@ -5370,9 +5370,9 @@ static gpre_req* par_cursor( gpre_sym** symbol_ptr) //____________________________________________________________ -// +// // If this is a dynamic curser, return dynamic statement block. -// +// static DYN par_dynamic_cursor(void) { @@ -5396,10 +5396,10 @@ static DYN par_dynamic_cursor(void) //____________________________________________________________ -// -// Handle an SQL field definition in CREATE, DECLARE or +// +// Handle an SQL field definition in CREATE, DECLARE or // ALTER TABLE statement. -// +// static gpre_fld* par_field( gpre_req* request, gpre_rel* relation) { @@ -5416,7 +5416,7 @@ static gpre_fld* par_field( gpre_req* request, gpre_rel* relation) par_computed(request, field); } -// Check if default value was specified +// Check if default value was specified if (gpreGlob.token_global.tok_keyword == KW_DEFAULT) { field->fld_default_source = CPR_start_text(); @@ -5449,7 +5449,7 @@ static gpre_fld* par_field( gpre_req* request, gpre_rel* relation) } -// Check for any column level constraints +// Check for any column level constraints cnstrt** constraint_ref = &field->fld_constraints; bool in_constraints = true; @@ -5473,7 +5473,7 @@ static gpre_fld* par_field( gpre_req* request, gpre_rel* relation) } // if (MSC_match (KW_NOT)) // if (MSC_match (KW_NULL)) -// { +// { // field->fld_flags |= FLD_not_null; // if (MSC_match (KW_UNIQUE)) // { @@ -5484,9 +5484,9 @@ static gpre_fld* par_field( gpre_req* request, gpre_rel* relation) // index->ind_flags &= ~IND_descend; // field->fld_index = index; // } -// } +// } // else -// CPR_s_error ("NULL"); +// CPR_s_error ("NULL"); SQL_par_field_collate(request, field); SQL_adjust_field_dtype(field); @@ -5496,10 +5496,10 @@ static gpre_fld* par_field( gpre_req* request, gpre_rel* relation) //____________________________________________________________ -// +// // Create a field level constraint as part of CREATE TABLE or // ALTER TABLE statement. Constraint maybe table or column level. -// +// static CNSTRT par_field_constraint( gpre_req* request, gpre_fld* for_field, gpre_rel* relation) @@ -5513,7 +5513,7 @@ static CNSTRT par_field_constraint( gpre_req* request, gpre_fld* for_field, new_constraint->cnstrt_name->str_string, NAME_SIZE + 1); if (gpreGlob.token_global.tok_length >= NAME_SIZE) PAR_error("Constraint name too long"); - + PAR_get_token(); } @@ -5543,14 +5543,14 @@ static CNSTRT par_field_constraint( gpre_req* request, gpre_fld* for_field, else new_constraint->cnstrt_type = CNSTRT_UNIQUE; - // Set field for PRIMARY KEY or FOREIGN KEY or UNIQUE constraint + // Set field for PRIMARY KEY or FOREIGN KEY or UNIQUE constraint field_name = (STR) MSC_alloc(NAME_SIZE + 1); strcpy(field_name->str_string, for_field->fld_symbol->sym_string); MSC_push((GPRE_NOD) field_name, &new_constraint->cnstrt_fields); if (keyword == KW_REFERENCES) { - // Relation name for foreign key + // Relation name for foreign key new_constraint->cnstrt_referred_rel = (STR) MSC_alloc(NAME_SIZE + 1); SQL_resolve_identifier("referred
", @@ -5558,17 +5558,17 @@ static CNSTRT par_field_constraint( gpre_req* request, gpre_fld* for_field, NAME_SIZE + 1); if (gpreGlob.token_global.tok_length >= NAME_SIZE) PAR_error("Referred table name too long"); - + PAR_get_token(); if (MSC_match(KW_LEFT_PAREN)) { - // Field specified for referred relation + // Field specified for referred relation field_name = (STR) MSC_alloc(NAME_SIZE + 1); SQL_resolve_identifier("", field_name->str_string, NAME_SIZE + 1); if (gpreGlob.token_global.tok_length >= NAME_SIZE) PAR_error("Referred field name too long"); - + MSC_push((GPRE_NOD) field_name, &new_constraint->cnstrt_referred_fields); CPR_token(); EXP_match_paren(); @@ -5602,7 +5602,7 @@ static CNSTRT par_field_constraint( gpre_req* request, gpre_fld* for_field, //____________________________________________________________ -// +// // Parse the INTO clause for a dynamic SQL statement. // Nobody uses its returned value currently. @@ -5625,9 +5625,9 @@ static bool par_into( DYN statement) //____________________________________________________________ -// +// // Parse request options. -// +// static void par_options(const TEXT** transaction) { @@ -5641,10 +5641,10 @@ static void par_options(const TEXT** transaction) //____________________________________________________________ -// +// // parse the page_size clause of a // create database statement -// +// static int par_page_size(void) { @@ -5671,9 +5671,9 @@ static int par_page_size(void) //____________________________________________________________ -// +// // Parse the next thing as a relation. -// +// static gpre_rel* par_relation( gpre_req* request) { @@ -5686,10 +5686,10 @@ static gpre_rel* par_relation( gpre_req* request) //____________________________________________________________ -// +// // Parse a dynamic statement name returning a dynamic // statement block. -// +// static DYN par_statement(void) { @@ -5702,19 +5702,19 @@ static DYN par_statement(void) //____________________________________________________________ -// -// Handle an extended foreign key definition as part of CREATE TABLE +// +// Handle an extended foreign key definition as part of CREATE TABLE // or ALTER TABLE statements. -// +// static void par_fkey_extension(cnstrt* cnstrt_val) { // // Extended foreign key definition could be as follows : -// +// // [ON DELETE { NO ACTION | CASCADE | SET DEFAULT | SET NULL } ] // [ON UPDATE { NO ACTION | CASCADE | SET DEFAULT | SET NULL } ] -// +// fb_assert(gpreGlob.token_global.tok_keyword == KW_ON); fb_assert(cnstrt_val != NULL); @@ -5724,21 +5724,21 @@ static void par_fkey_extension(cnstrt* cnstrt_val) const enum kwwords keyword = gpreGlob.token_global.tok_keyword; switch (keyword) { case KW_DELETE: - // NOTE: action must be defined only once + // NOTE: action must be defined only once if (cnstrt_val->cnstrt_fkey_def_type & REF_DELETE_ACTION) CPR_s_error("UPDATE"); else cnstrt_val->cnstrt_fkey_def_type |= REF_DELETE_ACTION; break; case KW_UPDATE: - // NOTE: action must be defined only once + // NOTE: action must be defined only once if (cnstrt_val->cnstrt_fkey_def_type & REF_UPDATE_ACTION) CPR_s_error("DELETE"); else cnstrt_val->cnstrt_fkey_def_type |= REF_UPDATE_ACTION; break; default: - // unexpected keyword + // unexpected keyword CPR_s_error("UPDATE or DELETE"); break; } @@ -5777,13 +5777,13 @@ static void par_fkey_extension(cnstrt* cnstrt_val) cnstrt_val->cnstrt_fkey_def_type |= REF_UPD_SET_NULL; break; default: - // unexpected keyword + // unexpected keyword CPR_s_error("NULL or DEFAULT"); break; } break; default: - // unexpected keyword + // unexpected keyword CPR_s_error("NO ACTION or CASCADE or SET DEFAULT or SET NULL"); break; } @@ -5791,10 +5791,10 @@ static void par_fkey_extension(cnstrt* cnstrt_val) //____________________________________________________________ -// +// // Handle a create constraint verb as part of CREATE TABLE or // ALTER TABLE statement. Constraint maybe table or column level. -// +// static CNSTRT par_table_constraint( gpre_req* request, gpre_rel* relation) { @@ -5807,7 +5807,7 @@ static CNSTRT par_table_constraint( gpre_req* request, gpre_rel* relation) constraint->cnstrt_name->str_string, NAME_SIZE + 1); if (gpreGlob.token_global.tok_length >= NAME_SIZE) PAR_error("Constraint name too long"); - + PAR_get_token(); } @@ -5844,7 +5844,7 @@ static CNSTRT par_table_constraint( gpre_req* request, gpre_rel* relation) SQL_resolve_identifier("", field_name->str_string, NAME_SIZE + 1); if (gpreGlob.token_global.tok_length >= NAME_SIZE) PAR_error("Field name too long"); - + MSC_push((GPRE_NOD) field_name, fields); fields = &(*fields)->lls_next; ++num_for_key_flds; @@ -5859,7 +5859,7 @@ static CNSTRT par_table_constraint( gpre_req* request, gpre_rel* relation) if (!MSC_match(KW_REFERENCES)) CPR_s_error("REFERENCES"); - // Relation name for foreign key + // Relation name for foreign key constraint->cnstrt_referred_rel = (STR) MSC_alloc(NAME_SIZE + 1); SQL_resolve_identifier("referred
", @@ -5867,13 +5867,13 @@ static CNSTRT par_table_constraint( gpre_req* request, gpre_rel* relation) NAME_SIZE + 1); if (gpreGlob.token_global.tok_length >= NAME_SIZE) PAR_error("Referred table name too long"); - + PAR_get_token(); constraint->cnstrt_referred_fields = NULL; if (MSC_match(KW_LEFT_PAREN)) { - // Fields specified for referred relation + // Fields specified for referred relation fields = &constraint->cnstrt_referred_fields; do { @@ -5882,7 +5882,7 @@ static CNSTRT par_table_constraint( gpre_req* request, gpre_rel* relation) field_name->str_string, NAME_SIZE + 1); if (gpreGlob.token_global.tok_length >= NAME_SIZE) PAR_error("Referred field name too long"); - + MSC_push((GPRE_NOD) field_name, fields); fields = &(*fields)->lls_next; ++num_prim_key_flds; @@ -5909,7 +5909,7 @@ static CNSTRT par_table_constraint( gpre_req* request, gpre_rel* relation) PAR_get_token(); } } - } // if KW_FOREIGN + } // if KW_FOREIGN break; case KW_CHECK: @@ -5929,11 +5929,11 @@ static CNSTRT par_table_constraint( gpre_req* request, gpre_rel* relation) //____________________________________________________________ -// +// // Parse the isolation level part. // If expect_iso is true, an isolation level is required. // Returns true if found a match else false. -// +// static bool par_transaction_modes(gpre_tra* trans, bool expect_iso) @@ -5990,9 +5990,9 @@ static bool par_transaction_modes(gpre_tra* trans, //____________________________________________________________ -// +// // Parse the USING clause for a dynamic SQL statement. -// +// static bool par_using( DYN statement) { @@ -6013,9 +6013,9 @@ static bool par_using( DYN statement) //____________________________________________________________ -// +// // Figure out the correct dtypes -// +// static USHORT resolve_dtypes(KWWORDS typ, bool sql_date) @@ -6080,25 +6080,25 @@ static USHORT resolve_dtypes(KWWORDS typ, PAR_error(err_mesg); break; } -// +// // TMN: FIX FIX Added "return dtype_unknown;" to silence compiler, but // this is really a logic error we have to fix. -// +// return dtype_unknown; } //____________________________________________________________ -// +// // Parse the tail of a CREATE DATABASE statement. -// +// static bool tail_database(enum act_t action_type, DBB database) { TEXT* string = NULL; -// parse options for the database parameter block +// parse options for the database parameter block bool extend_dpb = false; @@ -6174,13 +6174,13 @@ static bool tail_database(enum act_t action_type, if (MSC_match(KW_CASCADE)) database->dbb_flags |= DBB_cascade; /* TMN: ERROR ERROR we cant return _nothing* from a function returning */ - // a bool. I changed this to false to flag an error, but we have to - // look into this. + // a bool. I changed this to false to flag an error, but we have to + // look into this. return false; /* return; */ } -// parse add/drop items +// parse add/drop items bool logdefined = false; while (true) { MSC_match(KW_ADD); @@ -6193,11 +6193,11 @@ static bool tail_database(enum act_t action_type, else if (MSC_match(KW_CACHE)) database->dbb_flags |= DBB_drop_cache; else - PAR_error("only log files or shared cache can be dropped"); // msg 121 only SECURITY_CLASS, DESCRIPTION and CACHE can be dropped + PAR_error("only log files or shared cache can be dropped"); // msg 121 only SECURITY_CLASS, DESCRIPTION and CACHE can be dropped #else else - PAR_error("only log files can be dropped"); // msg 121 only SECURITY_CLASS, DESCRIPTION and CACHE can be dropped -#endif // FLINT_CACHE + PAR_error("only log files can be dropped"); // msg 121 only SECURITY_CLASS, DESCRIPTION and CACHE can be dropped +#endif // FLINT_CACHE // **** // else if (MSC_match (KW_DESCRIP)) @@ -6210,7 +6210,7 @@ static bool tail_database(enum act_t action_type, // else if (gpreGlob.token_global.tok_keyword == KW_DESCRIPTION) // database->dbb_description = parse_description(); // else if (MSC_match (KW_SECURITY_CLASS)) -// database->dbb_security_class = PARSE_symbol (tok_ident); +// database->dbb_security_class = PARSE_symbol (tok_ident); //*** else if (MSC_match(KW_FILE)) { FIL file = define_file(); @@ -6267,7 +6267,7 @@ static bool tail_database(enum act_t action_type, #ifdef FLINT_CACHE else if (MSC_match(KW_CACHE)) database->dbb_cache_file = define_cache(); -#endif // FLINT_CACHE +#endif // FLINT_CACHE else break; } @@ -6277,9 +6277,9 @@ static bool tail_database(enum act_t action_type, //____________________________________________________________ -// +// // Upcase a string into another string. -// +// static void to_upcase(const TEXT* p, TEXT* q, int target_size) { @@ -6294,7 +6294,7 @@ static void to_upcase(const TEXT* p, TEXT* q, int target_size) //____________________________________________________________ -// +// // To do: move these to the correct position in the file. // Idea: if we don't need a result in a variable, we don't pass it, since the // internal buffer will be used instead (in that case, bigger size cannot surpass @@ -6321,7 +6321,7 @@ void SQL_resolve_identifier( const TEXT* err_mesg, TEXT* str_in, int in_size) else if (in_size > len + 1) PAR_error("Provide your own buffer for sizes bigger than 64."); } - + TEXT* const tk_string = gpreGlob.token_global.tok_string; switch (gpreGlob.sw_sql_dialect) { diff --git a/src/intl/cv_big5.cpp b/src/intl/cv_big5.cpp index 5fccb6da0c..cba3d25ca8 100644 --- a/src/intl/cv_big5.cpp +++ b/src/intl/cv_big5.cpp @@ -153,9 +153,9 @@ ULONG CVBIG5_unicode_to_big5(csconvert* obj, const int tmp1 = big5_ch / 256; const int tmp2 = big5_ch % 256; if (tmp1 == 0) { /* ASCII character */ - + fb_assert((UCHAR(tmp2) & 0x80) == 0); - + *big5_str++ = tmp2; big5_len--; unicode_len -= sizeof(*unicode_str); @@ -190,9 +190,9 @@ INTL_BOOL CVBIG5_check_big5(charset* cs, /************************************** * Functional description * Make sure that the big5 string does not have any truncated 2 byte - * character at the end. - * If we have a truncated character then, - * return false. + * character at the end. + * If we have a truncated character then, + * return false. * else return(true); **************************************/ const UCHAR* big5_str_start = big5_str; diff --git a/src/intl/cv_gb2312.cpp b/src/intl/cv_gb2312.cpp index 6d3130b391..35d62183a3 100644 --- a/src/intl/cv_gb2312.cpp +++ b/src/intl/cv_gb2312.cpp @@ -113,7 +113,7 @@ ULONG CVGB_unicode_to_gb2312(csconvert* obj, const UCHAR* p_unicode_str, ULONG gb_len, UCHAR* gb_str, - USHORT* err_code, + USHORT* err_code, ULONG* err_position) { fb_assert(obj != NULL); @@ -152,9 +152,9 @@ ULONG CVGB_unicode_to_gb2312(csconvert* obj, const int tmp1 = gb_ch / 256; const int tmp2 = gb_ch % 256; if (tmp1 == 0) { /* ASCII character */ - + fb_assert((UCHAR(tmp2) & 0x80) == 0); - + *gb_str++ = tmp2; gb_len--; unicode_len -= sizeof(*unicode_str); @@ -186,9 +186,9 @@ INTL_BOOL CVGB_check_gb2312(charset* cs, ULONG gb_len, const UCHAR *gb_str, ULON /************************************** * Functional description * Make sure that the GB2312 string does not have any truncated 2 byte - * character at the end. - * If we have a truncated character then, - * return false. + * character at the end. + * If we have a truncated character then, + * return false. * else return(true); **************************************/ const UCHAR* gb_str_start = gb_str; diff --git a/src/intl/cv_jis.cpp b/src/intl/cv_jis.cpp index f48aa67e87..6ae632bf97 100644 --- a/src/intl/cv_jis.cpp +++ b/src/intl/cv_jis.cpp @@ -241,7 +241,7 @@ Received: by dbase.a-t.com (/\==/\ Smail3.1.21.1 #21.5) id ; Tue, 19 Nov 91 16:11 PST Received: by tate.a-t.com (/\==/\ Smail3.1.21.1 #21.1) id ; Tue, 19 Nov 91 16:03 PST -Received: from Sun.COM by relay1.UU.NET with SMTP +Received: from Sun.COM by relay1.UU.NET with SMTP (5.61/UUNET-internet-primary) id AA21144; Tue, 19 Nov 91 18:45:19 -0500 Received: from Eng.Sun.COM (zigzag-bb.Corp.Sun.COM) by Sun.COM (4.1/SMI-4.1) id AA04289; Tue, 19 Nov 91 15:40:59 PST @@ -350,7 +350,7 @@ STEPS: EX: JIS 1st is in the range 33-94, so we execute step 3(a). JIS 1st = 76 (is NOT odd), so JIS 2nd = 150 ((76/2) + 112) - + JIS 1st: 150 JIS 2nd: 162 @@ -561,7 +561,7 @@ INTL_BOOL CVJIS_check_euc(charset* cs, ULONG euc_len, const UCHAR* euc_str, ULON * Functional description * This is a cousin of the KANJI_check_sjis routine. * Make sure that the euc string does not have any truncated 2 byte - * character at the end. * If we have a truncated character then, + * character at the end. * If we have a truncated character then, * return false. * else return true; **************************************/ @@ -598,9 +598,9 @@ INTL_BOOL CVJIS_check_sjis(charset* cs, ULONG sjis_len, const UCHAR* sjis_str, U * * Functional description * This is a cousin of the KANJI_check_euc routine. - * Make sure that the sjis string does not have any truncated 2 byte + * Make sure that the sjis string does not have any truncated 2 byte * character at the end. * If we have a truncated character then, - * return 1. + * return 1. * else return(0); **************************************/ const UCHAR* start = sjis_str; diff --git a/src/intl/cv_ksc.cpp b/src/intl/cv_ksc.cpp index 7472862b29..c750aa1b9f 100644 --- a/src/intl/cv_ksc.cpp +++ b/src/intl/cv_ksc.cpp @@ -29,7 +29,7 @@ /* * KSC-5601 -> unicode -* % KSC-5601 is same to EUC cs1(codeset 1). Then converting +* % KSC-5601 is same to EUC cs1(codeset 1). Then converting * KSC-5601 to EUC is not needed. */ @@ -156,7 +156,7 @@ ULONG CVKSC_unicode_to_ksc(csconvert* obj, const int tmp1 = ksc_ch / 256; const int tmp2 = ksc_ch % 256; if (tmp1 == 0) { /* ASCII character */ - + fb_assert((UCHAR(tmp2) & 0x80) == 0); *ksc_str++ = tmp2; diff --git a/src/intl/cv_unicode_fss.cpp b/src/intl/cv_unicode_fss.cpp index 9025a06cd0..7c61985807 100644 --- a/src/intl/cv_unicode_fss.cpp +++ b/src/intl/cv_unicode_fss.cpp @@ -167,7 +167,7 @@ static fss_size_t fss_mbtowc( fss_wchar_t* p, const UCHAR* s, fss_size_t n) int nc = 0; if (n <= nc) return -1; - + const int c0 = *s & 0xff; long l = c0; for (const Fss_table* t = fss_sequence_table; t->cmask; t++) { @@ -265,7 +265,7 @@ ULONG CS_UTFFSS_fss_to_unicode_cc(csconvert* obj, fb_assert(obj != NULL); fb_assert(obj->csconvert_fn_convert == CS_UTFFSS_fss_to_unicode_cc); - return fss_to_unicode(src_len, src_ptr, + return fss_to_unicode(src_len, src_ptr, dest_len, Firebird::OutAligner(dest_ptr, dest_len), err_code, err_position); } diff --git a/src/intl/kanji.cpp b/src/intl/kanji.cpp index 16f1513869..9ba8f5a8f9 100644 --- a/src/intl/kanji.cpp +++ b/src/intl/kanji.cpp @@ -55,15 +55,15 @@ USHORT KANJI_check_euc(const UCHAR* euc_str, USHORT euc_len) { /************************************** * - * K A N J I _ c h e c k _ e u c + * K A N J I _ c h e c k _ e u c * ************************************** * * Functional description * This is a cousin of the KANJI_check_sjis routine. * Make sure that the euc string does not have any truncated 2 byte - * character at the end. * If we have a truncated character then, - * return 1. + * character at the end. * If we have a truncated character then, + * return 1. * else return(0); **************************************/ while (euc_len--) { @@ -93,9 +93,9 @@ USHORT KANJI_check_sjis(const UCHAR* sjis_str, USHORT sjis_len) * * Functional description * This is a cousin of the KANJI_check_euc routine. - * Make sure that the sjis string does not have any truncated 2 byte + * Make sure that the sjis string does not have any truncated 2 byte * character at the end. * If we have a truncated character then, - * return 1. + * return 1. * else return(0); **************************************/ while (sjis_len--) { diff --git a/src/intl/lc_ascii.cpp b/src/intl/lc_ascii.cpp index 740510fa06..5a7f3a9a0b 100644 --- a/src/intl/lc_ascii.cpp +++ b/src/intl/lc_ascii.cpp @@ -121,7 +121,7 @@ static inline bool FAMILY_ASCII(texttype* cache, TextTypeImpl* impl = FB_NEW(*getDefaultMemoryPool()) TextTypeImpl; cache->texttype_impl = impl; - + memset(&impl->cs, 0, sizeof(impl->cs)); LD_lookup_charset(&impl->cs, cs_name, config_info); @@ -504,7 +504,7 @@ USHORT famasc_key_length(texttype* obj, USHORT inLen) * * For ASCII type collation (codepoint collation) this mearly * involves stripping the space character off the key. - * + * * RETURN: * Length, in bytes, of returned key */ @@ -569,7 +569,7 @@ SSHORT famasc_compare(texttype* obj, ULONG l1, const BYTE* s1, ULONG l2, const B return 1; if (s1[i] < s2[i]) return -1; - + return 1; } diff --git a/src/intl/lc_big5.cpp b/src/intl/lc_big5.cpp index ba26b89f99..09c3bd1839 100644 --- a/src/intl/lc_big5.cpp +++ b/src/intl/lc_big5.cpp @@ -1,7 +1,7 @@ /* * PROGRAM: InterBase International support * MODULE: lc_big5.cpp - * DESCRIPTION: Language Drivers in the BIG5 family. + * DESCRIPTION: Language Drivers in the BIG5 family. * * The contents of this file are subject to the Interbase Public * License Version 1.0 (the "License"); you may not use this file diff --git a/src/intl/lc_gb2312.cpp b/src/intl/lc_gb2312.cpp index 4c06789b53..da68c202e0 100644 --- a/src/intl/lc_gb2312.cpp +++ b/src/intl/lc_gb2312.cpp @@ -1,7 +1,7 @@ /* * PROGRAM: InterBase International support * MODULE: lc_gb2312.cpp - * DESCRIPTION: Language Drivers in the GB2312 family. + * DESCRIPTION: Language Drivers in the GB2312 family. * * The contents of this file are subject to the Interbase Public * License Version 1.0 (the "License"); you may not use this file diff --git a/src/intl/lc_narrow.cpp b/src/intl/lc_narrow.cpp index df700f58fd..2cff953d25 100644 --- a/src/intl/lc_narrow.cpp +++ b/src/intl/lc_narrow.cpp @@ -81,7 +81,7 @@ const UINT16 NULL_TERTIARY = 0; * + 2 * ns * + 3 * nt * + 3 * (nc/2) - * + 3 * 2 * ne + * + 3 * 2 * ne * + 2 * nsp * + 1 (if nsp > 0, for separating keys from special keys) * @@ -161,7 +161,7 @@ static ULONG do_debug = 0; /* * * Convert a user string to a sequence that will collate bytewise. - * + * * RETURN: * Length, in bytes, of returned key */ @@ -205,7 +205,7 @@ USHORT LC_NARROW_string_to_key(texttype* obj, USHORT iInLen, const BYTE* pInChar } iInLen = (inbuff - pInChar + 1); - + USHORT i; for (i = 0; i < iInLen; i++, pInChar++) { @@ -546,7 +546,7 @@ static const SortOrderTblEntry* get_coltab_entry(texttype* obj, const UCHAR** p, #define XOR ^ /* C bitwise XOR operator - defined for readability */ -SSHORT LC_NARROW_compare(texttype* obj, ULONG l1, const BYTE* s1, ULONG l2, const BYTE* s2, +SSHORT LC_NARROW_compare(texttype* obj, ULONG l1, const BYTE* s1, ULONG l2, const BYTE* s2, INTL_BOOL* error_flag) { fb_assert(obj != NULL); @@ -583,7 +583,7 @@ SSHORT LC_NARROW_compare(texttype* obj, ULONG l1, const BYTE* s1, ULONG l2, cons coltab_status stat1, stat2; stat1.stat_flags = 0; stat2.stat_flags = 0; - + const SortOrderTblEntry* col1 = 0; const SortOrderTblEntry* col2 = 0; @@ -689,7 +689,7 @@ static SSHORT old_fam2_compare(texttype* obj, ULONG l1, const BYTE* s1, return (-1); if (len1 > len2) return (1); - + return (0); } #endif /* DEBUG_COMPARE */ diff --git a/src/intl/ld.cpp b/src/intl/ld.cpp index bdba1ea845..5b9133bca8 100644 --- a/src/intl/ld.cpp +++ b/src/intl/ld.cpp @@ -528,7 +528,7 @@ INTL_BOOL FB_DLL_EXPORT LD_lookup_texttype(texttype* tt, const ASCII* texttype_n { if (LD_lookup_charset(&cs, charset_name, configInfo)) break; - + return false; } } @@ -563,7 +563,7 @@ ULONG FB_DLL_EXPORT LD_setup_attributes( { Firebird::string specificAttributes((const char*) src, srcLen); Firebird::string newSpecificAttributes = specificAttributes; - + if (!LCICU_setup_attributes(textTypeName, charSetName, configInfo, specificAttributes, newSpecificAttributes)) { diff --git a/src/intl/utils/maptest.cpp b/src/intl/utils/maptest.cpp index 024ff92970..f3c1769e92 100644 --- a/src/intl/utils/maptest.cpp +++ b/src/intl/utils/maptest.cpp @@ -48,7 +48,7 @@ No errors #include "../intl/cs_iso8859_1.h" */ -/* +/* -- Multibyte character sets -- #include "../intl/cs_big5.h" #include "../intl/cs_gb2312.h" diff --git a/src/isql/ColList.cpp b/src/isql/ColList.cpp index d5cdd230e9..67de48c4e3 100644 --- a/src/isql/ColList.cpp +++ b/src/isql/ColList.cpp @@ -28,7 +28,7 @@ ColList::item::item(const char* name, int len) - : col_len(len), next(0) + : col_len(len), next(0) { fb_utils::copy_terminate(col_name, name, sizeof(col_name)); } diff --git a/src/isql/Extender.cpp b/src/isql/Extender.cpp index 2866d72be0..ab675a2af4 100644 --- a/src/isql/Extender.cpp +++ b/src/isql/Extender.cpp @@ -93,17 +93,17 @@ void Extender::grow(size_t n) alloc(n); return; } - + if (m_size < n) { const size_t old_pos = getUsed(); char* const old_buf = m_buf; - + m_buf = new char[m_size = n]; memcpy(m_buf, old_buf, old_pos); // Copy only the used bytes. m_pos = m_buf + old_pos; // Reposition the current insertion point. m_pos[0] = 0; // Same as alloc(). - + delete[] old_buf; } } diff --git a/src/isql/OptionsBase.cpp b/src/isql/OptionsBase.cpp index 9315c5e45c..eb5aa0e326 100644 --- a/src/isql/OptionsBase.cpp +++ b/src/isql/OptionsBase.cpp @@ -33,7 +33,7 @@ int OptionsBase::getCommand(const char* cmd) const const size_t swlen = strlen(cmd); if (!swlen) return m_wrong; - + for (int i = 0; i < m_size; ++i) { const optionsMap& item = m_options[i]; @@ -64,10 +64,10 @@ void OptionsBase::showCommands(FILE* out) const const optionsMap& item = m_options[i]; if (item.text[0] != cap) continue; - + const size_t swlen = strlen(item.text); fb_assert(swlen >= item.abbrlen || !item.abbrlen); - + if (!item.abbrlen) fprintf(out, "%-25s", item.text); else @@ -84,11 +84,11 @@ void OptionsBase::showCommands(FILE* out) const fputc(c, out); } - + for (; j < 25; ++j) fputc(' ', out); } - + if (newline == 2) { fputc('\n', out); @@ -98,7 +98,7 @@ void OptionsBase::showCommands(FILE* out) const ++newline; } } - + if (newline) // Last line was without newline. fputc('\n', out); } diff --git a/src/isql/isql_win.cpp b/src/isql/isql_win.cpp index 23943f4e0c..c13e5c8f8f 100644 --- a/src/isql/isql_win.cpp +++ b/src/isql/isql_win.cpp @@ -69,7 +69,7 @@ scrollkeys key2scroll[] = { {VK_RIGHT, WM_HSCROLL, SB_PAGEDOWN} }; -// data initialized by first instance +// data initialized by first instance struct tagSETUPDATA { SCHAR appName[20]; @@ -79,27 +79,27 @@ struct tagSETUPDATA { }; typedef tagSETUPDATA SETUPDATA; -// various temp file names +// various temp file names -static SCHAR defInputFile[MAXPATHLEN]; // default input file name -static SCHAR defOutputFile[MAXPATHLEN]; // default output file name -static SCHAR defHistFile[MAXPATHLEN]; // command history file name -static SCHAR defSessionFile[MAXPATHLEN]; // SQL session file -static FILE *ipf; // input file -static FILE *opf; // output file -static FILE *chf; // command history -static FILE *sss; // SQL session +static SCHAR defInputFile[MAXPATHLEN]; // default input file name +static SCHAR defOutputFile[MAXPATHLEN]; // default output file name +static SCHAR defHistFile[MAXPATHLEN]; // command history file name +static SCHAR defSessionFile[MAXPATHLEN]; // SQL session file +static FILE *ipf; // input file +static FILE *opf; // output file +static FILE *chf; // command history +static FILE *sss; // SQL session -// global flags +// global flags static SSHORT gflags; -const SSHORT DBINITED = 1; // database initilized flag -const SSHORT DEFINPUT = 2; // default input file exists flag -const SSHORT DEFOUTPUT = 4; // default output file exists flag -const SSHORT COMHIST = 8; // command history file exists flag -const SSHORT OVERWRITE = 16; // overwrite/append to window -const SSHORT SESSFILE = 32; // SQL session file exists flag +const SSHORT DBINITED = 1; // database initilized flag +const SSHORT DEFINPUT = 2; // default input file exists flag +const SSHORT DEFOUTPUT = 4; // default output file exists flag +const SSHORT COMHIST = 8; // command history file exists flag +const SSHORT OVERWRITE = 16; // overwrite/append to window +const SSHORT SESSFILE = 32; // SQL session file exists flag SETUPDATA SetUpData; @@ -108,44 +108,44 @@ SETUPDATA SetUpData; program but not passed to other instances */ -HINSTANCE hInst; // hInstance of application -HWND hWndMain; // hWnd of main window +HINSTANCE hInst; // hInstance of application +HWND hWndMain; // hWnd of main window -int xChar, yChar, yCharnl; // character size -int xClient, yClient; // client window size +int xChar, yChar, yCharnl; // character size +int xClient, yClient; // client window size -LOGFONT cursfont; // font structure -HFONT holdsfont; // handle of original font -HFONT hnewsfont; // handle of new fixed font -SCHAR tmpDialogParam[1024]; // used by dialog boxes +LOGFONT cursfont; // font structure +HFONT holdsfont; // handle of original font +HFONT hnewsfont; // handle of new fixed font +SCHAR tmpDialogParam[1024]; // used by dialog boxes -// window scroll/paint stuff +// window scroll/paint stuff -int nVscrollMax, nHscrollMax; // scroll ranges -int nVscrollPos, nHscrollPos; // current scroll positions -int numlines; // number of lines in file -int maxwidth; // width of display format -int nVscrollInc, nHscrollInc; // scroll increments -int nPageMaxLines; // max lines on screen +int nVscrollMax, nHscrollMax; // scroll ranges +int nVscrollPos, nHscrollPos; // current scroll positions +int numlines; // number of lines in file +int maxwidth; // width of display format +int nVscrollInc, nHscrollInc; // scroll increments +int nPageMaxLines; // max lines on screen -// arguments passed to ISQL +// arguments passed to ISQL -int ISQL_argc; // argument count -char *ISQL_argv[20]; // argument vector -char ISQL_args[1024]; // space for arguments -char *ISQL_cursor; // cursor into arguments +int ISQL_argc; // argument count +char *ISQL_argv[20]; // argument vector +char ISQL_args[1024]; // space for arguments +char *ISQL_cursor; // cursor into arguments -// database startup parameters +// database startup parameters static SCHAR newDataBase[256]; static SCHAR newUserName[32]; static SCHAR newPassword[16]; -// script parameters +// script parameters static SCHAR scriptName[256]; static SCHAR scriptOutput[256]; -// extract parameters +// extract parameters static SCHAR extractDbName[256]; static SCHAR extractOutput[256]; static SCHAR extractTarget[256]; @@ -216,8 +216,8 @@ LRESULT CALLBACK _export ISQLWndProc(HWND hWnd, * depends on message. * ********************************************************************/ - DLGPROC lpproc; // pointer to thunk for dialog box - SCHAR buf[1024]; // temp buffer + DLGPROC lpproc; // pointer to thunk for dialog box + SCHAR buf[1024]; // temp buffer SCHAR pwbuf[50]; SCHAR unbuf[50]; SSHORT i; @@ -232,18 +232,18 @@ LRESULT CALLBACK _export ISQLWndProc(HWND hWnd, case WM_COMMAND: switch (GET_WM_COMMAND_ID(wParam, lParam)) { case IDM_QUIT: - // User selected Quit on menu + // User selected Quit on menu PostMessage(hWnd, WM_CLOSE, 0, 0L); break; case IDM_HOME: - // Used to implement home to topleft from keyboard. + // Used to implement home to topleft from keyboard. SendMessage(hWnd, WM_HSCROLL, GET_WM_HSCROLL_MPS(SB_TOP, 0, 0)); SendMessage(hWnd, WM_VSCROLL, GET_WM_VSCROLL_MPS(SB_TOP, 0, 0)); break; case IDM_ABOUT: - // Display about box. + // Display about box. lpproc = (DLGPROC) MakeProcInstance((FARPROC) aboutDlgProc, hInst); DialogBox(hInst, MAKEINTRESOURCE(ABOUT), hWnd, lpproc); @@ -356,7 +356,7 @@ LRESULT CALLBACK _export ISQLWndProc(HWND hWnd, DialogBox(hInst, MAKEINTRESOURCE(EXEC_SCRIPT), hWnd, lpproc); FreeProcInstance((FARPROC) lpproc); if (ret) { - // generate an argc/argv + // generate an argc/argv ISQL_cursor = ISQL_args; ISQL_argc = 0; @@ -365,7 +365,7 @@ LRESULT CALLBACK _export ISQLWndProc(HWND hWnd, pusharg(scriptName); pusharg("-output"); - // use specified output file, or default + // use specified output file, or default if (scriptOutput[0]) pusharg(scriptOutput); @@ -391,7 +391,7 @@ LRESULT CALLBACK _export ISQLWndProc(HWND hWnd, } ISQL_main(ISQL_argc, ISQL_argv); - // reopen default files and database + // reopen default files and database ipf = fopen(defInputFile, "r"); opf = fopen(defOutputFile, "a"); @@ -412,7 +412,7 @@ LRESULT CALLBACK _export ISQLWndProc(HWND hWnd, ret = DialogBox(hInst, MAKEINTRESOURCE(EXTRACT_DB), hWnd, lpproc); FreeProcInstance((FARPROC) lpproc); if (ret) { - // create an argument vector for ISQL + // create an argument vector for ISQL ISQL_cursor = ISQL_args; ISQL_argc = 0; @@ -434,7 +434,7 @@ LRESULT CALLBACK _export ISQLWndProc(HWND hWnd, ISQL_main(ISQL_argc, ISQL_argv); ISQL_exit_db(); - // reopen default files and database + // reopen default files and database ipf = fopen(defInputFile, "r"); opf = fopen(defOutputFile, "a"); @@ -457,7 +457,7 @@ LRESULT CALLBACK _export ISQLWndProc(HWND hWnd, gflags |= OVERWRITE; break; - // Send the proper frontend commands for these: + // Send the proper frontend commands for these: case IDM_BLOB_TYPE: tmpDialogParam[0] = '\0'; @@ -531,7 +531,7 @@ LRESULT CALLBACK _export ISQLWndProc(HWND hWnd, } break; - // Send the proper show commands for these: + // Send the proper show commands for these: case IDM_SHOW_VERSION: test_overwrite(); @@ -648,15 +648,15 @@ LRESULT CALLBACK _export ISQLWndProc(HWND hWnd, break; case WM_SIZE: - // Save size of window client area. + // Save size of window client area. if (lParam) { yClient = HIWORD(lParam); xClient = LOWORD(lParam); yClient = (yClient / yCharnl + 1) * yCharnl; lParam = MAKELONG(xClient, yClient); - // Go setup scroll ranges and file display area based upon - // client area size. + // Go setup scroll ranges and file display area based upon + // client area size. setup_scroll(hWnd); return DefWindowProc(hWnd, message, wParam, lParam); @@ -664,7 +664,7 @@ LRESULT CALLBACK _export ISQLWndProc(HWND hWnd, break; case WM_VSCROLL: - // React to the various vertical scroll related actions. + // React to the various vertical scroll related actions. switch (GET_WM_VSCROLL_CODE(wParam, lParam)) { case SB_TOP: @@ -705,7 +705,7 @@ LRESULT CALLBACK _export ISQLWndProc(HWND hWnd, break; case WM_HSCROLL: - // React to the various horizontal scroll related actions. + // React to the various horizontal scroll related actions. switch (GET_WM_HSCROLL_CODE(wParam, lParam)) { case SB_LINEUP: @@ -740,8 +740,8 @@ LRESULT CALLBACK _export ISQLWndProc(HWND hWnd, break; case WM_KEYDOWN: - // Translate various keydown messages to appropriate horizontal - // and vertical scroll actions. + // Translate various keydown messages to appropriate horizontal + // and vertical scroll actions. for (i = 0; i < FB_NELEM(key2scroll); i++) { if (wParam == key2scroll[i].wVirtkey) { @@ -753,31 +753,31 @@ LRESULT CALLBACK _export ISQLWndProc(HWND hWnd, break; case WM_PAINT: - // Go paint the client area of the window with the appropriate - // part of the selected file. + // Go paint the client area of the window with the appropriate + // part of the selected file. paint_isql(hWnd); break; case WM_DESTROY: - // This is the end if we were closed by a DestroyWindow call. - close_isql(); // take any necessary wrapup action. - PostQuitMessage(0); // this is the end... + // This is the end if we were closed by a DestroyWindow call. + close_isql(); // take any necessary wrapup action. + PostQuitMessage(0); // this is the end... break; case WM_QUERYENDSESSION: - // If we return TRUE we are saying it's ok with us to end the - // windows session. - close_isql(); // take any necessary wrapup action. - return (long) TRUE; // we agree to end session. + // If we return TRUE we are saying it's ok with us to end the + // windows session. + close_isql(); // take any necessary wrapup action. + return (long) TRUE; // we agree to end session. case WM_CLOSE: - // Tell windows to destroy our window. + // Tell windows to destroy our window. DestroyWindow(hWnd); break; default: - // Let windows handle all messages we choose to ignore. + // Let windows handle all messages we choose to ignore. return DefWindowProc(hWnd, message, wParam, lParam); } @@ -857,28 +857,28 @@ static int cmdline_isql( HINSTANCE hInstance, LPSTR pCmdLine) * return from ISQL * ********************************************************************/ - FILE *inputfile; // input file - FILE *outputfile; // output file - SCHAR inputfilename[MAXPATHLEN]; // input file name - SCHAR outputfilename[MAXPATHLEN]; // output file name - SCHAR arg[MAXPATHLEN]; // current argument + FILE *inputfile; // input file + FILE *outputfile; // output file + SCHAR inputfilename[MAXPATHLEN]; // input file name + SCHAR outputfilename[MAXPATHLEN]; // output file name + SCHAR arg[MAXPATHLEN]; // current argument const SCHAR *cp; // command line cursor - SCHAR *ap; // current argument cursor + SCHAR *ap; // current argument cursor -// create default input and output files +// create default input and output files if (!open_temp_file (hInstance, &inputfile, inputfilename, IDS_TEMP_IN_FILE)) return 0; if (!open_temp_file (hInstance, &outputfile, outputfilename, IDS_TEMP_OUT_FILE)) return 0; -// create failsafe input file +// create failsafe input file fprintf(inputfile, "QUIT;\n"); fclose(inputfile); fclose(outputfile); -// create an argument vector, including the default files and command line args +// create an argument vector, including the default files and command line args ISQL_cursor = ISQL_args; ISQL_argc = 0; @@ -922,7 +922,7 @@ static void display_page( HWND hWnd) ***************************************************************/ FILE *fh; -// Determine file size and some display paramaters. +// Determine file size and some display paramaters. nVscrollPos = numlines; numlines = 0; maxwidth = 0; @@ -939,11 +939,11 @@ static void display_page( HWND hWnd) } opf = fopen(defOutputFile, "a"); -// Go setup scroll ranges for this file. +// Go setup scroll ranges for this file. setup_scroll(hWnd); -// Show first part of file. +// Show first part of file. InvalidateRect(hWnd, NULL, TRUE); UpdateWindow(hWnd); @@ -980,7 +980,7 @@ static SSHORT init_isql( DLGPROC dlgProc; int iReturn; -// perform instance dependant Windows initialization +// perform instance dependant Windows initialization if (!hPrevInstance) init_isql_first(hInstance); @@ -989,11 +989,11 @@ static SSHORT init_isql( init_isql_added(hPrevInstance); #endif -// perform common instance Windows initialization +// perform common instance Windows initialization init_isql_every(hInstance, cmdShow); -// open all the files +// open all the files if (!open_temp_file(hInstance, &ipf, defInputFile, IDS_DEF_IN_FILE)) return FALSE; @@ -1042,7 +1042,7 @@ static void init_isql_added( HINSTANCE hPrevInstance) * *********************************************************************/ -// get the results of the initialization of first instance +// get the results of the initialization of first instance GetInstanceData(hPrevInstance, (BYTE *) & SetUpData, sizeof(SETUPDATA)); } @@ -1071,28 +1071,28 @@ static void init_isql_every( HINSTANCE hInstance, int cmdShow) TEXTMETRIC tm; HDC hDC; - hInst = hInstance; // save for use by window procs + hInst = hInstance; // save for use by window procs -// Create applications main window. +// Create applications main window. - hWndMain = CreateWindow(SetUpData.appName, // window class name - SetUpData.appName, // window title - WS_OVERLAPPEDWINDOW | // type of window - WS_HSCROLL | WS_VSCROLL, CW_USEDEFAULT, // x window location - CW_USEDEFAULT, // y - CW_USEDEFAULT, // cx and size - CW_USEDEFAULT, // cy - NULL, // no parent for this window - NULL, // use the class menu - hInstance, // who created this window - NULL // no parms to pass on + hWndMain = CreateWindow(SetUpData.appName, // window class name + SetUpData.appName, // window title + WS_OVERLAPPEDWINDOW | // type of window + WS_HSCROLL | WS_VSCROLL, CW_USEDEFAULT, // x window location + CW_USEDEFAULT, // y + CW_USEDEFAULT, // cx and size + CW_USEDEFAULT, // cy + NULL, // no parent for this window + NULL, // use the class menu + hInstance, // who created this window + NULL // no parms to pass on ); -// Get the display context. +// Get the display context. hDC = GetDC(hWndMain); -// Build fixed screen font. +// Build fixed screen font. cursfont.lfHeight = 14; cursfont.lfWidth = 9; @@ -1111,11 +1111,11 @@ static void init_isql_every( HINSTANCE hInstance, int cmdShow) hnewsfont = CreateFontIndirect((LPLOGFONT) & cursfont); -// Install the font in the current display context. +// Install the font in the current display context. holdsfont = SelectObject(hDC, hnewsfont); -// get text metrics for paint +// get text metrics for paint GetTextMetrics(hDC, &tm); xChar = tm.tmAveCharWidth; @@ -1123,11 +1123,11 @@ static void init_isql_every( HINSTANCE hInstance, int cmdShow) yCharnl = tm.tmHeight; numlines = 0; -// Release the display context. +// Release the display context. ReleaseDC(hWndMain, hDC); -// Update display of main window. +// Update display of main window. ShowWindow(hWndMain, cmdShow); UpdateWindow(hWndMain); @@ -1152,14 +1152,14 @@ static void init_isql_first( HINSTANCE hInstance) ********************************************************************/ WNDCLASS wcISQLClass; -// Get string from resource with application name. +// Get string from resource with application name. LoadString(hInstance, IDS_NAME, (LPSTR) SetUpData.appName, 20); LoadString(hInstance, IDS_MENUNAME, (LPSTR) SetUpData.menuName, 20); LoadString(hInstance, IDS_ICONNAME, (LPSTR) SetUpData.iconName, 20); LoadString(hInstance, IDS_ERROR, (LPSTR) SetUpData.errorString, 20); -// Define the window class for this application. +// Define the window class for this application. wcISQLClass.lpszClassName = SetUpData.appName; wcISQLClass.hInstance = hInstance; @@ -1172,7 +1172,7 @@ static void init_isql_first( HINSTANCE hInstance) wcISQLClass.cbClsExtra = 0; wcISQLClass.cbWndExtra = 0; -// Register the class +// Register the class RegisterClass(&wcISQLClass); } @@ -1238,12 +1238,12 @@ static int windows_isql( ********************************************************************/ \ MSG msg; -// Go init this application. +// Go init this application. if (!init_isql(hInstance, hPrevInstance, cmdShow)) return 0; -// Get and dispatch messages for this applicaton. +// Get and dispatch messages for this applicaton. while (GetMessage(&msg, NULL, NULL, NULL)) { TranslateMessage(&msg); @@ -1281,28 +1281,28 @@ static void paint_isql( HWND hWnd) BeginPaint(hWnd, (LPPAINTSTRUCT) & ps); hDC = ps.hdc; -// Establish fixed font in display context. +// Establish fixed font in display context. SelectObject(hDC, hnewsfont); if (numlines) { - // Open the file to display - // (files should not stay open over multiple windows messages) + // Open the file to display + // (files should not stay open over multiple windows messages) hfile = fopen(defOutputFile, "r"); if (hfile) { - // Skip lines outside window limits + // Skip lines outside window limits for (i = 0; i < nVscrollPos; i++) fgets(buf, sizeof(buf), hfile); - // Read visible lines + // Read visible lines for (i = 0; i < nPageMaxLines; i++) { if (!fgets(buf, sizeof(buf), hfile)) break; - // figure out shortest text to put + // figure out shortest text to put for (e = strlen(buf); e >= 0; e--) if (buf[e] > ' ' && buf[e] <= '~') @@ -1363,7 +1363,7 @@ static void setup_scroll( HWND hWnd) * *********************************************************************/ -// numlines established during open +// numlines established during open nVscrollMax = max(0, numlines - yClient / yChar); nVscrollPos = min(nVscrollPos, nVscrollMax); @@ -1665,7 +1665,7 @@ BOOL CALLBACK _export createDbDlgProc(HWND hDlg, break; case IDCANCEL: - // Terminate this dialog box. + // Terminate this dialog box. EndDialog(hDlg, FALSE); break; @@ -1739,7 +1739,7 @@ BOOL CALLBACK _export dbNameDlgProc(HWND hDlg, break; case IDCANCEL: - // Terminate this dialog box. + // Terminate this dialog box. EndDialog(hDlg, FALSE); break; @@ -1795,7 +1795,7 @@ BOOL CALLBACK _export dropDbDlgProc(HWND hDlg, break; case IDCANCEL: - // Terminate this dialog box. + // Terminate this dialog box. EndDialog(hDlg, FALSE); break; @@ -1963,7 +1963,7 @@ BOOL CALLBACK _export extractDlgProc(HWND hDlg, break; case IDCANCEL: - // Terminate this dialog box. + // Terminate this dialog box. EndDialog(hDlg, FALSE); break; @@ -2173,7 +2173,7 @@ BOOL CALLBACK _export scriptDlgProc(HWND hDlg, break; case IDCANCEL: - // Terminate this dialog box. + // Terminate this dialog box. EndDialog(hDlg, FALSE); break; diff --git a/src/jrd/Collation.cpp b/src/jrd/Collation.cpp index 35db6cb281..0fa9ce2f10 100644 --- a/src/jrd/Collation.cpp +++ b/src/jrd/Collation.cpp @@ -527,7 +527,7 @@ private: { if (aux(obj, flags, search, end_search, match, end_match)) return true; - + if (search < end_search) { const CharType d = *search++; @@ -545,18 +545,18 @@ private: { if (search >= end_search) return false; - + search++; } else { if (++match >= end_match) return true; - + for (;;) { if (aux(obj, flags, search, end_search, match, end_match)) return true; - + if (++search >= end_search) return false; } @@ -581,7 +581,7 @@ private: { if (aux(obj, flags, search, end_search, match, end_match)) return true; - + if (search < end_search) { if (!className(obj, flags, char_class, end_class, *search++)) @@ -622,7 +622,7 @@ private: // Japanese version operates on short-based buffer, // instead of SCHAR-based. static bool className(Jrd::TextType* obj, USHORT flags, - const CharType* char_class, const CharType* const end_class, + const CharType* char_class, const CharType* const end_class, CharType character) { fb_assert(char_class != NULL); @@ -656,9 +656,9 @@ private: } // Merge the matching pattern and control strings to give a cannonical - // matching pattern. Return the length of the combined string. + // matching pattern. Return the length of the combined string. // - // What this routine does is to take the language template, strip off + // What this routine does is to take the language template, strip off // the prefix and put it in the output string, then parse the definitions // into an array of character pointers. The index array is the defined // character. The routine then takes the actual match pattern and uses @@ -738,7 +738,7 @@ private: while (*p) *comb++ = *p++; - // if we've got the definition of a quote character, + // if we've got the definition of a quote character, // slurp the next character too if (comb > combined && comb[-1] == *(CharType*) obj->getCanonicalChar(CHAR_GDML_QUOTE) && *match) @@ -932,7 +932,7 @@ Collation* Collation::createInstance(MemoryPool& pool, TTYPE_ID id, texttype* tt MatchesMatcherULongCanonical, SleuthMatcherULongCanonical>(id, tt, cs); } - fb_assert(false); + fb_assert(false); return NULL; // compiler silencer } diff --git a/src/jrd/DataTypeUtil.cpp b/src/jrd/DataTypeUtil.cpp index 95072fc5e1..985ec9e5c4 100644 --- a/src/jrd/DataTypeUtil.cpp +++ b/src/jrd/DataTypeUtil.cpp @@ -1,5 +1,5 @@ /* - * PROGRAM: + * PROGRAM: * MODULE: DataTypeUtil.cpp * DESCRIPTION: Data Type Utility functions * @@ -40,7 +40,7 @@ using namespace Firebird; SSHORT DataTypeUtilBase::getResultBlobSubType(const dsc* value1, const dsc* value2) -{ +{ SSHORT subType1 = value1->getBlobSubType(); SSHORT subType2 = value2->getBlobSubType(); @@ -71,40 +71,40 @@ USHORT DataTypeUtilBase::getResultTextType(const dsc* value1, const dsc* value2) void DataTypeUtilBase::makeFromList(dsc* result, const char* expressionName, int argsCount, const dsc** args) { - //-------------------------------------------------------------------------- + //-------------------------------------------------------------------------- // [Arno Brinkman] 2003-08-23 - // + // // This function is made to determine a output descriptor from a given list // of expressions according to the latest SQL-standard that was available. - // (ISO/ANSI SQL:200n WG3:DRS-013 H2-2002-358 August, 2002) - // + // (ISO/ANSI SQL:200n WG3:DRS-013 H2-2002-358 August, 2002) + // // If any datatype has a character type then : // - the output will always be a character type except unconvertable types. // (dtype_text, dtype_cstring, dtype_varying, dtype_blob sub_type TEXT) // !! Currently engine cannot convert string to BLOB therefor BLOB isn't allowed. !! // - first character-set and collation are used as output descriptor. - // - if all types have datatype CHAR then output should be CHAR else + // - if all types have datatype CHAR then output should be CHAR else // VARCHAR and with the maximum length used from the given list. - // - // If all of the datatypes are EXACT numeric then the output descriptor - // shall be EXACT numeric with the maximum scale and the maximum precision + // + // If all of the datatypes are EXACT numeric then the output descriptor + // shall be EXACT numeric with the maximum scale and the maximum precision // used. (dtype_byte, dtype_short, dtype_long, dtype_int64) - // + // // If any of the datatypes is APPROXIMATE numeric then each datatype in the - // list shall be numeric else a error is thrown and the output descriptor + // list shall be numeric else a error is thrown and the output descriptor // shall be APPROXIMATE numeric. (dtype_real, dtype_double, dtype_d_float) - // + // // If any of the datatypes is a datetime type then each datatype in the // list shall be the same datetime type else a error is thrown. // numeric. (dtype_sql_date, dtype_sql_time, dtype_timestamp) - // + // // If any of the datatypes is a BLOB datatype then : // - all types should be a BLOB else throw error. // - all types should have the same sub_type else throw error. // - when TEXT type then use first character-set and collation as output // descriptor. // (dtype_blob) - // + // //-------------------------------------------------------------------------- // Initialize values. @@ -161,10 +161,10 @@ void DataTypeUtilBase::makeFromList(dsc* result, const char* expressionName, int } else { if (all_equal) { - all_equal = + all_equal = (max_dtype == arg->dsc_dtype) && - (max_scale == arg->dsc_scale) && - (max_length == arg->dsc_length) && + (max_scale == arg->dsc_scale) && + (max_length == arg->dsc_length) && (max_sub_type == arg->dsc_sub_type); } } @@ -175,7 +175,7 @@ void DataTypeUtilBase::makeFromList(dsc* result, const char* expressionName, int // Is there any approximate numeric? if (DTYPE_IS_APPROX(arg->dsc_dtype)) { any_approx = true; - // Dialect 1 NUMERIC and DECIMAL are stored as sub-types + // Dialect 1 NUMERIC and DECIMAL are stored as sub-types // 1 and 2 from float types dtype_real, dtype_double if (!any_float) { any_float = (arg->dsc_sub_type == 0); @@ -218,11 +218,11 @@ void DataTypeUtilBase::makeFromList(dsc* result, const char* expressionName, int if (DTYPE_IS_TEXT(arg->dsc_dtype) || (arg->dsc_dtype == dtype_blob && arg->dsc_sub_type == isc_blob_text)) { - // Pick first characterset-collate from args-list - // - // Is there an better way to determine the - // characterset / collate from the list ? - // Maybe first according SQL-standard which has an order + // Pick first characterset-collate from args-list + // + // Is there an better way to determine the + // characterset / collate from the list ? + // Maybe first according SQL-standard which has an order // UTF32 -> UTF16 -> UTF8 then by a Firebird specified order // // At least give any first charset other than ASCII/NONE precedence @@ -351,7 +351,7 @@ void DataTypeUtilBase::makeFromList(dsc* result, const char* expressionName, int // If all of the arguments are from type text use a text type. // Firebird behaves a little bit different than standard here, because // any datatype (except BLOB) can be converted to a character-type we - // allow to use numeric and datetime types together with a + // allow to use numeric and datetime types together with a // character-type, but output will always be varying ! if (all_text || (any_text && (any_numeric || any_datetime))) { if (any_text_blob) diff --git a/src/jrd/DatabaseSnapshot.cpp b/src/jrd/DatabaseSnapshot.cpp index 7e232a427a..f6513ddbc3 100644 --- a/src/jrd/DatabaseSnapshot.cpp +++ b/src/jrd/DatabaseSnapshot.cpp @@ -960,7 +960,7 @@ void DatabaseSnapshot::putDatabase(const Database* database, // SQL dialect temp = (database->dbb_flags & DBB_DB_SQL_dialect_3) ? 3 : 1; writer.insertInt(f_mon_db_dialect, temp); - + // shutdown mode if (database->dbb_ast_flags & DBB_shutdown_full) temp = shut_mode_full; diff --git a/src/jrd/DebugInterface.cpp b/src/jrd/DebugInterface.cpp index fd7faba1c9..84bd2407b1 100644 --- a/src/jrd/DebugInterface.cpp +++ b/src/jrd/DebugInterface.cpp @@ -54,7 +54,7 @@ void DBG_parse_debug_info(USHORT length, const UCHAR* data, Firebird::DbgInfo& d bad_format = true; } - while (!bad_format && (data < end)) + while (!bad_format && (data < end)) { switch (*data++) { diff --git a/src/jrd/IntlManager.cpp b/src/jrd/IntlManager.cpp index 1add78371a..487a19639d 100644 --- a/src/jrd/IntlManager.cpp +++ b/src/jrd/IntlManager.cpp @@ -45,7 +45,7 @@ using namespace Firebird; -namespace +namespace { class ModulesMap : public GenericMap > > { @@ -243,7 +243,7 @@ const IntlManager::CharSetAliasDefinition IntlManager::defaultCharSetAliases[] = {"GB2312", CS_GB2312}, {"DOS_936", CS_GB2312}, {"WIN_936", CS_GB2312}, - {NULL, 0} + {NULL, 0} }; const IntlManager::CollationDefinition IntlManager::defaultCollations[] = @@ -566,7 +566,7 @@ bool IntlManager::lookupCharSet(const Firebird::string& charSetName, charset* cs else { ModuleLoader::Module* module; - + if (modules->get(externalInfo.moduleName, module) && module) module->findSymbol(STRINGIZE(CHARSET_ENTRYPOINT), lookupFunction); } @@ -601,7 +601,7 @@ bool IntlManager::lookupCollation(const Firebird::string& collationName, else { ModuleLoader::Module* module; - + if (modules->get(collationExternalInfo.moduleName, module) && module) module->findSymbol(STRINGIZE(TEXTTYPE_ENTRYPOINT), lookupFunction); } @@ -638,7 +638,7 @@ bool IntlManager::setupCollationAttributes( else { ModuleLoader::Module* module; - + if (modules->get(collationExternalInfo.moduleName, module) && module) module->findSymbol(STRINGIZE(INTL_SETUP_ATTRIBUTES_ENTRYPOINT), attributesFunction); } diff --git a/src/jrd/IntlUtil.cpp b/src/jrd/IntlUtil.cpp index b34ef98677..3e5c3629ea 100644 --- a/src/jrd/IntlUtil.cpp +++ b/src/jrd/IntlUtil.cpp @@ -144,7 +144,7 @@ bool IntlUtil::parseSpecificAttributes( while (p < end) { uSize = cs->getConvToUnicode().convert(size, p, sizeof(uc), uc); - + if (uSize == 2 && ((*(USHORT*)uc >= 'A' && *(USHORT*)uc <= 'Z') || (*(USHORT*)uc >= 'a' && *(USHORT*)uc <= 'z') || @@ -478,7 +478,7 @@ ULONG IntlUtil::toLower(Jrd::CharSet* cs, ULONG srcLen, const UCHAR* src, ULONG // convert to lowercase Firebird::HalfStaticArray lower_str; srcLen = UnicodeUtil::utf16LowerCase(srcLen, Firebird::Aligner(utf16_ptr, srcLen), - utf16_length, Firebird::OutAligner(lower_str.getBuffer(utf16_length), utf16_length), + utf16_length, Firebird::OutAligner(lower_str.getBuffer(utf16_length), utf16_length), exceptions); // convert to original character set @@ -504,7 +504,7 @@ ULONG IntlUtil::toUpper(Jrd::CharSet* cs, ULONG srcLen, const UCHAR* src, ULONG // convert to uppercase Firebird::HalfStaticArray upper_str; srcLen = UnicodeUtil::utf16UpperCase(srcLen, Firebird::Aligner(utf16_ptr, srcLen), - utf16_length, Firebird::OutAligner(upper_str.getBuffer(utf16_length), utf16_length), + utf16_length, Firebird::OutAligner(upper_str.getBuffer(utf16_length), utf16_length), exceptions); // convert to original character set @@ -580,7 +580,7 @@ string IntlUtil::escapeAttribute(Jrd::CharSet* cs, const string& s) { *(USHORT*)uc = '\\'; UCHAR bytes[sizeof(ULONG)]; - + ULONG bytesSize = cs->getConvFromUnicode().convert( sizeof(USHORT), uc, sizeof(bytes), bytes); diff --git a/src/jrd/PreparedStatement.cpp b/src/jrd/PreparedStatement.cpp index b435a4e869..e4990152ea 100644 --- a/src/jrd/PreparedStatement.cpp +++ b/src/jrd/PreparedStatement.cpp @@ -95,10 +95,10 @@ int PreparedStatement::getResultCount() const void PreparedStatement::parseDsqlMessage(dsql_msg* dsqlMsg, Firebird::Array& values, Firebird::UCharBuffer& blr, Firebird::UCharBuffer& msg) { - // Parameters in dsqlMsg->msg_parameters almost always linked in descending - // order by par_index. The only known exception is EXECUTE BLOCK statement. - // To generate correct BLR we must walk params in ascending par_index order. - // So store all params in array in an ascending par_index order despite of + // Parameters in dsqlMsg->msg_parameters almost always linked in descending + // order by par_index. The only known exception is EXECUTE BLOCK statement. + // To generate correct BLR we must walk params in ascending par_index order. + // So store all params in array in an ascending par_index order despite of // order in linked list. Firebird::HalfStaticArray params; @@ -120,7 +120,7 @@ void PreparedStatement::parseDsqlMessage(dsql_msg* dsqlMsg, Firebird::Array size_t msgLength = 0; int paramCount = params.getCount(); int i = 0; - + for (; i < paramCount; i++) { const dsql_par* par = params[i]; diff --git a/src/jrd/Relation.cpp b/src/jrd/Relation.cpp index 58698ed7d1..17e069f9fd 100644 --- a/src/jrd/Relation.cpp +++ b/src/jrd/Relation.cpp @@ -43,7 +43,7 @@ void RelationGarbage::clear() item->bm = NULL; } - array.clear(); + array.clear(); } void RelationGarbage::addPage(MemoryPool* pool, const SLONG pageno, const SLONG tranid) @@ -90,7 +90,7 @@ void RelationGarbage::getGarbage(const SLONG oldest_snapshot, PageBitmap **sbm) break; PageBitmap* bm_tran = garbage.bm; - PageBitmap** bm_or = PageBitmap::bit_or(sbm, &bm_tran); + PageBitmap** bm_or = PageBitmap::bit_or(sbm, &bm_tran); if (*bm_or == garbage.bm) { bm_tran = *sbm; *sbm = garbage.bm; @@ -112,7 +112,7 @@ RelationPages* jrd_rel::getPagesInternal(thread_db* tdbb, SLONG tran, bool alloc Database* dbb = tdbb->getDatabase(); SLONG inst_id; - if (rel_flags & REL_temp_tran) + if (rel_flags & REL_temp_tran) { if (tran > 0) inst_id = tran; @@ -123,7 +123,7 @@ RelationPages* jrd_rel::getPagesInternal(thread_db* tdbb, SLONG tran, bool alloc else // called without transaction, maybe from OPT or CMP ? return &rel_pages_base; } - else + else { if (tdbb->tdbb_temp_attid) inst_id = tdbb->tdbb_temp_attid; @@ -131,7 +131,7 @@ RelationPages* jrd_rel::getPagesInternal(thread_db* tdbb, SLONG tran, bool alloc inst_id = PAG_attachment_id(tdbb); } - if (!rel_pages_inst) + if (!rel_pages_inst) { MemoryPool& pool = *dbb->dbb_permanent; rel_pages_inst = FB_NEW(pool) RelationPagesInstances(pool); @@ -144,18 +144,18 @@ RelationPages* jrd_rel::getPagesInternal(thread_db* tdbb, SLONG tran, bool alloc return 0; RelationPages* newPages = rel_pages_free; - if (!newPages) + if (!newPages) { const size_t BULK_ALLOC = 8; - RelationPages* allocatedPages = newPages = + RelationPages* allocatedPages = newPages = FB_NEW(*dbb->dbb_permanent) RelationPages[BULK_ALLOC]; rel_pages_free = ++allocatedPages; for (size_t i = 1; i < BULK_ALLOC - 1; i++, allocatedPages++) allocatedPages->rel_next_free = allocatedPages + 1; } - else + else { rel_pages_free = newPages->rel_next_free; newPages->rel_next_free = 0; @@ -202,7 +202,7 @@ RelationPages* jrd_rel::getPagesInternal(thread_db* tdbb, SLONG tran, bool alloc idx->idx_root = 0; SelectivityList selectivity(*pool); - IDX_create_index(tdbb, this, idx, idx_name.c_str(), NULL, + IDX_create_index(tdbb, this, idx, idx_name.c_str(), NULL, tdbb->getTransaction(), selectivity); #ifdef VIO_DEBUG @@ -237,7 +237,7 @@ bool jrd_rel::delPages(thread_db* tdbb, SLONG tran, RelationPages* aPages) return false; fb_assert((tran <= 0) || ((tran > 0) && (pages->rel_instance_id == tran))); - + fb_assert(pages->useCount > 0); if (--pages->useCount) @@ -293,7 +293,7 @@ void jrd_rel::cleanUp() delete rel_pages_inst; } - + void jrd_rel::fillPagesSnapshot(RelPagesSnapshot& snapshot, const bool attachmentOnly) { if (rel_pages_inst) @@ -302,23 +302,23 @@ void jrd_rel::fillPagesSnapshot(RelPagesSnapshot& snapshot, const bool attachmen { RelationPages* relPages = (*rel_pages_inst)[i]; - if (!attachmentOnly) + if (!attachmentOnly) { snapshot.add(relPages); relPages->addRef(); } - else if ((rel_flags & REL_temp_conn) && - (PAG_attachment_id(snapshot.spt_tdbb) == relPages->rel_instance_id)) + else if ((rel_flags & REL_temp_conn) && + (PAG_attachment_id(snapshot.spt_tdbb) == relPages->rel_instance_id)) { snapshot.add(relPages); relPages->addRef(); } - else if (rel_flags & REL_temp_tran) + else if (rel_flags & REL_temp_tran) { const jrd_tra* tran = snapshot.spt_tdbb->getAttachment()->att_transactions; for (; tran; tran = tran->tra_next) { - if (tran->tra_number == relPages->rel_instance_id) + if (tran->tra_number == relPages->rel_instance_id) { snapshot.add(relPages); relPages->addRef(); @@ -362,7 +362,7 @@ bool jrd_rel::hasTriggers() const rel_pre_store, rel_post_store }; - + for (int i = 0; i < 6; ++i) { if (trigs[i] && trigs[i]->getCount()) @@ -371,7 +371,7 @@ bool jrd_rel::hasTriggers() const return false; } -void RelationPages::free(RelationPages*& nextFree) +void RelationPages::free(RelationPages*& nextFree) { rel_next_free = nextFree; nextFree = this; diff --git a/src/jrd/TempSpace.cpp b/src/jrd/TempSpace.cpp index 886bb6f60f..34b554a567 100644 --- a/src/jrd/TempSpace.cpp +++ b/src/jrd/TempSpace.cpp @@ -95,7 +95,7 @@ TempSpace::FileBlock::FileBlock(TempFile* f, Block* tail, size_t length) : Block(tail, length), file(f) { fb_assert(file); - + // FileBlock is created after file was extended by length (look at // TempSpace::extend) so this FileBlock is already inside the file seek = file->getSize() - length; @@ -433,7 +433,7 @@ offset_t TempSpace::allocateSpace(size_t size) } // If we didn't find any space, allocate it at the end of the file - if (!best) + if (!best) { extend(size); return getSize() - size; @@ -444,7 +444,7 @@ offset_t TempSpace::allocateSpace(size_t size) // If the hunk was an exact fit, remove the segment from the // list and splice it into the not used segments list - if (space->size == size) + if (space->size == size) { *best = space->next; space->next = notUsedSegments; @@ -461,7 +461,7 @@ offset_t TempSpace::allocateSpace(size_t size) // // TempSpace::releaseSpace // -// Return previously allocated segment back into not used segments list and +// Return previously allocated segment back into not used segments list and // join it with adjacent segments if found // @@ -524,7 +524,7 @@ char* TempSpace::inMemory(offset_t begin, size_t size) const // // TempSpace::findMemory // -// Return contiguous chunk of memory and adjust starting offset +// Return contiguous chunk of memory and adjust starting offset // of search range if found // @@ -537,7 +537,7 @@ char* TempSpace::findMemory(offset_t& begin, offset_t end, size_t size) const while (block && (begin + size <= end)) { char* mem = block->inMemory(local_offset, size); - if (mem) + if (mem) { return mem; } @@ -579,16 +579,16 @@ bool TempSpace::validate(offset_t& free) const // // TempSpace::allocateBatch // -// Allocate up to 'count' contiguous chunks of memory available in free +// Allocate up to 'count' contiguous chunks of memory available in free // segments if any. Adjust size of chunks between minSize and maxSize -// accordingly to available free space (assuming all of the free space +// accordingly to available free space (assuming all of the free space // is in memory blocks). Algorithm is very simple and can be improved in future -// +// size_t TempSpace::allocateBatch(size_t count, size_t minSize, size_t maxSize, Segments& segments) { // adjust passed chunk size to amount of free memory we have and number - // of runs still not allocated. + // of runs still not allocated. offset_t freeMem = 0; Segment* freeSpace = freeSegments; for (; freeSpace; freeSpace = freeSpace->next) @@ -597,7 +597,7 @@ size_t TempSpace::allocateBatch(size_t count, size_t minSize, size_t maxSize, Se freeMem = MIN(freeMem / count, maxSize); freeMem = MAX(freeMem, minSize); freeMem = MIN(freeMem, minBlockSize); - + Segment** prevSpace = &freeSegments; freeSpace = freeSegments; offset_t freeSeek = freeSpace ? freeSpace->position : 0; @@ -665,13 +665,13 @@ size_t TempSpace::allocateBatch(size_t count, size_t minSize, size_t maxSize, Se // TempSpace::getSegment // // Return not used Segment instance or allocate new one -// +// TempSpace::Segment* TempSpace::getSegment(offset_t position, size_t size) { Segment* result = notUsedSegments; - if (result) + if (result) { notUsedSegments = result->next; @@ -679,7 +679,7 @@ TempSpace::Segment* TempSpace::getSegment(offset_t position, size_t size) result->position = position; result->size = size; } - else + else { result = (Segment*) FB_NEW(pool) Segment(NULL, position, size); } @@ -690,8 +690,8 @@ TempSpace::Segment* TempSpace::getSegment(offset_t position, size_t size) // // TempSpace::joinSegment // -// Extend existing segment and join it with adjacent segment -// +// Extend existing segment and join it with adjacent segment +// void TempSpace::joinSegment(Segment* seg, offset_t position, size_t size) { diff --git a/src/jrd/TextType.cpp b/src/jrd/TextType.cpp index 94c78c678b..1250e09180 100644 --- a/src/jrd/TextType.cpp +++ b/src/jrd/TextType.cpp @@ -240,7 +240,7 @@ USHORT TextType::string_to_key(USHORT srcLen, if (getCharSet()->isMultiByte()) { - dstLen = UnicodeUtil::utf16ToKey(srcLen, Firebird::Aligner(src, srcLen), + dstLen = UnicodeUtil::utf16ToKey(srcLen, Firebird::Aligner(src, srcLen), dstLen, dst, key_type); } else @@ -321,7 +321,7 @@ SSHORT TextType::compare(ULONG len1, if (getCharSet()->isMultiByte()) { INTL_BOOL error_flag; - return UnicodeUtil::utf16Compare(len1, Firebird::Aligner(str1, len1), + return UnicodeUtil::utf16Compare(len1, Firebird::Aligner(str1, len1), len2, Firebird::Aligner(str2, len2), &error_flag); } diff --git a/src/jrd/ThreadStart.cpp b/src/jrd/ThreadStart.cpp index 874648c14a..1eed7c93ae 100644 --- a/src/jrd/ThreadStart.cpp +++ b/src/jrd/ThreadStart.cpp @@ -84,7 +84,7 @@ int API_ROUTINE gds__thread_start(ThreadEntryPoint* entrypoint, } -namespace +namespace { #ifdef THREAD_PSCHED @@ -147,14 +147,14 @@ THREAD_ENTRY_DECLARE threadStart(THREAD_ENTRY_PARAM arg) #endif //THREAD_PSCHED -} // anonymous namespace +} // anonymous namespace #ifdef USE_POSIX_THREADS #define START_THREAD void ThreadStart::start(ThreadEntryPoint* routine, - void* arg, - int priority_arg, + void* arg, + int priority_arg, void* thd_id) { /************************************** @@ -206,7 +206,7 @@ void ThreadStart::start(ThreadEntryPoint* routine, } #else - + state = pthread_attr_create(&pattr); if (state) Firebird::system_call_failed::raise("pthread_attr_create", state); @@ -275,8 +275,8 @@ void THD_wait_for_completion(ThreadHandle& thread) #ifdef SOLARIS_MT #define START_THREAD void ThreadStart::start(ThreadEntryPoint* routine, - void* arg, - int priority_arg, + void* arg, + int priority_arg, void* thd_id) { /************************************** @@ -311,8 +311,8 @@ void ThreadStart::start(ThreadEntryPoint* routine, #ifdef WIN_NT #define START_THREAD void ThreadStart::start(ThreadEntryPoint* routine, - void* arg, - int priority_arg, + void* arg, + int priority_arg, void* thd_id) { /************************************** @@ -354,7 +354,7 @@ void ThreadStart::start(ThreadEntryPoint* routine, #ifdef THREAD_PSCHED ThreadPriorityScheduler::Init(); - ThreadPriorityScheduler* tps = FB_NEW(*getDefaultMemoryPool()) + ThreadPriorityScheduler* tps = FB_NEW(*getDefaultMemoryPool()) ThreadPriorityScheduler(routine, arg, ThreadPriorityScheduler::adjustPriority(priority)); #endif // THREAD_PSCHED @@ -389,7 +389,7 @@ void THD_detach(ThreadHandle& handle) { CloseHandle(handle); } - + void THD_wait_for_completion(ThreadHandle& handle) { WaitForSingleObject(handle, INFINITE); @@ -399,8 +399,8 @@ void THD_wait_for_completion(ThreadHandle& handle) #ifndef START_THREAD void ThreadStart::start(ThreadEntryPoint* routine, - void* arg, - int priority_arg, + void* arg, + int priority_arg, void* thd_id) { /************************************** diff --git a/src/jrd/UserManagement.cpp b/src/jrd/UserManagement.cpp index 0d74b72254..01967ee72f 100644 --- a/src/jrd/UserManagement.cpp +++ b/src/jrd/UserManagement.cpp @@ -44,7 +44,7 @@ UserManagement::UserManagement(thread_db* tdbb) dpb.insertByte(isc_dpb_gsec_attach, TRUE); dpb.insertString(isc_dpb_trusted_auth, tdbb->getAttachment()->att_user->usr_user_name); - if (isc_attach_database(status, 0, securityDatabaseName, &database, + if (isc_attach_database(status, 0, securityDatabaseName, &database, dpb.getBufferLength(), reinterpret_cast(dpb.getBuffer()))) { status_exception::raise(status); @@ -59,10 +59,10 @@ UserManagement::UserManagement(thread_db* tdbb) void UserManagement::commit() { ISC_STATUS_ARRAY status; - if (transaction) + if (transaction) { // Commit transaction in security database - if (isc_commit_transaction(status, &transaction)) + if (isc_commit_transaction(status, &transaction)) { status_exception::raise(status); } @@ -73,18 +73,18 @@ void UserManagement::commit() UserManagement::~UserManagement() { ISC_STATUS_ARRAY status; - if (transaction) + if (transaction) { // Rollback transaction in security database ... - if (isc_rollback_transaction(status, &transaction)) + if (isc_rollback_transaction(status, &transaction)) { status_exception::raise(status); } } - if (database) + if (database) { - if (isc_detach_database(status, &database)) + if (isc_detach_database(status, &database)) { status_exception::raise(status); } diff --git a/src/jrd/all.cpp b/src/jrd/all.cpp index c3930ef7e3..de6fe593d8 100644 --- a/src/jrd/all.cpp +++ b/src/jrd/all.cpp @@ -40,11 +40,11 @@ void ALL_check_memory() * * Functional description * This routine goes through all allocated - * memory pools and checks the hunks of + * memory pools and checks the hunks of * memory allocated to make sure they are * valid. It is designed to be used for * debugging purposes to find bad memory - * areas as soon as they are corrupted. + * areas as soon as they are corrupted. * A call to this routine can be made from * looper() to ensure that it will be regularly * executed. @@ -104,11 +104,11 @@ void ALL_print_memory_pool_info(FILE* fptr, Database* databases) { fprintf(fptr, "\n\t dbb #%d -> %s\n", k, dbb->dbb_filename.c_str()); j = 0; - + size_t itr; for (itr = 0; itr < dbb->dbb_pools.getCount(); ++itr) { - if (dbb->dbb_pools[itr]) + if (dbb->dbb_pools[itr]) { ++j; } @@ -122,7 +122,7 @@ void ALL_print_memory_pool_info(FILE* fptr, Database* databases) for (itr = 0; itr < dbb->dbb_pools.getCount(); ++itr) { MemoryPool *myPool = dbb->dbb_pools[itr]; - if (myPool) + if (myPool) { myPool->print_contents(fptr, true); } diff --git a/src/jrd/alt.cpp b/src/jrd/alt.cpp index 160c498bab..fa8e1877ca 100644 --- a/src/jrd/alt.cpp +++ b/src/jrd/alt.cpp @@ -78,7 +78,7 @@ SLONG API_ROUTINE_VARARG isc_event_block(UCHAR** event_buffer, va_start(ptr, count); -/* calculate length of event parameter block, +/* calculate length of event parameter block, setting initial length to include version and counts for each argument */ @@ -142,7 +142,7 @@ USHORT API_ROUTINE isc_event_block_a(SCHAR** event_buffer, { /************************************** * - * i s c _ e v e n t _ b l o c k _ a + * i s c _ e v e n t _ b l o c k _ a * ************************************** * @@ -155,7 +155,7 @@ USHORT API_ROUTINE isc_event_block_a(SCHAR** event_buffer, **************************************/ const int MAX_NAME_LENGTH = 31; -/* calculate length of event parameter block, +/* calculate length of event parameter block, setting initial length to include version and counts for each argument */ @@ -357,7 +357,7 @@ ISC_STATUS API_ROUTINE gds__create_blob(ISC_STATUS* status_vector, FB_API_HANDLE* tra_handle, FB_API_HANDLE* blob_handle, GDS_QUAD* blob_id) { - return isc_create_blob(status_vector, db_handle, tra_handle, blob_handle, + return isc_create_blob(status_vector, db_handle, tra_handle, blob_handle, blob_id); } @@ -484,7 +484,7 @@ ISC_STATUS API_ROUTINE gds__put_slice(ISC_STATUS* status_vector, const SLONG* parameters, SLONG slice_length, void* slice) { - return isc_put_slice(status_vector, db_handle, tra_handle, array_id, + return isc_put_slice(status_vector, db_handle, tra_handle, array_id, sdl_length, sdl, parameters_leng, parameters, slice_length, reinterpret_cast(slice)); } @@ -557,7 +557,7 @@ ISC_STATUS API_ROUTINE gds__send(ISC_STATUS* status_vector, SSHORT msg_length, const void* msg, SSHORT req_level) { - return isc_send(status_vector, req_handle, msg_type, msg_length, + return isc_send(status_vector, req_handle, msg_type, msg_length, static_cast(msg), req_level); } @@ -576,7 +576,7 @@ ISC_STATUS API_ROUTINE gds__start_multiple(ISC_STATUS * status_vector, FB_API_HANDLE* tra_handle, SSHORT db_count, void *teb_vector) { - return isc_start_multiple(status_vector, tra_handle, db_count, + return isc_start_multiple(status_vector, tra_handle, db_count, (SCHAR *) teb_vector); } @@ -845,7 +845,7 @@ void API_ROUTINE CVT_move(const dsc*, dsc*, FPTR_ERROR err) } #if !defined(SUPERSERVER) || defined(SUPERCLIENT) -// AP: isc_*_user entrypoints are used only in any kind of embedded +// AP: isc_*_user entrypoints are used only in any kind of embedded // server (both posix and windows) and fbclient #ifndef BOOT_BUILD @@ -1208,7 +1208,7 @@ static ISC_STATUS executeSecurityCommand( input_user_data->dba_user_name, input_user_data->dba_password, false, - input_user_data->protocol, + input_user_data->protocol, input_user_data->server); if (handle) { @@ -1216,7 +1216,7 @@ static ISC_STATUS executeSecurityCommand( static Firebird::GlobalPtr > secExecBuf; callRemoteServiceManager(status, handle, userInfo, 0, 0); - + { // scope for MutexLockGuard Firebird::MutexLockGuard lockMutex(secExecMutex); secExecBuf->makePermanentVector(status, status); diff --git a/src/jrd/blb.cpp b/src/jrd/blb.cpp index 90c5308a6d..6ddd0020f5 100644 --- a/src/jrd/blb.cpp +++ b/src/jrd/blb.cpp @@ -315,7 +315,7 @@ blb* BLB_create2(thread_db* tdbb, if (to_charset == CS_dynamic) to_charset = tdbb->getAttachment()->att_charset; - if ((to_charset != CS_NONE) && (from_charset != CS_NONE) && + if ((to_charset != CS_NONE) && (from_charset != CS_NONE) && (to_charset != CS_BINARY) && (from_charset != CS_BINARY) && (from_charset != to_charset)) { @@ -389,7 +389,7 @@ void BLB_garbage_collect( * purge -- removing all but top version of a record * update_in_place -- replace the top level record. * - * hvlad: note that same blob_id can be reused by the staying record version + * hvlad: note that same blob_id can be reused by the staying record version * in the different field than it was in going record. This is happening * with 3 blob fields and update_in_place * @@ -399,16 +399,16 @@ void BLB_garbage_collect( RecordBitmap bmGoing; ULONG cntGoing = 0; - // Loop thru records on the way out looking for blobs to garbage collect - for (RecordStack::iterator stack1(going); stack1.hasData(); ++stack1) + // Loop thru records on the way out looking for blobs to garbage collect + for (RecordStack::iterator stack1(going); stack1.hasData(); ++stack1) { Record* rec = stack1.object(); if (!rec) continue; - // Look for active blob records + // Look for active blob records const Format* format = rec->rec_format; - for (USHORT id = 0; id < format->fmt_count; id++) + for (USHORT id = 0; id < format->fmt_count; id++) { DSC desc; if (DTYPE_IS_BLOB(format->fmt_desc[id].dsc_dtype) && @@ -423,13 +423,13 @@ void BLB_garbage_collect( bmGoing.set(number.getValue()); cntGoing++; } - else + else { - // hvlad: blob_id in descriptor is not from our relation. Yes, it is - // garbage in user data but we can handle it without bugcheck - just - // ignore it. To be reconsider latter based on real user reports. + // hvlad: blob_id in descriptor is not from our relation. Yes, it is + // garbage in user data but we can handle it without bugcheck - just + // ignore it. To be reconsider latter based on real user reports. // The same about staying blob few lines below - gds__log("going blob (%ld:%ld) is not owned by relation (id = %d), ignored", + gds__log("going blob (%ld:%ld) is not owned by relation (id = %d), ignored", blob->bid_quad.bid_quad_high, blob->bid_quad.bid_quad_low, relation->rel_id); } } @@ -440,15 +440,15 @@ void BLB_garbage_collect( if (!cntGoing) return; - // Make sure the blob doesn't stay in any record remaining - for (RecordStack::iterator stack2(staying); stack2.hasData(); ++stack2) + // Make sure the blob doesn't stay in any record remaining + for (RecordStack::iterator stack2(staying); stack2.hasData(); ++stack2) { Record* rec = stack2.object(); if (!rec) continue; const Format* format = rec->rec_format; - for (USHORT id = 0; id < format->fmt_count; id++) + for (USHORT id = 0; id < format->fmt_count; id++) { DSC desc; if (DTYPE_IS_BLOB(format->fmt_desc[id].dsc_dtype) && @@ -460,7 +460,7 @@ void BLB_garbage_collect( if (blob->bid_internal.bid_relation_id == relation->rel_id) { const RecordNumber number = blob->get_permanent_number(); - if (bmGoing.test(number.getValue())) + if (bmGoing.test(number.getValue())) { bmGoing.clear(number.getValue()); if (!--cntGoing) @@ -469,7 +469,7 @@ void BLB_garbage_collect( } else { - gds__log("staying blob (%ld:%ld) is not owned by relation (id = %d), ignored", + gds__log("staying blob (%ld:%ld) is not owned by relation (id = %d), ignored", blob->bid_quad.bid_quad_high, blob->bid_quad.bid_quad_low, relation->rel_id); } } @@ -1030,7 +1030,7 @@ void BLB_move(thread_db* tdbb, dsc* from_desc, dsc* to_desc, jrd_nod* field) BLB_gen_bpb_from_descs(from_desc, to_desc, bpb); Database* dbb = tdbb->getDatabase(); - const USHORT pageSpace = dbb->dbb_flags & DBB_read_only ? + const USHORT pageSpace = dbb->dbb_flags & DBB_read_only ? dbb->dbb_page_manager.getTempPageSpaceID(tdbb) : DB_PAGE_SPACE; copy_blob(tdbb, source, destination, bpb.getCount(), bpb.begin(), pageSpace); @@ -1086,7 +1086,7 @@ void BLB_move(thread_db* tdbb, dsc* from_desc, dsc* to_desc, jrd_nod* field) if (needFilter) BLB_gen_bpb_from_descs(from_desc, to_desc, bpb); - while (true) + while (true) { materialized_blob = false; blobIndex = NULL; @@ -1175,8 +1175,8 @@ void BLB_move(thread_db* tdbb, dsc* from_desc, dsc* to_desc, jrd_nod* field) // This is the only place in the engine where blobs are materialized // If new places appear code below should transform to common sub-routine if (materialized_blob) { - // hvlad: we have possible thread switch in DPM_store_blob above and somebody - // can modify transaction->tra_blobs therefore we must update our blobIndex + // hvlad: we have possible thread switch in DPM_store_blob above and somebody + // can modify transaction->tra_blobs therefore we must update our blobIndex if (!transaction->tra_blobs->locate(blob->blb_temp_id)) { // If we didn't find materialized blob in transaction blob index it // means memory structures are inconsistent and crash is appropriate @@ -1190,7 +1190,7 @@ void BLB_move(thread_db* tdbb, dsc* from_desc, dsc* to_desc, jrd_nod* field) jrd_req* own_request; if (blobIndex->bli_request) { own_request = blobIndex->bli_request; - } + } else { own_request = request; while (own_request->req_caller) @@ -2010,7 +2010,7 @@ static ISC_STATUS blob_filter( USHORT action, } -static blb* copy_blob(thread_db* tdbb, const bid* source, bid* destination, +static blb* copy_blob(thread_db* tdbb, const bid* source, bid* destination, USHORT bpb_length, const UCHAR* bpb, USHORT destPageSpaceID) { @@ -2165,7 +2165,7 @@ static void delete_blob_id( /* Fetch blob */ - blb* blob = allocate_blob(tdbb, dbb->dbb_sys_trans); + blb* blob = allocate_blob(tdbb, dbb->dbb_sys_trans); blob->blb_relation = relation; blob->blb_pg_space_id = relation->getPages(tdbb)->rel_pg_space_id; prior_page = @@ -2510,7 +2510,7 @@ static void move_from_string(thread_db* tdbb, const dsc* from_desc, dsc* to_desc if (blob_request) { if (blob_request->req_blobs.locate(blob_temp_id)) { blob_request->req_blobs.fastRemove(); - } + } else { // We should never get here because when bli_request is assigned // item should be added to req_blobs array @@ -2624,7 +2624,7 @@ static void release_blob(blb* blob, const bool purge_flag) } transaction->tra_blobs->fastRemove(); - } + } else { // We should never get here because allocate_blob stores each blob object diff --git a/src/jrd/blob_filter.cpp b/src/jrd/blob_filter.cpp index 88fd0ece69..e688b74c86 100644 --- a/src/jrd/blob_filter.cpp +++ b/src/jrd/blob_filter.cpp @@ -65,7 +65,7 @@ static const FPTR_BFILTER_CALLBACK filters[] = }; -static void open_blob(thread_db*, jrd_tra*, BlobControl**, bid*, +static void open_blob(thread_db*, jrd_tra*, BlobControl**, bid*, USHORT, const UCHAR*, FPTR_BFILTER_CALLBACK, USHORT, BlobFilter*); @@ -300,12 +300,12 @@ void BLF_put_segment(thread_db* tdbb, } } -// SEH moved to separate function to avoid conflicts +// SEH moved to separate function to avoid conflicts // with destructor of BlobControl inline void initializeFilter(thread_db *tdbb, ISC_STATUS &status, - BlobControl *control, - BlobFilter* filter, + BlobControl *control, + BlobFilter* filter, USHORT action) { START_CHECK_FOR_EXCEPTIONS(control->ctl_exception_message.c_str()) @@ -348,7 +348,7 @@ static void open_blob( /* Allocate a filter control block and open blob */ -/* utilize a temporary control block just to pass the three +/* utilize a temporary control block just to pass the three necessary internal parameters to the filter */ BlobControl temp; temp.ctl_internal[0] = dbb; diff --git a/src/jrd/btn.cpp b/src/jrd/btn.cpp index cefaeecb8a..9aa603bcf3 100644 --- a/src/jrd/btn.cpp +++ b/src/jrd/btn.cpp @@ -28,14 +28,14 @@ #include "memory_routines.h" // needed for get_long #include "../jrd/common.h" // needed for SINT64 -#include "../jrd/ods.h" -#include "../jrd/btn.h" +#include "../jrd/ods.h" +#include "../jrd/btn.h" namespace BTreeNode { using namespace Ods; -USHORT computePrefix(const UCHAR* prevString, USHORT prevLength, +USHORT computePrefix(const UCHAR* prevString, USHORT prevLength, const UCHAR* string, USHORT length) { /************************************** @@ -45,7 +45,7 @@ USHORT computePrefix(const UCHAR* prevString, USHORT prevLength, ************************************** * * Functional description - * Compute and return prefix common + * Compute and return prefix common * to two strings. * **************************************/ @@ -86,14 +86,14 @@ SLONG findPageInDuplicates(const btree_page* page, UCHAR* pointer, IndexNode node, previousNode; pointer = readNode(&node, pointer, flags, leafPage); - + // Check if pointer is still valid //if (pointer > endPointer) { // BUGCHECK(204); // msg 204 index inconsistent //} while (true) { - // loop through duplicates until + // loop through duplicates until // correct node is found. // If this is an end bucket marker then return // the previous passed page number. @@ -105,8 +105,8 @@ SLONG findPageInDuplicates(const btree_page* page, UCHAR* pointer, // then record number must be at the previous // passed page number. return previousNumber; - } - // Save current page number and fetch next node + } + // Save current page number and fetch next node // for comparision. previousNumber = node.pageNumber; previousNode = node; @@ -117,10 +117,10 @@ SLONG findPageInDuplicates(const btree_page* page, UCHAR* pointer, // BUGCHECK(204); // msg 204 index inconsistent //} - // We're done if end level marker is reached or this + // We're done if end level marker is reached or this // isn't a equal node anymore. - if ((node.isEndLevel) || - (node.length != 0) || + if ((node.isEndLevel) || + (node.length != 0) || (node.prefix != (previousNode.length + previousNode.prefix))) { return previousNumber; @@ -139,7 +139,7 @@ USHORT getJumpNodeSize(const IndexJumpNode* jumpNode, UCHAR flags) ************************************** * * Functional description - * Return the size needed to store + * Return the size needed to store * this node. * **************************************/ @@ -194,14 +194,14 @@ USHORT getNodeSize(const IndexNode* indexNode, UCHAR flags, bool leafNode) ************************************** * * Functional description - * Return the size needed to store + * Return the size needed to store * this node. * **************************************/ USHORT result = 0; if (flags & btr_large_keys) { - // Determine flags + // Determine flags UCHAR internalFlags = 0; if (indexNode->isEndLevel) { internalFlags = BTN_END_LEVEL_FLAG; @@ -255,7 +255,7 @@ USHORT getNodeSize(const IndexNode* indexNode, UCHAR flags, bool leafNode) // Size needed for page number number = indexNode->pageNumber; if (number < 0) { - number = 0; + number = 0; } if (number & 0xF0000000) { @@ -276,7 +276,7 @@ USHORT getNodeSize(const IndexNode* indexNode, UCHAR flags, bool leafNode) } if (internalFlags != BTN_ZERO_PREFIX_ZERO_LENGTH_FLAG) { - // Size needed for prefix + // Size needed for prefix number = indexNode->prefix; if (number & 0xFFFFC000) { result += 3; @@ -291,9 +291,9 @@ USHORT getNodeSize(const IndexNode* indexNode, UCHAR flags, bool leafNode) if ((internalFlags != BTN_ZERO_PREFIX_ZERO_LENGTH_FLAG) && (internalFlags != BTN_ZERO_LENGTH_FLAG) && - (internalFlags != BTN_ONE_LENGTH_FLAG)) + (internalFlags != BTN_ONE_LENGTH_FLAG)) { - // Size needed for length + // Size needed for length number = indexNode->length; if (number & 0xFFFFC000) { result += 3; @@ -309,18 +309,18 @@ USHORT getNodeSize(const IndexNode* indexNode, UCHAR flags, bool leafNode) result += indexNode->length; } else { - // Size needed for prefix + // Size needed for prefix result++; - // Size needed for length + // Size needed for length result++; - // Size needed for page number + // Size needed for page number result += sizeof(SLONG); result += indexNode->length; if ((flags & btr_all_record_number) && (!leafNode || - (leafNode && indexNode->isEndBucket && (indexNode->length == 0)))) + (leafNode && indexNode->isEndBucket && (indexNode->length == 0)))) { // Size needed for record number result += sizeof(SLONG); @@ -340,7 +340,7 @@ UCHAR* getPointerFirstNode(btree_page* page, IndexJumpInfo* jumpInfo) ************************************** * * Functional description - * Return the pointer to first data node + * Return the pointer to first data node * in the bucket. When a jumpInfo is * given, then pointer of first jump * node is returned. @@ -408,13 +408,13 @@ UCHAR* lastNode(btree_page* page, exp_index_buf* expanded_page, btree_exp** expa * ************************************** * - * Functional description + * Functional description * Find the last node on a page. Used when walking - * down the right side of an index tree. + * down the right side of an index tree. * **************************************/ - // the last expanded node is always at the end of the page + // the last expanded node is always at the end of the page // minus the size of a btree_exp, since there is always an extra // btree_exp node with zero-length tail at the end of the page btree_exp* enode = (btree_exp*) ((UCHAR*) expanded_page + expanded_page->exp_length - BTX_SIZE); @@ -426,8 +426,8 @@ UCHAR* lastNode(btree_page* page, exp_index_buf* expanded_page, btree_exp** expa IndexNode node; while (true) { pointer = previousNode(&node, pointer, flags, &enode); - if (!node.isEndBucket && - !node.isEndLevel) + if (!node.isEndBucket && + !node.isEndLevel) { if (expanded_node) { *expanded_node = enode; @@ -439,7 +439,7 @@ UCHAR* lastNode(btree_page* page, exp_index_buf* expanded_page, btree_exp** expa #endif -UCHAR* nextNode(IndexNode* node, UCHAR* pointer, +UCHAR* nextNode(IndexNode* node, UCHAR* pointer, UCHAR flags, btree_exp** expanded_node) { /************************************** @@ -448,7 +448,7 @@ UCHAR* nextNode(IndexNode* node, UCHAR* pointer, * ************************************** * - * Functional description + * Functional description * Find the next node on both the index page * and its associated expanded buffer. * @@ -474,9 +474,9 @@ UCHAR* previousNode(IndexNode* node, UCHAR* pointer, * ************************************** * - * Functional description + * Functional description * Find the previous node on a page. Used when walking - * an index backwards. + * an index backwards. * **************************************/ @@ -497,9 +497,9 @@ UCHAR* readJumpInfo(IndexJumpInfo* jumpInfo, UCHAR* pagePointer) ************************************** * * Functional description - * Read jump information from the page - * by the given pagePointer and the - * return the remaining position after + * Read jump information from the page + * by the given pagePointer and the + * return the remaining position after * the read. * **************************************/ @@ -512,7 +512,7 @@ UCHAR* readJumpInfo(IndexJumpInfo* jumpInfo, UCHAR* pagePointer) } -UCHAR* readJumpNode(IndexJumpNode* jumpNode, UCHAR* pagePointer, +UCHAR* readJumpNode(IndexJumpNode* jumpNode, UCHAR* pagePointer, UCHAR flags) { /************************************** @@ -579,7 +579,7 @@ UCHAR* writeJumpInfo(btree_page* page, const IndexJumpInfo* jumpInfo) } -UCHAR* writeJumpNode(IndexJumpNode* jumpNode, UCHAR* pagePointer, +UCHAR* writeJumpNode(IndexJumpNode* jumpNode, UCHAR* pagePointer, UCHAR flags) { /************************************** @@ -654,7 +654,7 @@ UCHAR* writeNode(IndexNode* indexNode, UCHAR* pagePointer, UCHAR flags, // To allow as much as compression possible we // store numbers per 7 bit and the 8-th bit tell us // if we need to go on reading or we're done. - // Also for duplicate node entries (length and prefix + // Also for duplicate node entries (length and prefix // are zero) we don't store the length and prefix // information. This will save at least 2 bytes per node. @@ -735,7 +735,7 @@ UCHAR* writeNode(IndexNode* indexNode, UCHAR* pagePointer, UCHAR flags, if (number == 0) { *pagePointer++ = tmp; } -/* +/* Enable this if you need more bits in record number else { *pagePointer++ = tmp | 0x80; @@ -867,9 +867,9 @@ UCHAR* writeNode(IndexNode* indexNode, UCHAR* pagePointer, UCHAR flags, if ((internalFlags != BTN_ZERO_PREFIX_ZERO_LENGTH_FLAG) && (internalFlags != BTN_ZERO_LENGTH_FLAG) && - (internalFlags != BTN_ONE_LENGTH_FLAG)) + (internalFlags != BTN_ONE_LENGTH_FLAG)) { - // Write length, maximum 14 bits + // Write length, maximum 14 bits number = indexNode->length; tmp = (number & 0x7F); number >>= 7; @@ -886,13 +886,13 @@ UCHAR* writeNode(IndexNode* indexNode, UCHAR* pagePointer, UCHAR flags, // Store data if (withData) { memcpy(pagePointer, indexNode->data, indexNode->length); - } + } pagePointer += indexNode->length; } else { - // Write prefix + // Write prefix *pagePointer++ = (UCHAR)indexNode->prefix; - // Write length + // Write length *pagePointer++ = (UCHAR)indexNode->length; if (indexNode->isEndLevel) { @@ -907,11 +907,11 @@ UCHAR* writeNode(IndexNode* indexNode, UCHAR* pagePointer, UCHAR flags, put_long(pagePointer, indexNode->recordNumber.getValue()); } else { - // Write page number + // Write page number put_long(pagePointer, indexNode->pageNumber); } } - pagePointer += sizeof(SLONG); + pagePointer += sizeof(SLONG); if (withData) { USHORT size = indexNode->length; @@ -920,16 +920,16 @@ UCHAR* writeNode(IndexNode* indexNode, UCHAR* pagePointer, UCHAR flags, *pagePointer++ = *ptr++; size--; } - } + } else { pagePointer += indexNode->length; } - if ((flags & btr_all_record_number) && + if ((flags & btr_all_record_number) && (!leafNode || - (leafNode && indexNode->isEndBucket && (indexNode->length == 0)))) + (leafNode && indexNode->isEndBucket && (indexNode->length == 0)))) { - // Write record number + // Write record number put_long(pagePointer, indexNode->recordNumber.getValue()); pagePointer += sizeof(SLONG); } @@ -975,7 +975,7 @@ void setEndLevel(IndexNode* indexNode, bool leafNode) } -void setNode(IndexNode* indexNode, USHORT prefix, USHORT length, +void setNode(IndexNode* indexNode, USHORT prefix, USHORT length, RecordNumber recordNumber, SLONG pageNumber, bool isEndBucket, bool isEndLevel) { diff --git a/src/jrd/btr.cpp b/src/jrd/btr.cpp index dbf74ace1e..b30c5921ed 100644 --- a/src/jrd/btr.cpp +++ b/src/jrd/btr.cpp @@ -79,7 +79,7 @@ const int MAX_LEVELS = 16; #define OVERSIZE (MAX_PAGE_SIZE + BTN_PAGE_SIZE + MAX_KEY + sizeof (SLONG) - 1) / sizeof (SLONG) -// END_LEVEL (-1) is choosen here as a unknown/none value, because it's +// END_LEVEL (-1) is choosen here as a unknown/none value, because it's // already reserved as END_LEVEL marker for page number and record number. // // NO_VALUE_PAGE and NO_VALUE are the same constant, but with different size @@ -94,7 +94,7 @@ const SLONG NO_SPLIT = 0; // Thresholds for determing of a page should be garbage collected // Garbage collect if page size is below GARBAGE_COLLECTION_THRESHOLD #define GARBAGE_COLLECTION_BELOW_THRESHOLD (dbb->dbb_page_size / 4) -// Garbage collect only if new merged page will +// Garbage collect only if new merged page will // be lower as GARBAGE_COLLECTION_NEW_PAGE_MAX_THRESHOLD // 256 is the old maximum possible key_length. #define GARBAGE_COLLECTION_NEW_PAGE_MAX_THRESHOLD ((dbb->dbb_page_size - 256)) @@ -155,8 +155,8 @@ static const struct { /* Used in make_int64_key() */ * uniquely. Values after this tend to round off to the upper limit during * division. Hence the ending with 0's so that values will be bunched together * in the same limit range and scale control for INT64 index temporary_key calculation. - * - * This part was changed as a fix for bug 10267. - bsriram 04-Mar-1999 + * + * This part was changed as a fix for bug 10267. - bsriram 04-Mar-1999 */ /* enumerate the possible outcomes of deleting a node */ @@ -182,20 +182,20 @@ static SLONG fast_load(thread_db*, jrd_rel*, index_desc*, USHORT, sort_context*, SelectivityList&); static index_root_page* fetch_root(thread_db*, WIN*, const jrd_rel*, const RelationPages*); -static UCHAR* find_node_start_point(btree_page*, temporary_key*, UCHAR*, USHORT*, +static UCHAR* find_node_start_point(btree_page*, temporary_key*, UCHAR*, USHORT*, bool, bool, bool = false, RecordNumber = NO_VALUE); -static UCHAR* find_area_start_point(btree_page*, const temporary_key*, UCHAR *, +static UCHAR* find_area_start_point(btree_page*, const temporary_key*, UCHAR *, USHORT *, bool, bool, RecordNumber = NO_VALUE); -static SLONG find_page(btree_page*, const temporary_key*, UCHAR, RecordNumber = NO_VALUE, +static SLONG find_page(btree_page*, const temporary_key*, UCHAR, RecordNumber = NO_VALUE, bool = false); static CONTENTS garbage_collect(thread_db*, WIN*, SLONG); static void generate_jump_nodes(thread_db*, btree_page*, jumpNodeList*, USHORT, USHORT*, USHORT*, USHORT*); -static SLONG insert_node(thread_db*, WIN*, index_insertion*, temporary_key*, +static SLONG insert_node(thread_db*, WIN*, index_insertion*, temporary_key*, RecordNumber*, SLONG*, SLONG*); static INT64_KEY make_int64_key(SINT64, SSHORT); @@ -204,19 +204,19 @@ static void print_int64_key(SINT64, SSHORT, INT64_KEY); #endif static CONTENTS remove_node(thread_db*, index_insertion*, WIN*); static CONTENTS remove_leaf_node(thread_db*, index_insertion*, WIN*); -static bool scan(thread_db*, UCHAR*, RecordBitmap**, RecordBitmap*, index_desc*, - IndexRetrieval*, USHORT, temporary_key*, const SCHAR, +static bool scan(thread_db*, UCHAR*, RecordBitmap**, RecordBitmap*, index_desc*, + IndexRetrieval*, USHORT, temporary_key*, const SCHAR, bool&, const temporary_key&); static void update_selectivity(index_root_page*, USHORT, const SelectivityList&); -static void checkForLowerKeySkip(bool&, const bool, const IndexNode&, const temporary_key&, +static void checkForLowerKeySkip(bool&, const bool, const IndexNode&, const temporary_key&, const index_desc&, const IndexRetrieval*); class Jrd::BtrPageGCLock : public Lock { - // We want to put 8 bytes (PageNumber) in lock key. One long is already - // reserved by Lock::lck_long, this is the second long. It is really unused - // as second long needed for 8-byte key already "allocated" by compiler - // because of alignment rules. Anyway, to be formally correct, let introduce + // We want to put 8 bytes (PageNumber) in lock key. One long is already + // reserved by Lock::lck_long, this is the second long. It is really unused + // as second long needed for 8-byte key already "allocated" by compiler + // because of alignment rules. Anyway, to be formally correct, let introduce // 4-byte field for guarantee we have space for lock key. SLONG unused; @@ -289,7 +289,7 @@ USHORT BTR_all(thread_db* tdbb, SET_TDBB(tdbb); const Database* dbb = tdbb->getDatabase(); CHECK_DBB(dbb); - + WIN window(relPages->rel_pg_space_id, -1); index_root_page* root = fetch_root(tdbb, &window, relation, relPages); @@ -354,14 +354,14 @@ void BTR_create(thread_db* tdbb, CHECK_DBB(dbb); // Now that the index id has been checked out, create the index. - idx->idx_root = fast_load(tdbb, relation, idx, key_length, + idx->idx_root = fast_load(tdbb, relation, idx, key_length, sort_handle, selectivity); // Index is created. Go back to the index root page and update it to // point to the index. RelationPages* relPages = relation->getPages(tdbb); WIN window(relPages->rel_pg_space_id, relPages->rel_index_root); - index_root_page* root = + index_root_page* root = (index_root_page*) CCH_FETCH(tdbb, &window, LCK_write, pag_root); CCH_MARK(tdbb, &window); root->irt_rpt[idx->idx_id].irt_root = idx->idx_root; @@ -490,7 +490,7 @@ DSC* BTR_eval_expression(thread_db* tdbb, index_desc* idx, Record* record, bool { SET_TDBB(tdbb); fb_assert(idx->idx_expression != NULL); - + // 15 June 2004. Nickolay Samofatov. // This code doesn't look correct. It should get broken in // case of reentrance due to recursion or multi-threading @@ -548,7 +548,7 @@ DSC* BTR_eval_expression(thread_db* tdbb, index_desc* idx, Record* record, bool static void checkForLowerKeySkip( - bool& skipLowerKey, + bool& skipLowerKey, const bool partLower, const IndexNode& node, const temporary_key& lower, @@ -557,35 +557,35 @@ static void checkForLowerKeySkip( { if (node.prefix == 0) { - // If the prefix is 0 we have a full key. + // If the prefix is 0 we have a full key. // (first node on every new page for example has prefix zero) - if (partLower) + if (partLower) { // With multi-segment compare first part of data with lowerKey - skipLowerKey = + skipLowerKey = ((lower.key_length <= node.length) && (memcmp(node.data, lower.key_data, lower.key_length) == 0)); if (skipLowerKey && (node.length > lower.key_length)) { - // We've bigger data in the node than in the lowerKey, + // We've bigger data in the node than in the lowerKey, // now check the segment-number const UCHAR *segp = node.data + lower.key_length; - const USHORT segnum = - idx.idx_count - (UCHAR)((idx.idx_flags & idx_descending) ? + const USHORT segnum = + idx.idx_count - (UCHAR)((idx.idx_flags & idx_descending) ? ((*segp) ^ -1) : *segp); - if (segnum < retrieval->irb_lower_count) + if (segnum < retrieval->irb_lower_count) { skipLowerKey = false; - } + } } } else { // Compare full data with lowerKey - skipLowerKey = + skipLowerKey = ((lower.key_length == node.length) && (memcmp(node.data, lower.key_data, lower.key_length) == 0)); } @@ -596,20 +596,20 @@ static void checkForLowerKeySkip( if (node.prefix < lower.key_length) { skipLowerKey = false; } - else if ((node.prefix == lower.key_length) && node.length) + else if ((node.prefix == lower.key_length) && node.length) { - // In case of multi-segment check segment-number else + // In case of multi-segment check segment-number else // it's a different key - if (partLower) + if (partLower) { - const USHORT segnum = - idx.idx_count - (UCHAR)((idx.idx_flags & idx_descending) ? + const USHORT segnum = + idx.idx_count - (UCHAR)((idx.idx_flags & idx_descending) ? (*node.data) ^ -1 : *node.data); if (segnum < retrieval->irb_lower_count) { skipLowerKey = false; } - } + } else { skipLowerKey = false; } @@ -627,7 +627,7 @@ void BTR_evaluate(thread_db* tdbb, IndexRetrieval* retrieval, RecordBitmap** bit ************************************** * * Functional description - * Do an index scan and return a bitmap + * Do an index scan and return a bitmap * of all candidate record numbers. * **************************************/ @@ -654,13 +654,13 @@ void BTR_evaluate(thread_db* tdbb, IndexRetrieval* retrieval, RecordBitmap** bit const bool partLower = (retrieval->irb_lower_count < idx.idx_count); // If there is a starting descriptor, search down index to starting position. - // This may involve sibling buckets if splits are in progress. If there + // This may involve sibling buckets if splits are in progress. If there // isn't a starting descriptor, walk down the left side of the index. USHORT prefix; UCHAR* pointer; if (retrieval->irb_lower_count) { while (!(pointer = find_node_start_point(page, &lower, 0, &prefix, - idx.idx_flags & idx_descending, + idx.idx_flags & idx_descending, (retrieval->irb_generic & (irb_starting | irb_partial))))) { page = (btree_page*) CCH_HANDOFF(tdbb, &window, page->btr_sibling, @@ -691,13 +691,13 @@ void BTR_evaluate(thread_db* tdbb, IndexRetrieval* retrieval, RecordBitmap** bit } } - if ((q >= end) && (p < node.data + node.length) && skipLowerKey && partLower) + if ((q >= end) && (p < node.data + node.length) && skipLowerKey && partLower) { - // since key length always is multiplier of (STUFF_COUNT + 1) (for partial - // compound keys) and we passed lower key completely then p pointed - // us to the next segment number and we can use this fact to calculate + // since key length always is multiplier of (STUFF_COUNT + 1) (for partial + // compound keys) and we passed lower key completely then p pointed + // us to the next segment number and we can use this fact to calculate // how many segments is equal to lower key - const USHORT segnum = + const USHORT segnum = idx.idx_count - (UCHAR)(descending ? ((*p) ^ -1) : *p); if (segnum < retrieval->irb_lower_count) { @@ -719,8 +719,8 @@ void BTR_evaluate(thread_db* tdbb, IndexRetrieval* retrieval, RecordBitmap** bit const UCHAR flags = page->btr_header.pag_flags; // if there is an upper bound, scan the index pages looking for it if (retrieval->irb_upper_count) { - while (scan(tdbb, pointer, bitmap, bitmap_and, &idx, retrieval, prefix, &upper, flags, - skipLowerKey, lower)) + while (scan(tdbb, pointer, bitmap, bitmap_and, &idx, retrieval, prefix, &upper, flags, + skipLowerKey, lower)) { page = (btree_page*) CCH_HANDOFF(tdbb, &window, page->btr_sibling, LCK_read, pag_index); @@ -731,7 +731,7 @@ void BTR_evaluate(thread_db* tdbb, IndexRetrieval* retrieval, RecordBitmap** bit else { // if there isn't an upper bound, just walk the index to the end of the level const UCHAR* endPointer = (UCHAR*)page + page->btr_length; - const bool ignoreNulls = + const bool ignoreNulls = (retrieval->irb_generic & irb_ignore_null_value_key) && (idx.idx_count == 1); IndexNode node; @@ -750,8 +750,8 @@ void BTR_evaluate(thread_db* tdbb, IndexRetrieval* retrieval, RecordBitmap** bit if (!node.isEndBucket) { // If we're walking in a descending index and we need to ignore NULLs // then stop at the first NULL we see (only for single segment!) - if (descending && ignoreNulls && (node.prefix == 0) && - (node.length >= 1) && (node.data[0] == 255)) + if (descending && ignoreNulls && (node.prefix == 0) && + (node.length >= 1) && (node.data[0] == 255)) { break; } @@ -831,7 +831,7 @@ btree_page* BTR_find_page(thread_db* tdbb, SET_TDBB(tdbb); // Generate keys before we get any pages locked to avoid unwind - // problems -- if we already have a key, assume that we + // problems -- if we already have a key, assume that we // are looking for an equality if (retrieval->irb_key) { copy_key(retrieval->irb_key, lower); @@ -882,14 +882,14 @@ btree_page* BTR_find_page(thread_db* tdbb, LCK_read, pag_index); // If there is a starting descriptor, search down index to starting position. - // This may involve sibling buckets if splits are in progress. If there + // This may involve sibling buckets if splits are in progress. If there // isn't a starting descriptor, walk down the left side of the index (right // side if we are going backwards). SLONG number; // Ignore NULLs if flag is set and this is a 1 segment index, // ASC index and no lower bound value is given. - const bool ignoreNulls = ((idx->idx_count == 1) && - !(idx->idx_flags & idx_descending) && + const bool ignoreNulls = ((idx->idx_count == 1) && + !(idx->idx_flags & idx_descending) && (retrieval->irb_generic & irb_ignore_null_value_key) && !(retrieval->irb_lower_count)); @@ -906,7 +906,7 @@ btree_page* BTR_find_page(thread_db* tdbb, while (page->btr_level > 0) { while (true) { - number = find_page(page, + number = find_page(page, backwards ? upper : ignoreNulls ? &firstNotNullKey : lower, idx->idx_flags, NO_VALUE, (retrieval->irb_generic & (irb_starting | irb_partial))); if (number != END_BUCKET) { @@ -979,7 +979,7 @@ void BTR_insert(thread_db* tdbb, WIN * root_window, index_insertion* insertion) RelationPages* relPages = insertion->iib_relation->getPages(tdbb); WIN window(relPages->rel_pg_space_id, idx->idx_root); btree_page* bucket = (btree_page*) CCH_FETCH(tdbb, &window, LCK_read, pag_index); - + if (bucket->btr_level == 0) { CCH_RELEASE(tdbb, &window); CCH_FETCH(tdbb, &window, LCK_write, pag_index); @@ -993,7 +993,7 @@ void BTR_insert(thread_db* tdbb, WIN * root_window, index_insertion* insertion) RecordNumber recordNumber(0); BtrPageGCLock lock(tdbb); insertion->iib_dont_gc_lock = &lock; - SLONG split_page = add_node(tdbb, &window, insertion, &key, + SLONG split_page = add_node(tdbb, &window, insertion, &key, &recordNumber, NULL, NULL); if (split_page == NO_SPLIT) { return; @@ -1001,14 +1001,14 @@ void BTR_insert(thread_db* tdbb, WIN * root_window, index_insertion* insertion) // The top of the index has split. We need to make a new level and // update the index root page. Oh boy. - index_root_page* root = + index_root_page* root = (index_root_page*) CCH_FETCH(tdbb, root_window, LCK_write, pag_root); window.win_page = root->irt_rpt[idx->idx_id].irt_root; bucket = (btree_page*) CCH_FETCH(tdbb, &window, LCK_write, pag_index); if (window.win_page.getPageNum() != idx->idx_root) { - // AB: It could be possible that the "top" page meanwhile was changed by + // AB: It could be possible that the "top" page meanwhile was changed by // another insert. In that case we are going to insert our split_page // in the existing "top" page instead of making a new "top" page. @@ -1025,7 +1025,7 @@ void BTR_insert(thread_db* tdbb, WIN * root_window, index_insertion* insertion) ret_key.key_length = 0; split_page = insert_node(tdbb, &window, &propagate, &ret_key, &recordNumber, NULL, NULL); - if (split_page != NO_SPLIT) + if (split_page != NO_SPLIT) { if (split_page == NO_VALUE_PAGE) { CCH_RELEASE(tdbb, &window); @@ -1038,13 +1038,13 @@ void BTR_insert(thread_db* tdbb, WIN * root_window, index_insertion* insertion) return; } - // the original page was marked as not garbage-collectable, but - // since it is the root page it won't be garbage-collected anyway, + // the original page was marked as not garbage-collectable, but + // since it is the root page it won't be garbage-collected anyway, // so go ahead and mark it as garbage-collectable now. lock.enablePageGC(tdbb); WIN new_window(relPages->rel_pg_space_id, split_page); - btree_page* new_bucket = + btree_page* new_bucket = (btree_page*) CCH_FETCH(tdbb, &new_window, LCK_read, pag_index); if (bucket->btr_level != new_bucket->btr_level) { @@ -1063,7 +1063,7 @@ void BTR_insert(thread_db* tdbb, WIN * root_window, index_insertion* insertion) const bool useJumpInfo = (flags & btr_jump_info); IndexJumpInfo jumpInfo; if (useJumpInfo) { - // First get jumpinfo from the level deeper, because we need + // First get jumpinfo from the level deeper, because we need // to know jumpAreaSize and keyLength. BTreeNode::getPointerFirstNode(bucket, &jumpInfo); jumpInfo.jumpers = 0; @@ -1122,9 +1122,9 @@ void BTR_insert(thread_db* tdbb, WIN * root_window, index_insertion* insertion) // Calculate length of bucket new_bucket->btr_length = pointer - (UCHAR*)new_bucket; - // update the root page to point to the new top-level page, - // and make sure the new page has higher precedence so that - // it will be written out first--this will make sure that the + // update the root page to point to the new top-level page, + // and make sure the new page has higher precedence so that + // it will be written out first--this will make sure that the // root page doesn't point into space CCH_RELEASE(tdbb, &new_window); CCH_precedence(tdbb, root_window, new_window.win_page); @@ -1134,7 +1134,7 @@ void BTR_insert(thread_db* tdbb, WIN * root_window, index_insertion* insertion) } -IDX_E BTR_key(thread_db* tdbb, jrd_rel* relation, Record* record, index_desc* idx, +IDX_E BTR_key(thread_db* tdbb, jrd_rel* relation, Record* record, index_desc* idx, temporary_key* key, idx_null_state* null_state, bool fuzzy) { /************************************** @@ -1144,7 +1144,7 @@ IDX_E BTR_key(thread_db* tdbb, jrd_rel* relation, Record* record, index_desc* id ************************************** * * Functional description - * Compute a key from an record and an index descriptor. + * Compute a key from an record and an index descriptor. * Note that compound keys are expanded by 25%. If this * changes, both BTR_key_length and GDEF exe.e have to * change. @@ -1174,7 +1174,7 @@ IDX_E BTR_key(thread_db* tdbb, jrd_rel* relation, Record* record, index_desc* id if (idx->idx_count == 1) { bool isNull; // for expression indices, compute the value of the expression - if (idx->idx_flags & idx_expressn) + if (idx->idx_flags & idx_expressn) { bool notNull; desc_ptr = BTR_eval_expression(tdbb, idx, record, notNull); @@ -1183,9 +1183,9 @@ IDX_E BTR_key(thread_db* tdbb, jrd_rel* relation, Record* record, index_desc* id else { desc_ptr = &desc; - // In order to "map a null to a default" value (in EVL_field()), - // the relation block is referenced. - // Reference: Bug 10116, 10424 + // In order to "map a null to a default" value (in EVL_field()), + // the relation block is referenced. + // Reference: Bug 10116, 10424 // isNull = !EVL_field(relation, record, tail->idx_field, desc_ptr); } @@ -1213,9 +1213,9 @@ IDX_E BTR_key(thread_db* tdbb, jrd_rel* relation, Record* record, index_desc* id } desc_ptr = &desc; - // In order to "map a null to a default" value (in EVL_field()), - // the relation block is referenced. - // Reference: Bug 10116, 10424 + // In order to "map a null to a default" value (in EVL_field()), + // the relation block is referenced. + // Reference: Bug 10116, 10424 const bool isNull = !EVL_field(relation, record, tail->idx_field, desc_ptr); if (isNull && (idx->idx_flags & idx_unique)) { @@ -1258,7 +1258,7 @@ IDX_E BTR_key(thread_db* tdbb, jrd_rel* relation, Record* record, index_desc* id if (null_state) { *null_state = !missing_unique_segments ? idx_nulls_none : - (missing_unique_segments == idx->idx_count) ? + (missing_unique_segments == idx->idx_count) ? idx_nulls_all : idx_nulls_some; } @@ -1397,13 +1397,13 @@ UCHAR *BTR_last_node(btree_page* page, exp_index_buf* expanded_page, btree_exp** * ************************************** * - * Functional description + * Functional description * Find the last node on a page. Used when walking - * down the right side of an index tree. + * down the right side of an index tree. * **************************************/ - // the last expanded node is always at the end of the page + // the last expanded node is always at the end of the page // minus the size of a btree_exp, since there is always an extra // btree_exp node with zero-length tail at the end of the page btree_exp* enode = (btree_exp*) ((UCHAR*)expanded_page + expanded_page->exp_length - BTX_SIZE); @@ -1437,8 +1437,8 @@ btree_page* BTR_left_handoff(thread_db* tdbb, WIN * window, btree_page* page, ************************************** * * Functional description - * Handoff a btree page to the left. This is more difficult than a - * right handoff because we have to traverse pages without handing + * Handoff a btree page to the left. This is more difficult than a + * right handoff because we have to traverse pages without handing * off locks. (A lock handoff to the left while someone was handing * off to the right could result in deadlock.) * @@ -1462,7 +1462,7 @@ btree_page* BTR_left_handoff(thread_db* tdbb, WIN * window, btree_page* page, // Since we are not handing off pages, a page could split before we get to it. // To detect this case, fetch the left sibling pointer and then handoff right - // sibling pointers until we reach the page to the left of the page passed + // sibling pointers until we reach the page to the left of the page passed // to us. while (sibling != original_page) { @@ -1489,7 +1489,7 @@ btree_page* BTR_left_handoff(thread_db* tdbb, WIN * window, btree_page* page, #endif -USHORT BTR_lookup(thread_db* tdbb, jrd_rel* relation, USHORT id, index_desc* buffer, +USHORT BTR_lookup(thread_db* tdbb, jrd_rel* relation, USHORT id, index_desc* buffer, RelationPages* relPages) { /************************************** @@ -1511,7 +1511,7 @@ USHORT BTR_lookup(thread_db* tdbb, jrd_rel* relation, USHORT id, index_desc* buf } if ((id >= root->irt_count) - || !BTR_description(tdbb, relation, root, buffer, id)) + || !BTR_description(tdbb, relation, root, buffer, id)) { CCH_RELEASE(tdbb, &window); return FB_FAILURE; @@ -1604,7 +1604,7 @@ IDX_E BTR_make_key(thread_db* tdbb, } // AB: Fix bug SF #1242982 - // Equality search on first segment (integer) in compound indexes resulted + // Equality search on first segment (integer) in compound indexes resulted // in more scans on specific values (2^n, f.e. 131072) than needed. if (!fuzzy && (n != idx->idx_count)) { for (; stuff_count; --stuff_count) { @@ -1644,7 +1644,7 @@ void BTR_make_null_key(thread_db* tdbb, index_desc* idx, temporary_key* key) * Functional description * Construct a (possibly) compound search key consist from * all null values. This is worked only for ODS11 and later - * + * **************************************/ dsc null_desc; null_desc.dsc_dtype = dtype_text; @@ -1710,7 +1710,7 @@ void BTR_make_null_key(thread_db* tdbb, index_desc* idx, temporary_key* key) bool BTR_next_index(thread_db* tdbb, - jrd_rel* relation, jrd_tra* transaction, index_desc* idx, + jrd_rel* relation, jrd_tra* transaction, index_desc* idx, WIN* window) { /************************************** @@ -1739,16 +1739,16 @@ bool BTR_next_index(thread_db* tdbb, if (window->win_bdb) { root = (index_root_page*) window->win_buffer; } - else { + else { RelationPages* relPages; if (transaction) relPages = relation->getPages(tdbb, transaction->tra_number); else relPages = relation->getPages(tdbb); - if (!(root = fetch_root(tdbb, window, relation, relPages))) + if (!(root = fetch_root(tdbb, window, relation, relPages))) { - return false; + return false; } } @@ -1756,7 +1756,7 @@ bool BTR_next_index(thread_db* tdbb, { const index_root_page::irt_repeat* irt_desc = root->irt_rpt + id; if (!irt_desc->irt_root && - (irt_desc->irt_flags & irt_in_progress) && transaction) + (irt_desc->irt_flags & irt_in_progress) && transaction) { const SLONG trans = irt_desc->irt_stuff.irt_transaction; CCH_RELEASE(tdbb, window); @@ -1802,7 +1802,7 @@ void BTR_remove(thread_db* tdbb, WIN * root_window, index_insertion* insertion) ************************************** * * Functional description - * Remove an index node from a b-tree. + * Remove an index node from a b-tree. * If the node doesn't exist, don't get overly excited. * **************************************/ @@ -1823,23 +1823,23 @@ void BTR_remove(thread_db* tdbb, WIN * root_window, index_insertion* insertion) // remove the node from the index tree via recursive descent CONTENTS result = remove_node(tdbb, insertion, &window); - // if the root page points at only one lower page, remove this - // level to prevent the tree from being deeper than necessary-- - // do this only if the level is greater than 1 to prevent - // excessive thrashing in the case where a small table is + // if the root page points at only one lower page, remove this + // level to prevent the tree from being deeper than necessary-- + // do this only if the level is greater than 1 to prevent + // excessive thrashing in the case where a small table is // constantly being loaded and deleted. if ((result == contents_single) && (level > 1)) { - // we must first release the windows to obtain the root for write + // we must first release the windows to obtain the root for write // without getting deadlocked CCH_RELEASE(tdbb, &window); CCH_RELEASE(tdbb, root_window); - index_root_page* root = + index_root_page* root = (index_root_page*) CCH_FETCH(tdbb, root_window, LCK_write, pag_root); page = (btree_page*) CCH_FETCH(tdbb, &window, LCK_write, pag_index); - // get the page number of the child, and check to make sure + // get the page number of the child, and check to make sure // the page still has only one node on it UCHAR *pointer = BTreeNode::getPointerFirstNode(page); const UCHAR flags = page->btr_header.pag_flags; @@ -1858,7 +1858,7 @@ void BTR_remove(thread_db* tdbb, WIN * root_window, index_insertion* insertion) root->irt_rpt[idx->idx_id].irt_root = number; // release the pages, and place the page formerly at the top level - // on the free list, making sure the root page is written out first + // on the free list, making sure the root page is written out first // so that we're not pointing to a released page CCH_RELEASE(tdbb, root_window); CCH_RELEASE(tdbb, &window); @@ -1874,7 +1874,7 @@ void BTR_remove(thread_db* tdbb, WIN * root_window, index_insertion* insertion) } -void BTR_reserve_slot(thread_db* tdbb, jrd_rel* relation, jrd_tra* transaction, +void BTR_reserve_slot(thread_db* tdbb, jrd_rel* relation, jrd_tra* transaction, index_desc* idx) { /************************************** @@ -1884,7 +1884,7 @@ void BTR_reserve_slot(thread_db* tdbb, jrd_rel* relation, jrd_tra* transaction, ************************************** * * Functional description - * Reserve a slot on an index root page + * Reserve a slot on an index root page * in preparation to index creation. * **************************************/ @@ -1899,7 +1899,7 @@ void BTR_reserve_slot(thread_db* tdbb, jrd_rel* relation, jrd_tra* transaction, // Get root page, assign an index id, and store the index descriptor. // Leave the root pointer null for the time being. - // Index id for temporary index instance of global temporary table is + // Index id for temporary index instance of global temporary table is // already assigned, use it. const bool use_idx_id = (relPages->rel_instance_id != 0); if (use_idx_id) { @@ -1907,7 +1907,7 @@ void BTR_reserve_slot(thread_db* tdbb, jrd_rel* relation, jrd_tra* transaction, } WIN window(relPages->rel_pg_space_id, relPages->rel_index_root); - index_root_page* root = + index_root_page* root = (index_root_page*) CCH_FETCH(tdbb, &window, LCK_write, pag_root); CCH_MARK(tdbb, &window); @@ -1924,10 +1924,10 @@ void BTR_reserve_slot(thread_db* tdbb, jrd_rel* relation, jrd_tra* transaction, USHORT l, space; index_root_page::irt_repeat * root_idx, *end, *slot; bool maybe_no_room = false; - + if (use_idx_id && (idx->idx_id >= root->irt_count)) { - memset(root->irt_rpt + root->irt_count, 0, + memset(root->irt_rpt + root->irt_count, 0, sizeof(index_root_page::irt_repeat) * (idx->idx_id - root->irt_count + 1)); root->irt_count = idx->idx_id + 1; } @@ -1943,16 +1943,16 @@ retry: slot = NULL; for (root_idx = root->irt_rpt, end = root_idx + root->irt_count; - root_idx < end; root_idx++) + root_idx < end; root_idx++) { if (root_idx->irt_root || (root_idx->irt_flags & irt_in_progress)) { space = MIN(space, root_idx->irt_desc); } if (!root_idx->irt_root && !slot - && !(root_idx->irt_flags & irt_in_progress)) + && !(root_idx->irt_flags & irt_in_progress)) { - if (!use_idx_id || - (use_idx_id && ((root_idx - root->irt_rpt) == idx->idx_id))) + if (!use_idx_id || + (use_idx_id && ((root_idx - root->irt_rpt) == idx->idx_id))) { slot = root_idx; } @@ -2054,7 +2054,7 @@ void BTR_selectivity(thread_db* tdbb, jrd_rel* relation, USHORT id, while (bucket->btr_level) { IndexNode pageNode; BTreeNode::readNode(&pageNode, pointer, flags, false); - bucket = (btree_page*) + bucket = (btree_page*) CCH_HANDOFF(tdbb, &window, pageNode.pageNumber, LCK_read, pag_index); pointer = BTreeNode::getPointerFirstNode(bucket); flags = bucket->btr_header.pag_flags; @@ -2066,7 +2066,7 @@ void BTR_selectivity(thread_db* tdbb, jrd_rel* relation, USHORT id, temporary_key key; key.key_flags = 0; key.key_length = 0; - SSHORT l; + SSHORT l; bool firstNode = true; const bool descending = (flags & btr_descending); const ULONG segments = root->irt_rpt[id].irt_keys; @@ -2078,7 +2078,7 @@ void BTR_selectivity(thread_db* tdbb, jrd_rel* relation, USHORT id, //const Database* dbb = tdbb->getDatabase(); - // go through all the leaf nodes and count them; + // go through all the leaf nodes and count them; // also count how many of them are duplicates IndexNode node; while (page) { @@ -2090,7 +2090,7 @@ void BTR_selectivity(thread_db* tdbb, jrd_rel* relation, USHORT id, ++nodes; l = node.length + node.prefix; - if (segments > 1 && !firstNode) + if (segments > 1 && !firstNode) { // Initialize variables for segment duplicate check. @@ -2102,7 +2102,7 @@ void BTR_selectivity(thread_db* tdbb, jrd_rel* relation, USHORT id, const UCHAR* const p2_end = p2 + node.length; SSHORT count, stuff_count; if (node.prefix == 0) { - count = *p2; + count = *p2; //pos = 0; stuff_count = 0; } @@ -2192,13 +2192,13 @@ void BTR_selectivity(thread_db* tdbb, jrd_rel* relation, USHORT id, CCH_RELEASE_TAIL(tdbb, &window); - // calculate the selectivity + // calculate the selectivity selectivity.grow(segments); if (segments > 1) { for (ULONG i = 0; i < segments; i++) { - selectivity[i] = + selectivity[i] = (float) ((nodes) ? 1.0 / (float) (nodes - duplicatesList[i]) : 0.0); - } + } } else { selectivity[0] = (float) ((nodes) ? 1.0 / (float) (nodes - duplicates) : 0.0); @@ -2272,7 +2272,7 @@ static SLONG add_node(thread_db* tdbb, index_insertion* insertion, temporary_key* new_key, RecordNumber* new_record_number, - SLONG * original_page, + SLONG * original_page, SLONG * sibling_page) { /************************************** @@ -2307,11 +2307,11 @@ static SLONG add_node(thread_db* tdbb, } // If we're above the leaf level, find the appropriate node in the chain of sibling pages. - // Hold on to this position while we recurse down to the next level, in case there's a + // Hold on to this position while we recurse down to the next level, in case there's a // split at the lower level, in which case we need to insert the new page at this level. SLONG page; while (true) { - page = find_page(bucket, insertion->iib_key, + page = find_page(bucket, insertion->iib_key, insertion->iib_descriptor->idx_flags, insertion->iib_number); if (page != END_BUCKET) { break; @@ -2323,7 +2323,7 @@ static SLONG add_node(thread_db* tdbb, BtrPageGCLock lockCurrent(tdbb); lockCurrent.disablePageGC(tdbb, window->win_page); - // Fetch the page at the next level down. If the next level is leaf level, + // Fetch the page at the next level down. If the next level is leaf level, // fetch for write since we know we are going to write to the page (most likely). const PageNumber index = window->win_page; CCH_HANDOFF(tdbb, window, page, @@ -2337,7 +2337,7 @@ static SLONG add_node(thread_db* tdbb, SLONG split = add_node(tdbb, window, insertion, new_key, new_record_number, &page, &propagate.iib_sibling); - if (split == NO_SPLIT) + if (split == NO_SPLIT) { lockCurrent.enablePageGC(tdbb); insertion->iib_dont_gc_lock = propagate.iib_dont_gc_lock; @@ -2346,12 +2346,12 @@ static SLONG add_node(thread_db* tdbb, #ifdef DEBUG_BTR_SPLIT Firebird::string s; - s.printf("page %ld splitted. split %ld, right %ld, parent %ld", + s.printf("page %ld splitted. split %ld, right %ld, parent %ld", page, split, propagate.iib_sibling, index); gds__trace(s.c_str()); #endif - // The page at the lower level split, so we need to insert a pointer + // The page at the lower level split, so we need to insert a pointer // to the new page to the page at this level. window->win_page = index; bucket = (btree_page*) CCH_FETCH(tdbb, window, LCK_write, pag_index); @@ -2362,10 +2362,10 @@ static SLONG add_node(thread_db* tdbb, propagate.iib_duplicates = NULL; propagate.iib_key = new_key; - // now loop through the sibling pages trying to find the appropriate - // place to put the pointer to the lower level page--remember that the + // now loop through the sibling pages trying to find the appropriate + // place to put the pointer to the lower level page--remember that the // page we were on could have split while we weren't looking - SLONG original_page2; + SLONG original_page2; SLONG sibling_page2; while (true) { split = insert_node(tdbb, window, &propagate, new_key, @@ -2380,7 +2380,7 @@ static SLONG add_node(thread_db* tdbb, } } - // the split page on the lower level has been propogated, so we can go back to + // the split page on the lower level has been propogated, so we can go back to // the page it was split from, and mark it as garbage-collectable now lockLower.enablePageGC(tdbb); insertion->iib_dont_gc_lock = propagate.iib_dont_gc_lock; @@ -2424,7 +2424,7 @@ static void compress(thread_db* tdbb, bool temp_is_negative = false; bool int64_key_op = false; - // For descending index and new index structure we insert 0xFE at the beginning. + // For descending index and new index structure we insert 0xFE at the beginning. // This is only done for values which begin with 0xFE (254) or 0xFF (255) and // is needed to make a difference between a NULL state and a VALUE. // Note! By descending index key is complemented after this compression routine. @@ -2445,7 +2445,7 @@ static void compress(thread_db* tdbb, // Therefore don't complement pad when we have an // ascending index. if (dbb->dbb_ods_version < ODS_VERSION11) { - if (!descending) { + if (!descending) { pad ^= -1; } } @@ -2506,8 +2506,8 @@ static void compress(thread_db* tdbb, if (itype == idx_string || itype == idx_byte_array || - itype == idx_metadata || - itype >= idx_first_intl_string) + itype == idx_metadata || + itype >= idx_first_intl_string) { UCHAR buffer[MAX_KEY]; const UCHAR pad = (itype == idx_string) ? ' ' : 0; @@ -2543,8 +2543,8 @@ static void compress(thread_db* tdbb, if (length > sizeof(key->key_data)) { length = sizeof(key->key_data); } - if (descending && (dbb->dbb_ods_version >= ODS_VERSION11) && - ((*ptr == desc_end_value_prefix) || (*ptr == desc_end_value_check))) + if (descending && (dbb->dbb_ods_version >= ODS_VERSION11) && + ((*ptr == desc_end_value_prefix) || (*ptr == desc_end_value_check))) { *p++ = desc_end_value_prefix; if ((length + 1) > sizeof(key->key_data)) { @@ -2552,11 +2552,11 @@ static void compress(thread_db* tdbb, } } memcpy(p, ptr, length); - p += length; + p += length; } else { // Leave key_empty flag, because the string is an empty string - if (descending && (dbb->dbb_ods_version >= ODS_VERSION11) && + if (descending && (dbb->dbb_ods_version >= ODS_VERSION11) && ((pad == desc_end_value_prefix) || (pad == desc_end_value_check))) { *p++ = desc_end_value_prefix; @@ -2573,13 +2573,13 @@ static void compress(thread_db* tdbb, return; } - // The index is numeric. + // The index is numeric. // For idx_numeric... - // Convert the value to a double precision number, - // then zap it to compare in a byte-wise order. + // Convert the value to a double precision number, + // then zap it to compare in a byte-wise order. // For idx_numeric2... // Convert the value to a INT64_KEY struct, - // then zap it to compare in a byte-wise order. + // then zap it to compare in a byte-wise order. // clear key_empty flag for all other types key->key_flags &= ~key_empty; @@ -2647,7 +2647,7 @@ static void compress(thread_db* tdbb, else if (desc->dsc_dtype == dtype_timestamp) { // This is the same as the pre v6 behavior. Basically, the // customer has created a NUMERIC index, and is probing into that - // index using a TIMESTAMP value. + // index using a TIMESTAMP value. // eg: WHERE anInteger = TIMESTAMP '1998-9-16' temp.temp_double = MOV_date_to_double(desc); temp_is_negative = (temp.temp_double < 0); @@ -2677,7 +2677,7 @@ static void compress(thread_db* tdbb, // Copy the first set of bytes into key_data size_t length = temp_copy_length; /* - AB: Speed things a little up, remember that this is function is called a lot. + AB: Speed things a little up, remember that this is function is called a lot. for (q = temp.temp_char + temp_copy_length; length; --length) { *p++ = *--q; @@ -2807,12 +2807,12 @@ static void compress(thread_db* tdbb, // By descending index, check first byte q = key->key_data; - if (descending && (dbb->dbb_ods_version >= ODS_VERSION11) && - (key->key_length >= 1) && - ((*q == desc_end_value_prefix) || (*q == desc_end_value_check))) - { + if (descending && (dbb->dbb_ods_version >= ODS_VERSION11) && + (key->key_length >= 1) && + ((*q == desc_end_value_prefix) || (*q == desc_end_value_check))) + { p = key->key_data; - p++; + p++; memmove(p, q, key->key_length); key->key_data[0] = desc_end_value_prefix; key->key_length++; @@ -2899,9 +2899,9 @@ static CONTENTS delete_node(thread_db* tdbb, WIN *window, UCHAR *pointer) ************************************** * * Functional description - * Delete a node from a page and return whether it - * empty, if there is a single node on it, or if it - * is above or below the threshold for garbage collection. + * Delete a node from a page and return whether it + * empty, if there is a single node on it, or if it + * is above or below the threshold for garbage collection. * **************************************/ @@ -2931,7 +2931,7 @@ static CONTENTS delete_node(thread_db* tdbb, WIN *window, UCHAR *pointer) // Save data in tempKey so we can rebuild from it USHORT newNextPrefix = nextNode.prefix; USHORT newNextLength = 0; - USHORT length = MAX(removingNode.length + removingNode.prefix, + USHORT length = MAX(removingNode.length + removingNode.prefix, nextNode.length + nextNode.prefix); UCHAR* tempData = FB_NEW(*tdbb->getDefaultPool()) UCHAR[length]; length = 0; @@ -2949,7 +2949,7 @@ static CONTENTS delete_node(thread_db* tdbb, WIN *window, UCHAR *pointer) // Update the page prefix total. page->btr_prefix_total -= (removingNode.prefix + (nextNode.prefix - newNextPrefix)); - // Update the next node so we are ready to save it. + // Update the next node so we are ready to save it. nextNode.prefix = newNextPrefix; nextNode.length = newNextLength; nextNode.data = tempData; @@ -2959,8 +2959,8 @@ static CONTENTS delete_node(thread_db* tdbb, WIN *window, UCHAR *pointer) // Compute length of rest of bucket and move it down. length = page->btr_length - (localPointer - (UCHAR*) page); if (length) { - // Could be overlapping buffers. - // memmove() is guaranteed to work non-destructivly on overlapping buffers. + // Could be overlapping buffers. + // memmove() is guaranteed to work non-destructivly on overlapping buffers. memmove(pointer, localPointer, length); pointer += length; localPointer += length; @@ -2973,10 +2973,10 @@ static CONTENTS delete_node(thread_db* tdbb, WIN *window, UCHAR *pointer) if (useJumpInfo) { // We use a fast approach here. - // Only update offsets pointing after the deleted node and + // Only update offsets pointing after the deleted node and // remove jump nodes pointing to the deleted node or node // next to the deleted one. - jumpNodeList* jumpNodes = FB_NEW(*tdbb->getDefaultPool()) + jumpNodeList* jumpNodes = FB_NEW(*tdbb->getDefaultPool()) jumpNodeList(*tdbb->getDefaultPool()); IndexJumpInfo jumpInfo; @@ -2988,8 +2988,8 @@ static CONTENTS delete_node(thread_db* tdbb, WIN *window, UCHAR *pointer) while (n) { pointer = BTreeNode::readJumpNode(&jumpNode, pointer, flags); // Jump nodes pointing to the deleted node are removed. - if ((jumpNode.offset < offsetDeletePoint) || - (jumpNode.offset > offsetNextPoint)) + if ((jumpNode.offset < offsetDeletePoint) || + (jumpNode.offset > offsetNextPoint)) { IndexJumpNode newJumpNode; if (rebuild && jumpNode.prefix > delJumpNode.prefix) { @@ -3002,7 +3002,7 @@ static CONTENTS delete_node(thread_db* tdbb, WIN *window, UCHAR *pointer) newJumpNode.offset -= delta; } newJumpNode.data = FB_NEW(*tdbb->getDefaultPool()) UCHAR[newJumpNode.length]; - memcpy(newJumpNode.data, delJumpNode.data, addLength); + memcpy(newJumpNode.data, delJumpNode.data, addLength); memcpy(newJumpNode.data + addLength, jumpNode.data, jumpNode.length); } else { @@ -3056,7 +3056,7 @@ static CONTENTS delete_node(thread_db* tdbb, WIN *window, UCHAR *pointer) return contents_single; } - // check to see if the size of the page is below the garbage collection threshold, + // check to see if the size of the page is below the garbage collection threshold, // meaning below the size at which it should be merged with its left sibling if possible. if (page->btr_length < GARBAGE_COLLECTION_BELOW_THRESHOLD) { return contents_below_threshold; @@ -3091,7 +3091,7 @@ static void delete_tree(thread_db* tdbb, window.win_page = next; btree_page* page = (btree_page*) CCH_FETCH(tdbb, &window, LCK_write, 0); - // do a little defensive programming--if any of these conditions + // do a little defensive programming--if any of these conditions // are true we have a damaged pointer, so just stop deleting. At // the same time, allow updates of indexes with id > 255 even though // the page header uses a byte for its index id. This requires relaxing @@ -3104,13 +3104,13 @@ static void delete_tree(thread_db* tdbb, return; } - // if we are at the beginning of a non-leaf level, position + // if we are at the beginning of a non-leaf level, position // "down" to the beginning of the next level down if (next.getPageNum() == down) { if (page->btr_level) { UCHAR *pointer = BTreeNode::getPointerFirstNode(page); IndexNode pageNode; - BTreeNode::readNode(&pageNode, pointer, + BTreeNode::readNode(&pageNode, pointer, page->btr_header.pag_flags, false); down = pageNode.pageNumber; } @@ -3119,7 +3119,7 @@ static void delete_tree(thread_db* tdbb, } } - // go through all the sibling pages on this level and release them + // go through all the sibling pages on this level and release them next = page->btr_sibling; CCH_RELEASE_TAIL(tdbb, &window); PAG_release_page(window.win_page, prior); @@ -3143,7 +3143,7 @@ static DSC *eval(thread_db* tdbb, jrd_nod* node, DSC * temp, bool *isNull) * * Functional description * Evaluate an expression returning a descriptor, and - * a flag to indicate a null value. + * a flag to indicate a null value. * **************************************/ SET_TDBB(tdbb); @@ -3188,7 +3188,7 @@ static SLONG fast_load(thread_db* tdbb, * comprehendable. * **************************************/ - + temporary_key keys[MAX_LEVELS]; btree_page* buckets[MAX_LEVELS]; win_for_array windows[MAX_LEVELS]; @@ -3203,7 +3203,7 @@ static SLONG fast_load(thread_db* tdbb, // ,__FILE__, __LINE__ #endif - + SET_TDBB(tdbb); const Database* dbb = tdbb->getDatabase(); CHECK_DBB(dbb); @@ -3220,7 +3220,7 @@ static SLONG fast_load(thread_db* tdbb, windows[i].win_bdb = NULL; } - // leaf-page and pointer-page size limits, we always need to + // leaf-page and pointer-page size limits, we always need to // leave room for the END_LEVEL node. const USHORT lp_fill_limit = dbb->dbb_page_size - BTN_LEAF_SIZE; const USHORT pp_fill_limit = dbb->dbb_page_size - BTN_PAGE_SIZE; @@ -3238,7 +3238,7 @@ static SLONG fast_load(thread_db* tdbb, bool useJumpInfo = (dbb->dbb_ods_version >= ODS_VERSION11); typedef Firebird::Array jumpNodeListContainer; - jumpNodeListContainer* jumpNodes = FB_NEW(*tdbb->getDefaultPool()) + jumpNodeListContainer* jumpNodes = FB_NEW(*tdbb->getDefaultPool()) jumpNodeListContainer(*tdbb->getDefaultPool()); jumpNodes->push(FB_NEW(*tdbb->getDefaultPool()) jumpNodeList(*tdbb->getDefaultPool())); @@ -3260,8 +3260,8 @@ static SLONG fast_load(thread_db* tdbb, // indices, cause this value is stored on each page. // Remember, the lower the value how more jumpkeys are generated and // how faster jumpkeys are recalculated on insert. - - + + jumpInfo.jumpAreaSize = 512 + ((int)sqrt((float)key_length) * 16); // key_size | jumpAreaSize // ----------+----------------- @@ -3305,7 +3305,7 @@ static SLONG fast_load(thread_db* tdbb, // the bucket header has room for only a byte of index id and that's // part of the ODS. So, for now, we'll just record the first byte // of the id and hope for the best. Index buckets are (almost) always - // located through the index structure (dmp being an exception used + // located through the index structure (dmp being an exception used // only for debug) so the id is actually redundant. btree_page* bucket = (btree_page*) DPM_allocate(tdbb, &windows[0]); bucket->btr_header.pag_type = pag_index; @@ -3381,7 +3381,7 @@ static SLONG fast_load(thread_db* tdbb, index_sort_record* isr = (index_sort_record*) (record + key_length); count++; record += nullIndLen; - + // restore previous values bucket = buckets[0]; split_pages[0] = 0; @@ -3396,10 +3396,10 @@ static SLONG fast_load(thread_db* tdbb, BTreeNode::setNode(&newNode, prefix, isr->isr_key_length - prefix, RecordNumber(isr->isr_record_number)); newNode.data = record + prefix; - // If the length of the new node will cause us to overflow the bucket, + // If the length of the new node will cause us to overflow the bucket, // form a new bucket. if (bucket->btr_length + totalJumpSize[0] + - BTreeNode::getNodeSize(&newNode, flags) > lp_fill_limit) + BTreeNode::getNodeSize(&newNode, flags) > lp_fill_limit) { // mark the end of the previous page const RecordNumber lastRecordNumber = previousNode.recordNumber; @@ -3450,7 +3450,7 @@ static SLONG fast_load(thread_db* tdbb, split->btr_id = bucket->btr_id; split->btr_header.pag_flags |= flags; #ifdef DEBUG_BTR_PAGES - sprintf(debugtext, "\t new page (%d), left page (%d)", + sprintf(debugtext, "\t new page (%d), left page (%d)", split_window.win_page, split->btr_left_sibling); gds__log(debugtext); #endif @@ -3481,8 +3481,8 @@ static SLONG fast_load(thread_db* tdbb, split_record_numbers[0] = splitNode.recordNumber; CCH_RELEASE(tdbb, &windows[0]); #ifdef DEBUG_BTR_PAGES - sprintf(debugtext, "\t release page (%d), left page (%d), right page (%d)", - windows[0].win_page, + sprintf(debugtext, "\t release page (%d), left page (%d), right page (%d)", + windows[0].win_page, ((btr*)windows[0].win_buffer)->btr_left_sibling, ((btr*)windows[0].win_buffer)->btr_sibling); gds__log(debugtext); @@ -3514,7 +3514,7 @@ static SLONG fast_load(thread_db* tdbb, previousNode = newNode; // if we have a compound-index calculate duplicates per segment. - if (segments > 1 && count > 1) + if (segments > 1 && count > 1) { // Initialize variables for segment duplicate check. // count holds the current checking segment (starting by @@ -3640,7 +3640,7 @@ static SLONG fast_load(thread_db* tdbb, split_pages[level] = 0; UCHAR* levelPointer = pointers[level]; - // If there isn't already a bucket at this level, make one. Remember to + // If there isn't already a bucket at this level, make one. Remember to // shorten the index id to a byte if (!(bucket = buckets[level])) { buckets[level + 1] = NULL; @@ -3657,7 +3657,7 @@ static SLONG fast_load(thread_db* tdbb, #endif // since this is the beginning of the level, we propagate the lower-level - // page with a "degenerate" zero-length node indicating that this page holds + // page with a "degenerate" zero-length node indicating that this page holds // any key value less than the next node if (useJumpInfo) { @@ -3677,11 +3677,11 @@ static SLONG fast_load(thread_db* tdbb, key->key_length = 0; // Initialize jumpNodes variables for new level - jumpNodes->push(FB_NEW(*tdbb->getDefaultPool()) + jumpNodes->push(FB_NEW(*tdbb->getDefaultPool()) jumpNodeList(*tdbb->getDefaultPool())); jumpKeys->push(FB_NEW(*tdbb->getDefaultPool()) dynKey); (*jumpKeys)[level]->keyLength = 0; - (*jumpKeys)[level]->keyData = + (*jumpKeys)[level]->keyData = FB_NEW(*tdbb->getDefaultPool()) UCHAR[key_length]; totalJumpSize[level] = 0; newAreaPointers[level] = levelPointer + jumpInfo.jumpAreaSize; @@ -3700,16 +3700,16 @@ static SLONG fast_load(thread_db* tdbb, // Save current node if we need to split. tempNode = levelNode[level]; // Set new node values. - BTreeNode::setNode(&levelNode[level], prefix, temp_key.key_length - prefix, + BTreeNode::setNode(&levelNode[level], prefix, temp_key.key_length - prefix, split_record_numbers[level - 1], windows[level - 1].win_page.getPageNum()); levelNode[level].data = temp_key.key_data + prefix; - // See if the new node fits in the current bucket. + // See if the new node fits in the current bucket. // If not, split the bucket. if (bucket->btr_length + totalJumpSize[level] + - BTreeNode::getNodeSize(&levelNode[level], flags, false) > pp_fill_limit) + BTreeNode::getNodeSize(&levelNode[level], flags, false) > pp_fill_limit) { - // mark the end of the page; note that the end_bucket marker must + // mark the end of the page; note that the end_bucket marker must // contain info about the first node on the next page const SLONG lastPageNumber = tempNode.pageNumber; BTreeNode::readNode(&tempNode, tempNode.nodePointer, flags, false); @@ -3740,7 +3740,7 @@ static SLONG fast_load(thread_db* tdbb, for (size_t i = 0; i < pageJumpNodes->getCount(); i++) { // Update offset position first. walkJumpNode[i].offset += totalJumpSize[level]; - levelPointer = BTreeNode::writeJumpNode(&walkJumpNode[i], + levelPointer = BTreeNode::writeJumpNode(&walkJumpNode[i], levelPointer, flags); } bucket->btr_length += totalJumpSize[level]; @@ -3759,7 +3759,7 @@ static SLONG fast_load(thread_db* tdbb, split->btr_id = bucket->btr_id; split->btr_header.pag_flags |= flags; #ifdef DEBUG_BTR_PAGES - sprintf(debugtext, "\t new page (%d), left page (%d)", + sprintf(debugtext, "\t new page (%d), left page (%d)", split_window.win_page, split->btr_left_sibling); gds__log(debugtext); #endif @@ -3780,7 +3780,7 @@ static SLONG fast_load(thread_db* tdbb, // insert the new node in the new bucket IndexNode splitNode; - BTreeNode::setNode(&splitNode, 0, key->key_length, + BTreeNode::setNode(&splitNode, 0, key->key_length, tempNode.recordNumber, lastPageNumber); splitNode.data = key->key_data; levelPointer = BTreeNode::writeNode(&splitNode, levelPointer, flags, false); @@ -3791,8 +3791,8 @@ static SLONG fast_load(thread_db* tdbb, split_record_numbers[level] = splitNode.recordNumber; CCH_RELEASE(tdbb, window); #ifdef DEBUG_BTR_PAGES - sprintf(debugtext, "\t release page (%d), left page (%d), right page (%d)", - window->win_page, + sprintf(debugtext, "\t release page (%d), left page (%d), right page (%d)", + window->win_page, ((btr*)window->win_buffer)->btr_left_sibling, ((btr*)window->win_buffer)->btr_sibling); gds__log(debugtext); @@ -3821,7 +3821,7 @@ static SLONG fast_load(thread_db* tdbb, levelPointer = BTreeNode::writeNode(&levelNode[level], levelPointer, flags, false); // Update the length of the page. - bucket->btr_length = levelPointer - (UCHAR*) bucket; + bucket->btr_length = levelPointer - (UCHAR*) bucket; if (bucket->btr_length > dbb->dbb_page_size) { BUGCHECK(205); // msg 205 index bucket overfilled } @@ -3846,12 +3846,12 @@ static SLONG fast_load(thread_db* tdbb, (levelNode[level].nodePointer - (UCHAR*)bucket); jumpNode.data = FB_NEW(*tdbb->getDefaultPool()) UCHAR[jumpNode.length]; - memcpy(jumpNode.data, temp_key.key_data + jumpNode.prefix, + memcpy(jumpNode.data, temp_key.key_data + jumpNode.prefix, jumpNode.length); // Push node on end in list pageJumpNodes->add(jumpNode); // Store new data in jumpKey, so a new jump node can calculate prefix - memcpy(pageJumpKey->keyData + jumpNode.prefix, jumpNode.data, + memcpy(pageJumpKey->keyData + jumpNode.prefix, jumpNode.data, jumpNode.length); pageJumpKey->keyLength = jumpNode.length + jumpNode.prefix; // Set new position for generating jumpnode @@ -3860,7 +3860,7 @@ static SLONG fast_load(thread_db* tdbb, } } - // Now restore the current key value and save this node as the + // Now restore the current key value and save this node as the // current node on this level; also calculate the new page length. copy_key(&temp_key, key); pointers[level] = levelPointer; @@ -3870,7 +3870,7 @@ static SLONG fast_load(thread_db* tdbb, error = JRD_reschedule(tdbb, 0, false); } - // To finish up, put an end of level marker on the last bucket + // To finish up, put an end of level marker on the last bucket // of each level. for (ULONG level = 0; (bucket = buckets[level]); level++) { // retain the top level window for returning to the calling routine @@ -3924,8 +3924,8 @@ static SLONG fast_load(thread_db* tdbb, CCH_RELEASE(tdbb, &windows[level]); #ifdef DEBUG_BTR_PAGES - sprintf(debugtext, "\t release page (%d), left page (%d), right page (%d)", - windows[level].win_page, + sprintf(debugtext, "\t release page (%d), left page (%d), right page (%d)", + windows[level].win_page, ((btr*)windows[level].win_buffer)->btr_left_sibling, ((btr*)windows[level].win_buffer)->btr_sibling); gds__log(debugtext); @@ -3933,8 +3933,8 @@ static SLONG fast_load(thread_db* tdbb, } // Finally clean up dynamic memory used. - for (jumpNodeListContainer::iterator itr = jumpNodes->begin(); - itr < jumpNodes->end(); ++itr) + for (jumpNodeListContainer::iterator itr = jumpNodes->begin(); + itr < jumpNodes->end(); ++itr) { jumpNodeList* freeJumpNodes = *itr; IndexJumpNode* walkJumpNode = freeJumpNodes->begin(); @@ -3947,8 +3947,8 @@ static SLONG fast_load(thread_db* tdbb, delete freeJumpNodes; } delete jumpNodes; - for (keyList::iterator itr3 = jumpKeys->begin(); - itr3 < jumpKeys->end(); ++itr3) + for (keyList::iterator itr3 = jumpKeys->begin(); + itr3 < jumpKeys->end(); ++itr3) { delete[] (*itr3)->keyData; delete (*itr3); @@ -3969,9 +3969,9 @@ static SLONG fast_load(thread_db* tdbb, // If the index delete fails, just go ahead and punt. try { - if (error) + if (error) { - // CCH_unwind does not released page buffers (as we + // CCH_unwind does not released page buffers (as we // set TDBB_no_cache_unwind flag), do it now for (int i = 0; i < MAX_LEVELS; i++) { if (windows[i].win_bdb) @@ -3979,7 +3979,7 @@ static SLONG fast_load(thread_db* tdbb, } if (window) { - delete_tree(tdbb, relation->rel_id, idx->idx_id, + delete_tree(tdbb, relation->rel_id, idx->idx_id, window->win_page, PageNumber(window->win_page.getPageSpaceID(), 0)); } ERR_punt(); @@ -3991,12 +3991,12 @@ static SLONG fast_load(thread_db* tdbb, selectivity.grow(segments); if (segments > 1) { for (ULONG i = 0; i < segments; i++) { - selectivity[i] = + selectivity[i] = (float) ((count) ? 1.0 / (float) (count - duplicatesList[i]) : 0.0); - } + } } else { - selectivity[0] = + selectivity[0] = (float) ((count) ? (1.0 / (float) (count - duplicates)) : 0.0); } @@ -4016,7 +4016,7 @@ static SLONG fast_load(thread_db* tdbb, } -static index_root_page* fetch_root(thread_db* tdbb, WIN* window, const jrd_rel* relation, +static index_root_page* fetch_root(thread_db* tdbb, WIN* window, const jrd_rel* relation, const RelationPages* relPages) { /************************************** @@ -4046,15 +4046,15 @@ static index_root_page* fetch_root(thread_db* tdbb, WIN* window, const jrd_rel* } -static UCHAR* find_node_start_point(btree_page* bucket, temporary_key* key, +static UCHAR* find_node_start_point(btree_page* bucket, temporary_key* key, UCHAR* value, - USHORT* return_value, bool descending, + USHORT* return_value, bool descending, bool retrieval, bool pointer_by_marker, RecordNumber find_record_number) { /************************************** * - * f i n d _ n o d e _ s t a r t _ p o i n t + * f i n d _ n o d e _ s t a r t _ p o i n t * ************************************** * @@ -4097,15 +4097,15 @@ static UCHAR* find_node_start_point(btree_page* bucket, temporary_key* key, } // If this is an non-leaf bucket of a descending index, the dummy node on the - // front will trip us up. NOTE: This code may be apocryphal. I don't see + // front will trip us up. NOTE: This code may be apocryphal. I don't see // anywhere that a dummy node is stored for a descending index. - deej // // AB: This node ("dummy" node) is inserted on every first page in a level. - // Because it's length and prefix is 0 a descending index would see it - // always as the first matching node. - if (!leafPage && descending && - (node.nodePointer == BTreeNode::getPointerFirstNode(bucket)) && - (node.length == 0)) + // Because it's length and prefix is 0 a descending index would see it + // always as the first matching node. + if (!leafPage && descending && + (node.nodePointer == BTreeNode::getPointerFirstNode(bucket)) && + (node.length == 0)) { pointer = BTreeNode::readNode(&node, pointer, flags, leafPage); // Check if pointer is still valid @@ -4122,14 +4122,14 @@ static UCHAR* find_node_start_point(btree_page* bucket, temporary_key* key, // If the record number is -1, the node is the last in the level // and, by definition, is the insertion point. Otherwise, if the - // prefix of the current node is less than the running prefix, the + // prefix of the current node is less than the running prefix, the // node must have a value greater than the key, so it is the insertion // point. if (node.isEndLevel || node.prefix < prefix) { goto done1; } - // If the node prefix is greater than current prefix , it must be less + // If the node prefix is greater than current prefix , it must be less // than the key, so we can skip it. If it has zero length, then // it is a duplicate, and can also be skipped. if (node.prefix == prefix) { @@ -4155,10 +4155,10 @@ static UCHAR* find_node_start_point(btree_page* bucket, temporary_key* key, { if (p == key_end) goto done1; - + if (q == nodeEnd || *p > *q) break; - + if (*p++ < *q++) goto done1; } @@ -4167,12 +4167,12 @@ static UCHAR* find_node_start_point(btree_page* bucket, temporary_key* key, } if (node.isEndBucket) { - if (pointer_by_marker && (prefix == key->key_length) && - (prefix == node.prefix + node.length)) + if (pointer_by_marker && (prefix == key->key_length) && + (prefix == node.prefix + node.length)) { - // AB: When storing equal nodes, recordnumbers should always + // AB: When storing equal nodes, recordnumbers should always // be inserted on this page, because the first node on the next - // page could be a equal node with a higher recordnumber than + // page could be a equal node with a higher recordnumber than // this one and that would cause a overwrite of the first node // in the next page, but the first node of a page must not change!! goto done1; @@ -4200,15 +4200,15 @@ static UCHAR* find_node_start_point(btree_page* bucket, temporary_key* key, register btree_nod* node = (btree_nod*)pointer; // If this is an non-leaf bucket of a descending index, the dummy node on the - // front will trip us up. NOTE: This code may be apocryphal. I don't see + // front will trip us up. NOTE: This code may be apocryphal. I don't see // anywhere that a dummy node is stored for a descending index. - deej // // AB: This node ("dummy" node) is inserted on every first page in a level. - // Because it's length and prefix is 0 a descending index would see it - // always as the first matching node. - if (!leafPage && descending && - (pointer == BTreeNode::getPointerFirstNode(bucket)) && - (node->btn_length == 0)) + // Because it's length and prefix is 0 a descending index would see it + // always as the first matching node. + if (!leafPage && descending && + (pointer == BTreeNode::getPointerFirstNode(bucket)) && + (node->btn_length == 0)) { if (flags & btr_all_record_number) { node = NEXT_NODE_RECNR(node); @@ -4227,9 +4227,9 @@ static UCHAR* find_node_start_point(btree_page* bucket, temporary_key* key, // If the page/record number is -1, the node is the last in the level // and, by definition, is the insertion point. Otherwise, if the - // prefix of the current node is less than the running prefix, the + // prefix of the current node is less than the running prefix, the // node must have a value greater than the key, so it is the insertion - // point. + // point. const SLONG number = get_long(node->btn_number); if (number == END_LEVEL || node->btn_prefix < prefix) { @@ -4239,7 +4239,7 @@ static UCHAR* find_node_start_point(btree_page* bucket, temporary_key* key, return (UCHAR*)node; } - // If the node prefix is greater than current prefix , it must be less + // If the node prefix is greater than current prefix , it must be less // than the key, so we can skip it. If it has zero length, then // it is a duplicate, and can also be skipped. if (node->btn_prefix == prefix) { @@ -4250,7 +4250,7 @@ static UCHAR* find_node_start_point(btree_page* bucket, temporary_key* key, { if (q == nodeEnd || retrieval && p == key_end) goto done2; - + if (p == key_end || *p > *q) break; @@ -4264,7 +4264,7 @@ static UCHAR* find_node_start_point(btree_page* bucket, temporary_key* key, { if (p == key_end) goto done2; - + if (q == nodeEnd || *p > *q) break; @@ -4299,7 +4299,7 @@ static UCHAR* find_node_start_point(btree_page* bucket, temporary_key* key, } -static UCHAR* find_area_start_point(btree_page* bucket, const temporary_key* key, +static UCHAR* find_area_start_point(btree_page* bucket, const temporary_key* key, UCHAR* value, USHORT* return_prefix, bool descending, bool retrieval, RecordNumber find_record_number) @@ -4312,7 +4312,7 @@ static UCHAR* find_area_start_point(btree_page* bucket, const temporary_key* key * * Functional description * Locate and return a pointer to a start area. - * The starting nodes for a area are + * The starting nodes for a area are * defined with jump nodes. A jump node * contains the prefix information for * a node at a specific offset. @@ -4336,10 +4336,10 @@ static UCHAR* find_area_start_point(btree_page* bucket, const temporary_key* key // Retrieve jump information. pointer = BTreeNode::getPointerFirstNode(bucket, &jumpInfo); USHORT n = jumpInfo.jumpers; - temporary_key jumpKey; + temporary_key jumpKey; // Set begin of page as default. - prevJumpNode.offset = jumpInfo.firstNodeOffset; + prevJumpNode.offset = jumpInfo.firstNodeOffset; prevJumpNode.prefix = 0; prevJumpNode.length = 0; jumpKey.key_length = 0; @@ -4349,7 +4349,7 @@ static UCHAR* find_area_start_point(btree_page* bucket, const temporary_key* key pointer = BTreeNode::readJumpNode(&jumpNode, pointer, flags); BTreeNode::readNode(&node, (UCHAR*)bucket + jumpNode.offset, flags, leafPage); - // jumpKey will hold complete data off referenced node + // jumpKey will hold complete data off referenced node memcpy(jumpKey.key_data + jumpNode.prefix, jumpNode.data, jumpNode.length); memcpy(jumpKey.key_data + node.prefix, node.data, node.length); jumpKey.key_length = node.prefix + node.length; @@ -4366,12 +4366,12 @@ static UCHAR* find_area_start_point(btree_page* bucket, const temporary_key* key { done = true; // Check if this is a exact match or a duplicate. - // If the node is pointing to its end and the length is + // If the node is pointing to its end and the length is // the same as the key then we have found a exact match. // Now start walking between the jump nodes until we - // found a node reference that's not equal anymore + // found a node reference that's not equal anymore // or the record number is higher then the one we need. - if (useFindRecordNumber && (keyPointer == keyEnd)) + if (useFindRecordNumber && (keyPointer == keyEnd)) { n--; while (n) { @@ -4385,7 +4385,7 @@ static UCHAR* find_area_start_point(btree_page* bucket, const temporary_key* key prevJumpNode = jumpNode; pointer = BTreeNode::readJumpNode(&jumpNode, pointer, flags); - BTreeNode::readNode(&node, (UCHAR*)bucket + + BTreeNode::readNode(&node, (UCHAR*)bucket + jumpNode.offset, flags, leafPage); if (node.length != 0 || @@ -4427,10 +4427,10 @@ static UCHAR* find_area_start_point(btree_page* bucket, const temporary_key* key // Reached end of our key we're searching for. done = true; // Check if this is a exact match or a duplicate - // If the node is pointing to its end and the length is + // If the node is pointing to its end and the length is // the same as the key then we have found a exact match. // Now start walking between the jump nodes until we - // found a node reference that's not equal anymore + // found a node reference that's not equal anymore // or the record number is higher then the one we need. if (useFindRecordNumber && q == nodeEnd) { n--; @@ -4445,7 +4445,7 @@ static UCHAR* find_area_start_point(btree_page* bucket, const temporary_key* key prevJumpNode = jumpNode; pointer = BTreeNode::readJumpNode(&jumpNode, pointer, flags); - BTreeNode::readNode(&node, (UCHAR*)bucket + + BTreeNode::readNode(&node, (UCHAR*)bucket + jumpNode.offset, flags, leafPage); if (node.length != 0 || @@ -4460,7 +4460,7 @@ static UCHAR* find_area_start_point(btree_page* bucket, const temporary_key* key } } break; - } + } if (q == nodeEnd) // End of node data reached break; @@ -4514,10 +4514,10 @@ static SLONG find_page(btree_page* bucket, const temporary_key* key, ************************************** * * Functional description - * Find a page number in an index level. Return either the + * Find a page number in an index level. Return either the * node equal to the key or the last node less than the key. - * Note that this routine can be called only for non-leaf - * pages, because it assumes the first node on page is + * Note that this routine can be called only for non-leaf + * pages, because it assumes the first node on page is * a degenerate, zero-length node. * **************************************/ @@ -4528,8 +4528,8 @@ static SLONG find_page(btree_page* bucket, const temporary_key* key, const bool descending = (idx_flags & idx_descending); const bool allRecordNumber = (flags & btr_all_record_number); const UCHAR* const endPointer = (UCHAR*)bucket + bucket->btr_length; - const bool validateDuplicates = - ((idx_flags & idx_unique) && !(key->key_flags & key_all_nulls)) || + const bool validateDuplicates = + ((idx_flags & idx_unique) && !(key->key_flags & key_all_nulls)) || (idx_flags & idx_primary); if (!allRecordNumber || validateDuplicates) { @@ -4571,7 +4571,7 @@ static SLONG find_page(btree_page* bucket, const temporary_key* key, if (node.nodePointer == BTreeNode::getPointerFirstNode(bucket)) { prefix = 0; // Handle degenerating node, always generated at first - // page in a level. + // page in a level. if ((node.prefix == 0) && (node.length == 0)) { // Compute common prefix of key and first node previousNumber = node.pageNumber; @@ -4581,7 +4581,7 @@ static SLONG find_page(btree_page* bucket, const temporary_key* key, BUGCHECK(204); // msg 204 index inconsistent } } - } + } const UCHAR* p = key->key_data + prefix; // pointer on key const UCHAR* const keyEnd = key->key_data + key->key_length; // pointer on end of key @@ -4596,7 +4596,7 @@ static SLONG find_page(btree_page* bucket, const temporary_key* key, return previousNumber; } - // If the node prefix is greater than current prefix , it must be less + // If the node prefix is greater than current prefix , it must be less // than the key, so we can skip it. If it has zero length, then // it is a duplicate, and can also be skipped. const UCHAR* q = node.data; // pointer on processing node @@ -4610,10 +4610,10 @@ static SLONG find_page(btree_page* bucket, const temporary_key* key, // record number matching. if (q == nodeEnd || p == keyEnd) { - if (find_record_number != NO_VALUE && - q == nodeEnd && p == keyEnd) + if (find_record_number != NO_VALUE && + q == nodeEnd && p == keyEnd) { - return BTreeNode::findPageInDuplicates(bucket, + return BTreeNode::findPageInDuplicates(bucket, node.nodePointer, previousNumber, find_record_number); } @@ -4635,10 +4635,10 @@ static SLONG find_page(btree_page* bucket, const temporary_key* key, if (p == keyEnd) { // Check for exact match and if we need to do // record number matching. - if (find_record_number != NO_VALUE && - q == nodeEnd) + if (find_record_number != NO_VALUE && + q == nodeEnd) { - return BTreeNode::findPageInDuplicates(bucket, + return BTreeNode::findPageInDuplicates(bucket, node.nodePointer, previousNumber, find_record_number); } @@ -4691,7 +4691,7 @@ static SLONG find_page(btree_page* bucket, const temporary_key* key, if (pointer == BTreeNode::getPointerFirstNode(bucket)) { prefix = 0; // Handle degenerating node, always generated at first - // page in a level. + // page in a level. if ((node->btn_prefix == 0) && (node->btn_length == 0)) { // Compute common prefix of key and first node prior = node; @@ -4719,7 +4719,7 @@ static SLONG find_page(btree_page* bucket, const temporary_key* key, return get_long(prior->btn_number); } - // If the node prefix is greater than current prefix , it must be less + // If the node prefix is greater than current prefix , it must be less // than the key, so we can skip it. If it has zero length, then // it is a duplicate, and can also be skipped. const UCHAR* q = node->btn_data; @@ -4729,11 +4729,11 @@ static SLONG find_page(btree_page* bucket, const temporary_key* key, while (true) { if (q == nodeEnd || p == keyEnd) { - if (find_record_number != NO_VALUE && - q == nodeEnd && p == keyEnd) + if (find_record_number != NO_VALUE && + q == nodeEnd && p == keyEnd) { - return BTreeNode::findPageInDuplicates(bucket, - (UCHAR*)node, get_long(prior->btn_number), + return BTreeNode::findPageInDuplicates(bucket, + (UCHAR*)node, get_long(prior->btn_number), find_record_number); } @@ -4756,11 +4756,11 @@ static SLONG find_page(btree_page* bucket, const temporary_key* key, { // Check for exact match and if we need to do // record number matching. - if (find_record_number != NO_VALUE && - q == nodeEnd) + if (find_record_number != NO_VALUE && + q == nodeEnd) { - return BTreeNode::findPageInDuplicates(bucket, - (UCHAR*)node, get_long(prior->btn_number), + return BTreeNode::findPageInDuplicates(bucket, + (UCHAR*)node, get_long(prior->btn_number), find_record_number); } @@ -4808,13 +4808,13 @@ static CONTENTS garbage_collect(thread_db* tdbb, WIN * window, SLONG parent_numb ************************************** * * Functional description - * Garbage collect an index page. This requires - * care so that we don't step on other processes - * that might be traversing the tree forwards, - * backwards, or top to bottom. We must also - * keep in mind that someone might be adding a node - * at the same time we are deleting. Therefore we - * must lock all the pages involved to prevent + * Garbage collect an index page. This requires + * care so that we don't step on other processes + * that might be traversing the tree forwards, + * backwards, or top to bottom. We must also + * keep in mind that someone might be adding a node + * at the same time we are deleting. Therefore we + * must lock all the pages involved to prevent * such operations while we are garbage collecting. * **************************************/ @@ -4833,20 +4833,20 @@ static CONTENTS garbage_collect(thread_db* tdbb, WIN * window, SLONG parent_numb return contents_above_threshold; } - // record the left sibling now since this is the only way to - // get to it quickly; don't worry if it's not accurate now or - // is changed after we release the page, since we will fetch + // record the left sibling now since this is the only way to + // get to it quickly; don't worry if it's not accurate now or + // is changed after we release the page, since we will fetch // it in a fault-tolerant way anyway. const SLONG left_number = gc_page->btr_left_sibling; - // if the left sibling is blank, that indicates we are the leftmost page, + // if the left sibling is blank, that indicates we are the leftmost page, // so don't garbage-collect the page; do this for several reasons: - // 1. The leftmost page needs a degenerate zero length node as its first node + // 1. The leftmost page needs a degenerate zero length node as its first node // (for a non-leaf, non-top-level page). - // 2. The parent page would need to be fixed up to have a degenerate node - // pointing to the right sibling. - // 3. If we remove all pages on the level, we would need to re-add it next - // time a record is inserted, so why constantly garbage-collect and re-create + // 2. The parent page would need to be fixed up to have a degenerate node + // pointing to the right sibling. + // 3. If we remove all pages on the level, we would need to re-add it next + // time a record is inserted, so why constantly garbage-collect and re-create // this page? if (!left_number) { @@ -4859,14 +4859,14 @@ static CONTENTS garbage_collect(thread_db* tdbb, WIN * window, SLONG parent_numb const UCHAR index_id = gc_page->btr_id; const UCHAR index_level = gc_page->btr_level; - // we must release the page we are attempting to garbage collect; + // we must release the page we are attempting to garbage collect; // this is necessary to avoid deadlocks when we fetch the parent page CCH_RELEASE(tdbb, window); - // fetch the parent page, but we have to be careful, because it could have - // been garbage-collected when we released it--make checks so that we know it - // is the parent page; there is a minute possibility that it could have been - // released and reused already as another page on this level, but if so, it + // fetch the parent page, but we have to be careful, because it could have + // been garbage-collected when we released it--make checks so that we know it + // is the parent page; there is a minute possibility that it could have been + // released and reused already as another page on this level, but if so, it // won't really matter because we won't find the node on it WIN parent_window(pageSpaceID, parent_number); btree_page* parent_page = @@ -4874,13 +4874,13 @@ static CONTENTS garbage_collect(thread_db* tdbb, WIN * window, SLONG parent_numb if ((parent_page->btr_header.pag_type != pag_index) || (parent_page->btr_relation != relation_number) || (parent_page->btr_id != (UCHAR)(index_id % 256)) - || (parent_page->btr_level != index_level + 1)) + || (parent_page->btr_level != index_level + 1)) { CCH_RELEASE(tdbb, &parent_window); return contents_above_threshold; } - // Find the node on the parent's level--the parent page could + // Find the node on the parent's level--the parent page could // have split while we didn't have it locked UCHAR *parentPointer = BTreeNode::getPointerFirstNode(parent_page); IndexNode parentNode; @@ -4894,8 +4894,8 @@ static CONTENTS garbage_collect(thread_db* tdbb, WIN * window, SLONG parent_numb continue; } - if (parentNode.pageNumber == window->win_page.getPageNum() || - parentNode.isEndLevel) + if (parentNode.pageNumber == window->win_page.getPageNum() || + parentNode.isEndLevel) { break; } @@ -4910,27 +4910,27 @@ static CONTENTS garbage_collect(thread_db* tdbb, WIN * window, SLONG parent_numb return contents_above_threshold; } - // Fix for ARINC database corruption bug: in most cases we update the END_BUCKET - // marker of the left sibling page to contain the END_BUCKET of the garbage-collected - // page. However, when this page is the first page on its parent, then the left - // sibling page is the last page on its parent. That means if we update its END_BUCKET - // marker, its bucket of values will extend past that of its parent, causing trouble - // down the line. - - // So we never garbage-collect a page which is the first one on its parent. This page - // will have to wait until the parent page gets collapsed with the page to its left, - // in which case this page itself will then be garbage-collectable. Since there are - // no more keys on this page, it will not be garbage-collected itself. When the page - // to the right falls below the threshold for garbage collection, it will be merged with + // Fix for ARINC database corruption bug: in most cases we update the END_BUCKET + // marker of the left sibling page to contain the END_BUCKET of the garbage-collected + // page. However, when this page is the first page on its parent, then the left + // sibling page is the last page on its parent. That means if we update its END_BUCKET + // marker, its bucket of values will extend past that of its parent, causing trouble + // down the line. + + // So we never garbage-collect a page which is the first one on its parent. This page + // will have to wait until the parent page gets collapsed with the page to its left, + // in which case this page itself will then be garbage-collectable. Since there are + // no more keys on this page, it will not be garbage-collected itself. When the page + // to the right falls below the threshold for garbage collection, it will be merged with // this page. if (parentNode.nodePointer == BTreeNode::getPointerFirstNode(parent_page)) { CCH_RELEASE(tdbb, &parent_window); return contents_above_threshold; } - // find the left sibling page by going one page to the left, - // but if it does not recognize us as its right sibling, keep - // going to the right until we find the page that is our real + // find the left sibling page by going one page to the left, + // but if it does not recognize us as its right sibling, keep + // going to the right until we find the page that is our real // left sibling WIN left_window(pageSpaceID, left_number); btree_page* left_page = @@ -4953,7 +4953,7 @@ static CONTENTS garbage_collect(thread_db* tdbb, WIN * window, SLONG parent_numb left_page->btr_sibling, LCK_write, pag_index); } - // now refetch the original page and make sure it is still + // now refetch the original page and make sure it is still // below the threshold for garbage collection. gc_page = (btree_page*) CCH_FETCH(tdbb, window, LCK_write, pag_index); if (gc_page->btr_length >= GARBAGE_COLLECTION_BELOW_THRESHOLD || @@ -5019,7 +5019,7 @@ static CONTENTS garbage_collect(thread_db* tdbb, WIN * window, SLONG parent_numb IndexJumpNode jumpNode; while (n) { pointer = BTreeNode::readJumpNode(&jumpNode, pointer, flags); - BTreeNode::readNode(&leftNode, + BTreeNode::readNode(&leftNode, (UCHAR*)left_page + jumpNode.offset, flags, leafPage); if (!(leftNode.isEndBucket || leftNode.isEndLevel)) { @@ -5089,30 +5089,30 @@ static CONTENTS garbage_collect(thread_db* tdbb, WIN * window, SLONG parent_numb // Copy header and data memcpy(newBucket, left_page, headerSize); - memcpy((UCHAR*)newBucket + headerSize, - (UCHAR*)left_page + jumpInfo.firstNodeOffset, + memcpy((UCHAR*)newBucket + headerSize, + (UCHAR*)left_page + jumpInfo.firstNodeOffset, left_page->btr_length - jumpInfo.firstNodeOffset); - // Update leftPointer to scratch page. - leftPointer = (UCHAR*)newBucket + (leftPointer - (UCHAR*)left_page) - + // Update leftPointer to scratch page. + leftPointer = (UCHAR*)newBucket + (leftPointer - (UCHAR*)left_page) - jumpersOriginalSize; const UCHAR flags2 = newBucket->btr_header.pag_flags; gcPointer = BTreeNode::getPointerFirstNode(gc_page); // BTreeNode::readNode(&leftNode, leftPointer, flags2, leafPage); - // Calculate the total amount of compression on page as the combined - // totals of the two pages, plus the compression of the first node - // on the g-c'ed page, minus the prefix of the END_BUCKET node to + // Calculate the total amount of compression on page as the combined + // totals of the two pages, plus the compression of the first node + // on the g-c'ed page, minus the prefix of the END_BUCKET node to // be deleted. - newBucket->btr_prefix_total += + newBucket->btr_prefix_total += gc_page->btr_prefix_total + prefix - leftNode.prefix; // Get first node from gc-page. gcPointer = BTreeNode::readNode(&gcNode, gcPointer, gcFlags, leafPage); // Write first node with prefix compression on left page. - BTreeNode::setNode(&leftNode, prefix, gcNode.length - prefix, - gcNode.recordNumber, gcNode.pageNumber, + BTreeNode::setNode(&leftNode, prefix, gcNode.length - prefix, + gcNode.recordNumber, gcNode.pageNumber, gcNode.isEndBucket, gcNode.isEndLevel); leftNode.data = gcNode.data + prefix; leftPointer = BTreeNode::writeNode(&leftNode, leftPointer, flags2, leafPage); @@ -5124,7 +5124,7 @@ static CONTENTS garbage_collect(thread_db* tdbb, WIN * window, SLONG parent_numb memcpy(leftPointer, gcPointer, l); // update page size. newBucket->btr_length += l; - + // Generate new jump nodes. jumpNodeList* jumpNodes = FB_NEW(*tdbb->getDefaultPool()) jumpNodeList(*tdbb->getDefaultPool()); USHORT jumpersNewSize = 0; @@ -5134,8 +5134,8 @@ static CONTENTS garbage_collect(thread_db* tdbb, WIN * window, SLONG parent_numb jumpInfo.jumpers = 0; BTreeNode::writeJumpInfo(newBucket, &jumpInfo); generate_jump_nodes(tdbb, newBucket, jumpNodes, 0, &jumpersNewSize, NULL, NULL); - - // Now we know exact how big our updated left page is, so check size + + // Now we know exact how big our updated left page is, so check size // again to be sure it all will fit. // If the new page will be larger then the page size don't gc ofcourse. if (newBucket->btr_length + jumpersNewSize > dbb->dbb_page_size) { @@ -5157,20 +5157,20 @@ static CONTENTS garbage_collect(thread_db* tdbb, WIN * window, SLONG parent_numb } #ifdef DEBUG_BTR_SPLIT - Firebird::string s; - s.printf("node with page %ld removed from parent page %ld", + Firebird::string s; + s.printf("node with page %ld removed from parent page %ld", parentNode.pageNumber, parent_window.win_page.getPageNum()); gds__trace(s.c_str()); #endif - // Update the parent first. If the parent is not written out first, - // we will be pointing to a page which is not in the doubly linked + // Update the parent first. If the parent is not written out first, + // we will be pointing to a page which is not in the doubly linked // sibling list, and therefore navigation back and forth won't work. // AB: Parent is always a index pointer page. result = delete_node(tdbb, &parent_window, parentNode.nodePointer); CCH_RELEASE(tdbb, &parent_window); - // Update the right sibling page next, since it does not really - // matter that the left sibling pointer points to the page directly + // Update the right sibling page next, since it does not really + // matter that the left sibling pointer points to the page directly // to the left, only that it point to some page to the left. // Set up the precedence so that the parent will be written first. if (right_page) { @@ -5183,7 +5183,7 @@ static CONTENTS garbage_collect(thread_db* tdbb, WIN * window, SLONG parent_numb CCH_RELEASE(tdbb, &right_window); } - // Now update the left sibling, effectively removing the garbage-collected page + // Now update the left sibling, effectively removing the garbage-collected page // from the tree. Set the precedence so the right sibling will be written first. if (right_page) { CCH_precedence(tdbb, &left_window, right_window.win_page); @@ -5216,7 +5216,7 @@ static CONTENTS garbage_collect(thread_db* tdbb, WIN * window, SLONG parent_numb } } // Copy data. - memcpy(pointer, (UCHAR*)newBucket + headerSize, + memcpy(pointer, (UCHAR*)newBucket + headerSize, newBucket->btr_length - headerSize); // Update page header information. left_page->btr_prefix_total = newBucket->btr_prefix_total; @@ -5226,19 +5226,19 @@ static CONTENTS garbage_collect(thread_db* tdbb, WIN * window, SLONG parent_numb delete jumpNodes; } else { - // Now begin updating the pages. We must write them out in such - // a way as to maintain on-disk integrity at all times. That means - // not having pointers to released pages, and not leaving things in + // Now begin updating the pages. We must write them out in such + // a way as to maintain on-disk integrity at all times. That means + // not having pointers to released pages, and not leaving things in // an inconsistent state for navigation through the pages. - // Update the parent first. If the parent is not written out first, - // we will be pointing to a page which is not in the doubly linked + // Update the parent first. If the parent is not written out first, + // we will be pointing to a page which is not in the doubly linked // sibling list, and therefore navigation back and forth won't work. // AB: Parent is always a index pointer page. #ifdef DEBUG_BTR_SPLIT - Firebird::string s; - s.printf("node with page %ld removed from parent page %ld", + Firebird::string s; + s.printf("node with page %ld removed from parent page %ld", parentNode.pageNumber, parent_window.win_page.getPageNum()); gds__trace(s.c_str()); #endif @@ -5246,8 +5246,8 @@ static CONTENTS garbage_collect(thread_db* tdbb, WIN * window, SLONG parent_numb result = delete_node(tdbb, &parent_window, parentNode.nodePointer); CCH_RELEASE(tdbb, &parent_window); - // Update the right sibling page next, since it does not really - // matter that the left sibling pointer points to the page directly + // Update the right sibling page next, since it does not really + // matter that the left sibling pointer points to the page directly // to the left, only that it point to some page to the left. // Set up the precedence so that the parent will be written first. if (right_page) { @@ -5260,7 +5260,7 @@ static CONTENTS garbage_collect(thread_db* tdbb, WIN * window, SLONG parent_numb CCH_RELEASE(tdbb, &right_window); } - // Now update the left sibling, effectively removing the garbage-collected page + // Now update the left sibling, effectively removing the garbage-collected page // from the tree. Set the precedence so the right sibling will be written first. if (right_page) { CCH_precedence(tdbb, &left_window, right_window.win_page); @@ -5280,18 +5280,18 @@ static CONTENTS garbage_collect(thread_db* tdbb, WIN * window, SLONG parent_numb gcPointer = BTreeNode::getPointerFirstNode(gc_page); BTreeNode::readNode(&leftNode, leftPointer, flags, leafPage); - // Calculate the total amount of compression on page as the combined totals + // Calculate the total amount of compression on page as the combined totals // of the two pages, plus the compression of the first node on the g-c'ed page, // minus the prefix of the END_BUCKET node to be deleted. - left_page->btr_prefix_total += + left_page->btr_prefix_total += gc_page->btr_prefix_total + prefix - leftNode.prefix; // Get first node from gc-page. gcPointer = BTreeNode::readNode(&gcNode, gcPointer, gcFlags, leafPage); // Write first node with prefix compression on left page. - BTreeNode::setNode(&leftNode, prefix, gcNode.length - prefix, - gcNode.recordNumber, gcNode.pageNumber, + BTreeNode::setNode(&leftNode, prefix, gcNode.length - prefix, + gcNode.recordNumber, gcNode.pageNumber, gcNode.isEndBucket, gcNode.isEndLevel); leftNode.data = gcNode.data + prefix; leftPointer = BTreeNode::writeNode(&leftNode, leftPointer, flags, leafPage); @@ -5316,25 +5316,25 @@ static CONTENTS garbage_collect(thread_db* tdbb, WIN * window, SLONG parent_numb CCH_RELEASE(tdbb, &left_window); #ifdef DEBUG_BTR_SPLIT - Firebird::string s; - s.printf("page %ld is removed from index. parent %ld, left %ld, right %ld", + Firebird::string s; + s.printf("page %ld is removed from index. parent %ld, left %ld, right %ld", window->win_page.getPageNum(), parent_window.win_page.getPageNum(), left_page ? left_window.win_page.getPageNum() : 0, right_page ? right_window.win_page.getPageNum() : 0 ); gds__trace(s.c_str()); #endif - // finally, release the page, and indicate that we should write the + // finally, release the page, and indicate that we should write the // previous page out before we write the TIP page out CCH_RELEASE(tdbb, window); PAG_release_page(window->win_page, left_page ? left_window.win_page : right_page ? right_window.win_page : parent_window.win_page); - // if the parent page needs to be garbage collected, that means we need to - // re-fetch the parent and check to see whether it is still garbage-collectable; + // if the parent page needs to be garbage collected, that means we need to + // re-fetch the parent and check to see whether it is still garbage-collectable; // make sure that the page is still a btree page in this index and in this level-- - // there is a miniscule chance that it was already reallocated as another page - // on this level which is already below the threshold, in which case it doesn't + // there is a miniscule chance that it was already reallocated as another page + // on this level which is already below the threshold, in which case it doesn't // hurt anything to garbage-collect it anyway if (result != contents_above_threshold) { window->win_page = parent_window.win_page; @@ -5343,7 +5343,7 @@ static CONTENTS garbage_collect(thread_db* tdbb, WIN * window, SLONG parent_numb if ((parent_page->btr_header.pag_type != pag_index) || (parent_page->btr_relation != relation_number) || (parent_page->btr_id != index_id) - || (parent_page->btr_level != index_level + 1)) + || (parent_page->btr_level != index_level + 1)) { CCH_RELEASE(tdbb, window); return contents_above_threshold; @@ -5368,7 +5368,7 @@ static CONTENTS garbage_collect(thread_db* tdbb, WIN * window, SLONG parent_numb return contents_below_threshold; } - // the page must have risen above the threshold; release the window since + // the page must have risen above the threshold; release the window since // someone else added a node while the page was released CCH_RELEASE(tdbb, window); return contents_above_threshold; @@ -5380,7 +5380,7 @@ static CONTENTS garbage_collect(thread_db* tdbb, WIN * window, SLONG parent_numb static void generate_jump_nodes(thread_db* tdbb, btree_page* page, jumpNodeList* jumpNodes, - USHORT excludeOffset, USHORT* jumpersSize, + USHORT excludeOffset, USHORT* jumpersSize, USHORT* splitIndex, USHORT* splitPrefix) { /************************************** @@ -5440,19 +5440,19 @@ static void generate_jump_nodes(thread_db* tdbb, btree_page* page, UCHAR* q = currentData + node.prefix; memcpy(q, node.data, node.length); } - + if (splitIndex && splitPrefix && !*splitIndex) { *splitPrefix += node.prefix; } - if ((node.nodePointer > newAreaPosition) && - (node.nodePointer != excludePointer)) + if ((node.nodePointer > newAreaPosition) && + (node.nodePointer != excludePointer)) { // Create a jumpnode, but it may not point to the new - // insert pointer or any MARKER else we make split + // insert pointer or any MARKER else we make split // more difficult then needed. jumpNode.offset = (node.nodePointer - (UCHAR*)page); - jumpNode.prefix = BTreeNode::computePrefix(jumpData, jumpLength, + jumpNode.prefix = BTreeNode::computePrefix(jumpData, jumpLength, currentData, node.prefix); jumpNode.length = node.prefix - jumpNode.prefix; if (jumpNode.length) { @@ -5492,20 +5492,20 @@ static void generate_jump_nodes(thread_db* tdbb, btree_page* page, UCHAR* q = currentData + node->btn_prefix; memcpy(q, node->btn_data, node->btn_length); } - + if (splitIndex && splitPrefix && !*splitIndex) { *splitPrefix += node->btn_prefix; } - if (((UCHAR*)node > newAreaPosition) && + if (((UCHAR*)node > newAreaPosition) && (get_long(node->btn_number) >= 0) && - ((UCHAR*)node != excludePointer)) + ((UCHAR*)node != excludePointer)) { // Create a jumpnode, but it may not point to the new - // insert pointer or any MARKER else we make split + // insert pointer or any MARKER else we make split // more difficult then needed. jumpNode.offset = ((UCHAR*)node - (UCHAR*)page); - jumpNode.prefix = BTreeNode::computePrefix(jumpData, jumpLength, + jumpNode.prefix = BTreeNode::computePrefix(jumpData, jumpLength, currentData, node->btn_prefix); jumpNode.length = node->btn_prefix - jumpNode.prefix; if (jumpNode.length) { @@ -5540,7 +5540,7 @@ static SLONG insert_node(thread_db* tdbb, index_insertion* insertion, temporary_key* new_key, RecordNumber* new_record_number, - SLONG * original_page, + SLONG * original_page, SLONG * sibling_page) { /************************************** @@ -5551,8 +5551,8 @@ static SLONG insert_node(thread_db* tdbb, * * Functional description * Insert a node in a index leaf page. - * If this isn't the right bucket, return NO_VALUE. - * If it splits, return the split page number and + * If this isn't the right bucket, return NO_VALUE. + * If it splits, return the split page number and * leading string. This is the workhorse for add_node. * **************************************/ @@ -5573,7 +5573,7 @@ static SLONG insert_node(thread_db* tdbb, const bool leafPage = (bucket->btr_level == 0); const bool allRecordNumber = (flags & btr_all_record_number); // hvlad: don't check unique index if key has only null values - const bool validateDuplicates = + const bool validateDuplicates = (unique && !(key->key_flags & key_all_nulls)) || primary; USHORT prefix = 0; RecordNumber newRecordNumber; @@ -5585,7 +5585,7 @@ static SLONG insert_node(thread_db* tdbb, } // For checking on duplicate nodes we should find the first matching key. UCHAR* pointer = find_node_start_point(bucket, key, 0, &prefix, - insertion->iib_descriptor->idx_flags & idx_descending, + insertion->iib_descriptor->idx_flags & idx_descending, false, allRecordNumber, validateDuplicates ? NO_VALUE : newRecordNumber); if (!pointer) { return NO_VALUE_PAGE; @@ -5598,7 +5598,7 @@ static SLONG insert_node(thread_db* tdbb, IndexNode beforeInsertNode; pointer = BTreeNode::readNode(&beforeInsertNode, pointer, flags, leafPage); - // loop through the equivalent nodes until the correct insertion + // loop through the equivalent nodes until the correct insertion // point is found; for leaf level this will be the first node USHORT newPrefix, newLength; USHORT nodeOffset; @@ -5634,8 +5634,8 @@ static SLONG insert_node(thread_db* tdbb, return NO_VALUE_PAGE; } - if (allRecordNumber && - (newRecordNumber < beforeInsertNode.recordNumber)) + if (allRecordNumber && + (newRecordNumber < beforeInsertNode.recordNumber)) { break; } @@ -5649,7 +5649,7 @@ static SLONG insert_node(thread_db* tdbb, if (leafPage && validateDuplicates) { // Save the duplicate so the main caller can validate them. - RBM_SET(tdbb->getDefaultPool(), &insertion->iib_duplicates, + RBM_SET(tdbb->getDefaultPool(), &insertion->iib_duplicates, beforeInsertNode.recordNumber.getValue()); } // AB: Never insert a duplicate node with the same record number. @@ -5660,9 +5660,9 @@ static SLONG insert_node(thread_db* tdbb, // going are wrong checked before BTR_remove is called. CCH_RELEASE(tdbb, window); return 0; - }*/ - //else - if (allRecordNumber && !validateDuplicates) { + }*/ + //else + if (allRecordNumber && !validateDuplicates) { // if recordnumber is higher we need to insert before it. if (newRecordNumber <= beforeInsertNode.recordNumber) { break; @@ -5691,7 +5691,7 @@ static SLONG insert_node(thread_db* tdbb, beforeInsertNode.prefix = newPrefix; beforeInsertNode.length = newLength; - USHORT beforeInsertSize = + USHORT beforeInsertSize = BTreeNode::getNodeSize(&beforeInsertNode, flags, leafPage); // Set values for our new node. @@ -5726,9 +5726,9 @@ static SLONG insert_node(thread_db* tdbb, // Copy remaining data to scratch page. if ((nodeOffset + beforeInsertOriginalSize) < bucket->btr_length) { - memcpy(pointer, (UCHAR*)bucket + nodeOffset + beforeInsertOriginalSize, + memcpy(pointer, (UCHAR*)bucket + nodeOffset + beforeInsertOriginalSize, bucket->btr_length - (nodeOffset + beforeInsertOriginalSize)); - } + } // Update bucket size. newBucket->btr_length += delta; @@ -5749,12 +5749,12 @@ static SLONG insert_node(thread_db* tdbb, USHORT ensureEndInsert = 0; if (endOfPage) { - // If we're adding a node at the end we don't want that a page + // If we're adding a node at the end we don't want that a page // splits in the middle, but at the end. We can never be sure // that this will happen, but at least give it a bigger chance. ensureEndInsert = 6 + key->key_length; } - + if (useJumpInfo) { // Get the total size of the jump nodes currently in use. pointer = BTreeNode::getPointerFirstNode(newBucket, &jumpInfo); @@ -5794,7 +5794,7 @@ static SLONG insert_node(thread_db* tdbb, } // Rebuild jump nodes if new node is inserted after last // jump node offset + jumpAreaSize. - if (nodeOffset >= (headerSize + jumpersOriginalSize + + if (nodeOffset >= (headerSize + jumpersOriginalSize + ((jumpInfo.jumpers + 1) * jumpInfo.jumpAreaSize))) { fragmentedOffset = true; @@ -5807,8 +5807,8 @@ static SLONG insert_node(thread_db* tdbb, if (fragmentedOffset) { // Clean up any previous nodes. jumpNodes->clear(); - // Generate new jump nodes. - generate_jump_nodes(tdbb, newBucket, jumpNodes, + // Generate new jump nodes. + generate_jump_nodes(tdbb, newBucket, jumpNodes, (USHORT)(newNode.nodePointer - (UCHAR*)newBucket), &jumpersNewSize, &splitJumpNodeIndex, &newPrefixTotalBySplit); } @@ -5816,9 +5816,9 @@ static SLONG insert_node(thread_db* tdbb, // If the bucket still fits on a page, we're almost done. if (newBucket->btr_length + ensureEndInsert + - jumpersNewSize - jumpersOriginalSize <= dbb->dbb_page_size) + jumpersNewSize - jumpersOriginalSize <= dbb->dbb_page_size) { - // if we are a pointer page, make sure that the page we are + // if we are a pointer page, make sure that the page we are // pointing to gets written before we do for on-disk integrity if (!leafPage) { CCH_precedence(tdbb, window, insertion->iib_number.getValue()); @@ -5845,16 +5845,16 @@ static SLONG insert_node(thread_db* tdbb, delete[] walkJumpNode[i].data; } } - } + } pointer = (UCHAR*)bucket + jumpInfo.firstNodeOffset; // Copy data block. - memcpy(pointer, (UCHAR*)newBucket + headerSize + jumpersOriginalSize, + memcpy(pointer, (UCHAR*)newBucket + headerSize + jumpersOriginalSize, newBucket->btr_length - (headerSize + jumpersOriginalSize)); - + // Update header information. bucket->btr_prefix_total = newBucket->btr_prefix_total; bucket->btr_length = newBucket->btr_length + jumpersNewSize - jumpersOriginalSize; - } + } else { // Copy temp-buffer data to window buffer. memcpy(window->win_buffer, newBucket, newBucket->btr_length); @@ -5870,10 +5870,10 @@ static SLONG insert_node(thread_db* tdbb, } // We've a bucket split in progress. We need to determine the split point. - // Set it halfway through the page, unless we are at the end of the page, - // in which case put only the new node on the new page. This will ensure - // that pages get filled in the case of a monotonically increasing key. - // Make sure that the original page has room, in case the END_BUCKET marker + // Set it halfway through the page, unless we are at the end of the page, + // in which case put only the new node on the new page. This will ensure + // that pages get filled in the case of a monotonically increasing key. + // Make sure that the original page has room, in case the END_BUCKET marker // is now longer because it is pointing at the new node. // // Note! : newBucket contains still old jump nodes and info. @@ -5886,9 +5886,9 @@ static SLONG insert_node(thread_db* tdbb, splitpoint = BTreeNode::readNode(&node, newNode.nodePointer, flags, leafPage); IndexNode dummyNode = newNode; BTreeNode::setEndBucket(&dummyNode, leafPage); - const USHORT deltaSize = BTreeNode::getNodeSize(&dummyNode, flags, leafPage) - + const USHORT deltaSize = BTreeNode::getNodeSize(&dummyNode, flags, leafPage) - BTreeNode::getNodeSize(&newNode, flags, leafPage); - if (endOfPage && ((splitpoint + jumpersNewSize - jumpersOriginalSize) <= + if (endOfPage && ((splitpoint + jumpersNewSize - jumpersOriginalSize) <= (UCHAR*)newBucket + dbb->dbb_page_size - deltaSize)) { // Copy data from inserted key and this key will we the END_BUCKET marker @@ -5935,7 +5935,7 @@ static SLONG insert_node(thread_db* tdbb, const USHORT length = walkJumpNode[i].prefix + walkJumpNode[i].length; UCHAR* newData = FB_NEW(*tdbb->getDefaultPool()) UCHAR[length]; memcpy(newData, new_key->key_data, walkJumpNode[i].prefix); - memcpy(newData + walkJumpNode[i].prefix, walkJumpNode[i].data, + memcpy(newData + walkJumpNode[i].prefix, walkJumpNode[i].data, walkJumpNode[i].length); if (walkJumpNode[i].data) { delete[] walkJumpNode[i].data; @@ -5966,15 +5966,15 @@ static SLONG insert_node(thread_db* tdbb, splitpoint = BTreeNode::readNode(&newNode, newNode.nodePointer, flags, leafPage); IndexNode dummyNode = newNode; BTreeNode::setEndBucket(&dummyNode, leafPage); - const USHORT deltaSize = BTreeNode::getNodeSize(&dummyNode, flags, leafPage) - + const USHORT deltaSize = BTreeNode::getNodeSize(&dummyNode, flags, leafPage) - BTreeNode::getNodeSize(&newNode, flags, leafPage); - if (endOfPage && ((UCHAR*)splitpoint <= (UCHAR*)newBucket + + if (endOfPage && ((UCHAR*)splitpoint <= (UCHAR*)newBucket + dbb->dbb_page_size - deltaSize)) { midpoint = splitpoint; } else { - midpoint = (UCHAR*)newBucket + ((dbb->dbb_page_size - + midpoint = (UCHAR*)newBucket + ((dbb->dbb_page_size - (BTreeNode::getPointerFirstNode(newBucket) - (UCHAR*)newBucket)) / 2); } // Start from the begin of the nodes @@ -6014,7 +6014,7 @@ static SLONG insert_node(thread_db* tdbb, // Format the first node on the overflow page BTreeNode::setNode(&newNode, 0, new_key->key_length, node.recordNumber, node.pageNumber); - // Return first record number on split page to caller. + // Return first record number on split page to caller. newNode.data = new_key->key_data; *new_record_number = newNode.recordNumber; const USHORT firstSplitNodeSize = BTreeNode::getNodeSize(&newNode, flags, leafPage); @@ -6040,7 +6040,7 @@ static SLONG insert_node(thread_db* tdbb, for (size_t i = 0; i < jumpNodes->getCount(); i++, index++) { if (index > splitJumpNodeIndex) { // Update offset to correct position. - walkJumpNode[i].offset = walkJumpNode[i].offset - splitOffset + + walkJumpNode[i].offset = walkJumpNode[i].offset - splitOffset + splitJumpInfo.firstNodeOffset + firstSplitNodeSize; pointer = BTreeNode::writeJumpNode(&walkJumpNode[i], pointer, flags); } @@ -6060,7 +6060,7 @@ static SLONG insert_node(thread_db* tdbb, split->btr_length = ((pointer + l) - (UCHAR*)split); // the sum of the prefixes on the split page is the previous total minus - // the prefixes found on the original page; the sum of the prefixes on the + // the prefixes found on the original page; the sum of the prefixes on the // original page must exclude the split node split->btr_prefix_total = newBucket->btr_prefix_total - prefix_total; const SLONG split_page = split_window.win_page.getPageNum(); @@ -6073,7 +6073,7 @@ static SLONG insert_node(thread_db* tdbb, // back to the original buffer. After cleaning up the last node, // we're done! - // mark the end of the page; note that the end_bucket marker must + // mark the end of the page; note that the end_bucket marker must // contain info about the first node on the next page. So we don't // overwrite the existing data. BTreeNode::setEndBucket(&node, leafPage); @@ -6097,14 +6097,14 @@ static SLONG insert_node(thread_db* tdbb, for (size_t i = 0; i < jumpNodes->getCount(); i++, index++) { if (index <= jumpInfo.jumpers) { // Update offset to correct position. - walkJumpNode[i].offset = walkJumpNode[i].offset + + walkJumpNode[i].offset = walkJumpNode[i].offset + jumpersNewSize - jumpersOriginalSize; pointer = BTreeNode::writeJumpNode(&walkJumpNode[i], pointer, flags); } } pointer = (UCHAR*)bucket + jumpInfo.firstNodeOffset; - memcpy(pointer, (UCHAR*)newBucket + headerSize + jumpersOriginalSize, + memcpy(pointer, (UCHAR*)newBucket + headerSize + jumpersOriginalSize, newBucket->btr_length - (headerSize + jumpersOriginalSize)); bucket->btr_length = newBucket->btr_length + jumpersNewSize - jumpersOriginalSize; @@ -6125,7 +6125,7 @@ static SLONG insert_node(thread_db* tdbb, bucket->btr_sibling = split_window.win_page.getPageNum(); bucket->btr_prefix_total = prefix_total; // mark the bucket as non garbage-collectable until we can propagate - // the split page up to the parent; otherwise its possible that the + // the split page up to the parent; otherwise its possible that the // split page we just created will be lost. insertion->iib_dont_gc_lock->disablePageGC(tdbb, window->win_page); @@ -6133,7 +6133,7 @@ static SLONG insert_node(thread_db* tdbb, *original_page = window->win_page.getPageNum(); } - // now we need to go to the right sibling page and update its + // now we need to go to the right sibling page and update its // left sibling pointer to point to the newly split page if (right_sibling) { bucket = (btree_page*) CCH_HANDOFF(tdbb, window, right_sibling, LCK_write, pag_index); @@ -6182,7 +6182,7 @@ static INT64_KEY make_int64_key(SINT64 q, SSHORT scale) // representations of the same value, entered at times when the // declared scale of the column was different, actually wind up // being mapped to the same key. - + int n = 0; FB_UINT64 uq = (FB_UINT64) ((q >= 0) ? q : -q); // absolute value while (uq < int64_scale_control[n].limit) { @@ -6261,7 +6261,7 @@ static void print_int64_key(SINT64 value, SSHORT scale, INT64_KEY key) ************************************** * * Functional description - * Debugging function to print a key created out of an int64 + * Debugging function to print a key created out of an int64 * quantify. * **************************************/ @@ -6289,8 +6289,8 @@ static CONTENTS remove_node(thread_db* tdbb, index_insertion* insertion, WIN* wi ************************************** * * Functional description - * Remove an index node from a b-tree, - * recursing down through the levels in case + * Remove an index node from a b-tree, + * recursing down through the levels in case * we need to garbage collect pages. * **************************************/ @@ -6318,7 +6318,7 @@ static CONTENTS remove_node(thread_db* tdbb, index_insertion* insertion, WIN* wi return contents_above_threshold; } - // recurse to the next level down; if we are about to fetch a + // recurse to the next level down; if we are about to fetch a // level 0 page, make sure we fetch it for write if (number != END_BUCKET) { @@ -6327,8 +6327,8 @@ static CONTENTS remove_node(thread_db* tdbb, index_insertion* insertion, WIN* wi page = (btree_page*) CCH_HANDOFF(tdbb, window, number, (SSHORT) ((page->btr_level == 1) ? LCK_write : LCK_read), pag_index); - // if the removed node caused the page to go below the garbage collection - // threshold, and the database was created by a version of the engine greater + // if the removed node caused the page to go below the garbage collection + // threshold, and the database was created by a version of the engine greater // than 8.2, then we can garbage-collect the page const CONTENTS result = remove_node(tdbb, insertion, window); @@ -6374,7 +6374,7 @@ static CONTENTS remove_leaf_node(thread_db* tdbb, index_insertion* insertion, WI UCHAR* pointer; USHORT prefix; while (!(pointer = find_node_start_point(page, key, 0, &prefix, - insertion->iib_descriptor->idx_flags & idx_descending, + insertion->iib_descriptor->idx_flags & idx_descending, false, false, insertion->iib_number))) { page = (btree_page*) CCH_HANDOFF(tdbb, window, page->btr_sibling, LCK_write, pag_index); @@ -6420,14 +6420,14 @@ static CONTENTS remove_leaf_node(thread_db* tdbb, index_insertion* insertion, WI // non-leaf pages and sort duplicates by record-number. // ***************************************************** - // now look through the duplicate nodes to find the one + // now look through the duplicate nodes to find the one // with matching record number ULONG pages = 0; while (true) { // if we find the right one, quit - if (insertion->iib_number == node.recordNumber && - !node.isEndBucket && !node.isEndLevel) + if (insertion->iib_number == node.recordNumber && + !node.isEndBucket && !node.isEndLevel) { break; } @@ -6454,7 +6454,7 @@ static CONTENTS remove_leaf_node(thread_db* tdbb, index_insertion* insertion, WI continue; } - // if we hit the end of bucket, go to the right sibling page, + // if we hit the end of bucket, go to the right sibling page, // and check that the first node is a duplicate ++pages; page = (btree_page*) CCH_HANDOFF(tdbb, window, page->btr_sibling, @@ -6507,8 +6507,8 @@ static CONTENTS remove_leaf_node(thread_db* tdbb, index_insertion* insertion, WI static bool scan(thread_db* tdbb, UCHAR* pointer, RecordBitmap** bitmap, RecordBitmap* bitmap_and, - index_desc* idx, IndexRetrieval* retrieval, USHORT prefix, - temporary_key* key, const SCHAR page_flags, + index_desc* idx, IndexRetrieval* retrieval, USHORT prefix, + temporary_key* key, const SCHAR page_flags, bool& skipLowerKey, const temporary_key& lowerKey) { /************************************** @@ -6518,7 +6518,7 @@ static bool scan(thread_db* tdbb, UCHAR* pointer, RecordBitmap** bitmap, RecordB ************************************** * * Functional description - * Do an index scan. + * Do an index scan. * If we run over the bucket, return true. * If we're completely done (passed END_LEVEL), * return false. @@ -6534,7 +6534,7 @@ static bool scan(thread_db* tdbb, UCHAR* pointer, RecordBitmap** bitmap, RecordB ULONG count; USHORT flag = retrieval->irb_generic; if ((flag & irb_partial) && (flag & irb_equality) - && !(flag & irb_starting) && !(flag & irb_descending)) + && !(flag & irb_starting) && !(flag & irb_descending)) { count = STUFF_COUNT - ((key->key_length + STUFF_COUNT) % (STUFF_COUNT + 1)); @@ -6606,9 +6606,9 @@ static bool scan(thread_db* tdbb, UCHAR* pointer, RecordBitmap** bitmap, RecordB for (; l; --l, prefix++) { if (skipUpperKey && partUpper) { - if (upperPrefix >= key->key_length) + if (upperPrefix >= key->key_length) { - const USHORT segnum = + const USHORT segnum = idx->idx_count - (UCHAR)(descending ? ((*q) ^ -1) : *q) + 1; if (segnum >= retrieval->irb_upper_count) { @@ -6648,7 +6648,7 @@ static bool scan(thread_db* tdbb, UCHAR* pointer, RecordBitmap** bitmap, RecordB } if (p >= end_key) { done = true; - + if ((l == 0) && skipUpperKey) { return false; } @@ -6736,9 +6736,9 @@ static bool scan(thread_db* tdbb, UCHAR* pointer, RecordBitmap** bitmap, RecordB for (; l; --l, prefix++) { if (skipUpperKey && partUpper) { - if (upperPrefix >= key->key_length) + if (upperPrefix >= key->key_length) { - const USHORT segnum = + const USHORT segnum = idx->idx_count - (UCHAR)(descending ? ((*q) ^ -1) : *q) + 1; if (segnum >= retrieval->irb_upper_count) { @@ -6780,7 +6780,7 @@ static bool scan(thread_db* tdbb, UCHAR* pointer, RecordBitmap** bitmap, RecordB } if (p >= end_key) { done = true; - + if ((l == 0) && skipUpperKey) { return false; } @@ -6796,51 +6796,51 @@ static bool scan(thread_db* tdbb, UCHAR* pointer, RecordBitmap** bitmap, RecordB if (ignoreNulls) { ignore = false; if (descending) { - if ((node->btn_prefix == 0) && - (node->btn_length >= 1) && (node->btn_data[0] == 255)) + if ((node->btn_prefix == 0) && + (node->btn_length >= 1) && (node->btn_data[0] == 255)) { return false; } } else { // Ascending (prefix + length == 0) - ignore = (node->btn_prefix + node->btn_length == 0); + ignore = (node->btn_prefix + node->btn_length == 0); } } - if (skipLowerKey) + if (skipLowerKey) { if (node->btn_prefix == 0) { - // If the prefix is 0 we have a full key. + // If the prefix is 0 we have a full key. // (first node on every new page for example has prefix zero) - if (partLower) + if (partLower) { // With multi-segment compare first part of data with lowerKey - skipLowerKey = + skipLowerKey = ((lowerKey.key_length <= node->btn_length) && (memcmp(node->btn_data, lowerKey.key_data, lowerKey.key_length) == 0)); if (skipLowerKey && (node->btn_length > lowerKey.key_length)) { - // We've bigger data in the node than in the lowerKey, + // We've bigger data in the node than in the lowerKey, // now check the segment-number const UCHAR* segp = node->btn_data + lowerKey.key_length; - const USHORT segnum = - idx->idx_count - (UCHAR)((idx->idx_flags & idx_descending) ? + const USHORT segnum = + idx->idx_count - (UCHAR)((idx->idx_flags & idx_descending) ? ((*segp) ^ -1) : *segp); - if (segnum < retrieval->irb_lower_count) + if (segnum < retrieval->irb_lower_count) { skipLowerKey = false; - } + } } } else { // Compare full data with lowerKey - skipLowerKey = + skipLowerKey = ((lowerKey.key_length == node->btn_length) && (memcmp(node->btn_data, lowerKey.key_data, lowerKey.key_length) == 0)); } @@ -6851,20 +6851,20 @@ static bool scan(thread_db* tdbb, UCHAR* pointer, RecordBitmap** bitmap, RecordB if (node->btn_prefix < lowerKey.key_length) { skipLowerKey = false; } - else if ((node->btn_prefix == lowerKey.key_length) && node->btn_length) + else if ((node->btn_prefix == lowerKey.key_length) && node->btn_length) { - // In case of multi-segment check segment-number else + // In case of multi-segment check segment-number else // it's a different key - if (partLower) + if (partLower) { - const USHORT segnum = - idx->idx_count - (UCHAR)((idx->idx_flags & idx_descending) ? + const USHORT segnum = + idx->idx_count - (UCHAR)((idx->idx_flags & idx_descending) ? (*node->btn_data) ^ -1 : *node->btn_data); if (segnum < retrieval->irb_lower_count) { skipLowerKey = false; } - } + } else { skipLowerKey = false; } diff --git a/src/jrd/builtin.cpp b/src/jrd/builtin.cpp index 80b43aad3f..b3263e13d3 100644 --- a/src/jrd/builtin.cpp +++ b/src/jrd/builtin.cpp @@ -2,7 +2,7 @@ * PROGRAM: InterBase Access Method * MODULE: builtin.cpp * DESCRIPTION: Entry points for builtin UDF library - * + * * * The contents of this file are subject to the Interbase Public * License Version 1.0 (the "License"); you may not use this file @@ -38,8 +38,8 @@ struct FN { static const FN isc_builtin_functions[] = { /* Internal functions available for QA testing only */ -/* "DEBUG_CRASH_TESTS", "TEST1", QATEST_entrypoint, - +/* "DEBUG_CRASH_TESTS", "TEST1", QATEST_entrypoint, + and so shall it be, *NEVER* include this in a production build removed this ugly security hole FSG 18.Dez.2000 diff --git a/src/jrd/cch.cpp b/src/jrd/cch.cpp index ae0578e73c..980221227a 100644 --- a/src/jrd/cch.cpp +++ b/src/jrd/cch.cpp @@ -144,7 +144,7 @@ static void clear_page_dirty_flag(thread_db*, BufferDesc*); static inline void insertDirty(BufferControl* bcb, BufferDesc* bdb) { - if (bdb->bdb_dirty.que_forward == &bdb->bdb_dirty) + if (bdb->bdb_dirty.que_forward == &bdb->bdb_dirty) { bcb->bcb_dirty_count++; QUE_INSERT(bcb->bcb_dirty, bdb->bdb_dirty); @@ -153,7 +153,7 @@ static inline void insertDirty(BufferControl* bcb, BufferDesc* bdb) static inline void removeDirty(BufferControl* bcb, BufferDesc* bdb) { - if (bdb->bdb_dirty.que_forward != &bdb->bdb_dirty) + if (bdb->bdb_dirty.que_forward != &bdb->bdb_dirty) { fb_assert(bcb->bcb_dirty_count > 0); @@ -226,7 +226,7 @@ static inline SharedLatch* allocSharedLatch(thread_db* tdbb, BufferDesc* bdb) latch->slt_tdbb = tdbb; QUE_APPEND(tdbb->tdbb_latches, latch->slt_tdbb_que); - + return latch; } @@ -244,7 +244,7 @@ static inline void freeSharedLatch(thread_db* tdbb, BufferControl* bcb, SharedLa static inline SharedLatch* findSharedLatch(thread_db* tdbb, BufferDesc* bdb) { - for (QUE que_inst = tdbb->tdbb_latches.que_forward; que_inst != &tdbb->tdbb_latches; + for (QUE que_inst = tdbb->tdbb_latches.que_forward; que_inst != &tdbb->tdbb_latches; que_inst = que_inst->que_forward) { SharedLatch* latch = BLOCK(que_inst, SharedLatch*, slt_tdbb_que); @@ -261,11 +261,11 @@ static inline SharedLatch* findSharedLatch(thread_db* tdbb, BufferDesc* bdb) //#define BCB_MUTEX_ACQUIRE //#define BCB_MUTEX_RELEASE // -//#define PRE_MUTEX_ACQUIRE -//#define PRE_MUTEX_RELEASE +//#define PRE_MUTEX_ACQUIRE +//#define PRE_MUTEX_RELEASE // -//#define BTC_MUTEX_ACQUIRE -//#define BTC_MUTEX_RELEASE +//#define BTC_MUTEX_ACQUIRE +//#define BTC_MUTEX_RELEASE // //#define LATCH_MUTEX_ACQUIRE //#define LATCH_MUTEX_RELEASE @@ -776,13 +776,13 @@ pag* CCH_fetch( SET_TDBB(tdbb); Database* dbb = tdbb->getDatabase(); - if (window->win_page == HEADER_PAGE_NUMBER) + if (window->win_page == HEADER_PAGE_NUMBER) dbb->dbb_backup_manager->lock_shared_database(tdbb, true); - + CCH_TRACE(("FETCH PAGE=%d", window->win_page)); // FETCH_LOCK will return 0, 1, -1 or -2 - + const SSHORT fetch_lock_return = CCH_FETCH_LOCK(tdbb, window, lock_type, latch_wait, page_type); @@ -830,7 +830,7 @@ pag* CCH_fetch( } else { bdb->bdb_scan_count = 0; - if (bdb->bdb_flags & BDB_garbage_collect) { + if (bdb->bdb_flags & BDB_garbage_collect) { bdb->bdb_flags &= ~BDB_garbage_collect; } } @@ -865,11 +865,11 @@ SSHORT CCH_fetch_lock( * * input * - * wait: - * LCK_WAIT (1) => Wait as long a necessary to get the lock. + * wait: + * LCK_WAIT (1) => Wait as long a necessary to get the lock. * This can cause deadlocks of course. * - * LCK_NO_WAIT (0) => + * LCK_NO_WAIT (0) => * If the latch can't be acquired immediately, give up and return -2. * If the lock can't be acquired immediately, give up and return -1. * @@ -901,7 +901,7 @@ SSHORT CCH_fetch_lock( return -2; /* latch timeout */ } - if (lock_type >= LCK_write) + if (lock_type >= LCK_write) { bdb->bdb_flags |= BDB_writer; } @@ -953,7 +953,7 @@ void CCH_fetch_page( ++dbb->dbb_reads; tdbb->bumpStats(RuntimeStatistics::PAGE_READS); page = bdb->bdb_buffer; - PageSpace* pageSpace = + PageSpace* pageSpace = dbb->dbb_page_manager.findPageSpace(bdb->bdb_page.getPageSpaceID()); fb_assert(pageSpace); jrd_file* file = pageSpace->file; @@ -977,7 +977,7 @@ void CCH_fetch_page( to rollover to the shadow file. If the I/O error is persistant (more than 3 times) error out of the routine by calling CCH_unwind, and eventually punting out. */ - + { // scope BackupManager::SharedDatabaseHolder sdbHolder(tdbb, dbb->dbb_backup_manager); @@ -995,7 +995,7 @@ void CCH_fetch_page( // In merge mode, if we are reading past beyond old end of file and page is in .delta file // then we maintain actual page in difference file. Always read it from there. - if (isTempPage || bak_state == nbak_state_normal || !diff_page) + if (isTempPage || bak_state == nbak_state_normal || !diff_page) { NBAK_TRACE(("Reading page %d, state=%d, diff page=%d from DISK", bdb->bdb_page, bak_state, diff_page)); @@ -1024,7 +1024,7 @@ void CCH_fetch_page( } else { - NBAK_TRACE(("Reading page %d, state=%d, diff page=%d from DIFFERENCE", + NBAK_TRACE(("Reading page %d, state=%d, diff page=%d from DIFFERENCE", bdb->bdb_page, bak_state, diff_page)); if (!dbb->dbb_backup_manager->read_difference(tdbb, diff_page, page)) { PAGE_LOCK_RELEASE(bdb->bdb_lock); @@ -1032,9 +1032,9 @@ void CCH_fetch_page( } if (page->pag_type == pag_undefined) { // Page was marked as allocated inside the difference file, but not really used - // this is very rare, but possible case (after certain errors). + // this is very rare, but possible case (after certain errors). // Read (or re-read) page from database - NBAK_TRACE(("Re-reading page %d, state=%d, diff page=%d from DISK", + NBAK_TRACE(("Re-reading page %d, state=%d, diff page=%d from DISK", bdb->bdb_page, bak_state, diff_page)); while (!PIO_read(file, bdb, page, status)) { if (!read_shadow) { @@ -1099,7 +1099,7 @@ void CCH_forget_page(thread_db* tdbb, WIN * window) Database* dbb = tdbb->getDatabase(); if (window->win_page != bdb->bdb_page || - bdb->bdb_buffer->pag_type != pag_undefined) + bdb->bdb_buffer->pag_type != pag_undefined) { // buffer was reassigned or page was reused return; @@ -1147,7 +1147,7 @@ void CCH_fini(thread_db* tdbb) SET_TDBB(tdbb); Database* dbb = tdbb->getDatabase(); bool flush_error = false; - + // CVC: Patching a conversion error FB1->FB2 with crude logic for (int i = 0; i < 2; ++i) { @@ -1221,15 +1221,15 @@ void CCH_fini(thread_db* tdbb) dbb->dbb_page_manager.closeAll(); SDW_close(); - if ( (bcb = dbb->dbb_bcb) ) + if ( (bcb = dbb->dbb_bcb) ) { - while (bcb->bcb_memory.hasData()) + while (bcb->bcb_memory.hasData()) { dbb->dbb_bufferpool->deallocate(bcb->bcb_memory.pop()); } #ifdef CACHE_WRITER /* Dispose off any associated latching semaphores */ - while (QUE_NOT_EMPTY(bcb->bcb_free_lwt)) + while (QUE_NOT_EMPTY(bcb->bcb_free_lwt)) { QUE que_inst = bcb->bcb_free_lwt.que_forward; QUE_DELETE(*que_inst); @@ -1249,7 +1249,7 @@ void CCH_fini(thread_db* tdbb) ERR_punt(); } } - + if (!flush_error) { // wasn't set in the catch => no failure, just exit break; } @@ -1329,10 +1329,10 @@ void CCH_flush(thread_db* tdbb, USHORT flush_flag, SLONG tra_number) } if (latch_bdb(tdbb, latch, bdb, bdb->bdb_page, 1) == -1) { - BUGCHECK(302); // msg 302 unexpected page change + BUGCHECK(302); // msg 302 unexpected page change } if (bdb->bdb_use_count > 1) - BUGCHECK(210); // msg 210 page in use during flush + BUGCHECK(210); // msg 210 page in use during flush #ifdef SUPERSERVER if (bdb->bdb_flags & BDB_db_dirty) { if (all_flag @@ -1364,7 +1364,7 @@ void CCH_flush(thread_db* tdbb, USHORT flush_flag, SLONG tra_number) #endif // DIRTY_TREE } - // + // // Check if flush needed // const int max_unflushed_writes = Config::getMaxUnflushedWrites(); @@ -1390,7 +1390,7 @@ void CCH_flush(thread_db* tdbb, USHORT flush_flag, SLONG tra_number) } // test max_num condition and max_time condition - max_num = max_num + max_num = max_num && (dbb->unflushed_writes == max_unflushed_writes); max_time = max_time && (now - dbb->last_flushed_write > max_unflushed_write_time); @@ -1444,7 +1444,7 @@ void CCH_flush_ast(thread_db* tdbb) #ifdef SUPERSERVER CCH_flush(tdbb, FLUSH_ALL, 0); -#else +#else // Do some fancy footwork to make sure that pages are // not removed from the btc tree at AST level. Then // restore the flag to whatever it was before. @@ -1656,7 +1656,7 @@ void CCH_init(thread_db* tdbb, ULONG number) **************************************/ SET_TDBB(tdbb); Database* dbb = tdbb->getDatabase(); - + CCH_TRACE(("INIT %s", dbb->dbb_filename.c_str())); // Check for database-specific page buffers @@ -1892,7 +1892,7 @@ void CCH_must_write(WIN * window) void CCH_precedence(thread_db* tdbb, WIN * window, SLONG pageNum) { - const USHORT pageSpaceID = pageNum > LOG_PAGE ? + const USHORT pageSpaceID = pageNum > LOG_PAGE ? window->win_page.getPageSpaceID() : DB_PAGE_SPACE; CCH_precedence(tdbb, window, PageNumber(pageSpaceID, pageNum)); @@ -1927,7 +1927,7 @@ void CCH_precedence(thread_db* tdbb, WIN * window, PageNumber page) return; } - // no need to support precedence for temporary pages + // no need to support precedence for temporary pages if (page.isTemporary() || window->win_page.isTemporary()) { return; } @@ -2034,7 +2034,7 @@ void set_diff_page(thread_db* tdbb, BufferDesc* bdb) return; // Temporary pages don't write to delta - PageSpace* pageSpace = + PageSpace* pageSpace = dbb->dbb_page_manager.findPageSpace(bdb->bdb_page.getPageSpaceID()); fb_assert(pageSpace); if (pageSpace->isTemporary()) @@ -2053,11 +2053,11 @@ void set_diff_page(thread_db* tdbb, BufferDesc* bdb) invalidate_and_release_buffer(tdbb, bdb); CCH_unwind(tdbb, true); } - NBAK_TRACE(("Allocate difference page %d for database page %d", + NBAK_TRACE(("Allocate difference page %d for database page %d", bdb->bdb_difference_page, bdb->bdb_page)); } else { - NBAK_TRACE(("Map existing difference page %d to database page %d", + NBAK_TRACE(("Map existing difference page %d to database page %d", bdb->bdb_difference_page, bdb->bdb_page)); } break; @@ -2066,7 +2066,7 @@ void set_diff_page(thread_db* tdbb, BufferDesc* bdb) bdb->bdb_difference_page = dbb->dbb_backup_manager->get_page_index(tdbb, bdb->bdb_page.getPageNum()); dbb->dbb_backup_manager->unlock_alloc(tdbb); if (bdb->bdb_difference_page) { - NBAK_TRACE(("Map existing difference page %d to database page %d (write_both)", + NBAK_TRACE(("Map existing difference page %d to database page %d (write_both)", bdb->bdb_difference_page, bdb->bdb_page)); } break; @@ -2117,15 +2117,15 @@ void CCH_release(thread_db* tdbb, WIN * window, const bool release_tail) if (bdb->bdb_use_count == 1) { const bool marked = bdb->bdb_flags & BDB_marked; - bdb->bdb_flags &= ~(BDB_writer | BDB_marked | BDB_faked); + bdb->bdb_flags &= ~(BDB_writer | BDB_marked | BDB_faked); - if (marked) + if (marked) { - if (bdb->bdb_flags & BDB_dirty) + if (bdb->bdb_flags & BDB_dirty) { fb_assert(bdb->bdb_backup_lock_owner == BackupManager::attachment_lock_handle(tdbb)); const SLONG database_lock_handle = BackupManager::database_lock_handle(tdbb); - dbb->dbb_backup_manager->change_dirty_page_owner(tdbb, + dbb->dbb_backup_manager->change_dirty_page_owner(tdbb, bdb->bdb_backup_lock_owner, database_lock_handle); bdb->bdb_backup_lock_owner = database_lock_handle; } @@ -2202,7 +2202,7 @@ void CCH_release(thread_db* tdbb, WIN * window, const bool release_tail) if (bdb->bdb_flags & (BDB_dirty | BDB_db_dirty)) { #ifdef DIRTY_LIST - if (bdb->bdb_dirty.que_forward != &bdb->bdb_dirty) + if (bdb->bdb_dirty.que_forward != &bdb->bdb_dirty) { QUE_DELETE(bdb->bdb_dirty); QUE_APPEND(bcb->bcb_dirty, bdb->bdb_dirty); @@ -2248,7 +2248,7 @@ void CCH_release_exclusive(thread_db* tdbb) * Release exclusive access to database. * **************************************/ - SET_TDBB(tdbb); + SET_TDBB(tdbb); Database* dbb = tdbb->getDatabase(); dbb->dbb_flags &= ~DBB_exclusive; @@ -2382,7 +2382,7 @@ void CCH_unwind(thread_db* tdbb, const bool punt) release_bdb(tdbb, bdb, true, false, false); } - // hvlad : as far as I understand thread can't hold more than two shared latches + // hvlad : as far as I understand thread can't hold more than two shared latches // on the same bdb, so findSharedLatch below will not be called many times SharedLatch* latch = findSharedLatch(tdbb, bdb); while (latch) @@ -2731,7 +2731,7 @@ static int cmpBdbs(const void* a, const void* b) } -// Remove cleared precedence blocks from high precedence queue +// Remove cleared precedence blocks from high precedence queue static void purgePrecedence(BufferControl* bcb, BufferDesc* bdb) { QUE que_prec = bdb->bdb_higher.que_forward, next_prec; @@ -2740,7 +2740,7 @@ static void purgePrecedence(BufferControl* bcb, BufferDesc* bdb) next_prec = que_prec->que_forward; Precedence* precedence = BLOCK(que_prec, Precedence*, pre_higher); - if (precedence->pre_flags & PRE_cleared) + if (precedence->pre_flags & PRE_cleared) { QUE_DELETE(precedence->pre_higher); QUE_DELETE(precedence->pre_lower); @@ -2751,11 +2751,11 @@ static void purgePrecedence(BufferControl* bcb, BufferDesc* bdb) } // Write pages modified by given or system transaction to disk. First sort all -// corresponding pages by their numbers to make writes physically ordered and +// corresponding pages by their numbers to make writes physically ordered and // thus faster. At every iteration of while loop write pages which have no high -// precedence pages to ensure order preserved. If after some iteration there are -// no such pages (i.e. all of not written yet pages have high precedence pages) -// then write them all at last iteration (of course write_buffer will also check +// precedence pages to ensure order preserved. If after some iteration there are +// no such pages (i.e. all of not written yet pages have high precedence pages) +// then write them all at last iteration (of course write_buffer will also check // for precedence before write) static void flushDirty(thread_db* tdbb, SLONG transaction_mask, @@ -2784,7 +2784,7 @@ static void flushDirty(thread_db* tdbb, flush.add(bdb); } } - + qsort(flush.begin(), flush.getCount(), sizeof(BufferDesc*), cmpBdbs); bool writeAll = false; @@ -2808,7 +2808,7 @@ static void flushDirty(thread_db* tdbb, CCH_unwind(tdbb, true); } - // re-post the lock only if it was really written + // re-post the lock only if it was really written if ((bdb->bdb_ast_flags & BDB_blocking) && !(bdb->bdb_flags & BDB_dirty)) { @@ -2842,12 +2842,12 @@ static void flushAll(thread_db* tdbb, USHORT flush_flag) const bool sweep_flag = (flush_flag & FLUSH_SWEEP) != 0; LATCH latch = (release_flag) ? LATCH_exclusive : LATCH_none; - for (ULONG i = 0; (bcb = dbb->dbb_bcb) && i < bcb->bcb_count; i++) + for (ULONG i = 0; (bcb = dbb->dbb_bcb) && i < bcb->bcb_count; i++) { BufferDesc* bdb = bcb->bcb_rpt[i].bcb_bdb; #ifdef SUPERSERVER - if (bdb->bdb_flags & BDB_db_dirty) + if (bdb->bdb_flags & BDB_db_dirty) { // pages modified by sweep\garbage collector are not in dirty list const bool dirty_list = (bdb->bdb_dirty.que_forward != &bdb->bdb_dirty); @@ -2893,20 +2893,20 @@ static void flushAll(thread_db* tdbb, USHORT flush_flag) if (release_flag) { if (latch_bdb(tdbb, latch, bdb, bdb->bdb_page, 1) == -1) { - BUGCHECK(302); // msg 302 unexpected page change + BUGCHECK(302); // msg 302 unexpected page change } if (bdb->bdb_use_count > 1) { - BUGCHECK(210); // msg 210 page in use during flush + BUGCHECK(210); // msg 210 page in use during flush } } - if (bdb->bdb_flags & (BDB_db_dirty | BDB_dirty)) + if (bdb->bdb_flags & (BDB_db_dirty | BDB_dirty)) { if (!write_buffer(tdbb, bdb, bdb->bdb_page, write_thru, status, true)) { CCH_unwind(tdbb, true); } } - if (release_flag) + if (release_flag) { PAGE_LOCK_RELEASE(bdb->bdb_lock); release_bdb(tdbb, bdb, false, false, false); @@ -2950,7 +2950,7 @@ static void btc_flush(thread_db* tdbb, this simplifies worrying about random pages dropping out when dependencies have been set up */ - PageNumber max_seen = MIN_PAGE_NUMBER; + PageNumber max_seen = MIN_PAGE_NUMBER; /* Pick starting place at leftmost node */ @@ -3119,7 +3119,7 @@ static void btc_insert_balanced(Database* dbb, BufferDesc* bdb) { comp = -1; } - + if (comp == 0) { // BTC_MUTEX_RELEASE; @@ -3273,14 +3273,14 @@ static bool btc_insert_balance(BufferDesc** bdb, bool subtree, SSHORT comp) else { p1 = p->bdb_left; - + if (p1->bdb_balance == comp) { if ( (p->bdb_left = p1->bdb_right) ) { p1->bdb_right->bdb_parent = p; } - + p1->bdb_right = p; p1->bdb_parent = p->bdb_parent; p->bdb_parent = p1; @@ -3474,7 +3474,7 @@ static void btc_remove_balanced(BufferDesc* bdb) { comp = -1; } - + stackp++; fb_assert(stackp >= 0 && stackp < BTREE_STACK_SIZE); @@ -3487,7 +3487,7 @@ static void btc_remove_balanced(BufferDesc* bdb) stack[stackp].bdb_node = p; stack[stackp].comp = comp; - + p = (comp > 0) ? p->bdb_right : p->bdb_left; // node not found, bad tree @@ -3530,7 +3530,7 @@ static void btc_remove_balanced(BufferDesc* bdb) { stack[stackp].bdb_node->bdb_left = p; } - + if (p) { p->bdb_parent = stack[stackp].bdb_node; @@ -3575,7 +3575,7 @@ static void btc_remove_balanced(BufferDesc* bdb) } else { - const int stackp_save = stackp; + const int stackp_save = stackp; while (p->bdb_right) { @@ -3723,7 +3723,7 @@ static bool btc_remove_balance(BufferDesc** bdb, bool subtree, SSHORT comp) { // double RL or LR rotation - p2 = p1->bdb_left; + p2 = p1->bdb_left; const SSHORT b2 = p2->bdb_balance; if ( (p1->bdb_left = p2->bdb_right) ) @@ -3731,7 +3731,7 @@ static bool btc_remove_balance(BufferDesc** bdb, bool subtree, SSHORT comp) p2->bdb_right->bdb_parent = p1; } - p2->bdb_right = p1; + p2->bdb_right = p1; p1->bdb_parent = p2; if ( (p->bdb_right = p2->bdb_left) ) @@ -3740,7 +3740,7 @@ static bool btc_remove_balance(BufferDesc** bdb, bool subtree, SSHORT comp) } p2->bdb_left = p; - p2->bdb_parent = p->bdb_parent; + p2->bdb_parent = p->bdb_parent; p->bdb_parent = p2; if (b2 == -comp) @@ -3780,7 +3780,7 @@ static bool btc_remove_balance(BufferDesc** bdb, bool subtree, SSHORT comp) } p1->bdb_right = p; - p1->bdb_parent = p->bdb_parent; + p1->bdb_parent = p->bdb_parent; p->bdb_parent = p1; if (b1 == 0) @@ -3817,11 +3817,11 @@ static bool btc_remove_balance(BufferDesc** bdb, bool subtree, SSHORT comp) p2->bdb_right->bdb_parent = p; } - p2->bdb_right = p; + p2->bdb_right = p; p2->bdb_parent = p->bdb_parent; p->bdb_parent = p2; - if (b2 == -comp) + if (b2 == -comp) { p->bdb_balance = comp; } @@ -3970,7 +3970,7 @@ static THREAD_ENTRY_DECLARE cache_reader(THREAD_ENTRY_PARAM arg) /* This try block is specifically to protect the LCK_init call: if LCK_init fails we won't be able to accomplish anything anyway, so return, unlike the other try blocks further down the page. */ - + BufferControl* bcb = 0; try { @@ -4014,7 +4014,7 @@ static THREAD_ENTRY_DECLARE cache_reader(THREAD_ENTRY_PARAM arg) do { if (!(prefetch1.prf_flags & PRF_active) && - SBM_next(bcb->bcb_prefetch, &starting_page, RSE_get_forward)) + SBM_next(bcb->bcb_prefetch, &starting_page, RSE_get_forward)) { found = true; prefetch_prologue(&prefetch1, &starting_page); @@ -4022,7 +4022,7 @@ static THREAD_ENTRY_DECLARE cache_reader(THREAD_ENTRY_PARAM arg) } if (!(prefetch2.prf_flags & PRF_active) && - SBM_next(bcb->bcb_prefetch, &starting_page, RSE_get_forward)) + SBM_next(bcb->bcb_prefetch, &starting_page, RSE_get_forward)) { found = true; prefetch_prologue(&prefetch2, &starting_page); @@ -4163,7 +4163,7 @@ static THREAD_ENTRY_DECLARE cache_writer(THREAD_ENTRY_PARAM arg) bcb = dbb->dbb_bcb; continue; } - + #ifdef SUPERSERVER_V2 /* Flush buffers for lazy commit */ SLONG commit_mask; @@ -4279,8 +4279,8 @@ static void check_precedence(thread_db* tdbb, WIN * window, PageNumber page) /* If this is really a transaction id, sort things out */ - if ((page.getPageSpaceID() == DB_PAGE_SPACE) && - (page.getPageNum() < 0)) + if ((page.getPageSpaceID() == DB_PAGE_SPACE) && + (page.getPageNum() < 0)) { if (-page.getPageNum() <= dbb->dbb_last_header_write) { return; @@ -4639,7 +4639,7 @@ static void expand_buffers(thread_db* tdbb, ULONG number) const bcb_repeat* const old_end = old->bcb_rpt + old->bcb_count; BufferControl* new_block = - FB_NEW_RPT(*dbb->dbb_bufferpool, number) + FB_NEW_RPT(*dbb->dbb_bufferpool, number) BufferControl(*dbb->dbb_bufferpool); new_block->bcb_count = number; new_block->bcb_free_minimum = (SSHORT) MIN(number / 4, 128); /* 25% clean page reserve */ @@ -4784,7 +4784,7 @@ static BufferDesc* get_buffer(thread_db* tdbb, const PageNumber page, LATCH latc QUE mod_que = &bcb->bcb_rpt[page.getPageNum() % bcb->bcb_count].bcb_page_mod; for (que_inst = mod_que->que_forward; que_inst != mod_que; - que_inst = que_inst->que_forward) + que_inst = que_inst->que_forward) { BufferDesc* bdb = BLOCK(que_inst, BufferDesc*, bdb_que); if (bdb->bdb_page == page) { @@ -5442,7 +5442,7 @@ static SSHORT lock_buffer( /* Case: a timeout was specified, or the caller didn't want to wait, return the error. */ - if ((wait < 0) && (status[1] == isc_lock_timeout)) + if ((wait < 0) && (status[1] == isc_lock_timeout)) { release_bdb(tdbb, bdb, false, false, false); return -1; @@ -5498,7 +5498,7 @@ static ULONG memory_init(thread_db* tdbb, BufferControl* bcb, SLONG number) memory_size = page_size * (number + 1); } - while (true) + while (true) { try { memory = (UCHAR*) dbb->dbb_bufferpool->allocate(memory_size); @@ -5591,8 +5591,8 @@ static void page_validation_error(thread_db* tdbb, WIN * window, SSHORT type) ERR_build_status(tdbb->tdbb_status_vector, Arg::Gds(isc_db_corrupt) << Arg::Str(pages->file->fil_string) << Arg::Gds(isc_page_type_err) << - Arg::Gds(isc_badpagtyp) << Arg::Num(bdb->bdb_page.getPageNum()) << - Arg::Num(type) << + Arg::Gds(isc_badpagtyp) << Arg::Num(bdb->bdb_page.getPageNum()) << + Arg::Num(type) << Arg::Num(page->pag_type)); /* We should invalidate this bad buffer. */ CCH_unwind(tdbb, true); @@ -5883,7 +5883,7 @@ static void release_bdb(thread_db* tdbb, --bdb->bdb_use_count; if (!bdb->bdb_use_count) { /* All latches are released */ bdb->bdb_exclusive = bdb->bdb_io = 0; - while (QUE_NOT_EMPTY(bdb->bdb_shared)) + while (QUE_NOT_EMPTY(bdb->bdb_shared)) { SharedLatch* latch = BLOCK(bdb->bdb_shared.que_forward, SharedLatch*, slt_bdb_que); freeSharedLatch(tdbb, bdb->bdb_dbb->dbb_bcb, latch); @@ -5979,7 +5979,7 @@ static void release_bdb(thread_db* tdbb, case LATCH_shared: if (bdb->bdb_exclusive) { break; /* defensive programming */ - + /* correct programming LATCH_MUTEX_RELEASE; return; */ @@ -6038,7 +6038,7 @@ static void unmark(thread_db* tdbb, WIN * window) fb_assert(bdb->bdb_backup_lock_owner == BackupManager::attachment_lock_handle(tdbb)); const SLONG database_lock_handle = BackupManager::database_lock_handle(tdbb); - tdbb->getDatabase()->dbb_backup_manager->change_dirty_page_owner(tdbb, + tdbb->getDatabase()->dbb_backup_manager->change_dirty_page_owner(tdbb, bdb->bdb_backup_lock_owner, database_lock_handle); bdb->bdb_backup_lock_owner = database_lock_handle; release_bdb(tdbb, bdb, false, false, true); @@ -6059,7 +6059,7 @@ static inline bool writeable(BufferDesc* bdb) * See if a buffer is writeable. A buffer is writeable if * neither it nor any of it's higher precedence cousins are * marked for write. - * This is the starting point of recursive walk of precedence + * This is the starting point of recursive walk of precedence * graph. The writeable_mark member is used to mark already seen * buffers to avoid repeated walk of the same sub-graph. * Currently this function can't be called from more than one @@ -6100,7 +6100,7 @@ static bool is_writeable(BufferDesc* bdb, const ULONG mark) * **************************************/ - // If there are buffers that must be written first, check them, too. + // If there are buffers that must be written first, check them, too. for (const que* queue = bdb->bdb_higher.que_forward; queue != &bdb->bdb_higher; queue = queue->que_forward) @@ -6110,12 +6110,12 @@ static bool is_writeable(BufferDesc* bdb, const ULONG mark) if (!(precedence->pre_flags & PRE_cleared)) { BufferDesc* high = precedence->pre_hi; - + if (high->bdb_flags & BDB_marked) { return false; } - if (high->bdb_writeable_mark != mark) + if (high->bdb_writeable_mark != mark) { if (QUE_EMPTY(high->bdb_higher)) high->bdb_writeable_mark = mark; @@ -6355,7 +6355,7 @@ static bool write_page( gds__trace(buffer); #endif - PageSpace* pageSpace = + PageSpace* pageSpace = dbb->dbb_page_manager.findPageSpace(bdb->bdb_page.getPageSpaceID()); fb_assert(pageSpace); const bool isTempPage = pageSpace->isTemporary(); @@ -6364,18 +6364,18 @@ static bool write_page( (backup_state == nbak_state_merge && bdb->bdb_difference_page))) { - const bool res = - dbb->dbb_backup_manager->write_difference(status, + const bool res = + dbb->dbb_backup_manager->write_difference(status, bdb->bdb_difference_page, bdb->bdb_buffer); - if (!res) + if (!res) { bdb->bdb_flags |= BDB_io_error; dbb->dbb_flags |= DBB_suspend_bgio; return false; } } - if (!isTempPage && backup_state == nbak_state_stalled) { + if (!isTempPage && backup_state == nbak_state_stalled) { // We finished. Adjust transaction accounting and get ready for exit if (bdb->bdb_page == HEADER_PAGE_NUMBER) { dbb->dbb_last_header_write = @@ -6448,8 +6448,8 @@ static bool write_page( } #endif - fb_assert(bdb->bdb_flags & BDB_dirty ? - bdb->bdb_backup_lock_owner == BackupManager::database_lock_handle(tdbb) : + fb_assert(bdb->bdb_flags & BDB_dirty ? + bdb->bdb_backup_lock_owner == BackupManager::database_lock_handle(tdbb) : true); clear_page_dirty_flag(tdbb, bdb); diff --git a/src/jrd/cvt.cpp b/src/jrd/cvt.cpp index 1712435612..b833622f8b 100644 --- a/src/jrd/cvt.cpp +++ b/src/jrd/cvt.cpp @@ -107,7 +107,7 @@ double CVT_date_to_double(const dsc* desc) * * Functional description * Convert a date to double precision for - * date arithmetic routines. + * date arithmetic routines. * **************************************/ SLONG temp[2], *date; @@ -206,7 +206,7 @@ UCHAR CVT_get_numeric(const UCHAR* string, * dtype_int64, or dtype_long depending on the conversion performed. * The binary value (long, int64, or double) is stored at the * address given by ptr. - * + * * **************************************/ dsc desc; @@ -477,6 +477,6 @@ static void isVersion4(bool& v4) namespace Jrd { - Callbacks toEngine = {transliterate, getChid, ERR_post, getToCharset, + Callbacks toEngine = {transliterate, getChid, ERR_post, getToCharset, validateData, validateLength, getCurDate, isVersion4}; } diff --git a/src/jrd/cvt2.cpp b/src/jrd/cvt2.cpp index e85cc9eaa7..c4f6b5b109 100644 --- a/src/jrd/cvt2.cpp +++ b/src/jrd/cvt2.cpp @@ -259,7 +259,7 @@ SSHORT CVT2_compare(const dsc* arg1, const dsc* arg2) return 0; } - + if (length) { do @@ -607,7 +607,7 @@ void CVT2_get_name(const dsc* desc, TEXT* string) const char* p; const USHORT length = CVT_make_string(desc, ttype_metadata, &p, (vary*) &temp, sizeof(temp), ERR_post); - + memcpy(string, p, length); string[length] = 0; fb_utils::exact_name(string); diff --git a/src/jrd/db_alias.cpp b/src/jrd/db_alias.cpp index a987a088a8..d253a6adbe 100644 --- a/src/jrd/db_alias.cpp +++ b/src/jrd/db_alias.cpp @@ -52,7 +52,7 @@ bool ResolveDatabaseAlias(const string& alias, string& database) string corrected_alias = alias; replace_dir_sep(corrected_alias); - + database = aliasConfig.getString(corrected_alias); if (!database.empty()) @@ -60,7 +60,7 @@ bool ResolveDatabaseAlias(const string& alias, string& database) replace_dir_sep(database); if (PathUtils::isRelative(database)) { gds__log("Value %s configured for alias %s " - "is not a fully qualified path name, ignored", + "is not a fully qualified path name, ignored", database.c_str(), alias.c_str()); return false; } diff --git a/src/jrd/dbg.cpp b/src/jrd/dbg.cpp index fbcc885790..8764bb918c 100644 --- a/src/jrd/dbg.cpp +++ b/src/jrd/dbg.cpp @@ -186,7 +186,7 @@ int DBG_analyze(int pool_id) if (!dbb || !dbb->dbb_pools.getCount()) return TRUE; - + Database::pool_vec_type* vector = &dbb->dbb_pools; for (p = blocks, end = p + (int) type_MAX; p < end; p++) { @@ -816,7 +816,7 @@ int DBG_pretty(const jrd_nod* node, int column) case nod_relation: relation = (jrd_rel*) node->nod_arg[e_rel_relation]; fprintf(dbg_file, ", stream: %d, %s (%X)\n", - node->nod_arg[e_rel_stream], + node->nod_arg[e_rel_stream], relation->rel_name.c_str(), relation); return TRUE; @@ -1116,7 +1116,7 @@ static void prt_dsc(DSC * desc, int column) { /************************************** * - * p r t _ d s c + * p r t _ d s c * ************************************** * diff --git a/src/jrd/dbt.cpp b/src/jrd/dbt.cpp index d2a5921a27..4c434dde79 100644 --- a/src/jrd/dbt.cpp +++ b/src/jrd/dbt.cpp @@ -25,7 +25,7 @@ #include #include "../jrd/ibase.h" // Those includes until the END comment comes from everything.h and was moved -// here when the file was removed. +// here when the file was removed. // Most probably only a few of the includes are needed #include "../jrd/common.h" #include "../jrd/isc.h" diff --git a/src/jrd/divorce.cpp b/src/jrd/divorce.cpp index 0784ed6c55..1ecab155f7 100644 --- a/src/jrd/divorce.cpp +++ b/src/jrd/divorce.cpp @@ -19,7 +19,7 @@ * 13379 katz 16-OCT-1993 * Move away from C language datatypes * -* 0 katz 7-JUN-1993 +* 0 katz 7-JUN-1993 * history begins * * The contents of this file are subject to the Interbase Public diff --git a/src/jrd/dmp.cpp b/src/jrd/dmp.cpp index f500012fbd..c5aeb65f3f 100644 --- a/src/jrd/dmp.cpp +++ b/src/jrd/dmp.cpp @@ -660,7 +660,7 @@ static void dmp_header(const header_page* page) fprintf(dbg_file, "HEADER PAGE\t checksum %d\t generation %ld\n\tPage size: %d, version: %d.%d(%d), pages: %ld\n", ((PAG) page)->pag_checksum, ((PAG) page)->pag_generation, - page->hdr_page_size, page->hdr_ods_version & ~ODS_FIREBIRD_FLAG, + page->hdr_page_size, page->hdr_ods_version & ~ODS_FIREBIRD_FLAG, minor_version, page->hdr_ods_minor_original, page->hdr_PAGES); const Firebird::TimeStamp ts(*((GDS_TIMESTAMP *) page->hdr_creation_date)); @@ -992,7 +992,7 @@ static void dmp_transactions(const tx_inv_page* page, ULONG sequence) { /************************************** * - * d m p _ t r a n s a c t i o n + * d m p _ t r a n s a c t i o n * ************************************** * diff --git a/src/jrd/dsc.cpp b/src/jrd/dsc.cpp index 79be2adba8..de5b5c41a1 100644 --- a/src/jrd/dsc.cpp +++ b/src/jrd/dsc.cpp @@ -890,7 +890,7 @@ int DSC_string_length(const dsc* desc) * * Functional description * Estimate length of string (in bytes) based on descriptor. - * Estimated length assumes representing string in + * Estimated length assumes representing string in * narrow-char ASCII format. * * Note that this strips off the short at the @@ -924,8 +924,8 @@ const TEXT *DSC_dtype_tostring(UCHAR dtype) ************************************** * * Functional description - * Convert a datatype to its textual representation - * + * Convert a datatype to its textual representation + * **************************************/ if (dtype < FB_NELEM(DSC_dtype_names)) return DSC_dtype_names[dtype]; @@ -943,8 +943,8 @@ void DSC_get_dtype_name(const dsc* desc, TEXT * buffer, USHORT len) ************************************** * * Functional description - * Convert a datatype to its textual representation - * + * Convert a datatype to its textual representation + * **************************************/ // This function didn't put a string terminator even though // it's calling strncpy that doesn't put it if source > target. @@ -992,7 +992,7 @@ static bool validate_dsc_tables() * server memory. If you uncomment the printf's and build a * kit, make sure that you run that server with the -d flag * so it won't detach from its controlling terminal. - * + * **************************************/ for (BYTE op1 = dtype_unknown; op1 < DTYPE_TYPE_MAX; op1++) { for (BYTE op2 = dtype_unknown; op2 < DTYPE_TYPE_MAX; op2++) { diff --git a/src/jrd/enc.cpp b/src/jrd/enc.cpp index 7b59ba6339..0e4ab28acf 100644 --- a/src/jrd/enc.cpp +++ b/src/jrd/enc.cpp @@ -435,7 +435,7 @@ static C_block constdatablock; /* encryption constant */ const static size_t RESULT_SIZE = (1 + 4 + 4 + 11 + 1); #define _PASSWORD_EFMT1 '#' /* - * Create data consisting of the "setting" followed by + * Create data consisting of the "setting" followed by * an encryption produced by the "key" and "setting". */ void ENC_crypt(TEXT* buf, size_t bufSize, const TEXT* key, const TEXT* setting) @@ -655,7 +655,7 @@ int des_cipher(const char* in, char* out, SLONG salt, int num_iter) C_block *kp; int ks_inc; - + if (num_iter >= 0) { /* encryption */ kp = &KS[0]; ks_inc = sizeof(*kp); @@ -825,7 +825,7 @@ STATIC void init_des() * SPE table */ static unsigned char tmp32[32]; /* "static" for speed */ - + for (i = 0; i < 48; i++) perm[i] = P32Tr[ExpandTr[i] - 1]; for (int tableno = 0; tableno < 8; tableno++) { diff --git a/src/jrd/err.cpp b/src/jrd/err.cpp index 3f9a050d12..e0d599b8aa 100644 --- a/src/jrd/err.cpp +++ b/src/jrd/err.cpp @@ -55,7 +55,7 @@ using namespace Firebird; //#define JRD_FAILURE_UNKNOWN "" /* Used when buffer fails */ -static void internal_error(ISC_STATUS status, int number, +static void internal_error(ISC_STATUS status, int number, const TEXT* file = NULL, int line = 0); static void internal_post(const ISC_STATUS* status_vector); @@ -163,13 +163,13 @@ void ERR_duplicate_error(IDX_E code, break; case idx_e_foreign_target_doesnt_exist: - ERR_post(Arg::Gds(isc_foreign_key) << Arg::Str(constraint) << + ERR_post(Arg::Gds(isc_foreign_key) << Arg::Str(constraint) << Arg::Str(relation->rel_name) << Arg::Gds(isc_foreign_key_target_doesnt_exist)); break; case idx_e_foreign_references_present: - ERR_post(Arg::Gds(isc_foreign_key) << Arg::Str(constraint) << + ERR_post(Arg::Gds(isc_foreign_key) << Arg::Str(constraint) << Arg::Str(relation->rel_name) << Arg::Gds(isc_foreign_key_references_present)); break; @@ -177,7 +177,7 @@ void ERR_duplicate_error(IDX_E code, default: if (haveConstraint) { - ERR_post(Arg::Gds(isc_unique_key_violation) << Arg::Str(constraint) << + ERR_post(Arg::Gds(isc_unique_key_violation) << Arg::Str(constraint) << Arg::Str(relation->rel_name)); } else @@ -237,7 +237,7 @@ void ERR_log(int facility, int number, const TEXT* message) ************************************** * * Functional description - * Log a message to the firebird.log + * Log a message to the firebird.log * **************************************/ TEXT errmsg[MAX_ERRMSG_LEN + 1]; @@ -285,7 +285,7 @@ bool ERR_post_warning(const Arg::StatusVector& v) fb_utils::init_status(status_vector); indx = 2; } - else + else { /* find end of a status vector */ PARSE_STATUS(status_vector, indx, warning_indx); @@ -294,7 +294,7 @@ bool ERR_post_warning(const Arg::StatusVector& v) } /* stuff the warning */ - if (indx + v.length() + 1 < ISC_STATUS_LENGTH) + if (indx + v.length() + 1 < ISC_STATUS_LENGTH) { memcpy(&status_vector[indx], v.value(), sizeof(ISC_STATUS) * (v.length() + 1)); ERR_make_permanent(&status_vector[indx]); @@ -573,7 +573,7 @@ void ERR_build_status(ISC_STATUS* status_vector, const Arg::StatusVector& v) } -static void internal_error(ISC_STATUS status, int number, +static void internal_error(ISC_STATUS status, int number, const TEXT* file, int line) { /************************************** @@ -593,7 +593,7 @@ static void internal_error(ISC_STATUS status, int number, strcpy(errmsg, "Internal error code"); const size_t len = strlen(errmsg); - + if (file) { // Remove path information const TEXT* ptr = (TEXT*)file + strlen(file); diff --git a/src/jrd/event.cpp b/src/jrd/event.cpp index 79df7afe1c..139afa3e0f 100644 --- a/src/jrd/event.cpp +++ b/src/jrd/event.cpp @@ -277,7 +277,7 @@ EVH EVENT_init(ISC_STATUS* status_vector) if (!(EVENT_header = (EVH) ISC_map_file(status_vector, event_file, init, 0, Config::getEventMemSize(), - &EVENT_data))) + &EVENT_data))) { return NULL; } @@ -544,7 +544,7 @@ static FRB alloc_global(UCHAR type, ULONG length, bool recurse) SRQ_PTR* best = NULL; for (ptr = &EVENT_header->evh_free; (free = (FRB) SRQ_ABS_PTR(*ptr)) && *ptr; - ptr = &free->frb_next) + ptr = &free->frb_next) { const SLONG tail = free->frb_header.hdr_length - length; if (tail >= 0 && (!best || tail < best_tail)) { @@ -733,7 +733,7 @@ static void delete_process(SLONG process_offset) /* Terminate the event watcher thread */ /* When we come through the exit handler, the event semaphore might have already been released by another exit handler. So we cannot - use that semaphore to post the event. Besides, the watcher thread + use that semaphore to post the event. Besides, the watcher thread would be terminated anyway because the whole NLM is being unloaded. */ // CVC: NLM??? is this Novell Netware specific code??? diff --git a/src/jrd/evl_string_test.cpp b/src/jrd/evl_string_test.cpp index 666093c433..92874dcb69 100644 --- a/src/jrd/evl_string_test.cpp +++ b/src/jrd/evl_string_test.cpp @@ -41,7 +41,7 @@ using namespace Firebird; class StringLikeEvaluator : public LikeEvaluator { public: - StringLikeEvaluator(MemoryPool *pool, const char *pattern, char escape_char) : + StringLikeEvaluator(MemoryPool *pool, const char *pattern, char escape_char) : LikeEvaluator(*pool, pattern, (SSHORT)strlen(pattern), escape_char, '%', '_') {} void process(const char *data, bool more, bool result) { @@ -54,7 +54,7 @@ public: class StringStartsEvaluator : public StartsEvaluator { public: - StringStartsEvaluator(const char *pattern) : + StringStartsEvaluator(const char *pattern) : StartsEvaluator(pattern, (SSHORT)strlen(pattern)) {} void process(const char *data, bool more, bool result) { @@ -67,7 +67,7 @@ public: class StringContainsEvaluator : public ContainsEvaluator { public: - StringContainsEvaluator(MemoryPool *pool, const char *pattern) : + StringContainsEvaluator(MemoryPool *pool, const char *pattern) : ContainsEvaluator(*pool, pattern, (SSHORT)strlen(pattern)) {} void process(const char *data, bool more, bool result) { @@ -107,7 +107,7 @@ int main() { t4.reset(); t4.process("%_some text", true, false); t4.process(".", true, true); - + // More escaped patterns StringLikeEvaluator t5(p, "%sosome_\\%text%", '\\'); t5.process("sosomso", true, false); diff --git a/src/jrd/exe.cpp b/src/jrd/exe.cpp index 9b8410cfbb..ed075e4fbd 100644 --- a/src/jrd/exe.cpp +++ b/src/jrd/exe.cpp @@ -33,7 +33,7 @@ * exception handling in SPs/triggers, * implemented ROWS_AFFECTED system variable * - * 2002.10.21 Nickolay Samofatov: Added support for explicit pessimistic locks + * 2002.10.21 Nickolay Samofatov: Added support for explicit pessimistic locks * 2002.10.28 Sean Leyne - Code cleanup, removed obsolete "MPEXL" port * 2002.10.28 Sean Leyne - Code cleanup, removed obsolete "DecOSF" port * 2002.10.29 Nickolay Samofatov: Added support for savepoints @@ -240,8 +240,8 @@ const size_t MAX_STACK_TRACE = 2048; /* this constant defines how many records are locked before we check whether record locking has been - turned off for a given relation; if we set the - constant to a low number, we will do too much + turned off for a given relation; if we set the + constant to a low number, we will do too much locking in the case where record locking is always turned on; too high and we will do too much record locking in the case where someone is only occasionally @@ -328,7 +328,7 @@ void EXE_assignment(thread_db* tdbb, jrd_nod* to, dsc* from_desc, bool from_null case nod_variable: if (to->nod_arg[e_var_info]) { - EVL_validate(tdbb, + EVL_validate(tdbb, Item(nod_variable, (IPTR) to->nod_arg[e_var_id]), reinterpret_cast(to->nod_arg[e_var_info]), from_desc, null == -1); @@ -740,7 +740,7 @@ void EXE_receive(thread_db* tdbb, VIO_start_save_point(tdbb, transaction); } } - + try { @@ -764,7 +764,7 @@ void EXE_receive(thread_db* tdbb, ERR_post(Arg::Gds(isc_req_sync)); if (length != format->fmt_length) { - ERR_post(Arg::Gds(isc_port_len) << Arg::Num(length) << + ERR_post(Arg::Gds(isc_port_len) << Arg::Num(length) << Arg::Num(format->fmt_length)); } @@ -834,14 +834,14 @@ void EXE_seek(thread_db* tdbb, jrd_req* request, USHORT direction, ULONG offset) ************************************** * * Functional description - * Seek a given request in a particular direction - * for offset records. + * Seek a given request in a particular direction + * for offset records. * **************************************/ SET_TDBB(tdbb); DEV_BLKCHK(request, type_req); -/* loop through all RSEs in the request, +/* loop through all RSEs in the request, and describe the rsb tree for that rsb; go backwards because items were popped off the stack backwards */ @@ -872,7 +872,7 @@ void EXE_send(thread_db* tdbb, ************************************** * * Functional description - * Send a message from the host program to the engine. + * Send a message from the host program to the engine. * This corresponds to a blr_receive or blr_select statement. * **************************************/ @@ -888,18 +888,18 @@ void EXE_send(thread_db* tdbb, jrd_nod* message; jrd_nod* node; #ifdef SCROLLABLE_CURSORS -/* look for an asynchronous send message--if such - a message was defined, we allow the user to send +/* look for an asynchronous send message--if such + a message was defined, we allow the user to send us a message at any time during request execution */ jrd_nod* save_next = NULL; jrd_nod* save_message = NULL; jrd_req::req_s save_operation = jrd_req::req_evaluate; - + if ((message = request->req_async_message) && (node = message->nod_arg[e_send_message]) && (msg == (USHORT)(ULONG) node->nod_arg[e_msg_number])) { - /* save the current state of the request so we can go + /* save the current state of the request so we can go back to what was interrupted */ save_operation = request->req_operation; @@ -948,7 +948,7 @@ void EXE_send(thread_db* tdbb, ERR_post(Arg::Gds(isc_req_sync)); if (length != format->fmt_length) { - ERR_post(Arg::Gds(isc_port_len) << Arg::Num(length) << + ERR_post(Arg::Gds(isc_port_len) << Arg::Num(length) << Arg::Num(format->fmt_length)); } @@ -1001,8 +1001,8 @@ void EXE_send(thread_db* tdbb, #ifdef SCROLLABLE_CURSORS if (save_next) { - /* if the message was sent asynchronously, restore all the - previous values so that whatever we were trying to do when + /* if the message was sent asynchronously, restore all the + previous values so that whatever we were trying to do when the message came in is what we do next */ request->req_operation = save_operation; @@ -1129,9 +1129,9 @@ void EXE_unwind(thread_db* tdbb, jrd_req* request) SET_TDBB(tdbb); - if (request->req_flags & req_active) + if (request->req_flags & req_active) { - if (request->req_fors.getCount() || request->req_exec_sta.getCount() || request->req_ext_stmt) + if (request->req_fors.getCount() || request->req_exec_sta.getCount() || request->req_ext_stmt) { Jrd::ContextPoolHolder context(tdbb, request->req_pool); jrd_req* old_request = tdbb->getRequest(); @@ -1242,9 +1242,9 @@ static void cleanup_rpb(thread_db* tdbb, record_param* rpb) } inline void PreModifyEraseTriggers(thread_db* tdbb, - trig_vec** trigs, - SSHORT which_trig, - record_param* rpb, + trig_vec** trigs, + SSHORT which_trig, + record_param* rpb, record_param* rec, jrd_req::req_ta op) { @@ -1255,13 +1255,13 @@ inline void PreModifyEraseTriggers(thread_db* tdbb, ****************************************************** * * Functional description - * Perform operation's pre-triggers, + * Perform operation's pre-triggers, * storing active rpb in chain. * ******************************************************/ if (! tdbb->getTransaction()->tra_rpblist) { - tdbb->getTransaction()->tra_rpblist = - FB_NEW(*tdbb->getTransaction()->tra_pool) + tdbb->getTransaction()->tra_rpblist = + FB_NEW(*tdbb->getTransaction()->tra_pool) traRpbList(*tdbb->getTransaction()->tra_pool); } const int rpblevel = @@ -1364,8 +1364,8 @@ static jrd_nod* erase(thread_db* tdbb, jrd_nod* node, SSHORT which_trig) trigger_failure(tdbb, trigger); } -/* call IDX_erase (which checks constraints) after all post erase triggers - have fired. This is required for cascading referential integrity, which +/* call IDX_erase (which checks constraints) after all post erase triggers + have fired. This is required for cascading referential integrity, which can be implemented as post_erase triggers */ if (!relation->rel_file && @@ -1530,7 +1530,7 @@ static void execute_procedure(thread_db* tdbb, jrd_nod* node) jrd_req* proc_request = EXE_find_request(tdbb, procedure->prc_request, false); Firebird::Array temp_buffer; - + if (!out_message) { const Format* format = (Format*) procedure->prc_output_msg->nod_arg[e_msg_format]; out_msg_length = format->fmt_length; @@ -1608,22 +1608,22 @@ static jrd_nod* execute_statement(thread_db* tdbb, jrd_req* request, jrd_nod* no const int inputs = (SSHORT)(IPTR) node->nod_arg[node->nod_count + e_exec_stmt_extra_inputs]; const int outputs = (SSHORT)(IPTR) node->nod_arg[node->nod_count + e_exec_stmt_extra_outputs]; - - jrd_nod** node_inputs = inputs ? + + jrd_nod** node_inputs = inputs ? node->nod_arg + e_exec_stmt_fixed_count + e_exec_stmt_extra_inputs : NULL; - jrd_nod** node_outputs = outputs ? + jrd_nod** node_outputs = outputs ? node->nod_arg + e_exec_stmt_fixed_count + inputs : NULL; - + jrd_nod* node_proc_block = node->nod_arg[e_exec_stmt_proc_block]; if (request->req_operation == jrd_req::req_evaluate) { fb_assert(*stmt_ptr == 0); - const EDS::ParamNames* inputs_names = + const EDS::ParamNames* inputs_names = (EDS::ParamNames*) node->nod_arg[node->nod_count + e_exec_stmt_extra_input_names]; - + const jrd_nod* tra_node = node->nod_arg[node->nod_count + e_exec_stmt_extra_tran]; const EDS::TraScope tra_scope = tra_node ? (EDS::TraScope)(IPTR) tra_node : EDS::traCommon; @@ -1675,7 +1675,7 @@ static jrd_nod* execute_statement(thread_db* tdbb, jrd_req* request, jrd_nod* no request->req_operation = jrd_req::req_return; } } - + if (stmt) { stmt->close(tdbb); } @@ -1724,7 +1724,7 @@ static jrd_req* execute_triggers(thread_db* tdbb, const Record* record = old_rec ? old_rec : new_rec; fb_assert(record && record->rec_format); // copy the record - null_rec = FB_NEW_RPT(record->rec_pool, record->rec_length) + null_rec = FB_NEW_RPT(record->rec_pool, record->rec_length) Record(record->rec_pool); null_rec->rec_length = record->rec_length; null_rec->rec_format = record->rec_format; @@ -2012,7 +2012,7 @@ jrd_nod* EXE_looper(thread_db* tdbb, jrd_req* request, jrd_nod* in_node) } } break; - + case nod_exec_proc: if (request->req_operation == jrd_req::req_unwind) { node = node->nod_parent; @@ -2227,7 +2227,7 @@ jrd_nod* EXE_looper(thread_db* tdbb, jrd_req* request, jrd_nod* in_node) // Release the savepoint and all subsequent ones while (transaction->tra_save_point && - transaction->tra_save_point->sav_number >= sav_number) + transaction->tra_save_point->sav_number >= sav_number) { verb_cleanup(tdbb, transaction); } @@ -2242,7 +2242,7 @@ jrd_nod* EXE_looper(thread_db* tdbb, jrd_req* request, jrd_nod* in_node) // Undo the savepoint while (transaction->tra_save_point && - transaction->tra_save_point->sav_number >= sav_number) + transaction->tra_save_point->sav_number >= sav_number) { transaction->tra_save_point->sav_verb_count++; verb_cleanup(tdbb, transaction); @@ -2286,7 +2286,7 @@ jrd_nod* EXE_looper(thread_db* tdbb, jrd_req* request, jrd_nod* in_node) /* If any requested modify/delete/insert ops have completed, forget them */ if (transaction != dbb->dbb_sys_trans) { - /* If an error is still pending when the savepoint is + /* If an error is still pending when the savepoint is supposed to end, then the application didn't handle the error and the savepoint should be undone. */ if (error_pending) { @@ -2320,7 +2320,7 @@ jrd_nod* EXE_looper(thread_db* tdbb, jrd_req* request, jrd_nod* in_node) switch (request->req_operation) { SLONG count; - + case jrd_req::req_evaluate: if (transaction != dbb->dbb_sys_trans) { VIO_start_save_point(tdbb, transaction); @@ -2398,7 +2398,7 @@ jrd_nod* EXE_looper(thread_db* tdbb, jrd_req* request, jrd_nod* in_node) /* Save the previous state of req_error_handler bit. We need to restore it later. This is - necessary if the error handler is deeply + necessary if the error handler is deeply nested. */ const ULONG prev_req_error_handler = @@ -2413,9 +2413,9 @@ jrd_nod* EXE_looper(thread_db* tdbb, jrd_req* request, jrd_nod* in_node) never returned back till the node tree was executed completely. Now that the looper has changed its behaviour such that it - returns back after handling error. This + returns back after handling error. This makes it necessary that the jmpbuf be reset - so that looper can proceede with the + so that looper can proceede with the processing of execution tree. If this is not done then anymore errors will take the engine out of looper there by abruptly @@ -2630,7 +2630,7 @@ jrd_nod* EXE_looper(thread_db* tdbb, jrd_req* request, jrd_nod* in_node) node = node->nod_parent; break; - case nod_exec_into: + case nod_exec_into: { ExecuteStatement* impure = (ExecuteStatement*) ((SCHAR*) request + node->nod_impure); @@ -2774,7 +2774,7 @@ jrd_nod* EXE_looper(thread_db* tdbb, jrd_req* request, jrd_nod* in_node) case nod_init_variable: if (request->req_operation == jrd_req::req_evaluate) { - const ItemInfo* itemInfo = + const ItemInfo* itemInfo = reinterpret_cast(node->nod_arg[e_init_var_info]); if (itemInfo) { @@ -2865,7 +2865,7 @@ jrd_nod* EXE_looper(thread_db* tdbb, jrd_req* request, jrd_nod* in_node) if (!(tdbb->tdbb_flags & TDBB_stack_trace_done) && !(tdbb->tdbb_flags & TDBB_sys_error)) { - stuff_stack_trace(request); + stuff_stack_trace(request); tdbb->tdbb_flags |= TDBB_stack_trace_done; } } @@ -3029,7 +3029,7 @@ static jrd_nod* modify(thread_db* tdbb, jrd_nod* node, SSHORT which_trig) ++transaction->tra_save_point->sav_verb_count; PreModifyEraseTriggers(tdbb, &relation->rel_pre_modify, - which_trig, org_rpb, new_rpb, + which_trig, org_rpb, new_rpb, jrd_req::req_trigger_update); if (node->nod_arg[e_mod_validate]) { @@ -3070,8 +3070,8 @@ static jrd_nod* modify(thread_db* tdbb, jrd_nod* node, SSHORT which_trig) trigger_failure(tdbb, trigger); } - /* now call IDX_modify_check_constrints after all post modify triggers - have fired. This is required for cascading referential integrity, + /* now call IDX_modify_check_constrints after all post modify triggers + have fired. This is required for cascading referential integrity, which can be implemented as post_erase triggers */ if (!relation->rel_file && @@ -3168,9 +3168,9 @@ static jrd_nod* modify(thread_db* tdbb, jrd_nod* node, SSHORT which_trig) DSC org_desc, new_desc; for (SSHORT i = 0; i < new_format->fmt_count; i++) { - /* In order to "map a null to a default" value (in EVL_field()), - * the relation block is referenced. - * Reference: Bug 10116, 10424 + /* In order to "map a null to a default" value (in EVL_field()), + * the relation block is referenced. + * Reference: Bug 10116, 10424 */ CLEAR_NULL(new_record, i); if (EVL_field(new_rpb->rpb_relation, new_record, i, &new_desc)) { @@ -3262,7 +3262,7 @@ static void release_blobs(thread_db* tdbb, jrd_req* request) if (request->req_blobs.getFirst()) { - while (true) + while (true) { const ULONG blob_temp_id = request->req_blobs.current(); if (transaction->tra_blobs->locate(blob_temp_id)) @@ -3275,10 +3275,10 @@ static void release_blobs(thread_db* tdbb, jrd_req* request) } else { - // Blob was created by request, is accounted for internal needs, + // Blob was created by request, is accounted for internal needs, // but is not materialized. Get rid of it. BLB_cancel(tdbb, current->bli_blob_object); - // Since the routine above modifies req_blobs + // Since the routine above modifies req_blobs // we need to reestablish accessor position } @@ -3346,8 +3346,8 @@ static jrd_nod* seek_rse(thread_db* tdbb, jrd_req* request, jrd_nod* node) ************************************** * * Functional description - * Execute a nod_seek, which specifies - * a direction and offset in which to + * Execute a nod_seek, which specifies + * a direction and offset in which to * scroll a record selection expression. * **************************************/ @@ -3389,7 +3389,7 @@ static void seek_rsb( ************************************** * * Functional description - * Allow scrolling through a stream as defined + * Allow scrolling through a stream as defined * by the input rsb. Handles multiple seeking. * Uses RSE_get_record() to do the actual work. * @@ -3438,10 +3438,10 @@ static void seek_rsb( ERR_post(Arg::Gds(isc_invalid_direction)); } -/* the actual offset to seek may be one less because the next time - through the blr_for loop we will seek one record--flag the fact - that a fetch is required on this stream in case it doesn't happen - (for example when GPRE generates BLR which does not stall prior to +/* the actual offset to seek may be one less because the next time + through the blr_for loop we will seek one record--flag the fact + that a fetch is required on this stream in case it doesn't happen + (for example when GPRE generates BLR which does not stall prior to the blr_for, as DSQL does) */ if (offset > 0) @@ -3471,9 +3471,9 @@ static void seek_rsb( case blr_forward: /* go forward from the current location */ /* the rsb_backwards flag is used to indicate the direction to seek in; - this is sticky in the sense that after the user has seek'ed in the - backward direction, the next retrieval from a blr_for loop will also - be in the backward direction--this allows us to continue scrolling + this is sticky in the sense that after the user has seek'ed in the + backward direction, the next retrieval from a blr_for loop will also + be in the backward direction--this allows us to continue scrolling without constantly sending messages to the engine */ impure->irsb_flags &= ~irsb_last_backwards; @@ -3515,7 +3515,7 @@ static void seek_rsb( RSE_close(tdbb, rsb); RSE_open(tdbb, rsb); - /* if this is a stream type which uses bof and eof flags, + /* if this is a stream type which uses bof and eof flags, reverse the sense of bof and eof in this case */ if (impure->irsb_flags & irsb_bof) { @@ -3630,9 +3630,9 @@ static void set_error(thread_db* tdbb, const xcp_repeat* exception, jrd_nod* msg Firebird::MetaName name, relation_name; TEXT message[XCP_MESSAGE_LENGTH + 1]; - // since temp used as vary, we need size of vary::vary_length + // since temp used as vary, we need size of vary::vary_length // (USHORT) extra chars - TEXT temp[XCP_MESSAGE_LENGTH + sizeof(USHORT)]; + TEXT temp[XCP_MESSAGE_LENGTH + sizeof(USHORT)]; SET_TDBB(tdbb); @@ -3646,7 +3646,7 @@ static void set_error(thread_db* tdbb, const xcp_repeat* exception, jrd_nod* msg } USHORT length = 0; - + if (msg_node) { const char* string = 0; @@ -3688,7 +3688,7 @@ static void set_error(thread_db* tdbb, const xcp_repeat* exception, jrd_nod* msg if (exception->xcp_code == isc_check_constraint) { MET_lookup_cnstrt_for_trigger(tdbb, name, relation_name, request->req_trg_name); - ERR_post(Arg::Gds(exception->xcp_code) << Arg::Str(name) << + ERR_post(Arg::Gds(exception->xcp_code) << Arg::Str(name) << Arg::Str(relation_name)); } else @@ -3723,7 +3723,7 @@ static void set_error(thread_db* tdbb, const xcp_repeat* exception, jrd_nod* msg ERR_post(Arg::Gds(isc_except) << Arg::Num(exception->xcp_code) << Arg::Gds(isc_random) << Arg::Str(name)); } - else + else ERR_post(Arg::Gds(isc_except) << Arg::Num(exception->xcp_code)); default: @@ -3736,7 +3736,7 @@ static jrd_nod* stall(thread_db* tdbb, jrd_nod* node) { /************************************** * - * s t a l l + * s t a l l * ************************************** * @@ -4123,7 +4123,7 @@ static void validate(thread_db* tdbb, jrd_nod* list) name = UNKNOWN_STRING_MARK; } - ERR_post(Arg::Gds(isc_not_valid) << Arg::Str(name) << + ERR_post(Arg::Gds(isc_not_valid) << Arg::Str(name) << Arg::Str(value)); } } diff --git a/src/jrd/execute_statement.cpp b/src/jrd/execute_statement.cpp index 6db79b6990..1fbc86cf7c 100644 --- a/src/jrd/execute_statement.cpp +++ b/src/jrd/execute_statement.cpp @@ -70,7 +70,7 @@ void ExecuteStatement::execute(Jrd::thread_db* tdbb, jrd_req* request, DSC* desc AutoPtr stmt(attachment->prepareStatement( tdbb, *tdbb->getDefaultPool(), transaction, sqlStatementText)); - // Other requests appear to be incorrect in this context + // Other requests appear to be incorrect in this context const long requests = (1 << REQ_INSERT) | (1 << REQ_DELETE) | (1 << REQ_UPDATE) | (1 << REQ_DDL) | (1 << REQ_SET_GENERATOR) | (1 << REQ_EXEC_PROCEDURE) | diff --git a/src/jrd/ext.cpp b/src/jrd/ext.cpp index 7eaeb2dff4..d3726a054a 100644 --- a/src/jrd/ext.cpp +++ b/src/jrd/ext.cpp @@ -20,7 +20,7 @@ * All Rights Reserved. * Contributor(s): ______________________________________. * - * 26-Sept-2001 Paul Beach - Windows External File Directory Config. Parameter + * 26-Sept-2001 Paul Beach - Windows External File Directory Config. Parameter * * 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE" * conditionals, as the engine now fully supports @@ -90,13 +90,13 @@ namespace { }; Firebird::InitInstance iExternalFileDirectoryList; - FILE *ext_fopen(Database* dbb, ExternalFile* ext_file) + FILE *ext_fopen(Database* dbb, ExternalFile* ext_file) { const char* file_name = ext_file->ext_filename; if (!iExternalFileDirectoryList().isPathInList(file_name)) { - ERR_post(Arg::Gds(isc_conf_access_denied) << Arg::Str("external file") << + ERR_post(Arg::Gds(isc_conf_access_denied) << Arg::Str("external file") << Arg::Str(file_name)); } @@ -108,10 +108,10 @@ namespace { if (!ext_file->ext_ifi) { - // could not open the file as read write attempt as read only + // could not open the file as read write attempt as read only if (!(ext_file->ext_ifi = fopen(file_name, FOPEN_READ_ONLY))) { - ERR_post(Arg::Gds(isc_io_error) << Arg::Str("fopen") << + ERR_post(Arg::Gds(isc_io_error) << Arg::Str("fopen") << Arg::Str(file_name) << Arg::Gds(isc_io_open_err) << SYS_ERR(errno)); } @@ -180,7 +180,7 @@ ExternalFile* EXT_file(jrd_rel* relation, const TEXT* file_name, bid* descriptio } #ifdef WIN_NT - /* Default number of file handles stdio.h on Windows is 512, use this + /* Default number of file handles stdio.h on Windows is 512, use this call to increase and set to the maximum */ _setmaxstdio(2048); #endif @@ -227,7 +227,7 @@ void EXT_fini(jrd_rel* relation, bool close_only) file->ext_ifi = NULL; } - // before zeroing out the rel_file we need to deallocate the memory + // before zeroing out the rel_file we need to deallocate the memory if (!close_only) { delete file; @@ -266,14 +266,14 @@ bool EXT_get(thread_db* tdbb, RecordSource* rsb) UCHAR* p = record->rec_data + offset; const ULONG l = record->rec_length - offset; - // hvlad: fseek will flush file buffer and degrade performance, so don't - // call it if it is not necessary. Note that we must flush file buffer if we + // hvlad: fseek will flush file buffer and degrade performance, so don't + // call it if it is not necessary. Note that we must flush file buffer if we // do read after write - if (file->ext_ifi == NULL || + if (file->ext_ifi == NULL || ( (ftell(file->ext_ifi) != rpb->rpb_ext_pos || !(file->ext_flags & EXT_last_read)) && (fseek(file->ext_ifi, rpb->rpb_ext_pos, 0) != 0)) ) { - ERR_post(Arg::Gds(isc_io_error) << Arg::Str("fseek") << + ERR_post(Arg::Gds(isc_io_error) << Arg::Str("fseek") << Arg::Str(file->ext_filename) << Arg::Gds(isc_io_open_err) << SYS_ERR(errno)); } @@ -298,7 +298,7 @@ bool EXT_get(thread_db* tdbb, RecordSource* rsb) { const jrd_fld* field = *itr; SET_NULL(record, i); - if (!desc_ptr->dsc_length || !field) + if (!desc_ptr->dsc_length || !field) continue; const Literal* literal = (Literal*) field->fld_missing_value; if (literal) { @@ -477,7 +477,7 @@ void EXT_store(thread_db* tdbb, record_param* rpb, jrd_tra* transaction) if (dbb->dbb_flags & DBB_read_only) ERR_post(Arg::Gds(isc_read_only_database)); else { - ERR_post(Arg::Gds(isc_io_error) << Arg::Str("insert") << + ERR_post(Arg::Gds(isc_io_error) << Arg::Str("insert") << Arg::Str(file->ext_filename) << Arg::Gds(isc_io_write_err) << Arg::Gds(isc_ext_readonly_err)); @@ -514,20 +514,20 @@ void EXT_store(thread_db* tdbb, record_param* rpb, jrd_tra* transaction) const UCHAR* p = record->rec_data + offset; const ULONG l = record->rec_length - offset; - // hvlad: fseek will flush file buffer and degrade performance, so don't - // call it if it is not necessary. Note that we must flush file buffer if we + // hvlad: fseek will flush file buffer and degrade performance, so don't + // call it if it is not necessary. Note that we must flush file buffer if we // do write after read - if (file->ext_ifi == NULL || + if (file->ext_ifi == NULL || (!(file->ext_flags & EXT_last_write) && fseek(file->ext_ifi, (SLONG) 0, 2) != 0) ) { - ERR_post(Arg::Gds(isc_io_error) << Arg::Str("fseek") << + ERR_post(Arg::Gds(isc_io_error) << Arg::Str("fseek") << Arg::Str(file->ext_filename) << Arg::Gds(isc_io_open_err) << SYS_ERR(errno)); } if (!fwrite(p, l, 1, file->ext_ifi)) { - ERR_post(Arg::Gds(isc_io_error) << Arg::Str("fwrite") << + ERR_post(Arg::Gds(isc_io_error) << Arg::Str("fwrite") << Arg::Str(file->ext_filename) << Arg::Gds(isc_io_open_err) << SYS_ERR(errno)); } diff --git a/src/jrd/extds/InternalDS.cpp b/src/jrd/extds/InternalDS.cpp index 905533492e..f5c5c07b69 100644 --- a/src/jrd/extds/InternalDS.cpp +++ b/src/jrd/extds/InternalDS.cpp @@ -79,7 +79,7 @@ void InternalProvider::jrdAttachmentEnd(thread_db *tdbb, Attachment* att) } } -void InternalProvider::getRemoteError(ISC_STATUS* status, string &err) const +void InternalProvider::getRemoteError(ISC_STATUS* status, string &err) const { err = ""; @@ -111,7 +111,7 @@ InternalConnection::~InternalConnection() { } -void InternalConnection::attach(thread_db *tdbb, const Firebird::string &dbName, +void InternalConnection::attach(thread_db *tdbb, const Firebird::string &dbName, const Firebird::string &user, const Firebird::string &pwd) { fb_assert(!m_attachment); @@ -134,7 +134,7 @@ void InternalConnection::attach(thread_db *tdbb, const Firebird::string &dbName, { EngineCallbackGuard guard(tdbb, *this); - jrd8_attach_database(status, m_dbName.c_str(), &m_attachment, + jrd8_attach_database(status, m_dbName.c_str(), &m_attachment, m_dpb.getBufferLength(), m_dpb.getBuffer()); } if (status[1]) { @@ -142,7 +142,7 @@ void InternalConnection::attach(thread_db *tdbb, const Firebird::string &dbName, } } - m_sqlDialect = (m_attachment->att_database->dbb_flags & DBB_DB_SQL_dialect_3) ? + m_sqlDialect = (m_attachment->att_database->dbb_flags & DBB_DB_SQL_dialect_3) ? SQL_DIALECT_V6 : SQL_DIALECT_V5; } @@ -164,7 +164,7 @@ void InternalConnection::doDetach(thread_db *tdbb) EngineCallbackGuard guard(tdbb, *this); jrd8_detach_database(status, &att); - + m_attachment = att; } @@ -192,11 +192,11 @@ bool InternalConnection::cancelExecution(thread_db *tdbb) // b) is not current conenction bool InternalConnection::isAvailable(thread_db *tdbb, TraScope traScope) const { - return !m_isCurrent || + return !m_isCurrent || (m_isCurrent && (tdbb->getAttachment() == m_attachment)); } -bool InternalConnection::isSameDatabase(thread_db *tdbb, const Firebird::string &dbName, +bool InternalConnection::isSameDatabase(thread_db *tdbb, const Firebird::string &dbName, const Firebird::string &user, const Firebird::string &pwd) const { if (m_isCurrent) @@ -235,12 +235,12 @@ void InternalTransaction::doStart(ISC_STATUS* status, thread_db *tdbb, ClumpletW Attachment *att = m_IntConnection.getJrdAtt(); EngineCallbackGuard guard(tdbb, *this); - jrd8_start_transaction(status, &m_transaction, 1, &att, + jrd8_start_transaction(status, &m_transaction, 1, &att, tpb.getBufferLength(), tpb.getBuffer()); } } -void InternalTransaction::doPrepare(ISC_STATUS* status, thread_db *tdbb, +void InternalTransaction::doPrepare(ISC_STATUS* status, thread_db *tdbb, int info_len, const char* info) { fb_assert(m_transaction); @@ -286,7 +286,7 @@ void InternalTransaction::doRollback(ISC_STATUS* status, thread_db *tdbb, bool r } -// InternalStatement +// InternalStatement InternalStatement::InternalStatement(InternalConnection &conn) : Statement(conn), @@ -311,7 +311,7 @@ void InternalStatement::doPrepare(thread_db *tdbb, const string &sql) jrd_tra *tran = getIntTransaction()->getJrdTran(); ISC_STATUS_ARRAY status = {0}; - if (!m_request) + if (!m_request) { fb_assert(!m_allocated); EngineCallbackGuard guard(tdbb, *this); @@ -328,7 +328,7 @@ void InternalStatement::doPrepare(thread_db *tdbb, const string &sql) jrd_req* const save_caller = tran->tra_callback_caller; tran->tra_callback_caller = m_callerPrivileges ? tdbb->getRequest() : NULL; - jrd8_prepare(status, &tran, &m_request, sql.length(), sql.c_str(), + jrd8_prepare(status, &tran, &m_request, sql.length(), sql.c_str(), m_connection.getSqlDialect(), 0, NULL, 0, NULL); tran->tra_callback_caller = save_caller; @@ -366,19 +366,19 @@ void InternalStatement::doPrepare(thread_db *tdbb, const string &sql) m_stmt_selectable = false; switch (m_request->req_type) { - case REQ_SELECT: - case REQ_SELECT_UPD: - case REQ_EMBED_SELECT: + case REQ_SELECT: + case REQ_SELECT_UPD: + case REQ_EMBED_SELECT: case REQ_SELECT_BLOCK: m_stmt_selectable = true; break; - - case REQ_START_TRANS: - case REQ_COMMIT: - case REQ_ROLLBACK: - case REQ_COMMIT_RETAIN: - case REQ_ROLLBACK_RETAIN: - case REQ_CREATE_DB: + + case REQ_START_TRANS: + case REQ_COMMIT: + case REQ_ROLLBACK: + case REQ_COMMIT_RETAIN: + case REQ_ROLLBACK_RETAIN: + case REQ_CREATE_DB: // forbidden ? break; @@ -402,11 +402,11 @@ void InternalStatement::doPrepare(thread_db *tdbb, const string &sql) void InternalStatement::doExecute(thread_db *tdbb) { jrd_tra *transaction = getIntTransaction()->getJrdTran(); - + ISC_STATUS_ARRAY status = {0}; { EngineCallbackGuard guard(tdbb, *this); - jrd8_execute(status, &transaction, &m_request, + jrd8_execute(status, &transaction, &m_request, m_inBlr.getCount(), reinterpret_cast(m_inBlr.begin()), 0, m_in_buffer.getCount(), reinterpret_cast(m_in_buffer.begin()), m_outBlr.getCount(), (SCHAR*) m_outBlr.begin(), @@ -422,11 +422,11 @@ void InternalStatement::doExecute(thread_db *tdbb) void InternalStatement::doOpen(thread_db *tdbb) { jrd_tra *transaction = getIntTransaction()->getJrdTran(); - + ISC_STATUS_ARRAY status = {0}; { EngineCallbackGuard guard(tdbb, *this); - jrd8_execute(status, &transaction, &m_request, + jrd8_execute(status, &transaction, &m_request, m_inBlr.getCount(), reinterpret_cast(m_inBlr.begin()), 0, m_in_buffer.getCount(), reinterpret_cast(m_in_buffer.begin()), 0, NULL, 0, 0, NULL); @@ -443,7 +443,7 @@ bool InternalStatement::doFetch(thread_db *tdbb) ISC_STATUS res = 0; { EngineCallbackGuard guard(tdbb, *this); - res = jrd8_fetch(status, &m_request, + res = jrd8_fetch(status, &m_request, m_outBlr.getCount(), reinterpret_cast(m_outBlr.begin()), 0, m_out_buffer.getCount(), (SCHAR*) m_out_buffer.begin()); } @@ -463,7 +463,7 @@ void InternalStatement::doClose(thread_db *tdbb, bool drop) jrd8_free_statement(status, &m_request, drop ? DSQL_drop : DSQL_close); m_allocated = (m_request != 0); } - if (status[1]) + if (status[1]) { m_allocated = m_request = 0; raise(status, tdbb, "jrd8_free_statement"); @@ -491,9 +491,9 @@ void InternalStatement::getExtBlob(thread_db *tdbb, const dsc &src, dsc &dst) -// InternalBlob +// InternalBlob -InternalBlob::InternalBlob(InternalConnection &conn) : +InternalBlob::InternalBlob(InternalConnection &conn) : Blob(conn), m_connection(conn), m_blob(NULL) @@ -522,7 +522,7 @@ void InternalBlob::open(thread_db *tdbb, Transaction &tran, const dsc &desc, con USHORT bpb_len = bpb ? bpb->getCount() : 0; const UCHAR* bpb_buff = bpb ? bpb->begin() : NULL; - jrd8_open_blob2(status, &att, &transaction, &m_blob, &m_blob_id, + jrd8_open_blob2(status, &att, &transaction, &m_blob, &m_blob_id, bpb_len, bpb_buff); } if (status[1]) { @@ -547,7 +547,7 @@ void InternalBlob::create(thread_db *tdbb, Transaction &tran, dsc &desc, const U USHORT bpb_len = bpb ? bpb->getCount() : 0; const UCHAR* bpb_buff = bpb ? bpb->begin() : NULL; - jrd8_create_blob2(status, &att, &transaction, &m_blob, &m_blob_id, + jrd8_create_blob2(status, &att, &transaction, &m_blob, &m_blob_id, bpb_len, bpb_buff); memcpy(desc.dsc_address, &m_blob_id, sizeof(m_blob_id)); } diff --git a/src/jrd/filters.cpp b/src/jrd/filters.cpp index e138686d2f..9c32bf084c 100644 --- a/src/jrd/filters.cpp +++ b/src/jrd/filters.cpp @@ -148,7 +148,7 @@ ISC_STATUS filter_acl(USHORT action, BlobControl* control) USHORT length; const ISC_STATUS status = caller(isc_blob_filter_get_segment, control, (USHORT) l, temp, &length); - + TEXT line[BUFFER_SMALL]; if (!status) { @@ -209,7 +209,7 @@ ISC_STATUS filter_blr(USHORT action, BlobControl* control) ************************************** * * Functional description - * Get next segment from a blr blob. + * Get next segment from a blr blob. * Doctor up Rdb BLR blobs that omit * the BLR eoc so the pretty printer * doesn't complain. @@ -278,8 +278,8 @@ ISC_STATUS filter_format(USHORT action, BlobControl* control) char buffer[256]; sprintf(buffer, "%5d: type=%d (%s) length=%d sub_type=%d flags=0x%X", - desc.dsc_offset, - desc.dsc_dtype, + desc.dsc_offset, + desc.dsc_dtype, desc.dsc_dtype >= DTYPE_TYPE_MAX ? "unknown" : dtypes[desc.dsc_dtype], desc.dsc_length, desc.dsc_sub_type, @@ -624,7 +624,7 @@ ISC_STATUS filter_transliterate_text(USHORT action, BlobControl* control) ************************************** * * Functional description - * Get next segment from a text blob. + * Get next segment from a text blob. * Convert the text from one character set to another. * * The usage of the variable ctl_data slots: @@ -648,7 +648,7 @@ ISC_STATUS filter_transliterate_text(USHORT action, BlobControl* control) const USHORT EXP_SCALE = 128; /* to keep expansion non-floating */ ctlaux* aux = (ctlaux*) control->ctl_data[0]; - + BlobControl* source; ISC_STATUS status; ULONG err_position; @@ -881,7 +881,7 @@ ISC_STATUS filter_transliterate_text(USHORT action, BlobControl* control) else can_use_more = true; - /* Always keep a minimal count of bytes in the input buffer, + /* Always keep a minimal count of bytes in the input buffer, * to prevent the case of truncated characters. */ if (length < 4) @@ -979,7 +979,7 @@ ISC_STATUS filter_transliterate_text(USHORT action, BlobControl* control) if (unused_len) return isc_segment; // can't fit all data into user buffer - // We handed back all our data, but did we GET all the data + // We handed back all our data, but did we GET all the data // from the source? return (aux->ctlaux_source_blob_status == isc_segment) ? isc_segment : FB_SUCCESS; diff --git a/src/jrd/flu.cpp b/src/jrd/flu.cpp index 9a3981bdfb..3dd3cb7165 100644 --- a/src/jrd/flu.cpp +++ b/src/jrd/flu.cpp @@ -165,8 +165,8 @@ namespace Jrd } - FPTR_INT Module::lookup(const TEXT* module, - const TEXT* name, + FPTR_INT Module::lookup(const TEXT* module, + const TEXT* name, DatabaseModules& interest) { FPTR_INT function = FUNCTIONS_entrypoint(module, name); @@ -196,7 +196,7 @@ namespace Jrd return (FPTR_INT)rc; } - FPTR_INT Module::lookup(const TEXT* module, + FPTR_INT Module::lookup(const TEXT* module, const TEXT* name) { FPTR_INT function = FUNCTIONS_entrypoint(module, name); @@ -224,7 +224,7 @@ namespace Jrd Firebird::PathName initialModule; terminate_at_space(initialModule, name); - // Look for module in array of already loaded + // Look for module in array of already loaded InternalModule* im = scanModule(initialModule); if (im) { @@ -263,10 +263,10 @@ namespace Jrd // UdfAccess verification Firebird::PathName path, relative; - // Search for module name in UdfAccess restricted + // Search for module name in UdfAccess restricted // paths list PathUtils::splitLastComponent(path, relative, fixedModule); - if (path.length() == 0 && + if (path.length() == 0 && PathUtils::isRelative(fixedModule)) { path = fixedModule; @@ -281,10 +281,10 @@ namespace Jrd // must satisfy UdfAccess entry in config file. if (! iUdfDirectoryList().isPathInList(fixedModule)) { - ERR_post(Arg::Gds(isc_conf_access_denied) << Arg::Str("UDF/BLOB-filter module") << + ERR_post(Arg::Gds(isc_conf_access_denied) << Arg::Str("UDF/BLOB-filter module") << Arg::Str(initialModule)); } - + ModuleLoader::Module* mlm = ModuleLoader::loadModule(fixedModule); if (mlm) { diff --git a/src/jrd/functions.cpp b/src/jrd/functions.cpp index 15a5e4b662..179d65e4cf 100644 --- a/src/jrd/functions.cpp +++ b/src/jrd/functions.cpp @@ -161,10 +161,10 @@ vary* get_context(const vary* ns_vary, const vary* name_vary) jrd_tra* transaction; // See if JRD thread data structure looks sane for occasion - if (!tdbb || - !(dbb = tdbb->getDatabase()) || - !(transaction = tdbb->getTransaction()) || - !(att = tdbb->getAttachment())) + if (!tdbb || + !(dbb = tdbb->getDatabase()) || + !(transaction = tdbb->getTransaction()) || + !(att = tdbb->getAttachment())) { fb_assert(false); return NULL; @@ -181,9 +181,9 @@ vary* get_context(const vary* ns_vary, const vary* name_vary) const Firebird::string name_str(name_vary->vary_string, name_vary->vary_length); // Handle system variables - if (ns_str == SYSTEM_NAMESPACE) + if (ns_str == SYSTEM_NAMESPACE) { - if (name_str == ENGINE_VERSION) + if (name_str == ENGINE_VERSION) { Firebird::string version; version.printf("%s.%s.%s", FB_MAJOR_VER, FB_MINOR_VER, FB_REV_NO); @@ -191,7 +191,7 @@ vary* get_context(const vary* ns_vary, const vary* name_vary) return make_result_str(version); } - if (name_str == NETWORK_PROTOCOL_NAME) + if (name_str == NETWORK_PROTOCOL_NAME) { if (att->att_network_protocol.isEmpty()) return NULL; @@ -199,7 +199,7 @@ vary* get_context(const vary* ns_vary, const vary* name_vary) return make_result_str(att->att_network_protocol); } - if (name_str == CLIENT_ADDRESS_NAME) + if (name_str == CLIENT_ADDRESS_NAME) { if (att->att_remote_address.isEmpty()) return NULL; @@ -207,12 +207,12 @@ vary* get_context(const vary* ns_vary, const vary* name_vary) return make_result_str(att->att_remote_address); } - if (name_str == DATABASE_NAME) + if (name_str == DATABASE_NAME) { return make_result_str(dbb->dbb_database_name.ToString()); } - if (name_str == CURRENT_USER_NAME) + if (name_str == CURRENT_USER_NAME) { if (!att->att_user || att->att_user->usr_user_name.isEmpty()) return NULL; @@ -220,7 +220,7 @@ vary* get_context(const vary* ns_vary, const vary* name_vary) return make_result_str(att->att_user->usr_user_name); } - if (name_str == CURRENT_ROLE_NAME) + if (name_str == CURRENT_ROLE_NAME) { if (!att->att_user || att->att_user->usr_sql_role_name.isEmpty()) return NULL; @@ -228,7 +228,7 @@ vary* get_context(const vary* ns_vary, const vary* name_vary) return make_result_str(att->att_user->usr_sql_role_name); } - if (name_str == SESSION_ID_NAME) + if (name_str == SESSION_ID_NAME) { Firebird::string session_id; const SLONG att_id = PAG_attachment_id(tdbb); @@ -243,7 +243,7 @@ vary* get_context(const vary* ns_vary, const vary* name_vary) return make_result_str(transaction_id); } - if (name_str == ISOLATION_LEVEL_NAME) + if (name_str == ISOLATION_LEVEL_NAME) { const char* isolation; @@ -258,12 +258,12 @@ vary* get_context(const vary* ns_vary, const vary* name_vary) } // "Context variable %s is not found in namespace %s" - ERR_post(Arg::Gds(isc_ctx_var_not_found) << Arg::Str(name_str) << + ERR_post(Arg::Gds(isc_ctx_var_not_found) << Arg::Str(name_str) << Arg::Str(ns_str)); } // Handle user-defined variables - if (ns_str == USER_SESSION_NAMESPACE) + if (ns_str == USER_SESSION_NAMESPACE) { Firebird::string result_str; @@ -271,8 +271,8 @@ vary* get_context(const vary* ns_vary, const vary* name_vary) return NULL; return make_result_str(result_str); - } - + } + if (ns_str == USER_TRANSACTION_NAMESPACE) { Firebird::string result_str; @@ -281,10 +281,10 @@ vary* get_context(const vary* ns_vary, const vary* name_vary) return NULL; return make_result_str(result_str); - } + } // "Invalid namespace name %s passed to %s" - ERR_post(Arg::Gds(isc_ctx_namespace_invalid) << Arg::Str(ns_str) << + ERR_post(Arg::Gds(isc_ctx_namespace_invalid) << Arg::Str(ns_str) << Arg::Str(RDB_GET_CONTEXT)); return NULL; } @@ -308,7 +308,7 @@ static SLONG set_context(const vary* ns_vary, const vary* name_vary, const vary* const Firebird::string ns_str(ns_vary->vary_string, ns_vary->vary_length); const Firebird::string name_str(name_vary->vary_string, name_vary->vary_length); - if (ns_str == USER_SESSION_NAMESPACE) + if (ns_str == USER_SESSION_NAMESPACE) { Attachment* att = tdbb->getAttachment(); @@ -327,7 +327,7 @@ static SLONG set_context(const vary* ns_vary, const vary* name_vary, const vary* return att->att_context_vars.put(name_str, Firebird::string(value_vary->vary_string, value_vary->vary_length)); - } + } if (ns_str == USER_TRANSACTION_NAMESPACE) { @@ -348,10 +348,10 @@ static SLONG set_context(const vary* ns_vary, const vary* name_vary, const vary* return tra->tra_context_vars.put(name_str, Firebird::string(value_vary->vary_string, value_vary->vary_length)); - } + } // "Invalid namespace name %s passed to %s" - ERR_post(Arg::Gds(isc_ctx_namespace_invalid) << Arg::Str(ns_str) << + ERR_post(Arg::Gds(isc_ctx_namespace_invalid) << Arg::Str(ns_str) << Arg::Str(RDB_SET_CONTEXT)); return 0; } @@ -440,6 +440,6 @@ static SLONG* byteLen(const dsc* v) rc = DSC_string_length(v); break; } - + return &rc; } diff --git a/src/jrd/gds.cpp b/src/jrd/gds.cpp index 66060ae642..65c05a3994 100644 --- a/src/jrd/gds.cpp +++ b/src/jrd/gds.cpp @@ -375,7 +375,7 @@ void gds__ulstr(char* buffer, ULONG value, const int minlen, const char filler) if (minlen > c) c = minlen; - + char* p = buffer + c; do { @@ -406,7 +406,7 @@ ISC_STATUS API_ROUTINE gds__decode(ISC_STATUS code, USHORT* fac, USHORT* code_cl if (!code) return FB_SUCCESS; - + // not an ISC error message if ((code & ISC_MASK) != ISC_MASK) return code; @@ -483,7 +483,7 @@ void API_ROUTINE isc_decode_timestamp(const GDS_TIMESTAMP* date, void* times_arg * Functional description * Convert from internal timestamp format to UNIX time structure. * - * Note: This routine is intended only for public API use. Engine itself and + * Note: This routine is intended only for public API use. Engine itself and * utilities should be using TimeStamp class directly in type-safe manner. * **************************************/ @@ -573,7 +573,7 @@ void API_ROUTINE isc_encode_timestamp(const void* times_arg, GDS_TIMESTAMP* date * Functional description * Convert from UNIX time structure to internal timestamp format. * - * Note: This routine is intended only for public API use. Engine itself and + * Note: This routine is intended only for public API use. Engine itself and * utilities should be using TimeStamp class directly in type-safe manner. * **************************************/ @@ -588,7 +588,7 @@ void GDS_breakpoint(int parameter) { /************************************** * - * G D S _ b r e a k p o i n t + * G D S _ b r e a k p o i n t * ************************************** * @@ -612,7 +612,7 @@ SINT64 API_ROUTINE isc_portable_integer(const UCHAR* ptr, SSHORT length) ************************************** * * Functional description - * Pick up (and convert) a Little Endian (VAX) style integer + * Pick up (and convert) a Little Endian (VAX) style integer * of length 1, 2, 4 or 8 bytes to local system's Endian format. * * various parameter blocks (i.e., dpb, tpb, spb) flatten out multibyte @@ -654,7 +654,7 @@ void API_ROUTINE gds_alloc_flag_unfreed(void *blk) * **************************************/ // JMB: need to rework this for the new pools -// Skidder: Not sure we need to rework this routine. +// Skidder: Not sure we need to rework this routine. // What we really need is to fix all memory leaks including very old. } @@ -663,7 +663,7 @@ void API_ROUTINE gds_alloc_report(ULONG flags, const char* filter_filename, int { /************************************** * - * g d s _ a l l o c _ r e p o r t + * g d s _ a l l o c _ r e p o r t * ************************************** * @@ -689,7 +689,7 @@ fb_interpret Translate a status code with arguments to a string. Return the length of the string while updating the vector address. If the message is null (end of messages) or invalid, return 0; - + @param s the output buffer where a human readable version of the error is put @param bufsize the size of the output buffer @param vector the input, the address of const pointer to the status vector @@ -729,7 +729,7 @@ SLONG API_ROUTINE gds__interprete(char* s, ISC_STATUS** vector) return safe_interpret(s, 1024, const_cast(vector), true); } - + /** safe_interpret @@ -833,7 +833,7 @@ static SLONG safe_interpret(char* const s, const size_t bufsize, // We'll silently truncate the parameter to our available space. while (--len) // CVC: Decrement first to make room for the null terminator. *p++ = *q++; - + *p++ = 0; } else // No space at all, pass the empty string. @@ -841,7 +841,7 @@ static SLONG safe_interpret(char* const s, const size_t bufsize, *arg++ = ""; safe << ""; } - + continue; default: @@ -853,7 +853,7 @@ static SLONG safe_interpret(char* const s, const size_t bufsize, // Handle primary code on a system by system basis - switch ((UCHAR) (*vector)[0]) + switch ((UCHAR) (*vector)[0]) { case isc_arg_warning: case isc_arg_gds: @@ -1012,10 +1012,10 @@ public: { CloseHandle(trace_mutex_handle); trace_mutex_handle = INVALID_HANDLE_VALUE; - + if (trace_file_handle != INVALID_HANDLE_VALUE) CloseHandle(trace_file_handle); - + trace_file_handle = INVALID_HANDLE_VALUE; } @@ -1045,19 +1045,19 @@ void API_ROUTINE gds__trace_raw(const char* text, unsigned int length) * This function tries to be async-signal safe * **************************************/ - if (!length) + if (!length) length = strlen(text); #ifdef WIN_NT // Note: thread-safe code - // Nickolay Samofatov, 12 Sept 2003. Windows open files extremely slowly. + // Nickolay Samofatov, 12 Sept 2003. Windows open files extremely slowly. // Slowly enough to make such trace useless. Thus we cache file handle ! WaitForSingleObject(CleanupTraceHandles::trace_mutex_handle, INFINITE); while (true) { if (CleanupTraceHandles::trace_file_handle == INVALID_HANDLE_VALUE) { TEXT name[MAXPATHLEN]; gds__prefix(name, LOGFILE); - // We do not care to close this file. + // We do not care to close this file. // It will be closed automatically when our process terminates. CleanupTraceHandles::trace_file_handle = CreateFile(name, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, @@ -1086,7 +1086,7 @@ void API_ROUTINE gds__trace_raw(const char* text, unsigned int length) int file = open(name, O_CREAT | O_APPEND | O_WRONLY, 0660); if (file == -1) return; - + write(file, text, length); close(file); #endif @@ -1105,12 +1105,12 @@ void API_ROUTINE gds__trace(const TEXT * text) * This function tries to be async-signal safe * **************************************/ - + const time_t now = time((time_t *)0); // is specified in POSIX to be signal-safe - + // 07 Sept 2003, Nickolay Samofatov. - // Since we cannot call ctime/localtime_r or anything else like this from - // signal hanlders we need to decode time by hand. + // Since we cannot call ctime/localtime_r or anything else like this from + // signal hanlders we need to decode time by hand. const int days = now / SECS_PER_DAY; int rem = now % SECS_PER_DAY; @@ -1208,7 +1208,7 @@ void API_ROUTINE gds__log(const TEXT* text, ...) FILE* file = fopen(name, "a"); if (file != NULL) { - fprintf(file, "\n%s%s\t%.25s\t", + fprintf(file, "\n%s%s\t%.25s\t", ISC_get_host(name, MAXPATHLEN), gdslogid, ctime(&now)); va_start(ptr, text); vfprintf(file, text, ptr); @@ -1233,7 +1233,7 @@ void API_ROUTINE gds__print_pool(MemoryPool* pool, const TEXT* text, ...) ************************************** * * Functional description - * Print pool contents to the log file. + * Print pool contents to the log file. * Preced it with normal log record as in gds__log * **************************************/ @@ -1258,7 +1258,7 @@ void API_ROUTINE gds__print_pool(MemoryPool* pool, const TEXT* text, ...) FILE* file = fopen(name, "a"); if (file != NULL) { - fprintf(file, "\n%s%s\t%.25s\t", + fprintf(file, "\n%s%s\t%.25s\t", ISC_get_host(name, MAXPATHLEN), gdslogid, ctime(&now)); va_start(ptr, text); vfprintf(file, text, ptr); @@ -1475,10 +1475,10 @@ SSHORT API_ROUTINE gds__msg_lookup(void* handle, Firebird::string::size_type pos = p.find_last_of('/'); if (pos == Firebird::string::npos) pos = p.find_last_of('\\'); - + if (pos != Firebird::string::npos) p.erase(0, pos + 1); - + fb_utils::snprintf(translated_msg_file, sizeof(translated_msg_file), MSG_FILE_LANG, p.c_str()); gds__prefix_msg(msg_file, translated_msg_file); @@ -1488,7 +1488,7 @@ SSHORT API_ROUTINE gds__msg_lookup(void* handle, } else status = 1; - + if (status) { /* Default to standard message file */ @@ -1509,7 +1509,7 @@ SSHORT API_ROUTINE gds__msg_lookup(void* handle, /* Search down index levels to the leaf. If we get lost, punt */ const ULONG code = MSG_NUMBER(facility, number); - const msgnod* const end = + const msgnod* const end = (msgnod*) ((char*) messageL->msg_bucket + messageL->msg_bucket_size); ULONG position = messageL->msg_top_tree; @@ -1539,7 +1539,7 @@ SSHORT API_ROUTINE gds__msg_lookup(void* handle, if (!status) { /* Search the leaf */ for (const msgrec* leaf = (msgrec*) messageL->msg_bucket; !status; - leaf = NEXT_LEAF(leaf)) + leaf = NEXT_LEAF(leaf)) { if (leaf >= (const msgrec*) end || leaf->msgrec_code > code) { status = -1; @@ -1668,7 +1668,7 @@ SLONG API_ROUTINE gds__get_prefix(SSHORT arg_type, const TEXT* passed_string) * it has very strange name, but to keep API as is leave it **************************************/ int count = 0; - + if (! passed_string) return -1; @@ -2084,8 +2084,8 @@ void API_ROUTINE gds__register_cleanup(FPTR_VOID_PTR routine, void* arg) * **************************************/ -/* - * Ifdef out for windows client. We have not implemented any way of +/* + * Ifdef out for windows client. We have not implemented any way of * determining when a task ends, therefore this never gets called. */ @@ -2138,7 +2138,7 @@ SLONG API_ROUTINE gds__sqlcode(const ISC_STATUS* status_vector) /* SQL code -999 (GENERIC_SQLCODE) is generic, meaning "no other sql code * known". Now scan the status vector, seeing if there is ANY sqlcode - * reported. Make note of the first error in the status vector who's + * reported. Make note of the first error in the status vector who's * SQLCODE is NOT -999, that will be the return code if there is no specific * sqlerr reported. */ @@ -2249,7 +2249,7 @@ void API_ROUTINE fb_sqlstate(char* sqlstate, const ISC_STATUS* status_vector) ++s; if (s >= last_status) break; - + const char* state = (char*) *s; // easy, next argument points to sqlstate string fb_utils::copy_terminate(sqlstate, state, FB_SQLSTATE_SIZE); have_sqlstate = true; @@ -2279,7 +2279,7 @@ void API_ROUTINE fb_sqlstate(char* sqlstate, const ISC_STATUS* status_vector) ++s; if (s >= last_status) break; - + const SLONG gdscode = (const SLONG) *s; if (gdscode != 0) { @@ -2292,7 +2292,7 @@ void API_ROUTINE fb_sqlstate(char* sqlstate, const ISC_STATUS* status_vector) int first = 0; int last = FB_NELEM(gds__sql_states) - 1; while (first <= last) - { + { const int mid = (first + last) / 2; const SLONG new_code = gds__sql_states[mid].gds_code; if (gdscode > new_code) @@ -2364,11 +2364,11 @@ void* API_ROUTINE gds__temp_file( * Create and open a temp file with a given location. * Unless the address of a buffer for the expanded file name string is * given, make up the file "pre-deleted". Return -1 on failure. - * If unlink_flag is TRUE than file is marked as pre-deleted even if + * If unlink_flag is TRUE than file is marked as pre-deleted even if * expanded_string is not NULL. - * NOTE + * NOTE * Function returns untyped handle that needs to be casted to either FILE - * or used as file descriptor. This is ugly and needs to be fixed probably + * or used as file descriptor. This is ugly and needs to be fixed probably * via introducing two functions with different return types. * **************************************/ @@ -2420,10 +2420,10 @@ void API_ROUTINE gds__unregister_cleanup(FPTR_VOID_PTR routine, void *arg) Firebird::MutexLockGuard guard(cleanup_handlers_mutex); for (CLEAN* clean_ptr = &cleanup_handlers; clean = *clean_ptr; - clean_ptr = &clean->clean_next) + clean_ptr = &clean->clean_next) { if (clean->clean_routine == routine - && clean->clean_arg == arg) + && clean->clean_arg == arg) { *clean_ptr = clean->clean_next; gds__free(clean); @@ -2446,10 +2446,10 @@ BOOLEAN API_ROUTINE gds__validate_lib_path(const TEXT* module, * * Functional description * Find the external library path variable. - * Validate that the path to the library module name + * Validate that the path to the library module name * in the path specified. If the external lib path - * is not defined then accept any path, and return - * TRUE. If the module is in the path then return TRUE + * is not defined then accept any path, and return + * TRUE. If the module is in the path then return TRUE * else, if the module is not in the path return FALSE. * **************************************/ @@ -2490,7 +2490,7 @@ BOOLEAN API_ROUTINE gds__validate_lib_path(const TEXT* module, if ((p != path) && ((p[-1] == '/') || (p[-1] == '\\'))) p[-1] = 0; if ((EXPAND_PATH(path, abs_path)) - && (!COMPARE_PATH(abs_path, abs_module_path))) + && (!COMPARE_PATH(abs_path, abs_module_path))) { strncpy(resolved_module, abs_module, length); resolved_module[length - 1] = 0; @@ -2518,7 +2518,7 @@ SLONG API_ROUTINE gds__vax_integer(const UCHAR* ptr, SSHORT length) **************************************/ if (!ptr || length <= 0 || length > 4) return 0; - + SLONG value = 0; for (int shift = 0; --length >= 0; shift += 8) { @@ -2602,13 +2602,13 @@ void API_ROUTINE isc_print_sqlerror(SSHORT sqlcode, const ISC_STATUS* status) TEXT* p = error_buffer; while (*p) p++; - + isc_sql_interprete(sqlcode, p, (SSHORT) (sizeof(error_buffer) - (p - error_buffer) - 2)); while (*p) p++; - + *p++ = '\n'; *p = 0; gds__put_error(error_buffer); @@ -3279,7 +3279,7 @@ static void blr_print_verb(gds_ctl* control, SSHORT level) else blr_print_word(control); break; - + case op_exec_into: { blr_print_verb(control, level); if (! blr_print_byte(control)) { @@ -3291,14 +3291,14 @@ static void blr_print_verb(gds_ctl* control, SSHORT level) break; } - case op_exec_stmt: + case op_exec_stmt: { offset = blr_print_line(control, offset); - static const char* sub_codes[] = + static const char* sub_codes[] = { NULL, "inputs", - "outputs", + "outputs", "sql", "proc_block", "data_src", @@ -3311,7 +3311,7 @@ static void blr_print_verb(gds_ctl* control, SSHORT level) "in_params2", "out_params" }; - + int inputs = 0; int outputs = 0; while ((blr_operator = BLR_BYTE) != blr_end) @@ -3345,7 +3345,7 @@ static void blr_print_verb(gds_ctl* control, SSHORT level) blr_print_byte(control); offset = blr_print_line(control, offset); break; - + case blr_exec_stmt_privs: offset = blr_print_line(control, offset); break; @@ -3354,16 +3354,16 @@ static void blr_print_verb(gds_ctl* control, SSHORT level) case blr_exec_stmt_in_params2: offset = blr_print_line(control, offset); level++; - while (inputs) + while (inputs) { // input param name if (blr_operator == blr_exec_stmt_in_params2) { blr_indent(control, level); - int len = blr_print_byte(control); - while (len--) + int len = blr_print_byte(control); + while (len--) blr_print_char(control); - + offset = blr_print_line(control, offset); } --inputs; @@ -3376,7 +3376,7 @@ static void blr_print_verb(gds_ctl* control, SSHORT level) case blr_exec_stmt_out_params: offset = blr_print_line(control, offset); level++; - while (outputs) + while (outputs) { --outputs; blr_print_verb(control, level); // param expression @@ -3392,7 +3392,7 @@ static void blr_print_verb(gds_ctl* control, SSHORT level) // print blr_end control->ctl_blr--; - blr_print_verb(control, level); + blr_print_verb(control, level); break; } @@ -3471,7 +3471,7 @@ void gds__cleanup() CLEAN clean; initialized = false; - Firebird::InstanceControl::registerGdsCleanup(0); + Firebird::InstanceControl::registerGdsCleanup(0); while ( (clean = cleanup_handlers) ) { cleanup_handlers = clean->clean_next; @@ -3524,11 +3524,11 @@ static void init(void) new_max.rlim_cur = new_max.rlim_max = old.rlim_max; if (!setrlimit(RLIMIT_NOFILE, &new_max)) { -#if _FILE_OFFSET_BITS == 64 +#if _FILE_OFFSET_BITS == 64 gds__log("64 bit i/o support is on."); gds__log("Open file limit increased from %lld to %lld", old.rlim_cur, new_max.rlim_cur); - + #else gds__log("Open file limit increased from %d to %d", old.rlim_cur, new_max.rlim_cur); @@ -3659,7 +3659,7 @@ public: // Find appropiate temp directory Firebird::PathName tempDir; - if (!fb_utils::readenv(FB_TMP_ENV, tempDir)) + if (!fb_utils::readenv(FB_TMP_ENV, tempDir)) { #ifdef WIN_NT const DWORD len = GetTempPath(sizeof(fbTempDir), fbTempDir); @@ -3733,7 +3733,7 @@ static bool GetProgramFilesDir(Firebird::PathName& output) #ifdef WIN_NT const char* pdir = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion"; const char* pvalue = "ProgramFilesDir"; - + HKEY hkey; LONG rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, pdir, 0, KEY_READ, &hkey); if (rc != ERROR_SUCCESS) @@ -3746,7 +3746,7 @@ static bool GetProgramFilesDir(Firebird::PathName& output) RegCloseKey(hkey); return false; } - + output.reserve(size); BYTE* answer = reinterpret_cast(output.begin()); rc = RegQueryValueEx(hkey, pvalue, NULL, &type, answer, &size); diff --git a/src/jrd/idx.cpp b/src/jrd/idx.cpp index 19445ec3ad..cb4379cd00 100644 --- a/src/jrd/idx.cpp +++ b/src/jrd/idx.cpp @@ -136,7 +136,7 @@ void IDX_check_access(thread_db* tdbb, CompilerScratch* csb, jrd_rel* view, jrd_ (index_root_page*) CCH_FETCH(tdbb, &referenced_window, LCK_read, pag_root); index_desc referenced_idx; if (!BTR_description(tdbb, referenced_relation, referenced_root, - &referenced_idx, index_id)) + &referenced_idx, index_id)) { BUGCHECK(173); /* msg 173 referenced index description not found */ } @@ -148,7 +148,7 @@ void IDX_check_access(thread_db* tdbb, CompilerScratch* csb, jrd_rel* view, jrd_ const jrd_fld* referenced_field = MET_get_field(referenced_relation, idx_desc->idx_field); CMP_post_access(tdbb, csb, - referenced_relation->rel_security_name, + referenced_relation->rel_security_name, (view ? view->rel_id : 0), SCL_sql_references, "TABLE", referenced_relation->rel_name); @@ -174,7 +174,7 @@ bool IDX_check_master_types (thread_db* tdbb, index_desc& idx, jrd_rel* partner_ * Functional description * Check if both indices of foreign key constraint * has compatible data types in appropriate segments. - * Called when detail index is created after idx_itype + * Called when detail index is created after idx_itype * was assigned * **********************************************/ @@ -183,14 +183,14 @@ bool IDX_check_master_types (thread_db* tdbb, index_desc& idx, jrd_rel* partner_ index_desc partner_idx; - // get the index root page for the partner relation + // get the index root page for the partner relation WIN window(get_root_page(tdbb, partner_relation)); index_root_page* root = (index_root_page*) CCH_FETCH(tdbb, &window, LCK_read, pag_root); - // get the description of the partner index + // get the description of the partner index if (!BTR_description(tdbb, partner_relation, root, &partner_idx, idx.idx_primary_index)) BUGCHECK(175); /* msg 175 partner index description not found */ - + CCH_RELEASE(tdbb, &window); // make sure partner index have the same segment count as our @@ -261,13 +261,13 @@ void IDX_create_index( const bool isDescending = (idx->idx_flags & idx_descending); const bool isPrimary = (idx->idx_flags & idx_primary); - // hvlad: in ODS11 empty string and NULL values can have the same binary - // representation in index keys. BTR can distinguish it by the key_length - // but SORT module currently don't take it into account. Therefore add to - // the index key one byte prefix with 0 for NULL value and 1 for not-NULL + // hvlad: in ODS11 empty string and NULL values can have the same binary + // representation in index keys. BTR can distinguish it by the key_length + // but SORT module currently don't take it into account. Therefore add to + // the index key one byte prefix with 0 for NULL value and 1 for not-NULL // value to produce right sorting. // BTR\fast_load will remove this one byte prefix from the index key. - // Note that this is necessary only for single-segment ascending indexes + // Note that this is necessary only for single-segment ascending indexes // and only for ODS11 and higher. const int nullIndLen = isODS11 && !isDescending && (idx->idx_count == 1) ? 1 : 0; @@ -372,14 +372,14 @@ void IDX_create_index( secondary.rpb_line = secondary.rpb_b_line; } - while (stack.hasData()) + while (stack.hasData()) { Record* record = stack.pop(); /* If foreign key index is being defined, make sure foreign key definition will not be violated */ - if (idx->idx_flags & idx_foreign) + if (idx->idx_flags & idx_foreign) { idx_null_state null_state; /* find out if there is a null segment by faking uniqueness -- @@ -389,7 +389,7 @@ void IDX_create_index( idx->idx_flags |= idx_unique; result = BTR_key(tdbb, relation, record, idx, &key, &null_state, false); idx->idx_flags &= ~idx_unique; - } + } else { result = BTR_key(tdbb, relation, record, idx, &key, &null_state, false); } @@ -410,14 +410,14 @@ void IDX_create_index( BTR_key(tdbb, relation, record, idx, &key, &null_state, false); key_is_null = (null_state == idx_nulls_all); - if (isPrimary && null_state != idx_nulls_none) + if (isPrimary && null_state != idx_nulls_none) { fb_assert(key.key_null_segment < idx->idx_count); const USHORT bad_id = idx->idx_rpt[key.key_null_segment].idx_field; const jrd_fld *bad_fld = MET_get_field(relation, bad_id); - ERR_post(Arg::Gds(isc_not_valid) << Arg::Str(bad_fld->fld_name) << + ERR_post(Arg::Gds(isc_not_valid) << Arg::Str(bad_fld->fld_name) << Arg::Str(NULL_STRING_MARK)); } } @@ -628,7 +628,7 @@ void IDX_delete_indices(thread_db* tdbb, jrd_rel* relation, RelationPages* relPa const bool is_temp = (relation->rel_flags & REL_temp_conn) && (relPages->rel_instance_id != 0); - for (i = 0; i < root->irt_count; i++) + for (i = 0; i < root->irt_count; i++) { const bool tree_exists = BTR_delete_index(tdbb, &window, i); root = (index_root_page*) CCH_FETCH(tdbb, &window, LCK_write, pag_root); @@ -661,7 +661,7 @@ IDX_E IDX_erase(thread_db* tdbb, * * Functional description * Check the various indices prior to an ERASE operation. - * If one is a primary key, check its partner for + * If one is a primary key, check its partner for * a duplicate record. * **************************************/ @@ -689,8 +689,8 @@ IDX_E IDX_erase(thread_db* tdbb, } -void IDX_garbage_collect(thread_db* tdbb, - record_param* rpb, +void IDX_garbage_collect(thread_db* tdbb, + record_param* rpb, RecordStack& going, RecordStack& staying) { @@ -730,7 +730,7 @@ void IDX_garbage_collect(thread_db* tdbb, /* Cancel index if there are duplicates in the remaining records */ - + RecordStack::iterator stack2(stack1); for (++stack2; stack2.hasData(); ++stack2) { @@ -743,7 +743,7 @@ void IDX_garbage_collect(thread_db* tdbb, } if (stack2.hasData()) continue; - + /* Make sure the index doesn't exist in any record remaining */ @@ -879,7 +879,7 @@ IDX_E IDX_modify_check_constraints(thread_db* tdbb, could be established by primary key/foreign key or unique key/foreign key */ while (BTR_next_index - (tdbb, org_rpb->rpb_relation, transaction, &idx, &window)) + (tdbb, org_rpb->rpb_relation, transaction, &idx, &window)) { if (!(idx.idx_flags & (idx_primary | idx_unique)) || !MET_lookup_partner(tdbb, org_rpb->rpb_relation, &idx, 0)) @@ -971,12 +971,12 @@ IDX_E IDX_store(thread_db* tdbb, WIN window(relPages->rel_pg_space_id, -1); while (BTR_next_index - (tdbb, rpb->rpb_relation, transaction, &idx, &window)) + (tdbb, rpb->rpb_relation, transaction, &idx, &window)) { *bad_index = idx.idx_id; *bad_relation = rpb->rpb_relation; if ( (error_code = - BTR_key(tdbb, rpb->rpb_relation, rpb->rpb_record, &idx, &key, 0, false)) ) + BTR_key(tdbb, rpb->rpb_relation, rpb->rpb_record, &idx, &key, 0, false)) ) { CCH_RELEASE(tdbb, &window); break; @@ -1040,7 +1040,7 @@ static IDX_E check_duplicates( if (rpb.rpb_number != insertion->iib_number && VIO_get_current(tdbb, &old_rpb, &rpb, insertion->iib_transaction, tdbb->getDefaultPool(), - is_fk, + is_fk, has_old_values) ) { // dimitr: we shouldn't ignore status exceptions which take place @@ -1075,18 +1075,18 @@ static IDX_E check_duplicates( break; } - /* check the values of the fields in the record being inserted with the - record retrieved -- for unique indexes the insertion index and the + /* check the values of the fields in the record being inserted with the + record retrieved -- for unique indexes the insertion index and the record index are the same, but for foreign keys they are different */ - + if (record_idx->idx_flags & idx_expressn) { bool flag_idx; const dsc* desc_idx = BTR_eval_expression(tdbb, record_idx, record, flag_idx); - - /* hvlad: BTR_eval_expression call EVL_expr which returns impure->vlu_desc. - Since record_idx and insertion_idx are the same indexes second call to - BTR_eval_expression will overwrite value from first call. So we must + + /* hvlad: BTR_eval_expression call EVL_expr which returns impure->vlu_desc. + Since record_idx and insertion_idx are the same indexes second call to + BTR_eval_expression will overwrite value from first call. So we must save first result into another dsc */ @@ -1097,10 +1097,10 @@ static IDX_E check_duplicates( memmove(desc1.dsc_address, desc_idx->dsc_address, desc_idx->dsc_length); bool flag_rec = false; - const dsc* desc_rec = has_cur_values ? + const dsc* desc_rec = has_cur_values ? BTR_eval_expression(tdbb, insertion_idx, rpb.rpb_record, flag_rec) : NULL; - const bool equal_cur = has_cur_values && flag_rec && flag_idx && + const bool equal_cur = has_cur_values && flag_rec && flag_idx && (MOV_compare(desc_rec, &desc1) == 0); if (!is_fk && equal_cur) { @@ -1112,7 +1112,7 @@ static IDX_E check_duplicates( { desc_rec = BTR_eval_expression(tdbb, insertion_idx, old_rpb.rpb_record, flag_rec); - const bool equal_old = flag_rec && flag_idx && + const bool equal_old = flag_rec && flag_idx && (MOV_compare(desc_rec, &desc1) == 0); if (is_fk) { @@ -1133,7 +1133,7 @@ static IDX_E check_duplicates( { bool all_nulls = true; USHORT i; - for (i = 0; i < insertion_idx->idx_count; i++) + for (i = 0; i < insertion_idx->idx_count; i++) { bool flag_cur = false; USHORT field_id = record_idx->idx_rpt[i].idx_field; @@ -1142,14 +1142,14 @@ static IDX_E check_duplicates( if (has_cur_values) { field_id = insertion_idx->idx_rpt[i].idx_field; - /* In order to "map a null to a default" value (in EVL_field()), - * the relation block is referenced. - * Reference: Bug 10116, 10424 + /* In order to "map a null to a default" value (in EVL_field()), + * the relation block is referenced. + * Reference: Bug 10116, 10424 */ flag_cur = EVL_field(relation_1, rpb.rpb_record, field_id, &desc1); } - const bool not_equal_cur = !has_cur_values || + const bool not_equal_cur = !has_cur_values || has_cur_values && ( (flag_cur != flag_idx) || (MOV_compare(&desc1, &desc2) != 0) ); if ((is_fk || !has_old_values) && not_equal_cur) @@ -1213,7 +1213,7 @@ static IDX_E check_foreign_key( * * Functional description * The passed index participates in a foreign key. - * Check the passed record to see if a corresponding + * Check the passed record to see if a corresponding * record appears in the partner index. * **************************************/ @@ -1250,7 +1250,7 @@ static IDX_E check_foreign_key( index_id = (*idx->idx_foreign_indexes)[index_number]; - if ((relation->rel_flags & REL_temp_conn) && + if ((relation->rel_flags & REL_temp_conn) && (partner_relation->rel_flags & REL_temp_tran)) { jrd_rel::RelPagesSnapshot pagesSnapshot(tdbb, partner_relation); @@ -1260,7 +1260,7 @@ static IDX_E check_foreign_key( { RelationPages* partnerPages = pagesSnapshot[i]; tdbb->tdbb_temp_traid = partnerPages->rel_instance_id; - if ( (result = check_partner_index(tdbb, relation, record, + if ( (result = check_partner_index(tdbb, relation, record, transaction, idx, partner_relation, index_id)) ) { break; @@ -1271,9 +1271,9 @@ static IDX_E check_foreign_key( if (result) break; } - else + else { - if ( (result = check_partner_index(tdbb, relation, record, + if ( (result = check_partner_index(tdbb, relation, record, transaction, idx, partner_relation, index_id)) ) { break; @@ -1313,7 +1313,7 @@ static IDX_E check_partner_index( * * Functional description * The passed index participates in a foreign key. - * Check the passed record to see if a corresponding + * Check the passed record to see if a corresponding * record appears in the partner index. * **************************************/ @@ -1357,9 +1357,9 @@ static IDX_E check_partner_index( segment = idx->idx_count; /* get the key in the original index */ - // AB: Fake the index to be an unique index, because the INTL makes + // AB: Fake the index to be an unique index, because the INTL makes // different keys depending on unique index or not. - // The key build should be exactly the same as stored in the + // The key build should be exactly the same as stored in the // unique index, because a comparison is done on both keys. index_desc tmpIndex = *idx; // ASF: Was incorrect to verify broken foreign keys. @@ -1373,7 +1373,7 @@ static IDX_E check_partner_index( /* now check for current duplicates */ if (result == idx_e_ok) { - /* fill out a retrieval block for the purpose of + /* fill out a retrieval block for the purpose of generating a bitmap of duplicate records */ IndexRetrieval retrieval; @@ -1392,7 +1392,7 @@ static IDX_E check_partner_index( if (partner_idx.idx_flags & idx_descending) { retrieval.irb_generic |= irb_descending; } - if ((idx->idx_flags & idx_descending) != + if ((idx->idx_flags & idx_descending) != (partner_idx.idx_flags & idx_descending)) { BTR_complement_key(&key); @@ -1492,7 +1492,7 @@ static int index_block_flush(void* ast_object) * Functional description * An exclusive lock has been requested on the * index block. The information in the cached - * index block is no longer valid, so clear it + * index block is no longer valid, so clear it * out and release the lock. * **************************************/ @@ -1535,8 +1535,8 @@ static IDX_E insert_key( ************************************** * * Functional description - * Insert a key in the index. - * If this is a unique index, check for active duplicates. + * Insert a key in the index. + * If this is a unique index, check for active duplicates. * If this is a foreign key, check for duplicates in the * primary key index. * @@ -1562,8 +1562,8 @@ static IDX_E insert_key( return result; } -/* if we are dealing with a foreign key index, - check for an insert into the corresponding +/* if we are dealing with a foreign key index, + check for an insert into the corresponding primary key index */ if (idx->idx_flags & idx_foreign) { /* find out if there is a null segment by faking uniqueness -- @@ -1587,9 +1587,9 @@ static IDX_E insert_key( } -void IDX_modify_flag_uk_modified(thread_db* tdbb, - record_param* org_rpb, - record_param* new_rpb, +void IDX_modify_flag_uk_modified(thread_db* tdbb, + record_param* org_rpb, + record_param* new_rpb, jrd_tra* transaction) { /************************************** @@ -1599,9 +1599,9 @@ void IDX_modify_flag_uk_modified(thread_db* tdbb, ************************************** * * Functional description - * Set record flag if key field value was changed by this update or - * if this is second update of this record in the same transaction and - * flag is already set by one of the previous update. + * Set record flag if key field value was changed by this update or + * if this is second update of this record in the same transaction and + * flag is already set by one of the previous update. * **************************************/ @@ -1611,7 +1611,7 @@ void IDX_modify_flag_uk_modified(thread_db* tdbb, (org_rpb->rpb_transaction_nr == new_rpb->rpb_transaction_nr)) { new_rpb->rpb_flags |= rpb_uk_modified; - return; + return; } RelationPages* relPages = org_rpb->rpb_relation->getPages(tdbb); @@ -1638,7 +1638,7 @@ void IDX_modify_flag_uk_modified(thread_db* tdbb, if (flag_org != flag_new || MOV_compare(&desc1, &desc2) != 0) { - new_rpb->rpb_flags |= rpb_uk_modified; + new_rpb->rpb_flags |= rpb_uk_modified; CCH_RELEASE(tdbb, &window); return; } @@ -1698,7 +1698,7 @@ static void signal_index_deletion(thread_db* tdbb, jrd_rel* relation, USHORT id) ************************************** * * Functional description - * On delete of an index, force all + * On delete of an index, force all * processes to get rid of index info. * **************************************/ diff --git a/src/jrd/inf.cpp b/src/jrd/inf.cpp index 8787b00f28..01e3d5d23c 100644 --- a/src/jrd/inf.cpp +++ b/src/jrd/inf.cpp @@ -30,8 +30,8 @@ * 2001.11.28 Ann Harrison - the dbb has to be refreshed before reporting * oldest_transaction, oldest_active, oldest_snapshot and next_transaction. * - * 2001.11.29 Paul Reeves - Added refresh of dbb to ensure forced_writes - * reports correctly when called immediately after a create database + * 2001.11.29 Paul Reeves - Added refresh of dbb to ensure forced_writes + * reports correctly when called immediately after a create database * operation. */ @@ -106,7 +106,7 @@ void INF_blob_info(const blb* blob, const SCHAR* const end_items = items + item_length; const SCHAR* const end = info + output_length; SCHAR* start_info; - + if (*items == isc_info_length) { start_info = info; items++; @@ -440,7 +440,7 @@ void INF_database_info(const SCHAR* items, case isc_info_creation_date: { const ISC_TIMESTAMP ts = dbb->dbb_creation_date.value(); - length = INF_convert(ts.timestamp_date, p); + length = INF_convert(ts.timestamp_date, p); p += length; length += INF_convert(ts.timestamp_time, p); } @@ -505,7 +505,7 @@ void INF_database_info(const SCHAR* items, { // scope SLONG cnt = 0; for (id = transaction->tra_oldest_active; - id < transaction->tra_number; id++) + id < transaction->tra_number; id++) { if (TRA_snapshot_state(tdbb, transaction, id) == tra_active) { cnt++; @@ -543,7 +543,7 @@ void INF_database_info(const SCHAR* items, { if (att->att_flags & ATT_shutdown) continue; - + const UserId* user = att->att_user; if (user) { const char* user_name = user->usr_user_name.hasData() ? @@ -857,7 +857,7 @@ void INF_request_info(const jrd_req* request, const SCHAR* const end_items = items + item_length; const SCHAR* const end = info + output_length; SCHAR* start_info; - + if (*items == isc_info_length) { start_info = info; items++; @@ -1011,7 +1011,7 @@ void INF_transaction_info(const jrd_tra* transaction, const SCHAR* const end_items = items + item_length; const SCHAR* const end = info + output_length; SCHAR* start_info; - + if (*items == isc_info_length) { start_info = info; items++; @@ -1042,7 +1042,7 @@ void INF_transaction_info(const jrd_tra* transaction, case isc_info_tra_oldest_active: length = INF_convert( - transaction->tra_lock ? transaction->tra_lock->lck_data : 0, + transaction->tra_lock ? transaction->tra_lock->lck_data : 0, buffer); break; diff --git a/src/jrd/intl.cpp b/src/jrd/intl.cpp index e85eeb5ba8..f602db6977 100644 --- a/src/jrd/intl.cpp +++ b/src/jrd/intl.cpp @@ -319,7 +319,7 @@ Collation* CharSetContainer::lookupCollation(thread_db* tdbb, USHORT tt_id) if (!lookup_texttype(tt, &info)) { delete tt; - ERR_post(Arg::Gds(isc_collation_not_installed) << Arg::Str(info.collationName) << + ERR_post(Arg::Gds(isc_collation_not_installed) << Arg::Str(info.collationName) << Arg::Str(info.charsetName)); } @@ -1250,7 +1250,7 @@ static int blocking_ast_collation(void* ast_object) ThreadContextHolder tdbb; tdbb->setDatabase(dbb); tdbb->setAttachment(tt->existenceLock->lck_attachment); - + Jrd::ContextPoolHolder context(tdbb, 0); LCK_release(tdbb, tt->existenceLock); diff --git a/src/jrd/intl_builtin.cpp b/src/jrd/intl_builtin.cpp index d1192a30fd..73017fabbf 100644 --- a/src/jrd/intl_builtin.cpp +++ b/src/jrd/intl_builtin.cpp @@ -17,7 +17,7 @@ using Firebird::IntlUtil; using Jrd::UnicodeUtil; - + static USHORT internal_keylength(texttype*, USHORT); static USHORT internal_string_to_key(texttype*, USHORT, const UCHAR*, USHORT, UCHAR*, USHORT); @@ -669,9 +669,9 @@ static USHORT utf16_string_to_key( static SSHORT utf16_compare( texttype* obj, - ULONG len1, - const UCHAR* str1, - ULONG len2, + ULONG len1, + const UCHAR* str1, + ULONG len2, const UCHAR* str2, INTL_BOOL* error_flag) { @@ -702,9 +702,9 @@ static SSHORT utf16_compare( static ULONG utf16_upper( texttype* obj, - ULONG srcLen, - const UCHAR* src, - ULONG dstLen, + ULONG srcLen, + const UCHAR* src, + ULONG dstLen, UCHAR* dst) { /************************************** @@ -726,9 +726,9 @@ static ULONG utf16_upper( static ULONG utf16_lower( texttype* obj, - ULONG srcLen, - const UCHAR* src, - ULONG dstLen, + ULONG srcLen, + const UCHAR* src, + ULONG dstLen, UCHAR* dst) { /************************************** @@ -896,7 +896,7 @@ static ULONG wc_to_mb(csconvert* obj, ULONG nSrc, const UCHAR* ppSrc, { /************************************** * - * w c _ t o _ m b + * w c _ t o _ m b * ************************************** * @@ -1127,10 +1127,10 @@ static INTL_BOOL ttype_utf32_init(texttype* tt, const ASCII* texttype_name, cons /* - * Start of Character set definitions + * Start of Character set definitions */ -static INTL_BOOL cs_utf8_well_formed(charset* cs, +static INTL_BOOL cs_utf8_well_formed(charset* cs, ULONG len, const UCHAR* str, ULONG* offending_position) @@ -1151,7 +1151,7 @@ static INTL_BOOL cs_utf8_well_formed(charset* cs, } -static INTL_BOOL cs_utf16_well_formed(charset* cs, +static INTL_BOOL cs_utf16_well_formed(charset* cs, ULONG len, const UCHAR* str, ULONG* offending_position) @@ -1172,7 +1172,7 @@ static INTL_BOOL cs_utf16_well_formed(charset* cs, } -static ULONG cs_utf16_length(charset* cs, +static ULONG cs_utf16_length(charset* cs, ULONG srcLen, const UCHAR* src) { @@ -1191,7 +1191,7 @@ static ULONG cs_utf16_length(charset* cs, } -static ULONG cs_utf16_substring(charset* cs, +static ULONG cs_utf16_substring(charset* cs, ULONG srcLen, const UCHAR* src, ULONG dstLen, @@ -1216,7 +1216,7 @@ static ULONG cs_utf16_substring(charset* cs, } -static INTL_BOOL cs_utf32_well_formed(charset* cs, +static INTL_BOOL cs_utf32_well_formed(charset* cs, ULONG len, const UCHAR* str, ULONG* offending_position) @@ -1333,11 +1333,11 @@ static ULONG cvt_utffss_to_ascii(csconvert* obj, ULONG nSrc, const UCHAR* pSrc, { /************************************** * - * c v t _ u t f f s s _ t o _ a s c i i + * c v t _ u t f f s s _ t o _ a s c i i * also - * c v t _ a s c i i _ t o _ u t f f s s + * c v t _ a s c i i _ t o _ u t f f s s * also - * c v t _ n o n e _ t o _ u t f f s s + * c v t _ n o n e _ t o _ u t f f s s * ************************************** * @@ -1389,7 +1389,7 @@ static ULONG cvt_unicode_to_utf8(csconvert* obj, { fb_assert(obj != NULL); fb_assert(obj->csconvert_fn_convert == cvt_unicode_to_utf8); - return UnicodeUtil::utf16ToUtf8(unicode_len, Firebird::Aligner(unicode_str, unicode_len), + return UnicodeUtil::utf16ToUtf8(unicode_len, Firebird::Aligner(unicode_str, unicode_len), utf8_len, utf8_str, err_code, err_position); } @@ -1404,7 +1404,7 @@ static ULONG cvt_utf8_to_unicode(csconvert* obj, { fb_assert(obj != NULL); fb_assert(obj->csconvert_fn_convert == cvt_utf8_to_unicode); - return UnicodeUtil::utf8ToUtf16(utf8_len, utf8_str, + return UnicodeUtil::utf8ToUtf16(utf8_len, utf8_str, unicode_len, Firebird::OutAligner(unicode_str, unicode_len), err_code, err_position); } @@ -1419,7 +1419,7 @@ static ULONG cvt_unicode_to_utf32(csconvert* obj, { fb_assert(obj != NULL); fb_assert(obj->csconvert_fn_convert == cvt_unicode_to_utf32); - return UnicodeUtil::utf16ToUtf32(unicode_len, Firebird::Aligner(unicode_str, unicode_len), + return UnicodeUtil::utf16ToUtf32(unicode_len, Firebird::Aligner(unicode_str, unicode_len), utf32_len, Firebird::OutAligner(utf32_str, utf32_len), err_code, err_position); } @@ -1435,7 +1435,7 @@ static ULONG cvt_utf32_to_unicode(csconvert* obj, fb_assert(obj != NULL); fb_assert(obj->csconvert_fn_convert == cvt_utf32_to_unicode); - return UnicodeUtil::utf32ToUtf16(utf32_len, Firebird::Aligner(utf32_str, utf32_len), + return UnicodeUtil::utf32ToUtf16(utf32_len, Firebird::Aligner(utf32_str, utf32_len), unicode_len, Firebird::OutAligner(unicode_str, unicode_len), err_code, err_position); } diff --git a/src/jrd/isc_file.cpp b/src/jrd/isc_file.cpp index abe60ff0f3..dfce4f324d 100644 --- a/src/jrd/isc_file.cpp +++ b/src/jrd/isc_file.cpp @@ -172,13 +172,13 @@ namespace { #if (defined AIX || defined AIX_PPC) TEXT* temp; int context; - + osMtab(); ~osMtab() { delete[] temp; } bool ok() const { return temp ? true : false; } #else FILE* mtab; - + osMtab() : mtab(MTAB_OPEN(MTAB, "r")) { } ~osMtab() { if (mtab) MTAB_CLOSE(mtab); } bool ok() const { return mtab; } @@ -196,7 +196,7 @@ namespace { osMtab mtab; #endif // DARWIN public: -/* Mnt() : AutoMemory(), mtab(), node(getPool()), +/* Mnt() : AutoMemory(), mtab(), node(getPool()), mount(getPool()), path(getPool()) { } */ #ifdef DARWIN Mnt(); @@ -210,7 +210,7 @@ namespace { path; /* path on remote server */ }; #endif //NO_NFS -} // anonymous namespace +} // anonymous namespace #if (!defined NO_NFS || defined FREEBSD || defined NETBSD) static void expand_filename2(tstring&, bool); @@ -249,7 +249,7 @@ bool ISC_analyze_nfs(tstring& expanded_filename, tstring& node_name) // If we are ignoring NFS remote mounts then do not bother checking here // and pretend it's only local. MOD 16-Nov-2002 - + if (Config::getRemoteFileOpenAbility()) { return false; } @@ -259,7 +259,7 @@ bool ISC_analyze_nfs(tstring& expanded_filename, tstring& node_name) // Search mount points Mnt mount; - if (!mount.ok()) + if (!mount.ok()) { return false; } @@ -271,11 +271,11 @@ bool ISC_analyze_nfs(tstring& expanded_filename, tstring& node_name) // if the whole mount point is not contained in the expanded_filename // or the mount point is not a valid pathname in the expanded_filename, // skip it - if (expanded_filename.length() <= mount.mount.length() + if (expanded_filename.length() <= mount.mount.length() || expanded_filename.compare(0, mount.mount.length(), mount.mount) != 0 || expanded_filename[mount.mount.length()] != '/') { - if (mount.mount == "/" && mount.path.hasData()) + if (mount.mount == "/" && mount.path.hasData()) { // root mount point = diskless client case mount.path += '/'; @@ -287,15 +287,15 @@ bool ISC_analyze_nfs(tstring& expanded_filename, tstring& node_name) } // the longest mount point contained in the expanded_filename wins - if (mount.mount.length() >= len) + if (mount.mount.length() >= len) { len = mount.mount.length(); - if (mount.node.hasData()) + if (mount.node.hasData()) { max_node = mount.node; max_path = mount.path; } - else + else { max_node = ""; max_path = ""; @@ -312,7 +312,7 @@ bool ISC_analyze_nfs(tstring& expanded_filename, tstring& node_name) node name and expanded_filename with the remote file name. */ bool flag = !max_path.isEmpty(); - if (flag) + if (flag) { expanded_filename.replace(0, len, max_path); node_name = max_node; @@ -442,10 +442,10 @@ bool ISC_check_if_remote(const tstring& file_name, bool implicit_flag) return ISC_extract_host(temp_name, host_name, implicit_flag) != ISC_PROTOCOL_LOCAL; } - -iscProtocol ISC_extract_host(Firebird::PathName& file_name, + +iscProtocol ISC_extract_host(Firebird::PathName& file_name, Firebird::PathName& host_name, - bool implicit_flag) + bool implicit_flag) { /************************************** * @@ -459,7 +459,7 @@ iscProtocol ISC_extract_host(Firebird::PathName& file_name, * analyze the path to see if it resolves to a * file on a remote machine. Otherwise, simply * check for an explicit node name. - * If file is found to be remote, extract + * If file is found to be remote, extract * the node name and compute the residual file name. * Return protocol type. * @@ -467,16 +467,16 @@ iscProtocol ISC_extract_host(Firebird::PathName& file_name, /* Always check for an explicit TCP node name */ - if (ISC_analyze_tcp(file_name, host_name)) + if (ISC_analyze_tcp(file_name, host_name)) { return ISC_PROTOCOL_TCPIP; } #ifndef NO_NFS - if (implicit_flag) + if (implicit_flag) { /* Check for a file on an NFS mounted device */ - if (ISC_analyze_nfs(file_name, host_name)) + if (ISC_analyze_nfs(file_name, host_name)) { return ISC_PROTOCOL_TCPIP; } @@ -486,7 +486,7 @@ iscProtocol ISC_extract_host(Firebird::PathName& file_name, #if defined(WIN_NT) /* Check for an explicit named pipe node name */ - if (ISC_analyze_pclan(file_name, host_name)) + if (ISC_analyze_pclan(file_name, host_name)) { return ISC_PROTOCOL_WLAN; } @@ -556,7 +556,7 @@ static bool isDriveLetter(const tstring::char_type letter) // Code of this function is a slightly changed version of this routine -// from Jim Barry (jim.barry@bigfoot.com) published at +// from Jim Barry (jim.barry@bigfoot.com) published at // http://www.geocities.com/SiliconValley/2060/articles/longpaths.html static bool ShortToLongPathName(tstring& Path) @@ -565,7 +565,7 @@ static bool ShortToLongPathName(tstring& Path) const char sep = '\\'; const char colon = ':'; - // Copy the short path into the work buffer and convert forward + // Copy the short path into the work buffer and convert forward // slashes to backslashes. translate_slashes(Path); @@ -606,13 +606,13 @@ static bool ShortToLongPathName(tstring& Path) { right = npos; // skip main block } - else + else { if (sep == Path[1]) // is it UNC? { // Find end of machine name right = Path.find_first_of(sep, 2); - if (npos == right) + if (npos == right) { return false; } @@ -629,7 +629,7 @@ static bool ShortToLongPathName(tstring& Path) } } // else FindFirstFile will handle relative paths - + bool error = false; if (npos != right) @@ -658,7 +658,7 @@ static bool ShortToLongPathName(tstring& Path) right = npos; error = true; } - + Path[last] = sep; } } @@ -778,7 +778,7 @@ bool ISC_expand_filename(tstring& file_name, bool expand_mounts) * **************************************/ // check for empty filename to avoid multiple checks later - if (file_name.isEmpty()) + if (file_name.isEmpty()) { return false; } @@ -792,7 +792,7 @@ bool ISC_expand_filename(tstring& file_name, bool expand_mounts) // assume named pipes. Translate forward slashes to back slashes // and return with no further processing. - if ((file_name.length() >= 2) && + if ((file_name.length() >= 2) && ((file_name[0] == '\\' && file_name[1] == '\\') || (file_name[0] == '/' && file_name[1] == '/'))) { @@ -819,7 +819,7 @@ bool ISC_expand_filename(tstring& file_name, bool expand_mounts) return true; } - // This happen if remote interface of our server + // This happen if remote interface of our server // rejected WNet connection or we were called with: // localhost:R:\Path\To\Database, where R - remote disk if (dtype == DRIVE_REMOTE && expand_mounts) @@ -828,7 +828,7 @@ bool ISC_expand_filename(tstring& file_name, bool expand_mounts) translate_slashes(file_name); return true; } - + if ((temp.length() >= 3) && (temp[2] == '/' || temp[2] == '\\')) { fully_qualified_path = true; @@ -853,7 +853,7 @@ bool ISC_expand_filename(tstring& file_name, bool expand_mounts) fully_qualified_path = true; } - // Expand the file name + // Expand the file name #ifdef SUPERSERVER if (!fully_qualified_path) @@ -936,7 +936,7 @@ void ISC_expand_share(tstring& file_name) { return; } - + HANDLE handle; if (WNetOpenEnum(RESOURCE_CONNECTED, RESOURCETYPE_DISK, 0, NULL, &handle) != NO_ERROR) @@ -949,7 +949,7 @@ void ISC_expand_share(tstring& file_name) { return; } - + DWORD ret = WNetEnumResource(handle, &nument, resources, &bufSize); if (ret == ERROR_MORE_DATA) { gds__free(resources); @@ -982,7 +982,7 @@ void ISC_expand_share(tstring& file_name) device += ':'; LPREMOTE_NAME_INFO res2 = (LPREMOTE_NAME_INFO) resources; ret = - WNetGetUniversalName(device.c_str(), + WNetGetUniversalName(device.c_str(), REMOTE_NAME_INFO_LEVEL, res2, &bufSize); if (ret == ERROR_MORE_DATA) { gds__free(resources); @@ -992,7 +992,7 @@ void ISC_expand_share(tstring& file_name) return; } res2 = (LPREMOTE_NAME_INFO) resources; - ret = WNetGetUniversalName(device.c_str(), + ret = WNetGetUniversalName(device.c_str(), REMOTE_NAME_INFO_LEVEL, res2, &bufSize); } if (ret == NO_ERROR) @@ -1069,7 +1069,7 @@ static void expand_filename2(tstring& buff, bool expand_mounts) **************************************/ // If the filename contains a TCP node name, don't even try to expand it - if (buff.find(INET_FLAG) != npos) + if (buff.find(INET_FLAG) != npos) { return; } @@ -1079,7 +1079,7 @@ static void expand_filename2(tstring& buff, bool expand_mounts) buff = ""; // Handle references to default directories (tilde refs) - if (*from == '~') + if (*from == '~') { ++from; tstring q; @@ -1087,7 +1087,7 @@ static void expand_filename2(tstring& buff, bool expand_mounts) q += *from++; const struct passwd* password = q.hasData() ? getpwnam(q.c_str()) : getpwuid(geteuid()); - if (password) + if (password) { buff = password->pw_dir; expand_filename2(buff, expand_mounts); @@ -1095,25 +1095,25 @@ static void expand_filename2(tstring& buff, bool expand_mounts) } // If the file is local, expand partial pathnames with default directory - if (*from && *from != '/') + if (*from && *from != '/') { fb_utils::getCwd(buff); buff += '/'; } // Process file name segment by segment looking for symbolic links. - while (*from) + while (*from) { // skip dual // (will collapse /// to / as well) - if (*from == '/' && from[1] == '/') + if (*from == '/' && from[1] == '/') { ++from; continue; } // Copy the leading slash, if any - if (*from == '/') + if (*from == '/') { if (buff.hasData() && (buff.end()[-1] == '/')) { @@ -1127,12 +1127,12 @@ static void expand_filename2(tstring& buff, bool expand_mounts) } // Handle self references - if (*from == '.' && (from[1] == '.' || from[1] == '/')) + if (*from == '.' && (from[1] == '.' || from[1] == '/')) { - if (*++from == '.') + if (*++from == '.') { ++from; - if (buff.length() > 2) + if (buff.length() > 2) { const size slash = buff.rfind('/', buff.length() - 2); buff = slash != npos ? buff.substr(0, slash + 1) : "/"; @@ -1143,7 +1143,7 @@ static void expand_filename2(tstring& buff, bool expand_mounts) // Copy the rest of the segment name const int segment = buff.length(); - while (*from && *from != '/') + while (*from && *from != '/') { buff += *from++; } @@ -1159,16 +1159,16 @@ static void expand_filename2(tstring& buff, bool expand_mounts) // We've got a link. If it contains a node name or it starts // with a slash, it replaces the initial segment so far. const tstring link(temp, n); - if (link.find(INET_FLAG) != npos) + if (link.find(INET_FLAG) != npos) { buff = link; return; } - if (link[0] == '/') + if (link[0] == '/') { buff = link; } - else + else { buff.replace(segment, buff.length() - segment, link); } @@ -1235,7 +1235,7 @@ static void expand_share_name(tstring& share_name) HKEY hkey; if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\LanmanServer\\Shares", - 0, KEY_QUERY_VALUE, &hkey) != ERROR_SUCCESS) + 0, KEY_QUERY_VALUE, &hkey) != ERROR_SUCCESS) { return; } @@ -1313,12 +1313,12 @@ namespace { #if (defined AIX || defined AIX_PPC) #define GET_MOUNTS -osMtab::osMtab() : temp(0), context(0) -{ +osMtab::osMtab() : temp(0), context(0) +{ SLONG l; if (mntctl(MCTL_QUERY, sizeof(SLONG), reinterpret_cast(&l)) != 0) return; - try + try { temp = FB_NEW(*getDefaultMemoryPool()) char[l]; } @@ -1360,11 +1360,11 @@ bool Mnt::get() p = vmt2dataptr(vmt, VMT_HOSTNAME); int l = vmt2datasize(vmt, VMT_HOSTNAME); - if (l && (p[0] != '-' || p[1])) + if (l && (p[0] != '-' || p[1])) { node = tstring(p, l); } - else + else { node.erase(); } @@ -1432,7 +1432,7 @@ bool Mnt::get() else return false; } -#else // !GETMNTENT_TAKES_TWO_ARGUMENTS +#else // !GETMNTENT_TAKES_TWO_ARGUMENTS bool Mnt::get() { /************************************** @@ -1457,7 +1457,7 @@ bool Mnt::get() // NFS mount points, therefore ignore mnt_type const char* iflag = strchr(mptr->mnt_fsname, ':'); - + if (iflag) { node = tstring(mptr->mnt_fsname, iflag - mptr->mnt_fsname); @@ -1552,10 +1552,10 @@ bool Mnt::get() /* This code is tested on Solaris 2.6 IA */ TEXT device[128], mount_point[128], type[16], opts[256], ftime[128]; - + const int n = fscanf(mtab.mtab, "%s %s %s %s %s ", device, mount_point, type, opts,ftime); const char* start = device; - + if (n<5) return false; @@ -1619,16 +1619,16 @@ bool Mnt::get() * Get ALL mount points. * **************************************/ - + /* Solaris uses this because: Since we had to substitute an alternative for the stdio supplied with Solaris, we cannot use the getmntent() library call which wants a Solaris stdio FILE* as an argument, so we parse the text- type /etc/mnttab file ourselves. - from FB1 - + This will still apply with SFIO on FB2. nmcc Dec2002 */ - + TEXT device[128], mount_point[128], type[16], rw[128], foo1[16]; /* Start by finding a mount point. */ @@ -1744,7 +1744,7 @@ static void share_name_from_resource(tstring& file_name, expanded_name += '!'; file_name.replace(0, 2, expanded_name); } - else { + else { // we're guessing that it might be an NFS shared drive iter q = expanded_name.end() - 1; @@ -1759,7 +1759,7 @@ static void share_name_from_resource(tstring& file_name, Therefore we must convert any back slashes to forward slashes. */ if ((file_name[0] != '\\' || file_name[1] != '\\') - && (file_name.find(INET_FLAG) != npos)) + && (file_name.find(INET_FLAG) != npos)) { for (q = file_name.begin(); q < file_name.end(); ++q) { diff --git a/src/jrd/jrd.cpp b/src/jrd/jrd.cpp index e3be87add3..5a0f4aae75 100644 --- a/src/jrd/jrd.cpp +++ b/src/jrd/jrd.cpp @@ -339,7 +339,7 @@ void Jrd::Trigger::compile(thread_db* tdbb) throw; } - + request->req_trg_name = name; if (sys_trigger) @@ -362,7 +362,7 @@ void Jrd::Trigger::release(thread_db* tdbb) { return; // FALSE; } - + CMP_release(tdbb, request); request = NULL; return; // TRUE; @@ -413,7 +413,7 @@ public: ULONG dpb_flags; // to OR'd with dbb_flags // here begin compound objects - // for constructor to work properly dpb_sys_user_name + // for constructor to work properly dpb_sys_user_name // MUST be FIRST string dpb_sys_user_name; string dpb_user_name; @@ -435,8 +435,8 @@ public: public: DatabaseOptions() { - memset(this, 0, - reinterpret_cast(&this->dpb_sys_user_name) - + memset(this, 0, + reinterpret_cast(&this->dpb_sys_user_name) - reinterpret_cast(this)); } void get(const UCHAR*, USHORT, bool&); @@ -458,10 +458,10 @@ namespace { enum vdnResult {vdnFail, vdnOk, vdnSecurity}; } static vdnResult verify_database_name(const PathName&, ISC_STATUS*); -static ISC_STATUS unwindAttach(const Exception& ex, - ISC_STATUS* userStatus, - thread_db* tdbb, - Attachment* attachment, +static ISC_STATUS unwindAttach(const Exception& ex, + ISC_STATUS* userStatus, + thread_db* tdbb, + Attachment* attachment, Database* dbb); #ifdef WIN_NT static void ExtractDriveLetter(const TEXT*, ULONG*); @@ -492,7 +492,7 @@ static void cancel_attachments() { Database::SyncGuard dsGuard(dbb); Attachment* lockedAtt = NULL; - Attachment* att = dbb->dbb_attachments; + Attachment* att = dbb->dbb_attachments; while (att) { @@ -500,12 +500,12 @@ static void cancel_attachments() // deleted while waiting for lock. while (true) { - if (att->att_mutex.tryEnter() || (att->att_flags & ATT_purge_error)) + if (att->att_mutex.tryEnter() || (att->att_flags & ATT_purge_error)) { lockedAtt = att; break; } - + { const bool cancel_disable = (att->att_flags & ATT_cancel_disable); Database::Checkout dcoHolder(dbb); @@ -544,7 +544,7 @@ static void check_autocommit(jrd_req* request, thread_db* tdbb) { // dimitr: we should ignore autocommit for requests // created by EXECUTE STATEMENT - // AP: also do nothing if request is cancelled and + // AP: also do nothing if request is cancelled and // transaction is already missing if ((!request->req_transaction) || (request->req_transaction->tra_callback_count > 0)) return; @@ -667,7 +667,7 @@ ISC_STATUS GDS_ATTACH_DATABASE(ISC_STATUS* user_status, **************************************/ ThreadContextHolder tdbb(user_status); - if (*handle) + if (*handle) { return handle_error(user_status, isc_bad_db_handle); } @@ -756,38 +756,38 @@ ISC_STATUS GDS_ATTACH_DATABASE(ISC_STATUS* user_status, { // Check to see if the database is truly local or if it just looks // that way - + if (ISC_check_if_remote(expanded_name, true)) { ERR_post(Arg::Gds(isc_unavailable)); } } -/* If database to be opened is security database, then only +/* If database to be opened is security database, then only gsec or SecurityDatabase may open it. This protects from use of old gsec to write wrong password hashes into it. */ if (vdn == vdnSecurity && !options.dpb_gsec_attach && !options.dpb_sec_attach) { - ERR_post(Arg::Gds(isc_no_priv) << Arg::Str("direct") << - Arg::Str("security database") << + ERR_post(Arg::Gds(isc_no_priv) << Arg::Str("direct") << + Arg::Str("security database") << Arg::Str(file_name)); } // Worry about encryption key if (dbb->dbb_decrypt) { - if (dbb->dbb_filename.hasData() && + if (dbb->dbb_filename.hasData() && (dbb->dbb_encrypt_key.hasData() || options.dpb_key.hasData())) { if ((dbb->dbb_encrypt_key.hasData() && options.dpb_key.isEmpty()) || (dbb->dbb_encrypt_key.empty() && options.dpb_key.hasData()) || (dbb->dbb_encrypt_key != options.dpb_key)) { - ERR_post(Arg::Gds(isc_no_priv) << Arg::Str("encryption") << - Arg::Str("database") << + ERR_post(Arg::Gds(isc_no_priv) << Arg::Str("encryption") << + Arg::Str("database") << Arg::Str(file_name)); } } - else if (options.dpb_key.hasData()) + else if (options.dpb_key.hasData()) { dbb->dbb_encrypt_key = options.dpb_key; } @@ -857,7 +857,7 @@ ISC_STATUS GDS_ATTACH_DATABASE(ISC_STATUS* user_status, // 1. Ensure uniqueness of ID even in presence of multiple processes // 2. Make sure that ID value can be used to connect back to database // - if (is_alias && vdn == vdnFail) + if (is_alias && vdn == vdnFail) dbb->dbb_database_name = file_name; else dbb->dbb_database_name = expanded_name; @@ -985,7 +985,7 @@ ISC_STATUS GDS_ATTACH_DATABASE(ISC_STATUS* user_status, case SQL_DIALECT_V6_TRANSITION: case SQL_DIALECT_V6: { - if (userId.usr_sql_role_name.hasData() && + if (userId.usr_sql_role_name.hasData() && (userId.usr_sql_role_name[0] == DBL_QUOTE || userId.usr_sql_role_name[0] == SINGLE_QUOTE)) { @@ -993,7 +993,7 @@ ISC_STATUS GDS_ATTACH_DATABASE(ISC_STATUS* user_status, // remove the delimited quotes and escape quote // from ROLE name userId.usr_sql_role_name.erase(0, 1); - for (string::iterator p = userId.usr_sql_role_name.begin(); + for (string::iterator p = userId.usr_sql_role_name.begin(); p < userId.usr_sql_role_name.end(); ++p) { if (*p == end_quote) @@ -1007,7 +1007,7 @@ ISC_STATUS GDS_ATTACH_DATABASE(ISC_STATUS* user_status, else { // delimited done - userId.usr_sql_role_name.erase(--p, + userId.usr_sql_role_name.erase(--p, userId.usr_sql_role_name.end()); } } @@ -1038,21 +1038,21 @@ ISC_STATUS GDS_ATTACH_DATABASE(ISC_STATUS* user_status, if (user_status[1] != FB_SUCCESS) ERR_punt(); else - ERR_post(Arg::Gds(isc_no_priv) << Arg::Str("shutdown or online") << - Arg::Str("database") << + ERR_post(Arg::Gds(isc_no_priv) << Arg::Str("shutdown or online") << + Arg::Str("database") << Arg::Str(file_name)); } } if (options.dpb_online) { - if (!SHUT_online(tdbb, options.dpb_online)) + if (!SHUT_online(tdbb, options.dpb_online)) { if (user_status[1] != FB_SUCCESS) ERR_punt(); else - ERR_post(Arg::Gds(isc_no_priv) << Arg::Str("shutdown or online") << - Arg::Str("database") << + ERR_post(Arg::Gds(isc_no_priv) << Arg::Str("shutdown or online") << + Arg::Str("database") << Arg::Str(file_name)); } } @@ -1206,7 +1206,7 @@ ISC_STATUS GDS_ATTACH_DATABASE(ISC_STATUS* user_status, validateAccess(attachment); if (!CCH_exclusive(tdbb, LCK_EX, WAIT_PERIOD)) { ERR_post(Arg::Gds(isc_lock_timeout) << - Arg::Gds(isc_obj_in_use) << Arg::Str(file_name)); + Arg::Gds(isc_obj_in_use) << Arg::Str(file_name)); } PAG_set_db_readonly(dbb, options.dpb_db_readonly); } @@ -1269,7 +1269,7 @@ ISC_STATUS GDS_ATTACH_DATABASE(ISC_STATUS* user_status, // guardDatabases.leave(); - *handle = attachment; + *handle = attachment; attachment->att_mutex.leave(); } // try @@ -1689,7 +1689,7 @@ ISC_STATUS GDS_CREATE_DATABASE(ISC_STATUS* user_status, if (!is_alias && vdn == vdnFail) { return user_status[1]; - } + } Database* dbb = NULL; MutexEnsureUnlock guardDatabases(databases_mutex); @@ -1727,13 +1727,13 @@ ISC_STATUS GDS_CREATE_DATABASE(ISC_STATUS* user_status, // Check to see if the database is truly local or if it just looks // that way - if (ISC_check_if_remote(expanded_name, true)) + if (ISC_check_if_remote(expanded_name, true)) { ERR_post(Arg::Gds(isc_unavailable)); } } - if (options.dpb_key.hasData()) + if (options.dpb_key.hasData()) { dbb->dbb_encrypt_key = options.dpb_key; } @@ -1764,7 +1764,7 @@ ISC_STATUS GDS_CREATE_DATABASE(ISC_STATUS* user_status, switch (options.dpb_sql_dialect) { case 0: - // This can be issued by QLI, GDEF and old BDE clients. + // This can be issued by QLI, GDEF and old BDE clients. // In this case assume dialect 1 options.dpb_sql_dialect = SQL_DIALECT_V5; case SQL_DIALECT_V5: @@ -1850,8 +1850,8 @@ ISC_STATUS GDS_CREATE_DATABASE(ISC_STATUS* user_status, } else { - ERR_post(Arg::Gds(isc_no_priv) << Arg::Str("overwrite") << - Arg::Str("database") << + ERR_post(Arg::Gds(isc_no_priv) << Arg::Str("overwrite") << + Arg::Str("database") << Arg::Str(expanded_name)); } } @@ -1871,8 +1871,8 @@ ISC_STATUS GDS_CREATE_DATABASE(ISC_STATUS* user_status, // Initialize backup difference subsystem. This must be done before WAL and shadowing // is enabled because nbackup it is a lower level subsystem - dbb->dbb_backup_manager = FB_NEW(*dbb->dbb_permanent) BackupManager(tdbb, dbb, nbak_state_normal); - + dbb->dbb_backup_manager = FB_NEW(*dbb->dbb_permanent) BackupManager(tdbb, dbb, nbak_state_normal); + dbb->dbb_backup_manager->dbCreating = true; PAG_format_header(tdbb); INI_init2(tdbb); @@ -1885,24 +1885,24 @@ ISC_STATUS GDS_CREATE_DATABASE(ISC_STATUS* user_status, if (options.dpb_set_no_reserve) PAG_set_no_reserve(dbb, options.dpb_no_reserve); - INI_format(attachment->att_user->usr_user_name.c_str(), + INI_format(attachment->att_user->usr_user_name.c_str(), options.dpb_set_db_charset.c_str()); // There is no point to move database online at database creation since it is online by default. // We do not allow to create database that is fully shut down. if (options.dpb_online || (options.dpb_shutdown & isc_dpb_shut_mode_mask) == isc_dpb_shut_full) ERR_post(Arg::Gds(isc_bad_shutdown_mode) << Arg::Str(file_name)); - + if (options.dpb_shutdown) { if (!SHUT_database(tdbb, options.dpb_shutdown, options.dpb_shutdown_delay)) { - ERR_post(Arg::Gds(isc_no_priv) << Arg::Str("shutdown or online") << - Arg::Str("database") << + ERR_post(Arg::Gds(isc_no_priv) << Arg::Str("shutdown or online") << + Arg::Str("database") << Arg::Str(file_name)); } } - + if (options.dpb_sweep_interval != -1) { PAG_sweep_interval(options.dpb_sweep_interval); dbb->dbb_sweep_interval = options.dpb_sweep_interval; @@ -1924,7 +1924,7 @@ ISC_STATUS GDS_CREATE_DATABASE(ISC_STATUS* user_status, if (!CCH_exclusive (tdbb, LCK_EX, WAIT_PERIOD)) ERR_post(Arg::Gds(isc_lock_timeout) << Arg::Gds(isc_obj_in_use) << Arg::Str(file_name)); - + PAG_set_db_readonly(dbb, options.dpb_db_readonly); } @@ -2136,8 +2136,8 @@ ISC_STATUS GDS_DROP_DATABASE(ISC_STATUS* user_status, Attachment** handle) if (!attachment->locksmith()) { - ERR_post(Arg::Gds(isc_no_priv) << Arg::Str("drop") << - Arg::Str("database") << + ERR_post(Arg::Gds(isc_no_priv) << Arg::Str("drop") << + Arg::Str("database") << Arg::Str(file_name)); } @@ -2199,7 +2199,7 @@ ISC_STATUS GDS_DROP_DATABASE(ISC_STATUS* user_status, Attachment** handle) // drop the files here bool err = drop_files(file); - for (; shadow; shadow = shadow->sdw_next) + for (; shadow; shadow = shadow->sdw_next) { err = err || drop_files(shadow->sdw_file); } @@ -2298,7 +2298,7 @@ ISC_STATUS GDS_GET_SLICE(ISC_STATUS* user_status, check_database(tdbb); jrd_tra* transaction = find_transaction(tdbb, isc_segstr_wrong_db); - + if (!array_id->gds_quad_low && !array_id->gds_quad_high) { MOVE_CLEAR(slice, slice_length); *return_length = 0; @@ -2520,7 +2520,7 @@ ISC_STATUS GDS_QUE_EVENTS(ISC_STATUS* user_status, { return user_status[1]; } - + *id = EVENT_que(user_status, attachment->att_event_session, lock->lck_length, @@ -2823,12 +2823,12 @@ ISC_STATUS GDS_SEND(ISC_STATUS * user_status, check_transaction(tdbb, request->req_transaction); verify_request_synchronization(request, level); - + EXE_send(tdbb, request, msg_type, msg_length, reinterpret_cast(msg)); - + check_autocommit(request, tdbb); - + if (request->req_flags & req_warning) request->req_flags &= ~req_warning; } @@ -2955,7 +2955,7 @@ ISC_STATUS GDS_SERVICE_QUERY(ISC_STATUS* user_status, service->query2(tdbb, send_item_length, send_items, recv_item_length, recv_items, buffer_length, buffer); - + // If there is a status vector from a service thread, copy it into the thread status int len, warning; PARSE_STATUS(service->getStatus(), len, warning); @@ -3004,7 +3004,7 @@ ISC_STATUS GDS_SERVICE_START(ISC_STATUS* user_status, validateHandle(service); service->start(spb_length, reinterpret_cast(spb)); - + if (service->getStatus()[1]) { memcpy(tdbb->tdbb_status_vector, service->getStatus(), sizeof(ISC_STATUS_ARRAY)); } @@ -3048,7 +3048,7 @@ ISC_STATUS GDS_START_AND_SEND(ISC_STATUS* user_status, check_transaction(tdbb, request->req_transaction); jrd_tra* transaction = find_transaction(tdbb, isc_req_wrong_db); - + JRD_start_and_send(tdbb, request, transaction, msg_type, msg_length, msg, level); } catch (const Exception& ex) @@ -3255,7 +3255,7 @@ ISC_STATUS GDS_TRANSACT_REQUEST(ISC_STATUS* user_status, **************************************/ ThreadContextHolder tdbb(user_status); - try + try { Attachment* attachment = *db_handle; validateHandle(tdbb, attachment); @@ -3286,11 +3286,11 @@ ISC_STATUS GDS_TRANSACT_REQUEST(ISC_STATUS* user_status, { if ( (node = csb->csb_rpt[i].csb_message) ) { - if ((int) (IPTR) node->nod_arg[e_msg_number] == 0) + if ((int) (IPTR) node->nod_arg[e_msg_number] == 0) { in_message = node; } - else if ((int) (IPTR) node->nod_arg[e_msg_number] == 1) + else if ((int) (IPTR) node->nod_arg[e_msg_number] == 1) { out_message = node; } @@ -3322,7 +3322,7 @@ ISC_STATUS GDS_TRANSACT_REQUEST(ISC_STATUS* user_status, if (in_msg_length != len) { - ERR_post(Arg::Gds(isc_port_len) << Arg::Num(in_msg_length) << + ERR_post(Arg::Gds(isc_port_len) << Arg::Num(in_msg_length) << Arg::Num(len)); } @@ -3340,7 +3340,7 @@ ISC_STATUS GDS_TRANSACT_REQUEST(ISC_STATUS* user_status, } if (out_msg_length != len) { - ERR_post(Arg::Gds(isc_port_len) << Arg::Num(out_msg_length) << + ERR_post(Arg::Gds(isc_port_len) << Arg::Num(out_msg_length) << Arg::Num(len)); } @@ -3878,7 +3878,7 @@ bool JRD_reschedule(thread_db* tdbb, SLONG quantum, bool punt) tdbb->tdbb_quantum = (tdbb->tdbb_quantum <= 0) ? #ifdef SUPERSERVER - (quantum ? quantum : (ThreadPriorityScheduler::boosted() ? + (quantum ? quantum : (ThreadPriorityScheduler::boosted() ? Config::getPriorityBoost() : 1) * QUANTUM) : #else (quantum ? quantum : QUANTUM) : @@ -4073,7 +4073,7 @@ static bool drop_files(const jrd_file* file) { if (unlink(file->fil_string)) { - ERR_build_status(status, Arg::Gds(isc_io_error) << Arg::Str("unlink") << + ERR_build_status(status, Arg::Gds(isc_io_error) << Arg::Str("unlink") << Arg::Str(file->fil_string) << Arg::Gds(isc_io_delete_err) << SYS_ERR(errno)); Database* dbb = GET_DBB(); @@ -4143,7 +4143,7 @@ static void find_intl_charset(thread_db* tdbb, Attachment* attachment, const Dat const UCHAR* lc_ctype = reinterpret_cast(options->dpb_lc_ctype.c_str()); - + if (MET_get_char_coll_subtype(tdbb, &id, lc_ctype, options->dpb_lc_ctype.length()) && INTL_defined_type(tdbb, id & 0xFF) && ((id & 0xFF) != CS_BINARY)) @@ -4593,7 +4593,7 @@ static Database* init(thread_db* tdbb, if (!(dbb->dbb_flags & (DBB_bugcheck | DBB_not_in_use)) && (dbb->dbb_filename == expanded_filename)) { - if (attach_flag) + if (attach_flag) return dbb; ERR_post(Arg::Gds(isc_no_meta_update) << @@ -4644,7 +4644,7 @@ static Database* init(thread_db* tdbb, else if (GCPolicyDefault == GCPolicyCombined) { dbb->dbb_flags |= DBB_gc_cooperative | DBB_gc_background; } - else + else fb_assert(false); } } @@ -4858,7 +4858,7 @@ static void release_attachment(thread_db* tdbb, Attachment* attachment, ISC_STAT if (attachment->att_temp_pg_lock) LCK_release(tdbb, attachment->att_temp_pg_lock); - for (bool getResult = attachment->att_dsql_cache.getFirst(); getResult; + for (bool getResult = attachment->att_dsql_cache.getFirst(); getResult; getResult = attachment->att_dsql_cache.getNext()) { LCK_release(tdbb, attachment->att_dsql_cache.current()->second.lock); @@ -4951,10 +4951,10 @@ static void detachLocksFromAttachment(Attachment* attachment) Attachment::Attachment(MemoryPool* pool, Database* dbb) : att_pool(pool), att_memory_stats(&dbb->dbb_memory_stats), - att_database(dbb), + att_database(dbb), att_lock_owner_id(Database::getLockOwnerId()), att_lc_messages(*pool), - att_working_directory(*pool), + att_working_directory(*pool), att_filename(*pool), att_timestamp(TimeStamp::getCurrentTimeStamp()), att_context_vars(*pool), @@ -4973,9 +4973,9 @@ Attachment::Attachment(MemoryPool* pool, Database* dbb) Attachment::~Attachment() { // For normal attachments that happens release_attachment(), - // but for special ones like GC should be done also in dtor - + // but for special ones like GC should be done also in dtor - // they do not (and should not) call release_attachment(). - // It's no danger calling detachLocksFromAttachment() + // It's no danger calling detachLocksFromAttachment() // once more here because it nulls att_long_locks. // AP 2007 detachLocksFromAttachment(this); @@ -5189,7 +5189,7 @@ static void strip_quotes(string& out) * Get rid of quotes around strings * **************************************/ - if (out.isEmpty()) + if (out.isEmpty()) { return; } @@ -5357,7 +5357,7 @@ UCHAR* JRD_num_attachments(UCHAR* const buf, USHORT buf_len, JRD_info_tag flag, catch (const Exception&) { // Here we ignore possible errors from databases_mutex. - // They were always silently ignored, and for this function + // They were always silently ignored, and for this function // we really have no way to notify world about mutex problem. // AP. 2008. } @@ -5466,7 +5466,7 @@ static unsigned int purge_transactions(thread_db* tdbb, ************************************** * * Functional description - * commit or rollback all transactions + * commit or rollback all transactions * from an attachment * **************************************/ @@ -5540,7 +5540,7 @@ static void purge_attachment(thread_db* tdbb, **************************************/ SET_TDBB(tdbb); Database* dbb = attachment->att_database; - + if (!(dbb->dbb_flags & DBB_bugcheck)) { try @@ -5701,10 +5701,10 @@ static void verify_request_synchronization(jrd_req*& request, SSHORT level) /** - + verify_database_name - - @brief Verify database name for open/create + + @brief Verify database name for open/create against given in conf file list of available directories and security database name @@ -5731,7 +5731,7 @@ static vdnResult verify_database_name(const PathName& name, ISC_STATUS* status) // Check for .conf if (!JRD_verify_database_access(name)) { - ERR_build_status(status, Arg::Gds(isc_conf_access_denied) << Arg::Str("database") << + ERR_build_status(status, Arg::Gds(isc_conf_access_denied) << Arg::Str("database") << Arg::Str(name)); return vdnFail; } @@ -5740,9 +5740,9 @@ static vdnResult verify_database_name(const PathName& name, ISC_STATUS* status) /** - + getUserInfo - + @brief Checks the userinfo database to validate password to that passed in. Takes into account possible trusted authentication. @@ -5768,7 +5768,7 @@ static void getUserInfo(UserId& user, const DatabaseOptions& options) } else { - if (options.dpb_user_name.isEmpty() && + if (options.dpb_user_name.isEmpty() && options.dpb_network_protocol.isEmpty() && // This 2 checks ensure that we are not remote server options.dpb_remote_address.isEmpty()) // process, i.e. can use unix OS auth. { @@ -5778,13 +5778,13 @@ static void getUserInfo(UserId& user, const DatabaseOptions& options) if (options.dpb_user_name.hasData() || (id == -1)) { - string remote = options.dpb_network_protocol + + string remote = options.dpb_network_protocol + (options.dpb_network_protocol.isEmpty() || options.dpb_remote_address.isEmpty() ? "" : "/") + options.dpb_remote_address; - SecurityDatabase::verifyUser(name, - options.dpb_user_name.nullStr(), - options.dpb_password.nullStr(), + SecurityDatabase::verifyUser(name, + options.dpb_user_name.nullStr(), + options.dpb_password.nullStr(), options.dpb_password_enc.nullStr(), &id, &group, &node_id, remote); } @@ -5810,7 +5810,7 @@ static void getUserInfo(UserId& user, const DatabaseOptions& options) if (name.length() > USERNAME_LENGTH) { - status_exception::raise(Arg::Gds(isc_long_login) << + status_exception::raise(Arg::Gds(isc_long_login) << Arg::Num(name.length()) << Arg::Num(USERNAME_LENGTH)); } @@ -5821,7 +5821,7 @@ static void getUserInfo(UserId& user, const DatabaseOptions& options) user.usr_user_id = id; user.usr_group_id = group; user.usr_node_id = node_id; - if (wheel) + if (wheel) { user.usr_flags |= USR_locksmith; } @@ -5832,10 +5832,10 @@ static void getUserInfo(UserId& user, const DatabaseOptions& options) } } -static ISC_STATUS unwindAttach(const Exception& ex, - ISC_STATUS* userStatus, - thread_db* tdbb, - Attachment* attachment, +static ISC_STATUS unwindAttach(const Exception& ex, + ISC_STATUS* userStatus, + thread_db* tdbb, + Attachment* attachment, Database* dbb) { stuff_exception(userStatus, ex); @@ -5843,7 +5843,7 @@ static ISC_STATUS unwindAttach(const Exception& ex, try { ThreadStatusGuard temp_status(tdbb); - + dbb->dbb_flags &= ~DBB_being_opened; if (attachment) @@ -6349,7 +6349,7 @@ namespace { public: explicit DatabaseDirectoryList(MemoryPool& p) : DirectoryList(p) - { + { initialize(); } }; diff --git a/src/jrd/mov.cpp b/src/jrd/mov.cpp index 739e4d0a01..5e44e01c4c 100644 --- a/src/jrd/mov.cpp +++ b/src/jrd/mov.cpp @@ -69,7 +69,7 @@ double MOV_date_to_double(const dsc* desc) * * Functional description * Convert a date to double precision for - * date arithmetic routines. + * date arithmetic routines. * **************************************/ @@ -189,7 +189,7 @@ void MOV_get_metadata_str(const dsc* desc, TEXT* buffer, USHORT buffer_length) { /************************************** * - * M O V _ g e t _ m e t a d a t a _ s t r + * M O V _ g e t _ m e t a d a t a _ s t r * ************************************** * @@ -204,7 +204,7 @@ void MOV_get_metadata_str(const dsc* desc, TEXT* buffer, USHORT buffer_length) USHORT length = CVT_get_string_ptr(desc, &dummy_type, &ptr, NULL, 0, ERR_post); - + #ifdef DEV_BUILD if ((dummy_type != ttype_metadata) && (dummy_type != ttype_none) && (dummy_type != ttype_ascii)) @@ -245,7 +245,7 @@ SQUAD MOV_get_quad(const dsc* desc, SSHORT scale) ************************************** * * Functional description - * Convert something arbitrary to a quad + * Convert something arbitrary to a quad * Note: a quad is NOT the same as a 64 bit integer * **************************************/ @@ -364,7 +364,7 @@ int MOV_make_string(const dsc* desc, * Make a string, in a specified text type, out of a descriptor. * The caller must provide a sufficiently * large temporary. The address of the resultant string is returned - * by reference. + * by reference. * MOV_make_string returns the length of the string in bytes. * * Note: If the descriptor is known to be a string type in the @@ -380,7 +380,7 @@ int MOV_make_string(const dsc* desc, int MOV_make_string2(Jrd::thread_db* tdbb, const dsc* desc, USHORT ttype, - UCHAR** address, + UCHAR** address, Jrd::MoveBuffer& buffer, bool limit) { diff --git a/src/jrd/nav.cpp b/src/jrd/nav.cpp index ebe658594c..ed25c65889 100644 --- a/src/jrd/nav.cpp +++ b/src/jrd/nav.cpp @@ -53,7 +53,7 @@ using namespace Jrd; //#define MOVE_BYTE(x_from, x_to) *x_to++ = *x_from++; -static int compare_keys(const index_desc*, const UCHAR*, USHORT, +static int compare_keys(const index_desc*, const UCHAR*, USHORT, const temporary_key*, USHORT); #ifdef SCROLLABLE_CURSORS @@ -79,13 +79,13 @@ exp_index_buf* NAV_expand_index(WIN * window, IRSB_NAV impure) ************************************** * * Functional description - * Given a window with a btree leaf page loaded into it, + * Given a window with a btree leaf page loaded into it, * expand the index page into a form that facilitates walking - * backward through it. Each node's data is decompressed. - * Since the prefix field is not needed, it contains an offset to + * backward through it. Each node's data is decompressed. + * Since the prefix field is not needed, it contains an offset to * the prior node. * - * If an impure pointer is passed, set the current node on the + * If an impure pointer is passed, set the current node on the * expanded page to match that on the corresponding btree page. * **************************************/ @@ -95,8 +95,8 @@ exp_index_buf* NAV_expand_index(WIN * window, IRSB_NAV impure) // (note that the difference in size of a btree_exp node versus a btree_nod node could // be deducted, but there is no easy way to get the no. of nodes on page) */ - // if the right version of expanded page is available, there - // is no work to be done + // if the right version of expanded page is available, there + // is no work to be done exp_index_buf* expanded_page = window->win_expanded_buffer; if (expanded_page && (expanded_page->exp_incarnation == CCH_get_incarnation(window))) @@ -157,16 +157,16 @@ bool NAV_get_record(thread_db* tdbb, * Functional description * Get a record from a stream, either in * the forward or backward direction, or the - * current record. This routine must set + * current record. This routine must set * BOF or EOF properly. * **************************************/ SET_TDBB(tdbb); #ifdef SCROLLABLE_CURSORS - // before we do anything, check for the case where an ascending index - // was used to optimize a descending sort, or a descending index was - // used to optimize an ascending sort--in either case, we need to flip + // before we do anything, check for the case where an ascending index + // was used to optimize a descending sort, or a descending index was + // used to optimize an ascending sort--in either case, we need to flip // the nominal direction of navigation if (rsb->rsb_flags & rsb_descending) { if (direction == RSE_get_forward) { @@ -181,7 +181,7 @@ bool NAV_get_record(thread_db* tdbb, init_fetch(impure); index_desc* idx = (index_desc*) ((SCHAR*) impure + (IPTR) rsb->rsb_arg[RSB_NAV_idx_offset]); - // The bitmap is only valid when we are continuing on in one + // The bitmap is only valid when we are continuing on in one // direction. It is of no help when we change direction, // and so we need to reset in that case. #ifdef SCROLLABLE_CURSORS @@ -202,18 +202,18 @@ bool NAV_get_record(thread_db* tdbb, #endif // find the last fetched position from the index - const USHORT pageSpaceID = rpb->rpb_relation->getPages(tdbb)->rel_pg_space_id; + const USHORT pageSpaceID = rpb->rpb_relation->getPages(tdbb)->rel_pg_space_id; WIN window(pageSpaceID, impure->irsb_nav_page); btree_exp* expanded_next = NULL; - UCHAR* nextPointer = get_position(tdbb, rsb, impure, &window, + UCHAR* nextPointer = get_position(tdbb, rsb, impure, &window, direction, &expanded_next); if (!nextPointer) return false; temporary_key key; memcpy(key.key_data, impure->irsb_nav_data, impure->irsb_nav_length); jrd_nod* retrieval_node = (jrd_nod*) rsb->rsb_arg[RSB_NAV_index]; - IndexRetrieval* retrieval = + IndexRetrieval* retrieval = (IndexRetrieval*) retrieval_node->nod_arg[e_idx_retrieval]; // set the upper (or lower) limit for navigational retrieval @@ -221,7 +221,7 @@ bool NAV_get_record(thread_db* tdbb, #ifdef SCROLLABLE_CURSORS temporary_key lower; #endif - if ((direction == RSE_get_forward) && retrieval->irb_upper_count) + if ((direction == RSE_get_forward) && retrieval->irb_upper_count) { upper.key_length = impure->irsb_nav_upper_length; #ifdef SCROLLABLE_CURSORS @@ -235,7 +235,7 @@ bool NAV_get_record(thread_db* tdbb, #endif } #ifdef SCROLLABLE_CURSORS - else if ((direction == RSE_get_backward) && retrieval->irb_lower_count) + else if ((direction == RSE_get_backward) && retrieval->irb_lower_count) { lower.key_length = impure->irsb_nav_lower_length; memcpy(lower.key_data, @@ -244,17 +244,17 @@ bool NAV_get_record(thread_db* tdbb, } #endif - // In the case of a DISTINCT, we must detect whether the key changed since the last - // time a record was returned from the rsb. It is not good enough to know whether the - // key changed since the last node in the index, because the record represented - // by the last index node may not have satisfied some boolean expression on the rsb. - // So to find out whether the key has changed since the last time a record was actually - // returned from the rsb, we save the record count each time we return a candidate record, + // In the case of a DISTINCT, we must detect whether the key changed since the last + // time a record was returned from the rsb. It is not good enough to know whether the + // key changed since the last node in the index, because the record represented + // by the last index node may not have satisfied some boolean expression on the rsb. + // So to find out whether the key has changed since the last time a record was actually + // returned from the rsb, we save the record count each time we return a candidate record, // and see if the count is updated the next time we get here. - // If the count has been updated, we know the record has been returned from the rsb, and - // the index key must change before we can return another DISTINCT record candidate. If - // the last candidate did not qualify, we know we should return another record no matter + // If the count has been updated, we know the record has been returned from the rsb, and + // the index key must change before we can return another DISTINCT record candidate. If + // the last candidate did not qualify, we know we should return another record no matter // what. if (rsb->rsb_record_count != impure->irsb_nav_count) { @@ -281,7 +281,7 @@ bool NAV_get_record(thread_db* tdbb, } #ifdef SCROLLABLE_CURSORS - // in the backwards case, check to make sure we haven't hit the + // in the backwards case, check to make sure we haven't hit the // beginning of a page, and if so fetch the left sibling page. if (direction == RSE_get_backward) { if (pointer < BTreeNode::getPointerFirstNode(page)) { @@ -328,16 +328,16 @@ bool NAV_get_record(thread_db* tdbb, } // In the project (DISTINCT) case, we need to determine if the key has changed - // since the last record that was returned from the rsb. That means that we must + // since the last record that was returned from the rsb. That means that we must // know what the key was for that record - // in the case where we are on the same page, - // we simply check to see if there is any data in the node; if we are on a new - // page, we must compare this node with the last key we saw - // NOTE: the optimizer only uses indices which have the same number of fields as - // those in the DISTINCT clause; there's no reason we couldn't use an index which - // has extra fields to the right, we just need to add some code to check + // in the case where we are on the same page, + // we simply check to see if there is any data in the node; if we are on a new + // page, we must compare this node with the last key we saw + // NOTE: the optimizer only uses indices which have the same number of fields as + // those in the DISTINCT clause; there's no reason we couldn't use an index which + // has extra fields to the right, we just need to add some code to check // when only the first n segment(s) of the key has changed, rather than the whole key if (rsb->rsb_flags & rsb_project) { if (page_changed) @@ -368,7 +368,7 @@ bool NAV_get_record(thread_db* tdbb, compare_keys(idx, key.key_data, key.key_length, &upper, retrieval->irb_generic & (irb_descending | irb_partial | - irb_starting)) > 0) + irb_starting)) > 0) { break; } @@ -378,7 +378,7 @@ bool NAV_get_record(thread_db* tdbb, compare_keys(idx, key.key_data, key.key_length, &lower, retrieval->irb_generic & (irb_descending | irb_partial | - irb_starting)) < 0) + irb_starting)) < 0) { break; } @@ -395,7 +395,7 @@ bool NAV_get_record(thread_db* tdbb, || !RecordBitmap::test(*impure->irsb_nav_bitmap, number.getValue()))) || RecordBitmap::test(impure->irsb_nav_records_visited, number.getValue()) || ((rsb->rsb_flags & rsb_project) - && !(impure->irsb_flags & irsb_key_changed))) + && !(impure->irsb_flags & irsb_key_changed))) { #ifdef SCROLLABLE_CURSORS if (direction == RSE_get_backward) { @@ -441,16 +441,16 @@ static int compare_keys( USHORT length1, const temporary_key* key2, USHORT flags) { /************************************** - * + * * c o m p a r e _ k e y s * ************************************** * * Functional description - * Compare two index keys. - * If a partial key comparison is specified, - * ensure that the shorter key (the second - * one) matches segment-by-segment with the + * Compare two index keys. + * If a partial key comparison is specified, + * ensure that the shorter key (the second + * one) matches segment-by-segment with the * index key. * **************************************/ @@ -478,7 +478,7 @@ static int compare_keys( // is specified, for other types do only matches on the entire segment if ((flags & (irb_partial | irb_starting)) && (length1 > length2)) { - // figure out what segment we're on; if it's a + // figure out what segment we're on; if it's a // character segment we've matched the partial string const UCHAR* segment = 0; const index_desc::idx_repeat* tail; @@ -497,14 +497,14 @@ static int compare_keys( (tail->idx_itype == idx_string || tail->idx_itype == idx_byte_array || tail->idx_itype == idx_metadata || - tail->idx_itype >= idx_first_intl_string)) + tail->idx_itype >= idx_first_intl_string)) { return 0; } if (idx->idx_count > 1) { - // If we search for NULLs at the begin then we're done if the first + // If we search for NULLs at the begin then we're done if the first // segment isn't the first one possible (0 for ASC, 255 for DESC). if (length2 == 0) { if (flags & irb_descending) { @@ -521,7 +521,7 @@ static int compare_keys( // if we've exhausted the segment, we've found a match USHORT remainder = length2 % (Ods::STUFF_COUNT + 1); - if (!remainder && (*string1 != *segment)) + if (!remainder && (*string1 != *segment)) { return 0; } @@ -529,7 +529,7 @@ static int compare_keys( // if the rest of the key segment is 0's, we've found a match if (remainder) { for (remainder = Ods::STUFF_COUNT + 1 - remainder; remainder; - remainder--) + remainder--) { if (*string1++) { break; @@ -560,10 +560,10 @@ static void expand_index(WIN * window) ************************************** * * Functional description - * Given a window with a btree leaf page loaded into it, + * Given a window with a btree leaf page loaded into it, * expand the index page into a form that facilitates walking - * backward through it. Each node's data is decompressed. - * Since the prefix field is not needed, it contains an offset to + * backward through it. Each node's data is decompressed. + * Since the prefix field is not needed, it contains an offset to * the prior node. * **************************************/ @@ -664,8 +664,8 @@ static bool find_saved_node(RecordSource* rsb, IRSB_NAV impure, ************************************** * * Functional description - * A page has changed. Find the new position of the - * previously stored node. The node could even be on + * A page has changed. Find the new position of the + * previously stored node. The node could even be on * a sibling page if the page has split. If we find * the actual node, return true. * @@ -705,7 +705,7 @@ static bool find_saved_node(RecordSource* rsb, IRSB_NAV impure, impure->irsb_nav_length, &key, 0); // if the keys are equal, return this node even if it is just a duplicate node; - // duplicate nodes that have already been returned will be filtered out at a + // duplicate nodes that have already been returned will be filtered out at a // higher level by checking the sparse bit map of records already returned, and // duplicate nodes that were inserted before the stored node can be // safely returned since their position in the index is arbitrary @@ -715,7 +715,7 @@ static bool find_saved_node(RecordSource* rsb, IRSB_NAV impure, } // if the stored key is less than the current key, then the stored key - // has been deleted from the index and we should just return the next + // has been deleted from the index and we should just return the next // key after it if (result < 0) { *return_pointer = node.nodePointer; @@ -765,7 +765,7 @@ static UCHAR* get_position( Ods::btree_page* page = (Ods::btree_page*) CCH_FETCH(tdbb, window, LCK_read, pag_index); #ifdef SCROLLABLE_CURSORS - // we must ensure that if we are going backwards, we always + // we must ensure that if we are going backwards, we always // have an expanded buffer (and a valid position on that page) if (direction == RSE_get_backward) { NAV_expand_index(window, impure); @@ -779,12 +779,12 @@ static UCHAR* get_position( Ods::IndexNode node; if (incarnation == impure->irsb_nav_incarnation) { pointer = ((UCHAR*) page + impure->irsb_nav_offset); - if (!expanded_page) { + if (!expanded_page) { // theoretically impossible *expanded_node = NULL; } else if (impure->irsb_nav_expanded_offset < 0) { - // position unknown or invalid + // position unknown or invalid *expanded_node = find_current(expanded_page, page, pointer); } else { @@ -836,8 +836,8 @@ static UCHAR* get_position( } #ifdef SCROLLABLE_CURSORS - // As a last resort, return the first (or last if backwards) - // node on the page. The sparse bitmap will prevent us from + // As a last resort, return the first (or last if backwards) + // node on the page. The sparse bitmap will prevent us from // seeing records we have already visited before. if (direction == RSE_get_backward) { expanded_page = NAV_expand_index(window, 0); @@ -878,9 +878,9 @@ static bool get_record( try { if (inhibit_cleanup) { - // Inhibit garbage collection & other housekeeping - + // Inhibit garbage collection & other housekeeping - // to prevent a deadlock when we visit the record. - // There are cases when we are called here and have a window locked + // There are cases when we are called here and have a window locked // HACK for bug 7041 old_att_flags = (tdbb->getAttachment()->att_flags & ATT_no_cleanup); @@ -911,7 +911,7 @@ static bool get_record( &value, 0, false); if (compare_keys(idx, key->key_data, key->key_length, &value, 0)) { result = false; - } + } else { // mark in the navigational bitmap that we have visited this record RBM_SET(tdbb->getDefaultPool(), &impure->irsb_nav_records_visited, rpb->rpb_number.getValue()); @@ -1059,7 +1059,7 @@ static UCHAR* nav_open( #endif // If there is a starting descriptor, search down index to starting position. - // This may involve sibling buckets if splits are in progress. If there + // This may involve sibling buckets if splits are in progress. If there // isn't a starting descriptor, walk down the left side of the index (or the // right side if backwards). @@ -1069,7 +1069,7 @@ static UCHAR* nav_open( UCHAR* pointer = NULL; if (limit_ptr) { - + // If END_BUCKET is reached BTR_find_leaf will return NULL while (!(pointer = BTR_find_leaf(page, limit_ptr, impure->irsb_nav_data, 0, (idx->idx_flags & idx_descending) != 0, true))) @@ -1129,7 +1129,7 @@ static void set_position(IRSB_NAV impure, record_param* rpb, WIN* window, ************************************** * * Functional description - * Setup the information about the current position + * Setup the information about the current position * in the navigational index. Store all required data in the * impure area for the request. * @@ -1141,7 +1141,7 @@ static void set_position(IRSB_NAV impure, record_param* rpb, WIN* window, impure->irsb_nav_page = window->win_page.getPageNum(); impure->irsb_nav_number = rpb->rpb_number; - // save the current key value if it hasn't already been saved + // save the current key value if it hasn't already been saved if (key_data) { impure->irsb_nav_length = length; memcpy(impure->irsb_nav_data, key_data, length); @@ -1152,7 +1152,7 @@ static void set_position(IRSB_NAV impure, record_param* rpb, WIN* window, if (window->win_expanded_buffer) { impure->irsb_nav_expanded_offset = (UCHAR*) expanded_node - (UCHAR*) window->win_expanded_buffer; - } + } else { impure->irsb_nav_expanded_offset = -1; } @@ -1168,7 +1168,7 @@ static bool setup_bitmaps(RecordSource* rsb, IRSB_NAV impure) ************************************** * * Functional description - * Setup the various bitmaps associated + * Setup the various bitmaps associated * with a stream. * **************************************/ diff --git a/src/jrd/nbak.cpp b/src/jrd/nbak.cpp index 4dff39e4f3..a1e50ec62e 100644 --- a/src/jrd/nbak.cpp +++ b/src/jrd/nbak.cpp @@ -158,7 +158,7 @@ void BackupManager::change_dirty_page_owner(thread_db* tdbb, SLONG from_handle, } void BackupManager::lock_clean_database( - thread_db* tdbb, SSHORT wait, WIN* window) + thread_db* tdbb, SSHORT wait, WIN* window) { database_lock->flags |= NBAK_state_blocking; // Flush local cache to release all dirty pages @@ -172,15 +172,15 @@ void BackupManager::lock_clean_database( tdbb->tdbb_flags |= TDBB_backup_write_locked; CCH_FETCH(tdbb, window, LCK_write, pag_header); } - + void BackupManager::unlock_clean_database( - thread_db* tdbb) + thread_db* tdbb) { tdbb->tdbb_flags &= ~TDBB_backup_write_locked; database_lock->unlock(tdbb, LCK_write); NBAK_TRACE(("database write unlocked")); -} +} void BackupManager::lock_shared_database(thread_db* tdbb, SSHORT wait) { @@ -247,7 +247,7 @@ void BackupManager::begin_backup(thread_db* tdbb) bool header_locked = false; - try + try { CleanDatabaseHolder cdbHolder(tdbb, this, true, &window); Ods::header_page* header = (Ods::header_page*) window.win_buffer; @@ -261,10 +261,10 @@ void BackupManager::begin_backup(thread_db* tdbb) return; } - // Create file + // Create file NBAK_TRACE(("Creating difference file %s", diff_name.c_str())); diff_file = PIO_create(database, diff_name, true, false, false); -#ifdef UNIX +#ifdef UNIX // adjust difference file access rights to make it match main DB ones if (diff_file && geteuid() == 0) { struct stat st; @@ -301,7 +301,7 @@ void BackupManager::begin_backup(thread_db* tdbb) int newState = nbak_state_stalled; header->hdr_flags = (header->hdr_flags & ~Ods::hdr_backup_mask) | newState; const ULONG adjusted_scn = ++header->hdr_header.pag_scn; // Generate new SCN - PAG_replace_entry_first(header, Ods::HDR_backup_guid, sizeof(guid), + PAG_replace_entry_first(header, Ods::HDR_backup_guid, sizeof(guid), reinterpret_cast(&guid)); header_locked = false; @@ -312,7 +312,7 @@ void BackupManager::begin_backup(thread_db* tdbb) // All changes go to the difference file now } - catch (const Firebird::Exception&) + catch (const Firebird::Exception&) { backup_state = nbak_state_unknown; if (header_locked) @@ -351,7 +351,7 @@ ULONG BackupManager::getPageCount() temp_bdb.bdb_buffer = buf; temp_bdb.bdb_page = pageNum; ISC_STATUS_ARRAY status; - if (!PIO_read(pageSpace->file, &temp_bdb, temp_bdb.bdb_buffer, status)) + if (!PIO_read(pageSpace->file, &temp_bdb, temp_bdb.bdb_buffer, status)) { Firebird::status_exception::raise(status); } @@ -363,10 +363,10 @@ ULONG BackupManager::getPageCount() } -// Merge difference file to main files (if needed) and unlink() difference -// file then. If merge is already in progress method silently returns and -// does nothing (so it can be used for recovery on database startup). -void BackupManager::end_backup(thread_db* tdbb, bool recover) +// Merge difference file to main files (if needed) and unlink() difference +// file then. If merge is already in progress method silently returns and +// does nothing (so it can be used for recovery on database startup). +void BackupManager::end_backup(thread_db* tdbb, bool recover) { NBAK_TRACE(("end_backup, recover=%i", recover)); @@ -391,13 +391,13 @@ void BackupManager::end_backup(thread_db* tdbb, bool recover) // for some instants and anything is possible at // that times. - try + try { // Check state under PR lock of backup state for speed { // scope SharedDatabaseHolder sdbHolder(tdbb, this); - // Nobody is doing end_backup but database isn't in merge state. - if ( (recover || backup_state != nbak_state_stalled) && (backup_state != nbak_state_merge ) ) + // Nobody is doing end_backup but database isn't in merge state. + if ( (recover || backup_state != nbak_state_stalled) && (backup_state != nbak_state_merge ) ) { NBAK_TRACE(("invalid state %d", backup_state)); endLock.unlock(tdbb, LCK_write); @@ -409,7 +409,7 @@ void BackupManager::end_backup(thread_db* tdbb, bool recover) CleanDatabaseHolder cdbHolder(tdbb, this, true, &window); - if ( (recover || backup_state != nbak_state_stalled) && (backup_state != nbak_state_merge ) ) + if ( (recover || backup_state != nbak_state_stalled) && (backup_state != nbak_state_merge ) ) { NBAK_TRACE(("invalid state %d", backup_state)); endLock.unlock(tdbb, LCK_write); @@ -445,20 +445,20 @@ void BackupManager::end_backup(thread_db* tdbb, bool recover) // STEP 2. Merging database and delta // Here comes the dirty work. We need to reapply all changes from difference file to database - // Release write state lock and get read lock. + // Release write state lock and get read lock. // Merge process should not inhibit normal operations. - try + try { NBAK_TRACE(("database locked to merge")); SharedDatabaseHolder sdbHolder(tdbb, this); NBAK_TRACE(("Merge. State=%d, current_scn=%d, adjusted_scn=%d", - backup_state, current_scn, adjusted_scn)); + backup_state, current_scn, adjusted_scn)); actualize_alloc(tdbb); - NBAK_TRACE(("Merge. Alloc table is actualized.")); + NBAK_TRACE(("Merge. Alloc table is actualized.")); AllocItemTree::Accessor all(alloc_table); if (all.getFirst()) { @@ -533,14 +533,14 @@ void BackupManager::end_backup(thread_db* tdbb, bool recover) return; } - + bool BackupManager::actualize_alloc(thread_db* tdbb) { ISC_STATUS *status_vector = tdbb->tdbb_status_vector; try { - NBAK_TRACE(("actualize_alloc last_allocated_page=%d alloc_table=%p", + NBAK_TRACE(("actualize_alloc last_allocated_page=%d alloc_table=%p", last_allocated_page, alloc_table)); - // For SuperServer this routine is really executed only at database startup when + // For SuperServer this routine is really executed only at database startup when // it has exlock or when exclusive access to database is enabled if (!alloc_table) alloc_table = FB_NEW(*database->dbb_permanent) AllocItemTree(database->dbb_permanent); @@ -564,7 +564,7 @@ bool BackupManager::actualize_alloc(thread_db* tdbb) if (!alloc_table->add(AllocItem(alloc_buffer[i + 1], temp_bdb.bdb_page.getPageNum() + i + 1))) { database->dbb_flags |= DBB_bugcheck; - ERR_build_status(status_vector, + ERR_build_status(status_vector, Arg::Gds(isc_bug_check) << Arg::Str("Duplicated item in allocation table detected")); return false; } @@ -587,8 +587,8 @@ bool BackupManager::actualize_alloc(thread_db* tdbb) return true; } -// Return page index in difference file that can be used in -// write_difference call later. +// Return page index in difference file that can be used in +// write_difference call later. ULONG BackupManager::get_page_index(thread_db* tdbb, ULONG db_page) { NBAK_TRACE(("get_page_index")); @@ -612,7 +612,7 @@ ULONG BackupManager::allocate_difference_page(thread_db* tdbb, ULONG db_page) ISC_STATUS* status_vector = tdbb->tdbb_status_vector; // Grow file first. This is done in such order to keep difference - // file consistent in case of write error. We should always be able + // file consistent in case of write error. We should always be able // to read next alloc page when previous one is full. BufferDesc temp_bdb; temp_bdb.bdb_page = last_allocated_page + 1; @@ -677,7 +677,7 @@ bool BackupManager::write_difference(ISC_STATUS* status, ULONG diff_page, Ods::p return false; return true; } - + bool BackupManager::read_difference(thread_db* tdbb, ULONG diff_page, Ods::pag* page) { NBAK_TRACE(("read_diff")); @@ -685,11 +685,11 @@ bool BackupManager::read_difference(thread_db* tdbb, ULONG diff_page, Ods::pag* temp_bdb.bdb_page = diff_page; temp_bdb.bdb_dbb = database; temp_bdb.bdb_buffer = page; - if (!PIO_read(diff_file, &temp_bdb, page, tdbb->tdbb_status_vector)) + if (!PIO_read(diff_file, &temp_bdb, page, tdbb->tdbb_status_vector)) return false; - return true; + return true; } - + BackupManager::BackupManager(thread_db* tdbb, Database* _database, int ini_state) : dbCreating(false), database(_database), diff_file(NULL), alloc_table(NULL), last_allocated_page(0), current_scn(0), diff_name(*_database->dbb_permanent), @@ -728,14 +728,14 @@ BackupManager::~BackupManager() delete[] temp_buffers_space; } -void BackupManager::set_difference(thread_db* tdbb, const char* filename) +void BackupManager::set_difference(thread_db* tdbb, const char* filename) { if (filename) { WIN window(HEADER_PAGE_NUMBER); Ods::header_page* header = (Ods::header_page*) CCH_FETCH(tdbb, &window, LCK_write, pag_header); CCH_MARK_MUST_WRITE(tdbb, &window); - PAG_replace_entry_first(header, Ods::HDR_difference_file, + PAG_replace_entry_first(header, Ods::HDR_difference_file, strlen(filename), reinterpret_cast(filename)); CCH_RELEASE(tdbb, &window); diff_name = filename; @@ -791,7 +791,7 @@ bool BackupManager::actualize_state(thread_db* tdbb) nbak_state_normal; NBAK_TRACE(("backup state read from header is %d", new_backup_state)); // Check is we missed lock/unlock cycle and need to invalidate - // our allocation table and file handle + // our allocation table and file handle const bool missed_cycle = (header->hdr_header.pag_scn - current_scn) > 1; current_scn = header->hdr_header.pag_scn; @@ -845,7 +845,7 @@ bool BackupManager::actualize_state(thread_db* tdbb) return true; } -void BackupManager::shutdown(thread_db* tdbb) +void BackupManager::shutdown(thread_db* tdbb) { if (diff_file) PIO_close(diff_file); diff --git a/src/jrd/ods.cpp b/src/jrd/ods.cpp index 4a3b3b2aa0..83fcf557c3 100644 --- a/src/jrd/ods.cpp +++ b/src/jrd/ods.cpp @@ -52,7 +52,7 @@ bool isSupported(USHORT majorVersion, USHORT minorVersion) if (majorVersion == ODS_VERSION && minorVersion >= ODS_RELEASED && minorVersion <= ODS_CURRENT) - { + { return true; } diff --git a/src/jrd/opt.cpp b/src/jrd/opt.cpp index f393e42ef3..09746a98f6 100644 --- a/src/jrd/opt.cpp +++ b/src/jrd/opt.cpp @@ -581,7 +581,7 @@ RecordSource* OPT_compile(thread_db* tdbb, if (relation && !relation->rel_file && !relation->isVirtual()) { csb->csb_rpt[stream].csb_indices = - BTR_all(tdbb, relation, &csb->csb_rpt[stream].csb_idx, + BTR_all(tdbb, relation, &csb->csb_rpt[stream].csb_idx, relation->getPages(tdbb)); sort_indices_by_selectivity(&csb->csb_rpt[stream]); mark_indices(&csb->csb_rpt[stream], relation->rel_id); @@ -590,7 +590,7 @@ RecordSource* OPT_compile(thread_db* tdbb, csb->csb_rpt[stream].csb_indices = 0; const Format* format = CMP_format(tdbb, csb, stream); - csb->csb_rpt[stream].csb_cardinality = + csb->csb_rpt[stream].csb_cardinality = OPT_getRelationCardinality(tdbb, relation, format); } } @@ -1166,18 +1166,18 @@ jrd_nod* OPT_make_index(thread_db* tdbb, OptimizerBlk* opt, jrd_rel* relation, } bool includeLower = true, includeUpper = true; - for (tail = opt->opt_segments; (tail->opt_lower || tail->opt_upper) && + for (tail = opt->opt_segments; (tail->opt_lower || tail->opt_upper) && tail->opt_match && (tail < end); tail++) { switch (tail->opt_match->nod_type) { - case nod_gtr: + case nod_gtr: if (retrieval->irb_generic & irb_descending) includeUpper = false; else includeLower = false; break; - + case nod_lss: if (retrieval->irb_generic & irb_descending) includeLower = false; @@ -2074,8 +2074,8 @@ static SLONG decompose(thread_db* tdbb, boolean_node->nod_arg[1] = or_stack.pop(); while (or_stack.hasData()) { - boolean_node->nod_arg[1] = - OPT_make_binary_node(nod_and, boolean_node->nod_arg[1], or_stack.pop(), true); + boolean_node->nod_arg[1] = + OPT_make_binary_node(nod_and, boolean_node->nod_arg[1], or_stack.pop(), true); } } } @@ -3538,7 +3538,7 @@ static void find_rsbs(RecordSource* rsb, StreamStack* stream_list, RsbStack* rsb switch (rsb->rsb_type) { case rsb_union: - case rsb_recurse: + case rsb_recurse: case rsb_aggregate: case rsb_procedure: if (rsb_list) { @@ -3980,7 +3980,7 @@ static RecordSource* gen_aggregate(thread_db* tdbb, OptimizerBlk* opt, jrd_nod* if (asb_intl) { - const USHORT key_length = ROUNDUP(INTL_key_length(tdbb, + const USHORT key_length = ROUNDUP(INTL_key_length(tdbb, INTL_TEXT_TO_INDEX(desc->getTextType()), desc->getStringLength()), sizeof(SINT64)); sort_key->skd_dtype = SKD_bytes; @@ -5289,7 +5289,7 @@ static RecordSource* gen_sort(thread_db* tdbb, for (ptr = &streams[1]; ptr <= end_ptr; ptr++) { UInt32Bitmap::Accessor accessor(csb->csb_rpt[*ptr].csb_fields); - if (accessor.getFirst()) + if (accessor.getFirst()) do { const ULONG id = accessor.current(); items++; @@ -5802,14 +5802,14 @@ static RecordSource* gen_union(thread_db* tdbb, const USHORT count = clauses->nod_count; const bool recurse = (union_node->nod_flags & nod_recurse); CompilerScratch* csb = opt->opt_csb; - RecordSource* rsb = + RecordSource* rsb = FB_NEW_RPT(*tdbb->getDefaultPool(), count + nstreams + 1 + (recurse ? 2 : 0)) RecordSource(); if (recurse) { rsb->rsb_type = rsb_recurse; rsb->rsb_impure = CMP_impure(csb, sizeof(struct irsb_recurse)); } - else + else { rsb->rsb_type = rsb_union; rsb->rsb_impure = CMP_impure(csb, sizeof(struct irsb)); @@ -7253,7 +7253,7 @@ static jrd_nod* optimize_like(thread_db* tdbb, CompilerScratch* csb, jrd_nod* li matchTextType->canonical(first_len, p, sizeof(first_canonic), first_canonic); const BYTE canWidth = matchTextType->getCanonicalWidth(); - + // If the first character is a wildcard char, forget it. if ((!escape_node || (memcmp(first_canonic, escape_canonic, canWidth) != 0)) && diff --git a/src/jrd/os/darwin/mod_loader.cpp b/src/jrd/os/darwin/mod_loader.cpp index 480ebbf004..45a61c277b 100644 --- a/src/jrd/os/darwin/mod_loader.cpp +++ b/src/jrd/os/darwin/mod_loader.cpp @@ -36,7 +36,7 @@ #include -static void inline debugPrint(const char* s) +static void inline debugPrint(const char* s) { //printf("%s\n", s); } @@ -46,10 +46,10 @@ static void inline debugPrint(const char* s) class DarwinModule : public ModuleLoader::Module { public: - DarwinModule(NSModule ns, void* dl) : nsModule(ns), dlModule(dl) { } + DarwinModule(NSModule ns, void* dl) : nsModule(ns), dlModule(dl) { } ~DarwinModule(); void* findSymbol(const Firebird::string&); - + private: NSModule nsModule; void* dlModule; // non-NULL means this is dynamic library @@ -99,7 +99,7 @@ ModuleLoader::Module* ModuleLoader::loadModule(const Firebird::PathName& modPath else { debugPrint("not a Mach-O MH_BUNDLE file type or dynamic library"); - return 0; + return 0; } case NSObjectFileImageArch: debugPrint("no object for this architecture"); @@ -114,7 +114,7 @@ ModuleLoader::Module* ModuleLoader::loadModule(const Firebird::PathName& modPath debugPrint("unknown error from NSCreateObjectFileImageFromFile()"); return 0; } - + /* link the image */ NSModule mod_handle = NSLinkModule(image, modPath.c_str(), NSLINKMODULE_OPTION_PRIVATE); NSDestroyObjectFileImage(image); @@ -125,7 +125,7 @@ ModuleLoader::Module* ModuleLoader::loadModule(const Firebird::PathName& modPath // We should really throw an error here. return 0; } - + NSSymbol initSym = NSLookupSymbolInModule(mod_handle, "__init"); if (initSym != NULL) { @@ -133,7 +133,7 @@ ModuleLoader::Module* ModuleLoader::loadModule(const Firebird::PathName& modPath init = ( void (*)(void)) NSAddressOfSymbol(initSym); init(); } - + return FB_NEW(*getDefaultMemoryPool()) DarwinModule(mod_handle, NULL); } @@ -143,7 +143,7 @@ DarwinModule::~DarwinModule() { dlclose(dlModule); } - else + else { /* Make sure the fini function gets called, if there is one */ NSSymbol symbol = NSLookupSymbolInModule(nsModule, "__fini"); diff --git a/src/jrd/os/posix/config_root.cpp b/src/jrd/os/posix/config_root.cpp index 595bf042dc..3a18521c80 100644 --- a/src/jrd/os/posix/config_root.cpp +++ b/src/jrd/os/posix/config_root.cpp @@ -20,7 +20,7 @@ * Contributor(s): ______________________________________. * 25 May 2003 - Nickolay Samofatov: Fix several bugs that prevented * compatibility with Kylix - * + * */ #include "firebird.h" @@ -47,7 +47,7 @@ static string getRootPathFromExePath() { // get the pathname of the running executable string bin_dir = fb_utils::get_process_name(); - if (bin_dir.length() == 0) + if (bin_dir.length() == 0) return ""; // get rid of the filename diff --git a/src/jrd/os/posix/fbsyslog.cpp b/src/jrd/os/posix/fbsyslog.cpp index ca5321f9b8..65ee5767bb 100644 --- a/src/jrd/os/posix/fbsyslog.cpp +++ b/src/jrd/os/posix/fbsyslog.cpp @@ -40,7 +40,7 @@ void Syslog::Record(Severity level, const char* msg) break; } syslog(priority | LOG_LOCAL3, "%s (%m)", msg); - + // try to put it also on controlling tty int fd = 2; if (! isatty(fd)) diff --git a/src/jrd/os/posix/isc_ipc.cpp b/src/jrd/os/posix/isc_ipc.cpp index 9d1876c9bf..a2c90bb426 100644 --- a/src/jrd/os/posix/isc_ipc.cpp +++ b/src/jrd/os/posix/isc_ipc.cpp @@ -210,10 +210,10 @@ int ISC_kill(SLONG pid, SLONG signal_number) send to him. */ int pipes[2]; - + if (!relay_pipe) { TEXT process[MAXPATHLEN], arg[10]; - + gds__prefix(process, GDS_RELAY); if (access(process, X_OK) != 0) { // we don't have relay, therefore simply give meaningful diagnostic @@ -315,7 +315,7 @@ static bool isc_signal2( sigaddset(&act.sa_mask, signal_number); sigaction(signal_number, &act, &oact); old_sig_w_siginfo = oact.sa_flags & SA_SIGINFO; - + if (oact.sa_sigaction != signal_action && oact.sa_handler != SIG_DFL && oact.sa_handler != SIG_HOLD && @@ -360,7 +360,7 @@ void ISC_signal_cancel( for (ptr = &signals; sig = *ptr;) { if (sig->sig_signal == signal_number && (handler == NULL || - (sig->sig_routine.user == handler && sig->sig_arg == arg))) + (sig->sig_routine.user == handler && sig->sig_arg == arg))) { *ptr = sig->sig_next; gds__free(sig); @@ -446,8 +446,8 @@ static SLONG overflow_handler(void* arg) } static SIG que_signal(int signal_number, - FPTR_VOID handler, - void* arg, + FPTR_VOID handler, + void* arg, int flags, bool sig_w_siginfo) { @@ -518,7 +518,7 @@ static void CLIB_ROUTINE signal_action(int number, siginfo_t *siginfo, void *con (*sig->sig_routine.client1)(number); } } - else if (sig->sig_flags & SIG_informs) + else if (sig->sig_flags & SIG_informs) { /* Routine will tell us whether to chain the signal to other handlers */ if ((*sig->sig_routine.informs)(sig->sig_arg) == SIG_informs_stop) diff --git a/src/jrd/os/posix/mod_loader.cpp b/src/jrd/os/posix/mod_loader.cpp index df60c194d0..edb31e169e 100644 --- a/src/jrd/os/posix/mod_loader.cpp +++ b/src/jrd/os/posix/mod_loader.cpp @@ -43,7 +43,7 @@ public: DlfcnModule(void *m) : module(m) {} ~DlfcnModule(); void *findSymbol(const Firebird::string&); - + private: void *module; }; @@ -73,7 +73,7 @@ ModuleLoader::Module *ModuleLoader::loadModule(const Firebird::PathName& modPath void* module = dlopen(modPath.c_str(), RTLD_LAZY); if (module == NULL) return 0; - + return FB_NEW(*getDefaultMemoryPool()) DlfcnModule(module); } diff --git a/src/jrd/os/posix/path_utils.cpp b/src/jrd/os/posix/path_utils.cpp index 562c508e65..02a91e1ee9 100644 --- a/src/jrd/os/posix/path_utils.cpp +++ b/src/jrd/os/posix/path_utils.cpp @@ -54,7 +54,7 @@ public: const PosixDirItr& operator++(); const Firebird::PathName& operator*() { return file; } operator bool() { return !done; } - + private: DIR *dir; Firebird::PathName file; @@ -110,7 +110,7 @@ void PathUtils::splitLastComponent(Firebird::PathName& path, Firebird::PathName& file = orgPath; return; } - + path.erase(); path.append(orgPath, 0, pos); // skip the directory separator file.erase(); @@ -131,7 +131,7 @@ void PathUtils::concatPath(Firebird::PathName& result, result = second; return; } - + if (first[first.length() - 1] != dir_sep && second[0] != dir_sep) { @@ -145,7 +145,7 @@ void PathUtils::concatPath(Firebird::PathName& result, result.append(second, 1, second.length() - 1); return; } - + result = first + second; } diff --git a/src/jrd/os/posix/unix.cpp b/src/jrd/os/posix/unix.cpp index 052c326f4f..4e7ae1105f 100644 --- a/src/jrd/os/posix/unix.cpp +++ b/src/jrd/os/posix/unix.cpp @@ -73,7 +73,7 @@ using namespace Firebird; #define O_DIRECT F_NOCACHE #endif -// Some operating systems have problems with use of write/read with +// Some operating systems have problems with use of write/read with // big (>2Gb) files. On the other hand, pwrite/pread works fine for them. // Therefore: #if defined SOLARIS @@ -221,9 +221,9 @@ jrd_file* PIO_create(Database* dbb, const PathName& file_name, #endif const int desc = open(file_name.c_str(), flag, 0666); - if (desc == -1) + if (desc == -1) { - ERR_post(Arg::Gds(isc_io_error) << Arg::Str("open O_CREAT") << + ERR_post(Arg::Gds(isc_io_error) << Arg::Str("open O_CREAT") << Arg::Str(file_name) << Arg::Gds(isc_io_create_err) << Arg::Unix(errno)); } @@ -239,7 +239,7 @@ jrd_file* PIO_create(Database* dbb, const PathName& file_name, // we cannot help much with former recovery close(desc); unlink(file_name.c_str()); - ERR_post(Arg::Gds(isc_io_error) << Arg::Str("chmod") << + ERR_post(Arg::Gds(isc_io_error) << Arg::Str("chmod") << Arg::Str(file_name) << Arg::Gds(isc_io_create_err) << Arg::Unix(chmodError)); } @@ -250,12 +250,12 @@ jrd_file* PIO_create(Database* dbb, const PathName& file_name, #endif ) { - int rc = unlink(file_name.c_str()); + int rc = unlink(file_name.c_str()); // it's no use throwing an error if unlink() failed for temp file in release build #ifdef DEV_BUILD if (rc < 0) { - ERR_post(Arg::Gds(isc_io_error) << Arg::Str("unlink") << + ERR_post(Arg::Gds(isc_io_error) << Arg::Str("unlink") << Arg::Str(file_name) << Arg::Gds(isc_io_create_err) << Arg::Unix(errno)); } @@ -287,7 +287,7 @@ bool PIO_expand(const TEXT* file_name, USHORT file_length, TEXT* expanded_name, * **************************************/ - return ISC_expand_filename(file_name, file_length, + return ISC_expand_filename(file_name, file_length, expanded_name, len_expanded, false); } @@ -301,7 +301,7 @@ void PIO_extend(Database* dbb, jrd_file* /*main_file*/, const ULONG /*extPages*/ ************************************** * * Functional description - * Extend file by extPages pages of pageSize size. + * Extend file by extPages pages of pageSize size. * **************************************/ // not implemented @@ -369,7 +369,7 @@ void PIO_force_write(jrd_file* file, const bool forcedWrites, const bool notUseF } #else //FCNTL_BROKEN maybeCloseFile(file->fil_desc); - file->fil_desc = openFile(file->fil_string, forcedWrites, + file->fil_desc = openFile(file->fil_string, forcedWrites, notUseFSCache, file->fil_flags & FIL_readonly); if (file->fil_desc == -1) { @@ -378,7 +378,7 @@ void PIO_force_write(jrd_file* file, const bool forcedWrites, const bool notUseF #endif //FCNTL_BROKEN file->fil_flags &= ~(FIL_force_write | FIL_no_fs_cache); - file->fil_flags |= (forcedWrites ? FIL_force_write : 0) | + file->fil_flags |= (forcedWrites ? FIL_force_write : 0) | (notUseFSCache ? FIL_no_fs_cache : 0); } #endif @@ -447,7 +447,7 @@ void PIO_get_unique_file_id(const Jrd::jrd_file* file, UCharBuffer& id) memcpy(p, &statistics.st_ino, len2); } - + void PIO_header(Database* dbb, SCHAR * address, int length) { /************************************** @@ -517,7 +517,7 @@ void PIO_header(Database* dbb, SCHAR * address, int length) static InitInstance zeros; -USHORT PIO_init_data(Database* dbb, jrd_file* main_file, ISC_STATUS* status_vector, +USHORT PIO_init_data(Database* dbb, jrd_file* main_file, ISC_STATUS* status_vector, ULONG startPage, USHORT initPages) { /************************************** @@ -561,7 +561,7 @@ USHORT PIO_init_data(Database* dbb, jrd_file* main_file, ISC_STATUS* status_vect SLONG to_write = write_pages * dbb->dbb_page_size; SLONG written; - for (int r = 0; r < IO_RETRY; r++) + for (int r = 0; r < IO_RETRY; r++) { if (!(file = seek_file(file, &bdb, &offset, status_vector))) return false; @@ -605,7 +605,7 @@ jrd_file* PIO_open(Database* dbb, */ desc = openFile(ptr, false, false, true); if (desc == -1) { - ERR_post(Arg::Gds(isc_io_error) << Arg::Str("open") << + ERR_post(Arg::Gds(isc_io_error) << Arg::Str("open") << Arg::Str(file_name) << Arg::Gds(isc_io_open_err) << Arg::Unix(errno)); } @@ -630,7 +630,7 @@ jrd_file* PIO_open(Database* dbb, if (PIO_on_raw_device(file_name) && !raw_devices_validate_database(desc, file_name)) { - ERR_post(Arg::Gds(isc_io_error) << Arg::Str("open") << + ERR_post(Arg::Gds(isc_io_error) << Arg::Str("open") << Arg::Str(file_name) << Arg::Gds(isc_io_open_err) << Arg::Unix(ENOENT)); } @@ -671,7 +671,7 @@ bool PIO_read(jrd_file* file, BufferDesc* bdb, Ods::pag* page, ISC_STATUS* statu for (i = 0; i < IO_RETRY; i++) { if (!(file = seek_file(file, bdb, &offset, status_vector))) return false; - if ((bytes = pread (file->fil_desc, spare_buffer, size, LSEEK_OFFSET_CAST offset)) == size) + if ((bytes = pread (file->fil_desc, spare_buffer, size, LSEEK_OFFSET_CAST offset)) == size) { (*dbb->dbb_decrypt) (dbb->dbb_encrypt_key->str_data, spare_buffer, size, page); @@ -946,12 +946,12 @@ static bool unix_error(const TEXT* string, return false; } - ERR_post(Arg::Gds(isc_io_error) << Arg::Str(string) << + ERR_post(Arg::Gds(isc_io_error) << Arg::Str(string) << Arg::Str(file->fil_string) << Arg::Gds(operation) << Arg::Unix(errno)); // Added a false for final return - which seems to be the answer, - // but is better than what it was which was nothing ie random + // but is better than what it was which was nothing ie random // Most usages within here want it to return a failure. // MOD 01-July-2002 @@ -1100,7 +1100,7 @@ static bool raw_devices_validate_database(int desc, const PathName& file_name) /* Read in database header. Code lifted from PIO_header. */ if (desc == -1) { - ERR_post(Arg::Gds(isc_io_error) << Arg::Str("raw_devices_validate_database") << + ERR_post(Arg::Gds(isc_io_error) << Arg::Str("raw_devices_validate_database") << Arg::Str(file_name) << Arg::Gds(isc_io_read_err) << Arg::Unix(errno)); } @@ -1109,7 +1109,7 @@ static bool raw_devices_validate_database(int desc, const PathName& file_name) { if (lseek (desc, LSEEK_OFFSET_CAST 0, 0) == (off_t) -1) { - ERR_post(Arg::Gds(isc_io_error) << Arg::Str("lseek") << + ERR_post(Arg::Gds(isc_io_error) << Arg::Str("lseek") << Arg::Str(file_name) << Arg::Gds(isc_io_read_err) << Arg::Unix(errno)); } @@ -1117,16 +1117,16 @@ static bool raw_devices_validate_database(int desc, const PathName& file_name) const ssize_t bytes = read (desc, header, sizeof(header)); if (bytes == sizeof(header)) goto read_finished; - + if (bytes == -1 && !SYSCALL_INTERRUPTED(errno)) { - ERR_post(Arg::Gds(isc_io_error) << Arg::Str("read") << + ERR_post(Arg::Gds(isc_io_error) << Arg::Str("read") << Arg::Str(file_name) << Arg::Gds(isc_io_read_err) << Arg::Unix(errno)); } } - ERR_post(Arg::Gds(isc_io_error) << Arg::Str("read_retry") << + ERR_post(Arg::Gds(isc_io_error) << Arg::Str("read_retry") << Arg::Str(file_name) << Arg::Gds(isc_io_read_err) << Arg::Unix(errno)); @@ -1134,7 +1134,7 @@ static bool raw_devices_validate_database(int desc, const PathName& file_name) /* Rewind file pointer */ if (lseek (desc, LSEEK_OFFSET_CAST 0, 0) == (off_t) -1) { - ERR_post(Arg::Gds(isc_io_error) << Arg::Str("lseek") << + ERR_post(Arg::Gds(isc_io_error) << Arg::Str("lseek") << Arg::Str(file_name) << Arg::Gds(isc_io_read_err) << Arg::Unix(errno)); } @@ -1177,7 +1177,7 @@ static int raw_devices_unlink_database(const PathName& file_name) if (!SYSCALL_INTERRUPTED(errno)) { - ERR_post(Arg::Gds(isc_io_error) << Arg::Str("open") << + ERR_post(Arg::Gds(isc_io_error) << Arg::Str("open") << Arg::Str(file_name) << Arg::Gds(isc_io_open_err) << Arg::Unix(errno)); } @@ -1192,7 +1192,7 @@ static int raw_devices_unlink_database(const PathName& file_name) break; if (bytes == -1 && SYSCALL_INTERRUPTED(errno)) continue; - ERR_post(Arg::Gds(isc_io_error) << Arg::Str("write") << + ERR_post(Arg::Gds(isc_io_error) << Arg::Str("write") << Arg::Str(file_name) << Arg::Gds(isc_io_write_err) << Arg::Unix(errno)); } diff --git a/src/jrd/os/vms/extvms.cpp b/src/jrd/os/vms/extvms.cpp index 22900dabf5..2aadb2786e 100644 --- a/src/jrd/os/vms/extvms.cpp +++ b/src/jrd/os/vms/extvms.cpp @@ -298,13 +298,13 @@ bool EXT_get(RecordSource* rsb) switch (rsb->rsb_type) { case rsb_ext_sequential: return get_sequential(rsb); - + case rsb_ext_indexed: return get_indexed(rsb); - + case rsb_ext_dbkey: return get_dbkey(rsb); - + default: IBERROR(181); /* msg 181 external access type not implemented */ } @@ -439,7 +439,7 @@ RecordSource* EXT_optimize(OptimizerBlk* opt, SSHORT stream, jrd_nod** sort_ptr) { for (SSHORT i = 0; i < file->ext_index_count; i++) { if (OPT_match_index(opt, stream, idx) && - opt->opt_rpt[0].opt_lower) + opt->opt_rpt[0].opt_lower) { inversion = OPT_make_index(tdbb, opt, relation, idx); if (check_sort(*sort_ptr, idx, stream)) @@ -630,7 +630,7 @@ static bool check_sort(const jrd_nod* sort, const index_desc* index, USHORT stre const index_desc::idx_repeat* tail = index->idx_rpt; const jrd_nod* const* ptr = sort->nod_arg; - for (const jrd_nod* const* const end = ptr + sort->nod_count; ptr < end; + for (const jrd_nod* const* const end = ptr + sort->nod_count; ptr < end; ptr++, tail++) { const jrd_nod* field = *ptr; @@ -921,7 +921,7 @@ static bool get_indexed(RecordSource* rsb) UCHAR* p = key_buffer; index_desc::idx_repeat* segment = index->idx_rpt; jrd_nod** ptr = retrieval->irb_value; - for (const jrd_nod* const* const end = ptr + retrieval->irb_lower_count; + for (const jrd_nod* const* const end = ptr + retrieval->irb_lower_count; ptr < end; ptr++, segment++) { p += get_key_segment(*ptr, p, @@ -1209,7 +1209,7 @@ static void set_flags(jrd_rel* relation, Record* record) vec* vector = relation->rel_fields; if (!vector) return; - + jrd_fld** field_ptr = &vector[0]; const Format* format = record->rec_format; dsc* desc_ptr = format->fmt_desc; diff --git a/src/jrd/os/vms/vmsevent.cpp b/src/jrd/os/vms/vmsevent.cpp index 13fc32dde4..af243ce011 100644 --- a/src/jrd/os/vms/vmsevent.cpp +++ b/src/jrd/os/vms/vmsevent.cpp @@ -605,7 +605,7 @@ static void deliver(EVNT event) event->evnt_count = event->evnt_lksb.lksb_value[0]; for (RINT interest = event->evnt_interests; interest; - interest = interest->rint_evnt_interests) + interest = interest->rint_evnt_interests) { if (VMS_REQ request = interest->rint_request) if (request->req_ast && request_completed(request)) @@ -642,7 +642,7 @@ static void deliver_request(VMS_REQ request) stuff */ for (RINT interest = request->req_interests; interest; - interest = interest->rint_req_interests) + interest = interest->rint_req_interests) { EVNT event = interest->rint_event; if (end < p + event->evnt_length + 5) { @@ -694,7 +694,7 @@ static void delivery_thread(void) for (VMS_REQ request = session->ses_requests; request; request = request->req_next) { - if (request->req_ast && request_completed(request)) + if (request->req_ast && request_completed(request)) { deliver_request(request); request->req_ast = NULL; @@ -749,7 +749,7 @@ static ISC_STATUS error(ISC_STATUS * status_vector, static EVNT find_event(USHORT length, const TEXT* string, - EVNT parent) + EVNT parent) { /************************************** * @@ -789,7 +789,7 @@ static void free(SCHAR * block) { static RINT historical_interest(SES session, - EVNT event) + EVNT event) { /************************************** * @@ -806,7 +806,7 @@ static RINT historical_interest(SES session, ptr = &(*ptr)->rint_req_interests) { if (interest->rint_event == event) - return interest; + return interest; } return NULL; } @@ -814,7 +814,7 @@ static RINT historical_interest(SES session, static EVNT make_event(USHORT length, const TEXT* string, - EVNT parent) + EVNT parent) { /************************************** * @@ -827,8 +827,8 @@ static EVNT make_event(USHORT length, * **************************************/ EVNT event = (EVNT) alloc(sizeof(struct evnt) + length); - if (!event) - return NULL; + if (!event) + return NULL; EVNT* ptr; SLONG parent_id; @@ -838,7 +838,7 @@ static EVNT make_event(USHORT length, } else { - ptr = &global_parent_events; + ptr = &global_parent_events; parent_id = 0; } @@ -850,7 +850,7 @@ static EVNT make_event(USHORT length, /* Request VMS lock on event */ struct dsc$descriptor desc; ISC_make_desc(string, &desc, length); - lock_status* lksb = &event->evnt_lksb; + lock_status* lksb = &event->evnt_lksb; int status = sys$enqw(0, /* event flag */ LCK$K_PRMODE, /* lock mode */ lksb, /* Lock status block */ @@ -896,7 +896,7 @@ static EVNT make_event(USHORT length, } -static void poke_ast(POKE poke) +static void poke_ast(POKE poke) { /************************************** * @@ -930,10 +930,10 @@ static bool request_completed(VMS_REQ request) * **************************************/ for (RINT interest = request->req_interests; interest; - interest = interest->rint_req_interests) + interest = interest->rint_req_interests) { EVNT event = interest->rint_event; - if (interest->rint_count <= event->evnt_count) + if (interest->rint_count <= event->evnt_count) return true; } @@ -956,7 +956,7 @@ static int return_ok(ISC_STATUS * status_vector) *status_vector++ = isc_arg_gds; *status_vector++ = 0; - *status_vector = isc_arg_end; + *status_vector = isc_arg_end; return 0; } diff --git a/src/jrd/os/vms/vmslock.cpp b/src/jrd/os/vms/vmslock.cpp index ec372a0df3..3a195c2084 100644 --- a/src/jrd/os/vms/vmslock.cpp +++ b/src/jrd/os/vms/vmslock.cpp @@ -108,7 +108,7 @@ int LOCK_deq(PTR lock_id) { /************************************** * - * L O C K _ d e q + * L O C K _ d e q * ************************************** * @@ -360,4 +360,4 @@ static SLONG write_data(SLONG lock_id, SLONG data) { if (!(status & 1) || !((status = lksb.lksb_status) & 1)) return 0; } - + diff --git a/src/jrd/os/win32/fbsyslog.cpp b/src/jrd/os/win32/fbsyslog.cpp index 56900d547b..966f5ceefa 100644 --- a/src/jrd/os/win32/fbsyslog.cpp +++ b/src/jrd/os/win32/fbsyslog.cpp @@ -28,7 +28,7 @@ namespace { typedef HANDLE WINAPI tRegisterEventSource( - LPCTSTR lpUNCServerName, + LPCTSTR lpUNCServerName, LPCTSTR lpSourceName); typedef BOOL WINAPI tReportEvent( HANDLE hEventLog, @@ -51,7 +51,7 @@ private: public: explicit SyslogAccess(Firebird::MemoryPool&) { - InitializeCriticalSection(&cs); + InitializeCriticalSection(&cs); InitFlag = false; LogHandle = 0; } @@ -62,7 +62,7 @@ public: void Record(WORD wType, const char* msg); }; -void SyslogAccess::Record(WORD wType, const char* msg) +void SyslogAccess::Record(WORD wType, const char* msg) { EnterCriticalSection(&cs); if (! InitFlag) { @@ -95,7 +95,7 @@ Firebird::InitInstance iSyslogAccess; namespace Firebird { -void Syslog::Record(Severity level, const char* msg) +void Syslog::Record(Severity level, const char* msg) { WORD wType = EVENTLOG_ERROR_TYPE; switch (level) { diff --git a/src/jrd/os/win32/isc_ipc.cpp b/src/jrd/os/win32/isc_ipc.cpp index 401b7a9514..b5dae8fb80 100644 --- a/src/jrd/os/win32/isc_ipc.cpp +++ b/src/jrd/os/win32/isc_ipc.cpp @@ -87,7 +87,7 @@ static void (*system_overflow_handler)(int); static void cleanup(void *); static void overflow_handler(int, int); -// Not thread-safe +// Not thread-safe ULONG isc_enter_count = 0; @@ -102,7 +102,7 @@ void ISC_enter(void) * Functional description * Enter ISC world from caller. * - **************************************/ + **************************************/ /* Setup overflow handler - with chaining to any user handler */ void (*temp)(int) = signal(SIGFPE, reinterpret_cast(overflow_handler)); diff --git a/src/jrd/os/win32/mod_loader.cpp b/src/jrd/os/win32/mod_loader.cpp index 2f052d0a18..a23b2bd9ac 100644 --- a/src/jrd/os/win32/mod_loader.cpp +++ b/src/jrd/os/win32/mod_loader.cpp @@ -18,7 +18,7 @@ public: Win32Module(HMODULE m) : module(m) {} ~Win32Module(); void *findSymbol(const string&); - + private: HMODULE module; }; @@ -48,7 +48,7 @@ ModuleLoader::Module *ModuleLoader::loadModule(const Firebird::PathName& modPath HMODULE module = LoadLibraryEx(modPath.c_str(), 0, LOAD_WITH_ALTERED_SEARCH_PATH); if (!module) return 0; - + return FB_NEW(*getDefaultMemoryPool()) Win32Module(module); } diff --git a/src/jrd/os/win32/path_utils.cpp b/src/jrd/os/win32/path_utils.cpp index 2f7bddd2f3..76079b8137 100644 --- a/src/jrd/os/win32/path_utils.cpp +++ b/src/jrd/os/win32/path_utils.cpp @@ -25,7 +25,7 @@ public: const PathUtils::dir_iterator& operator++(); const Firebird::PathName& operator*() { return file; } operator bool() { return !done; } - + private: HANDLE dir; WIN32_FIND_DATA fd; @@ -42,7 +42,7 @@ void Win32DirItr::Win32DirInit(const Firebird::PathName& path) if (dirPrefix.length() && dirPrefix[dirPrefix.length() - 1] != PathUtils::dir_sep) dirPrefix2 = dirPrefix2 + PathUtils::dir_sep; dirPrefix2 += "*.*"; - + dir = FindFirstFile(dirPrefix2.c_str(), &fd); if (dir == INVALID_HANDLE_VALUE) { dir = 0; @@ -68,7 +68,7 @@ const PathUtils::dir_iterator& Win32DirItr::operator++() done = true; else PathUtils::concatPath(file, dirPrefix, fd.cFileName); - + return *this; } @@ -92,7 +92,7 @@ void PathUtils::splitLastComponent(Firebird::PathName& path, Firebird::PathName& return; } } - + path.erase(); path.append(orgPath, 0, pos); // skip the directory separator file.erase(); @@ -113,7 +113,7 @@ void PathUtils::concatPath(Firebird::PathName& result, result = second; return; } - + if (first[first.length() - 1] != PathUtils::dir_sep && second[0] != PathUtils::dir_sep) { @@ -127,7 +127,7 @@ void PathUtils::concatPath(Firebird::PathName& result, result.append(second, 1, second.length() - 1); return; } - + result = first + second; } @@ -136,7 +136,7 @@ void PathUtils::ensureSeparator(Firebird::PathName& in_out) { if (in_out.length() == 0) in_out = PathUtils::dir_sep; - + if (in_out[in_out.length() - 1] != PathUtils::dir_sep) in_out += PathUtils::dir_sep; } @@ -146,8 +146,8 @@ bool PathUtils::isRelative(const Firebird::PathName& path) if (path.length() > 0) { char ds = path[0]; if (path.length() > 2) { - if (path[1] == ':' && - (('A' <= path[0] && path[0] <= 'Z') || + if (path[1] == ':' && + (('A' <= path[0] && path[0] <= 'Z') || ('a' <= path[0] && path[0] <= 'z'))) { ds = path[2]; diff --git a/src/jrd/os/win32/thd_priority.cpp b/src/jrd/os/win32/thd_priority.cpp index 91d0043aa4..4f75f556e6 100644 --- a/src/jrd/os/win32/thd_priority.cpp +++ b/src/jrd/os/win32/thd_priority.cpp @@ -118,12 +118,12 @@ void ThreadPriorityScheduler::init() gds__register_cleanup(Cleanup, 0); } -void ThreadPriorityScheduler::Cleanup(void*) +void ThreadPriorityScheduler::Cleanup(void*) { initialized.cleanup(); } -void ThreadPriorityScheduler::cleanup() +void ThreadPriorityScheduler::cleanup() { Firebird::MutexLockGuard guard(mutex); opMode = Stopping; @@ -163,7 +163,7 @@ void ThreadPriorityScheduler::run() { routine(arg); } -void ThreadPriorityScheduler::detach() +void ThreadPriorityScheduler::detach() { if (active) { @@ -171,7 +171,7 @@ void ThreadPriorityScheduler::detach() TLS_SET(currentScheduler, 0); if (opMode == ShutdownComplete) { - for (ThreadPriorityScheduler** pt = &chain; *pt; pt = &(*pt)->next) + for (ThreadPriorityScheduler** pt = &chain; *pt; pt = &(*pt)->next) { if (*pt == this) { @@ -198,9 +198,9 @@ void ThreadPriorityScheduler::detach() } } -unsigned int __stdcall ThreadPriorityScheduler::schedulerMain(LPVOID) +unsigned int __stdcall ThreadPriorityScheduler::schedulerMain(LPVOID) { - for (;;) + for (;;) { if (opMode == Stopping) { @@ -216,24 +216,24 @@ unsigned int __stdcall ThreadPriorityScheduler::schedulerMain(LPVOID) Sleep(Config::getPrioritySwitchDelay()); // We needn't lock mutex, because we don't modify // next here, and new thps object may be added - // only in the beginning of the chain - even if it + // only in the beginning of the chain - even if it // happens, we safely ignore it here. // To be sure that nothing is deleted from chain, // toDetach member is added to this class. - for (ThreadPriorityScheduler *t = chain; t; t = t->next) + for (ThreadPriorityScheduler *t = chain; t; t = t->next) { const UCHAR p_flags = t->flags; - if (p_flags & THPS_PSCHED) + if (p_flags & THPS_PSCHED) { const bool gonein = t->gonein; t->gonein = false; t->flags &= ~(THPS_UP | THPS_LOW); // clean them #pragma FB_COMPILER_MESSAGE("Fix! May have problems with long running UDFs.") - if ((! gonein) && (! (p_flags & THPS_BOOSTED))) + if ((! gonein) && (! (p_flags & THPS_BOOSTED))) { - if (p_flags & THPS_UP) + if (p_flags & THPS_UP) { - // 1. thread exited single thread zone and didn't + // 1. thread exited single thread zone and didn't // return into it since this &last cycle: // increase priority if (! SetThreadPriority(t->handle, highPriority)) @@ -253,9 +253,9 @@ unsigned int __stdcall ThreadPriorityScheduler::schedulerMain(LPVOID) t->flags |= THPS_UP; continue; } - if ((gonein || t->inside) && (p_flags & THPS_BOOSTED)) + if ((gonein || t->inside) && (p_flags & THPS_BOOSTED)) { - if (p_flags & THPS_LOW) + if (p_flags & THPS_LOW) { // 3. thread entered single thread zone // last cycle and didn't leave it completely @@ -279,7 +279,7 @@ unsigned int __stdcall ThreadPriorityScheduler::schedulerMain(LPVOID) } } - if (toDetach->getCount() > 0) + if (toDetach->getCount() > 0) { Firebird::MutexLockGuard guard(mutex); doDetach(); @@ -291,7 +291,7 @@ unsigned int __stdcall ThreadPriorityScheduler::schedulerMain(LPVOID) // *** mutex MUST be locked before doDetach *** void ThreadPriorityScheduler::doDetach() { - for (ThreadPriorityScheduler ** pt = &chain; *pt; pt = &(*pt)->next) + for (ThreadPriorityScheduler ** pt = &chain; *pt; pt = &(*pt)->next) { start_label: size_t pos; diff --git a/src/jrd/os/win32/winnt.cpp b/src/jrd/os/win32/winnt.cpp index aaa95d8852..39c4637549 100644 --- a/src/jrd/os/win32/winnt.cpp +++ b/src/jrd/os/win32/winnt.cpp @@ -29,8 +29,8 @@ * 02-Nov-2001 Mike Nordell: Synch with FB1 changes. * * 20-Nov-2001 Ann Harrison: Make page count work on db with forced write - * - * 21-Nov-2001 Ann Harrison: Allow read sharing so gstat works + * + * 21-Nov-2001 Ann Harrison: Allow read sharing so gstat works */ #include "firebird.h" @@ -60,7 +60,7 @@ class FileExtendLockGuard { public: FileExtendLockGuard(Firebird::RWLock* lock, bool exclusive) : - m_lock(lock), m_exclusive(exclusive) + m_lock(lock), m_exclusive(exclusive) { if (m_exclusive) { fb_assert(m_lock); @@ -228,7 +228,7 @@ jrd_file* PIO_create(Database* dbb, const Firebird::PathName& string, if (desc == INVALID_HANDLE_VALUE) { - ERR_post(Arg::Gds(isc_io_error) << Arg::Str("CreateFile (create)") << + ERR_post(Arg::Gds(isc_io_error) << Arg::Str("CreateFile (create)") << Arg::Str(string) << Arg::Gds(isc_io_create_err) << Arg::Windows(GetLastError())); } @@ -258,7 +258,7 @@ bool PIO_expand(const TEXT* file_name, USHORT file_length, TEXT* expanded_name, * **************************************/ - return ISC_expand_filename(file_name, file_length, + return ISC_expand_filename(file_name, file_length, expanded_name, len_expanded, false); } @@ -272,15 +272,15 @@ void PIO_extend(Database* dbb, jrd_file* main_file, const ULONG extPages, const ************************************** * * Functional description - * Extend file by extPages pages of pageSize size. + * Extend file by extPages pages of pageSize size. * **************************************/ - + // hvlad: prevent other reading\writing threads from changing file pointer. // As we open file without FILE_FLAG_OVERLAPPED, ReadFile\WriteFile calls // will change file pointer we set here and file truncation instead of file // extension will occurs. - // It solved issue CORE-1468 (database file corruption when file extension + // It solved issue CORE-1468 (database file corruption when file extension // and read\write activity performed simultaneously) // if file have no extend lock it is better to not extend file than corrupt it @@ -294,7 +294,7 @@ void PIO_extend(Database* dbb, jrd_file* main_file, const ULONG extPages, const for (jrd_file* file = main_file; file && leftPages; file = file->fil_next) { const ULONG filePages = PIO_get_number_of_pages(file, pageSize); - const ULONG fileMaxPages = (file->fil_max_page == MAX_ULONG) ? MAX_ULONG : + const ULONG fileMaxPages = (file->fil_max_page == MAX_ULONG) ? MAX_ULONG : file->fil_max_page - file->fil_min_page + 1; if (filePages < fileMaxPages) { @@ -302,7 +302,7 @@ void PIO_extend(Database* dbb, jrd_file* main_file, const ULONG extPages, const HANDLE hFile = file->fil_desc; - LARGE_INTEGER newSize; + LARGE_INTEGER newSize; newSize.QuadPart = (ULONGLONG) (filePages + extendBy) * pageSize; const DWORD ret = SetFilePointer(hFile, newSize.LowPart, &newSize.HighPart, FILE_BEGIN); @@ -373,11 +373,11 @@ void PIO_force_write(jrd_file* file, const bool forceWrite, const bool notUseFSC if (hFile == INVALID_HANDLE_VALUE) { - ERR_post(Arg::Gds(isc_io_error) << Arg::Str("CreateFile (force write)") << + ERR_post(Arg::Gds(isc_io_error) << Arg::Str("CreateFile (force write)") << Arg::Str(file->fil_string) << Arg::Gds(isc_io_access_err) << Arg::Windows(GetLastError())); } - + if (forceWrite) { file->fil_flags |= FIL_force_write; } @@ -405,7 +405,7 @@ void PIO_header(Database* dbb, SCHAR * address, int length) * Functional description * Read the page header. This assumes that the file has not been * repositioned since the file was originally mapped. - * The detail of Win32 implementation is that it doesn't assume + * The detail of Win32 implementation is that it doesn't assume * this fact as seeks to first byte of file initially, but external * callers should not rely on this behavior * @@ -467,7 +467,7 @@ void PIO_header(Database* dbb, SCHAR * address, int length) static Firebird::InitInstance zeros; -USHORT PIO_init_data(Database* dbb, jrd_file* main_file, ISC_STATUS* status_vector, +USHORT PIO_init_data(Database* dbb, jrd_file* main_file, ISC_STATUS* status_vector, ULONG startPage, USHORT initPages) { /************************************** @@ -493,7 +493,7 @@ USHORT PIO_init_data(Database* dbb, jrd_file* main_file, ISC_STATUS* status_vect OVERLAPPED overlapped; OVERLAPPED* overlapped_ptr; - jrd_file* file = + jrd_file* file = seek_file(main_file, &bdb, status_vector, &overlapped, &overlapped_ptr); if (!file) @@ -573,7 +573,7 @@ jrd_file* PIO_open(Database* dbb, if (desc == INVALID_HANDLE_VALUE) { - ERR_post(Arg::Gds(isc_io_error) << Arg::Str("CreateFile (open)") << + ERR_post(Arg::Gds(isc_io_error) << Arg::Str("CreateFile (open)") << Arg::Str(file_name) << Arg::Gds(isc_io_open_err) << Arg::Windows(GetLastError())); } @@ -851,7 +851,7 @@ bool PIO_write(jrd_file* file, BufferDesc* bdb, Ods::pag* page, ISC_STATUS* stat else { DWORD actual_length; - if (!WriteFile(desc, page, size, &actual_length, overlapped_ptr) + if (!WriteFile(desc, page, size, &actual_length, overlapped_ptr) || actual_length != size ) { #ifdef SUPERSERVER_V2 @@ -1127,13 +1127,13 @@ static bool nt_error(TEXT* string, if (status_vector) { - ERR_build_status(status_vector, Arg::Gds(isc_io_error) << Arg::Str(string) << + ERR_build_status(status_vector, Arg::Gds(isc_io_error) << Arg::Str(string) << Arg::Str(file->fil_string) << Arg::Gds(operation) << Arg::Windows(GetLastError())); return false; } - ERR_post(Arg::Gds(isc_io_error) << Arg::Str(string) << + ERR_post(Arg::Gds(isc_io_error) << Arg::Str(string) << Arg::Str(file->fil_string) << Arg::Gds(operation) << Arg::Windows(GetLastError())); diff --git a/src/jrd/pag.cpp b/src/jrd/pag.cpp index 7edcdf0506..d60e9665fe 100644 --- a/src/jrd/pag.cpp +++ b/src/jrd/pag.cpp @@ -119,7 +119,7 @@ inline void err_post_if_database_is_readonly(const Database* dbb) // Class definitions (obsolete platforms are commented out) // Class constant name consists of OS platform and CPU architecture. // -// For ports created before Firebird 2.0 release 64-bit and 32-bit +// For ports created before Firebird 2.0 release 64-bit and 32-bit // sub-architectures of the same CPU should use different classes. // For 64-bit ports first created after or as a part of Firebird 2.0 // release CPU architecture may be the same for both variants. @@ -171,21 +171,21 @@ static const int CLASS_MAX = CLASS_DARWIN_PPC64; // 2) alignment (32-bit or 64-bit), matters for record formats // 3) pointer size (32-bit or 64-bit), also matters for record formats // -// For ODS11 pointers are not stored in database and alignment is always 64-bit. +// For ODS11 pointers are not stored in database and alignment is always 64-bit. // So the only thing which normally matters for ODS11 is endiannes, but if // endianness is wrong we are going to notice it during ODS version check, // before architecture compatibility is tested. But we distinguish them here too, // for consistency. -enum ArchitectureType { +enum ArchitectureType { archUnknown, // Unknown architecture, allow opening database only if CLASS matches exactly archIntel86, // Little-endian platform with 32-bit pointers and 32-bit alignment (ODS10) archLittleEndian, // Any little-endian platform with standard layout of data archBigEndian // Any big-endian platform with standard layout of data }; -// Note that Sparc, HP and PowerPC disk structures should be compatible in theory, -// but in practice alignment on these platforms varies and actually depends on the +// Note that Sparc, HP and PowerPC disk structures should be compatible in theory, +// but in practice alignment on these platforms varies and actually depends on the // compiler used to produce the build. Yes, some 32-bit RISC builds use 64-bit alignment. // This is why we declare all such builds "Unknown" for ODS10. @@ -389,7 +389,7 @@ void PAG_add_clump( UCHAR* entry_p; const UCHAR* clump_end; while (mode != CLUMP_ADD) { - const bool found = + const bool found = find_type(page_num, &window, &page, LCK_write, type, &entry_p, &clump_end); @@ -415,7 +415,7 @@ void PAG_add_clump( CCH_MARK_MUST_WRITE(tdbb, &window); else CCH_MARK(tdbb, &window); - + memcpy(entry_p, entry, len); } CCH_RELEASE(tdbb, &window); @@ -511,8 +511,8 @@ USHORT PAG_add_file(const TEXT* file_name, SLONG start) if (dbb->dbb_flags & (DBB_force_write | DBB_no_fs_cache)) { - PIO_force_write(next, - dbb->dbb_flags & DBB_force_write, + PIO_force_write(next, + dbb->dbb_flags & DBB_force_write, dbb->dbb_flags & DBB_no_fs_cache); } @@ -758,13 +758,13 @@ PAG PAG_allocate(WIN * window) // CVC: Not sure of the initial value. Notice bytes and bit are used after the loop. UCHAR* bytes = 0; UCHAR bit = 0; - + pag* new_page = 0; // NULL before the search for a new page. - // Starting from ODS 11.1 we store in pip_header.reserved number of pages + // Starting from ODS 11.1 we store in pip_header.reserved number of pages // allocated from this pointer page. There is intention to create dedicated // field at page_inv_page for this purpose in ODS 12. - const bool isODS11_x = (dbb->dbb_ods_version == ODS_VERSION11 && + const bool isODS11_x = (dbb->dbb_ods_version == ODS_VERSION11 && dbb->dbb_minor_version >= 1); /* Find an allocation page with something on it */ @@ -775,7 +775,7 @@ PAG PAG_allocate(WIN * window) for (sequence = pageSpace->pipHighWater;; sequence++) { pip_window.win_page = (sequence == 0) ? pageSpace->ppFirst : sequence * dbb->dbb_page_manager.pagesPerPIP - 1; - page_inv_page* pip_page = + page_inv_page* pip_page = (page_inv_page*) CCH_FETCH(tdbb, &pip_window, LCK_write, pag_pages); pipMin = MAX_SLONG; @@ -790,7 +790,7 @@ PAG PAG_allocate(WIN * window) if (bit & *bytes) { relative_bit = ((bytes - pip_page->pip_bits) << 3) + i; pipMin = MIN(pipMin, relative_bit); - + const SLONG pageNum = relative_bit + sequence * pageMgr.pagesPerPIP; window->win_page = pageNum; new_page = CCH_fake(tdbb, window, 0); /* don't wait on latch */ @@ -805,13 +805,13 @@ PAG PAG_allocate(WIN * window) fb_assert(relative_bit == pip_page->pip_header.reserved); USHORT init_pages = 1; - if (!(dbb->dbb_flags & DBB_no_reserve)) + if (!(dbb->dbb_flags & DBB_no_reserve)) { const int minExtendPages = MIN_EXTEND_BYTES / dbb->dbb_page_size; init_pages = sequence ? 64 : MIN(pip_page->pip_header.reserved / 16, 64); // don't touch pages belongs to the next PIP - init_pages = + init_pages = MIN(init_pages, pageMgr.pagesPerPIP - pip_page->pip_header.reserved); if (init_pages < minExtendPages) @@ -821,7 +821,7 @@ PAG PAG_allocate(WIN * window) } ISC_STATUS_ARRAY status; - const ULONG start = + const ULONG start = sequence * pageMgr.pagesPerPIP + pip_page->pip_header.reserved; init_pages = PIO_init_data(dbb, pageSpace->file, status, start, init_pages); @@ -829,37 +829,37 @@ PAG PAG_allocate(WIN * window) if (init_pages) { pip_page->pip_header.reserved += init_pages; } - else + else { - // PIO_init_data returns zero - perhaps it is not supported, no space - // left on disk or IO error occured. Try to write one page and handle + // PIO_init_data returns zero - perhaps it is not supported, no space + // left on disk or IO error occured. Try to write one page and handle // IO errors if any CCH_must_write(window); try { CCH_RELEASE(tdbb, window); pip_page->pip_header.reserved = relative_bit + 1; } - catch (Firebird::status_exception) + catch (Firebird::status_exception) { // forget about this page as if we never tried to fake it CCH_forget_page(tdbb, window); - - // normally all page buffers now released by CCH_unwind - // only exception is when TDBB_no_cache_unwind flag is set + + // normally all page buffers now released by CCH_unwind + // only exception is when TDBB_no_cache_unwind flag is set if (tdbb->tdbb_flags & TDBB_no_cache_unwind) CCH_RELEASE(tdbb, &pip_window); - + throw; } - + new_page = CCH_fake(tdbb, window, 1); } fb_assert(new_page); } - if (!(dbb->dbb_flags & DBB_no_reserve)) + if (!(dbb->dbb_flags & DBB_no_reserve)) { - const ULONG initialized = + const ULONG initialized = sequence * pageMgr.pagesPerPIP + pip_page->pip_header.reserved; // At this point we ensure database has at least "initialized" pages @@ -1004,7 +1004,7 @@ int PAG_delete_clump_entry(SLONG page_num, USHORT type) UCHAR* entry_p; const UCHAR* clump_end; if (!find_type - (page_num, &window, &page, LCK_write, type, &entry_p, &clump_end)) + (page_num, &window, &page, LCK_write, type, &entry_p, &clump_end)) { CCH_RELEASE(tdbb, &window); return FALSE; @@ -1242,7 +1242,7 @@ void PAG_header(thread_db* tdbb, bool info) RelationPages* relPages = relation->getBasePages(); if (!relPages->rel_pages) { // 21-Dec-2003 Nickolay Samofatov - // No need to re-set first page for RDB$PAGES relation since + // No need to re-set first page for RDB$PAGES relation since // current code cannot change its location after database creation. // Currently, this change only affects isc_database_info call, // the only call which may call PAG_header multiple times. @@ -1276,7 +1276,7 @@ void PAG_header(thread_db* tdbb, bool info) /* If hdr_read_only is not set... */ if (!(header->hdr_flags & hdr_read_only) - && (dbb->dbb_flags & DBB_being_opened_read_only)) + && (dbb->dbb_flags & DBB_being_opened_read_only)) { /* Looks like the Header page says, it is NOT ReadOnly!! But the database * file system permission gives only ReadOnly access. Punt out with @@ -1291,14 +1291,14 @@ void PAG_header(thread_db* tdbb, bool info) if ((header->hdr_flags & hdr_force_write) || !useFSCache) { - dbb->dbb_flags |= - (header->hdr_flags & hdr_force_write ? DBB_force_write : 0) | + dbb->dbb_flags |= + (header->hdr_flags & hdr_force_write ? DBB_force_write : 0) | (useFSCache ? 0 : DBB_no_fs_cache); PageSpace* pageSpace = dbb->dbb_page_manager.findPageSpace(DB_PAGE_SPACE); for (jrd_file* file = pageSpace->file; file; file = file->fil_next) { - PIO_force_write(file, - (dbb->dbb_flags & DBB_force_write) && !(header->hdr_flags & hdr_read_only), + PIO_force_write(file, + (dbb->dbb_flags & DBB_force_write) && !(header->hdr_flags & hdr_read_only), dbb->dbb_flags & DBB_no_fs_cache); } } @@ -1391,7 +1391,7 @@ void PAG_header_init(thread_db* tdbb) // is accessed with engine built for another architecture. - Nickolay 9-Feb-2005 if (header->hdr_implementation != CLASS && - ods_version < ODS_VERSION11 ? + ods_version < ODS_VERSION11 ? (header->hdr_implementation < 0 || header->hdr_implementation > CLASS_MAX10 || archMatrix10[header->hdr_implementation] == archUnknown || archMatrix10[header->hdr_implementation] != archMatrix10[CLASS]) @@ -1405,7 +1405,7 @@ void PAG_header_init(thread_db* tdbb) } if (header->hdr_page_size < MIN_PAGE_SIZE || - header->hdr_page_size > MAX_PAGE_SIZE) + header->hdr_page_size > MAX_PAGE_SIZE) { ERR_post(Arg::Gds(isc_bad_db_format) << Arg::Str(attachment->att_filename)); } @@ -1417,7 +1417,7 @@ void PAG_header_init(thread_db* tdbb) dbb->dbb_page_size = header->hdr_page_size; dbb->dbb_page_buffers = header->hdr_page_buffers; } - + void PAG_init(thread_db* tdbb) { @@ -1474,11 +1474,11 @@ void PAG_init(thread_db* tdbb) // Artifically reduce density of records to test high bits of record number // dbb->dbb_max_records = 32000; -/* Optimize record numbers for new 64-bit sparse bitmap implementation +/* Optimize record numbers for new 64-bit sparse bitmap implementation We need to measure if it is beneficial from performance point of view. Price is slightly reduced density of record numbers, but for ODS11 it doesn't matter because record numbers are 40-bit. - Benefit is ~1.5 times smaller sparse bitmaps on average and + Benefit is ~1.5 times smaller sparse bitmaps on average and faster bitmap iteration. */ // if (dbb->dbb_ods_version >= ODS_VERSION11) // dbb->dbb_max_records = FB_ALIGN(dbb->dbb_max_records, 64); @@ -1636,8 +1636,8 @@ void PAG_init2(thread_db* tdbb, USHORT shadow_number) file = file->fil_next; if (dbb->dbb_flags & (DBB_force_write | DBB_no_fs_cache)) { - PIO_force_write(file, - dbb->dbb_flags & DBB_force_write, + PIO_force_write(file, + dbb->dbb_flags & DBB_force_write, dbb->dbb_flags & DBB_no_fs_cache); } file->fil_min_page = last_page + 1; @@ -1737,7 +1737,7 @@ void PAG_release_page(const PageNumber& number, const PageNumber& prior_page) WIN pip_window(number.getPageSpaceID(), (sequence == 0) ? pageSpace->ppFirst : sequence * pageMgr.pagesPerPIP - 1); - page_inv_page* pages = + page_inv_page* pages = (page_inv_page*) CCH_FETCH(tdbb, &pip_window, LCK_write, pag_pages); CCH_precedence(tdbb, &pip_window, prior_page); CCH_MARK(tdbb, &pip_window); @@ -2267,7 +2267,7 @@ ULONG PageSpace::actAlloc(const USHORT pageSize) * **************************************/ - // Traverse the linked list of files and add up the + // Traverse the linked list of files and add up the // number of pages in each file ULONG tot_pages = 0; for (const jrd_file* f = file; f != NULL; f = f->fil_next) { @@ -2296,7 +2296,7 @@ ULONG PageSpace::maxAlloc(const USHORT pageSize) f = f->fil_next; } - const ULONG nPages = f->fil_min_page - f->fil_fudge + + const ULONG nPages = f->fil_min_page - f->fil_fudge + PIO_get_number_of_pages(f, pageSize); if (maxPageNumber < nPages) @@ -2316,11 +2316,11 @@ bool PageSpace::extend(thread_db* tdbb, const ULONG pageNum) /************************************** * * Functional description - * Extend database file(s) up to at least pageNum pages. Number of pages to + * Extend database file(s) up to at least pageNum pages. Number of pages to * extend can't be less than hardcoded value MIN_EXTEND_BYTES and more than * configured value "DatabaseGrowthIncrement" (both values in bytes). - * - * If "DatabaseGrowthIncrement" is less than MIN_EXTEND_BYTES then don't + * + * If "DatabaseGrowthIncrement" is less than MIN_EXTEND_BYTES then don't * extend file(s) * **************************************/ @@ -2343,28 +2343,28 @@ bool PageSpace::extend(thread_db* tdbb, const ULONG pageNum) while (true) { - try + try { PIO_extend(dbb, file, extPages, dbb->dbb_page_size); break; } - catch (Firebird::status_exception) + catch (Firebird::status_exception) { - if (extPages > reqPages) + if (extPages > reqPages) { extPages = MAX(reqPages, extPages / 2); fb_utils::init_status(tdbb->tdbb_status_vector); } - else + else { - gds__log("Error extending file \"%s\" by %lu page(s).\nCurrently allocated %lu pages, requested page number %lu", + gds__log("Error extending file \"%s\" by %lu page(s).\nCurrently allocated %lu pages, requested page number %lu", file->fil_string, extPages, maxPageNumber, pageNum); return false; } } } - maxPageNumber = 0; + maxPageNumber = 0; } return true; } @@ -2453,7 +2453,7 @@ USHORT PageManager::getTempPageSpaceID(thread_db* tdbb) att->att_temp_pg_lock = lock; } - + result = (USHORT) att->att_temp_pg_lock->lck_key.lck_long; #endif @@ -2498,7 +2498,7 @@ ULONG PAG_page_count(Database* database, PageCountCallback* cb) { cb->newPage(pageNo, &pip->pip_header); fb_assert(pip->pip_header.pag_type == pag_pages); - if (pip->pip_header.reserved == pagesPerPip) + if (pip->pip_header.reserved == pagesPerPip) { // this is not last page, continue search continue; diff --git a/src/jrd/par.cpp b/src/jrd/par.cpp index 6092104ec1..6652c1c881 100644 --- a/src/jrd/par.cpp +++ b/src/jrd/par.cpp @@ -1320,7 +1320,7 @@ static jrd_nod* par_field(thread_db* tdbb, CompilerScratch* csb, SSHORT blr_oper if (procedure) { par_name(csb, name); if ((id = find_proc_field(procedure, name)) == -1) - error(csb, Arg::Gds(isc_fldnotdef2) << Arg::Str(name) << + error(csb, Arg::Gds(isc_fldnotdef2) << Arg::Str(name) << Arg::Str(procedure->prc_name)); } else { @@ -1354,12 +1354,12 @@ static jrd_nod* par_field(thread_db* tdbb, CompilerScratch* csb, SSHORT blr_oper if (tdbb->getAttachment()->att_flags & ATT_gbak_attachment) { - warning(csb, Arg::Warning(isc_fldnotdef) << Arg::Str(name) << + warning(csb, Arg::Warning(isc_fldnotdef) << Arg::Str(name) << Arg::Str(relation->rel_name)); } else if (!(relation->rel_flags & REL_deleted)) { - error(csb, Arg::Gds(isc_fldnotdef) << Arg::Str(name) << + error(csb, Arg::Gds(isc_fldnotdef) << Arg::Str(name) << Arg::Str(relation->rel_name)); } else @@ -1893,12 +1893,12 @@ static jrd_nod* par_plan(thread_db* tdbb, CompilerScratch* csb) { if (tdbb->getAttachment()->att_flags & ATT_gbak_attachment) { - warning(csb, Arg::Warning(isc_indexname) << Arg::Str(name) << + warning(csb, Arg::Warning(isc_indexname) << Arg::Str(name) << Arg::Str(relation->rel_name)); } else { - error(csb, Arg::Gds(isc_indexname) << Arg::Str(name) << + error(csb, Arg::Gds(isc_indexname) << Arg::Str(name) << Arg::Str(relation->rel_name)); } } @@ -3433,8 +3433,8 @@ void PAR_syntax_error(CompilerScratch* csb, const TEXT* string) * **************************************/ - error(csb, Arg::Gds(isc_syntaxerr) << Arg::Str(string) << - Arg::Num(csb->csb_running - csb->csb_blr - 1) << + error(csb, Arg::Gds(isc_syntaxerr) << Arg::Str(string) << + Arg::Num(csb->csb_running - csb->csb_blr - 1) << Arg::Num(csb->csb_running[-1])); } diff --git a/src/jrd/plugin_manager.cpp b/src/jrd/plugin_manager.cpp index b004f885c5..10782d329d 100644 --- a/src/jrd/plugin_manager.cpp +++ b/src/jrd/plugin_manager.cpp @@ -1,4 +1,4 @@ -/* +/* * PROGRAM: JRD Plugin Manager Method * MODULE: plugin_manager.cpp * DESCRIPTION: Manages dynamically loadable engine plugins @@ -36,9 +36,9 @@ PluginManager::Plugin PluginManager::findPlugin(const Firebird::PathName &name) if (itr->name() == name) return itr; } - + Module *result = 0; - + result = loadPluginModule(name); if (!result) { @@ -49,7 +49,7 @@ PluginManager::Plugin PluginManager::findPlugin(const Firebird::PathName &name) return 0; } } - + // Link the new module into the module list result->acquire(); if (moduleList) @@ -66,7 +66,7 @@ void PluginManager::loadAllPlugins() { Firebird::PathName checkDir; const Firebird::PathName fbLibPath = Config::getRootDirectory(); - + for (spIterator pathItr = searchPaths.begin(); pathItr != searchPaths.end(); ++pathItr) { if (pathItr->second) // This path is fb relative @@ -77,8 +77,8 @@ void PluginManager::loadAllPlugins() { checkDir = pathItr->first; } - - PathUtils::dir_iterator *dirItr = + + PathUtils::dir_iterator *dirItr = PathUtils::newDirItr(getPool(), checkDir); while (*dirItr) { @@ -92,7 +92,7 @@ void PluginManager::loadAllPlugins() break; } } - + // Check to see if the module has been explicitly excluded from loading if (!alreadyLoaded && ignoreModules.getCount() > 0) { @@ -108,7 +108,7 @@ void PluginManager::loadAllPlugins() } } } - + // If we haven't already loaded, and the module is loadable // as defined by the host os, then by all means load it! if (!alreadyLoaded && ModuleLoader::isLoadableModule(**dirItr)) @@ -122,7 +122,7 @@ void PluginManager::loadAllPlugins() mod->next = moduleList; mod->prev = &moduleList; moduleList = mod; - } + } ++(*dirItr); } delete dirItr; @@ -133,7 +133,7 @@ PluginManager::Module *PluginManager::loadPluginModule(const Firebird::PathName& { Firebird::PathName checkPath; const Firebird::PathName fbLibPath = Config::getRootDirectory(); - + // Check to see if the module name was specified as a relative path // from one of our search paths. This only makes sense if the name // of the module is relative. @@ -150,7 +150,7 @@ PluginManager::Module *PluginManager::loadPluginModule(const Firebird::PathName& { PathUtils::concatPath(checkPath, itr->first, name); } - + if (ModuleLoader::isLoadableModule(checkPath)) { return FB_NEW(getPool()) PluginModule(getPool(), name, @@ -164,7 +164,7 @@ PluginManager::Module *PluginManager::loadPluginModule(const Firebird::PathName& } } } - + // If we get this far we know the module isn't given as a relative path. // Check to see if it is a valid absolute path that happens to fall in one // of our search paths. This only makes sense if the name of the module @@ -176,7 +176,7 @@ PluginManager::Module *PluginManager::loadPluginModule(const Firebird::PathName& { Firebird::PathName::size_type pos = 0; Firebird::PathName::size_type checkPos; - + if (itr->second) // use fb path prefix { checkPos = name.find(fbLibPath, pos); @@ -202,7 +202,7 @@ PluginManager::Module *PluginManager::loadPluginModule(const Firebird::PathName& } } } - + // If we made it this far there is nothing left we can try. // The module _must_ not be an on-disk module :-) return 0; @@ -220,7 +220,7 @@ void PluginManager::addSearchPath(const Firebird::PathName& path, bool isFBRelat if (itr->first == path && itr->second == isFBRelative) return; } - + searchPaths.push(Path(path, isFBRelative)); } @@ -311,7 +311,7 @@ void PluginManager::load_engine_plugins() { enginePluginManager().addSearchPath(ENGINE_PLUGIN_DIR); enginePluginManager().loadAllPlugins(); - + const Firebird::string entryPoint(ENGINE_PLUGIN_REGISTRATION_ENTRYPOINT); for (PluginManager::iterator itr = enginePluginManager().begin(); itr != enginePluginManager().end(); ++itr) diff --git a/src/jrd/pwd.cpp b/src/jrd/pwd.cpp index 2a42c5facf..a840cf7d86 100644 --- a/src/jrd/pwd.cpp +++ b/src/jrd/pwd.cpp @@ -120,7 +120,7 @@ namespace { explicit FailedLogin(const string& l) : login(l), failCount(1), lastAttempt(time(0)) {} - FailedLogin(MemoryPool& p, const FailedLogin& fl) + FailedLogin(MemoryPool& p, const FailedLogin& fl) : login(p, fl.login), failCount(fl.failCount), lastAttempt(fl.lastAttempt) {} static const string* generate(const void* sender, const FailedLogin* f) @@ -133,17 +133,17 @@ namespace { const int MAX_FAILED_ATTEMPTS = 4; const int FAILURE_DELAY = 8; // seconds - class FailedLogins : private SortedObjectsArray, - const string, FailedLogin> + class FailedLogins : private SortedObjectsArray, + const string, FailedLogin> { private: // as long as we have voluntary threads scheduler, // this mutex should be entered AFTER that scheduler entered! Mutex fullAccess; - typedef SortedObjectsArray, + typedef SortedObjectsArray, const string, FailedLogin> inherited; public: @@ -274,7 +274,7 @@ bool SecurityDatabase::lookup_user(const TEXT* user_name, int* uid, int* gid, TE isc_start_and_send(status, &lookup_req, &lookup_trans, 0, sizeof(uname), uname, 0); checkStatus("isc_start_and_send"); - + while (true) { isc_receive(status, &lookup_req, 1, sizeof(user), &user, 0); @@ -287,7 +287,7 @@ bool SecurityDatabase::lookup_user(const TEXT* user_name, int* uid, int* gid, TE *uid = user.uid; if (gid) *gid = user.gid; - if (pwd) + if (pwd) { strncpy(pwd, user.password, MAX_PASSWORD_LENGTH); pwd[MAX_PASSWORD_LENGTH] = 0; @@ -323,7 +323,7 @@ void SecurityDatabase::prepare() // Attach as SYSDBA dpb.insertString(isc_dpb_trusted_auth, SYSDBA_USER_NAME, strlen(SYSDBA_USER_NAME)); - isc_attach_database(status, 0, user_info_name, &lookup_db, + isc_attach_database(status, 0, user_info_name, &lookup_db, dpb.getBufferLength(), reinterpret_cast(dpb.getBuffer())); checkStatus("isc_attach_database", isc_psw_attach); @@ -359,7 +359,7 @@ void SecurityDatabase::verifyUser(string& name, const TEXT* password_enc, int* uid, int* gid, - int* node_id, + int* node_id, const string& remoteId) { if (user_name) @@ -384,7 +384,7 @@ void SecurityDatabase::verifyUser(string& name, // We use PathName for string comparison using platform filename comparison // rules (case-sensitive or case-insensitive). const PathName authMethod(Config::getAuthMethod()); - useNative = (authMethod == AmNative || authMethod == AmMixed) ? + useNative = (authMethod == AmNative || authMethod == AmMixed) ? AM_ENABLED : AM_DISABLED; } if (useNative == AM_DISABLED) @@ -404,7 +404,7 @@ void SecurityDatabase::verifyUser(string& name, storedHash.rtrim(); // Punt if the user has specified neither a raw nor an encrypted password, - // or if the user has specified both a raw and an encrypted password, + // or if the user has specified both a raw and an encrypted password, // or if the user name specified was not in the password database // (or if there was no password database - it's still not found) @@ -416,7 +416,7 @@ void SecurityDatabase::verifyUser(string& name, } TEXT pwt[MAX_PASSWORD_LENGTH + 2]; - if (password) + if (password) { ENC_crypt(pwt, sizeof pwt, password, PASSWORD_SALT); password_enc = pwt + 2; @@ -435,7 +435,7 @@ void SecurityDatabase::verifyUser(string& name, newHash.erase(0, 2); legacyHash = newHash == storedHash; } - if (! legacyHash) + if (! legacyHash) { usernameFailedLogins().loginFail(name); remoteFailedLogins().loginFail(remoteId); diff --git a/src/jrd/qatest.cpp b/src/jrd/qatest.cpp index 0746262850..741ea1e4e3 100644 --- a/src/jrd/qatest.cpp +++ b/src/jrd/qatest.cpp @@ -31,8 +31,8 @@ this was done with a user UDF, but with NLM no longer supporting user UDF's we are including it in the system. I have therefore extended the BUILTIN_entrypoint() method to include -a system UDF entry, QATEST_entrypoint, which will do various -nasty things to the system when invoked. +a system UDF entry, QATEST_entrypoint, which will do various +nasty things to the system when invoked. ------------- THIS FUNCTION IS NOT TO BE DOCUMENTED OR USED BY CUSTOMERS @@ -40,31 +40,31 @@ THIS FUNCTION IS NOT TO BE DOCUMENTED OR USED BY CUSTOMERS To use the UDF, it must be declared to a database, thusly: - declare external function QAPOKE - int, int + declare external function QAPOKE + int, int returns int by value - entry_point "DEBUG_CRASH_TESTS" + entry_point "DEBUG_CRASH_TESTS" module_name "TEST1"; Note the special magic values for entry_point & module_name. Any number of parameters can be declared as part of the UDF definition and -will be passed to the entrypoint - the first parameter selects the +will be passed to the entrypoint - the first parameter selects the subfunction to invoke. Currently defined subfunctions, and expected parameters, are: 0 QATEST_testing (SLONG) - + Tests that the mechanism is working properly. returns 2*arg1; - 1 QATEST_delete_database (void) - + 1 QATEST_delete_database (void) + Deletes the current database file. Returns 0 on success Returns -1 if database doesn't have a file (when can this happen?) - 2 QATEST_delete_shadow (ULONG) + 2 QATEST_delete_shadow (ULONG) Deletes shadow #arg1. Returns 0 on success @@ -80,7 +80,7 @@ Currently defined subfunctions, and expected parameters, are: Code for the UDF is in jrd/qatest.c. -The R&D TCS test case is QATEST_METHOD, which exercises all the +The R&D TCS test case is QATEST_METHOD, which exercises all the defined APIs for this function. 1994-July-14 David Schnepper diff --git a/src/jrd/rpb_chain.cpp b/src/jrd/rpb_chain.cpp index 9bde541787..9ec6e26500 100644 --- a/src/jrd/rpb_chain.cpp +++ b/src/jrd/rpb_chain.cpp @@ -19,7 +19,7 @@ * All Rights Reserved. * Contributor(s): ______________________________________. */ - + #include "firebird.h" #include "../jrd/common.h" #include "../jrd/rpb_chain.h" @@ -49,8 +49,8 @@ int traRpbList::PushRpb(record_param* value) if (pos-- > 0) { traRpbListElement& prev = (*this)[pos]; if (prev.lr_rpb->rpb_relation->rel_id == value->rpb_relation->rel_id && - prev.lr_rpb->rpb_number == value->rpb_number) - { + prev.lr_rpb->rpb_number == value->rpb_number) + { // we got the same record once more - mark for refetch level = prev.level; fb_assert(pos >= level); diff --git a/src/jrd/rse.cpp b/src/jrd/rse.cpp index 19a67c012e..698e29283d 100644 --- a/src/jrd/rse.cpp +++ b/src/jrd/rse.cpp @@ -2369,9 +2369,9 @@ static bool get_record(thread_db* tdbb, } } - // hvlad: self referenced members are removed from recursive SELECT's - // in recursive CTE (it is done in dsql\pass1.cpp). If there are no other - // members in such SELECT then rsb_count will be zero. Handle it + // hvlad: self referenced members are removed from recursive SELECT's + // in recursive CTE (it is done in dsql\pass1.cpp). If there are no other + // members in such SELECT then rsb_count will be zero. Handle it else if (rsb->rsb_count == 0) return false; @@ -2620,8 +2620,8 @@ static void invalidate_child_rpbs(thread_db* tdbb, RecordSource* rsb) case rsb_recurse: { - // hvlad: recursive CTE is always a 'union all' of - // exactly two members. + // hvlad: recursive CTE is always a 'union all' of + // exactly two members. // see also comments for RSBRecurse::open invalidate_child_rpbs(tdbb, rsb->rsb_arg[0]); invalidate_child_rpbs(tdbb, rsb->rsb_arg[2]); @@ -2917,7 +2917,7 @@ static void open_sort(thread_db* tdbb, RecordSource* rsb, irsb_sort* impure, FB_ // Initialize for sort. If this is really a project operation, // establish a callback routine to reject duplicate records. - impure->irsb_sort_handle = + impure->irsb_sort_handle = SORT_init(tdbb, map->smb_length, map->smb_keys, map->smb_keys, map->smb_key_desc, ((map->smb_flags & SMB_project) ? reject : NULL), @@ -3608,14 +3608,14 @@ static void write_merge_block(thread_db* tdbb, merge_file* mfb, ULONG block) const USHORT RSBRecurse::MAX_RECURSE_LEVEL = 1024; -// hvlad: +// hvlad: // values of rsb_arg's: -// 0 - 1st stream +// 0 - 1st stream // 1 - 1st stream map -// 2 - 2nd stream +// 2 - 2nd stream // 3 - 2nd stream map -// 4 - count of the streams that make up the union -// 5..5+rsb_arg[4]-1 - numbers of the streams that make up the union +// 4 - count of the streams that make up the union +// 5..5+rsb_arg[4]-1 - numbers of the streams that make up the union // 5+rsb_arg[4] - inner impure area size // 6+rsb_arg[4] - number of stream for next level record void RSBRecurse::open(thread_db* tdbb, RecordSource* rsb, irsb_recurse* irsb) @@ -3639,7 +3639,7 @@ void RSBRecurse::open(thread_db* tdbb, RecordSource* rsb, irsb_recurse* irsb) // Initialize the record number for both and stream RecordSource** ptr = rsb->rsb_arg + rsb->rsb_count + 1; const RecordSource* const* end = ptr + streams; - for (; ptr < end; ptr++) + for (; ptr < end; ptr++) { const USHORT stream = (USHORT)(U_IPTR) *ptr; request->req_rpb[stream].rpb_number.setValue(BOF_NUMBER); @@ -3654,15 +3654,15 @@ bool RSBRecurse::get(thread_db* tdbb, RecordSource* rsb, irsb_recurse* irsb) jrd_req* request = tdbb->getRequest(); const USHORT streams = (USHORT)(U_IPTR) rsb->rsb_arg[rsb->rsb_count]; - const ULONG inner_size = (ULONG)(U_IPTR) rsb->rsb_arg[streams + rsb->rsb_count + 1]; + const ULONG inner_size = (ULONG)(U_IPTR) rsb->rsb_arg[streams + rsb->rsb_count + 1]; const ULONG rpbs_size = sizeof(record_param) * streams; const USHORT map_stream = (USHORT)(U_IPTR) rsb->rsb_arg[streams + rsb->rsb_count + 2]; RecordSource** rsb_ptr; - + Record* record = request->req_rpb[rsb->rsb_stream].rpb_record; Record* map_record = request->req_rpb[map_stream].rpb_record; - switch (irsb->irsb_mode) + switch (irsb->irsb_mode) { case root: rsb_ptr = &rsb->rsb_arg[0]; @@ -3670,7 +3670,7 @@ bool RSBRecurse::get(thread_db* tdbb, RecordSource* rsb, irsb_recurse* irsb) case recurse: { - // Stop infinite recursion of bad queries + // Stop infinite recursion of bad queries if (irsb->irsb_level > MAX_RECURSE_LEVEL) ERR_post(Arg::Gds(isc_req_max_clones_exceeded)); @@ -3681,7 +3681,7 @@ bool RSBRecurse::get(thread_db* tdbb, RecordSource* rsb, irsb_recurse* irsb) char* p = tmp + inner_size; RecordSource** ptr = rsb->rsb_arg + rsb->rsb_count + 1; const RecordSource* const* end = ptr + streams; - for (; ptr < end; ptr++) + for (; ptr < end; ptr++) { const record_param* rpb = &request->req_rpb[(USHORT)(U_IPTR) *ptr]; memmove(p, rpb, sizeof(record_param)); @@ -3712,7 +3712,7 @@ bool RSBRecurse::get(thread_db* tdbb, RecordSource* rsb, irsb_recurse* irsb) // there isn't a previous level, we're done while (!get_record(tdbb, *rsb_ptr, NULL, RSE_get_forward)) { - if (irsb->irsb_level == 1) + if (irsb->irsb_level == 1) { return false; } @@ -3726,7 +3726,7 @@ bool RSBRecurse::get(thread_db* tdbb, RecordSource* rsb, irsb_recurse* irsb) char* p = tmp + inner_size; RecordSource** ptr = rsb->rsb_arg + rsb->rsb_count + 1; const RecordSource* const* end = ptr + streams; - for (; ptr < end; ptr++) + for (; ptr < end; ptr++) { record_param* rpb = &request->req_rpb[(USHORT)(U_IPTR) *ptr]; Record* rec = rpb->rpb_record; @@ -3740,14 +3740,14 @@ bool RSBRecurse::get(thread_db* tdbb, RecordSource* rsb, irsb_recurse* irsb) } delete[] tmp; - if (irsb->irsb_level > 1) + if (irsb->irsb_level > 1) { rsb_ptr = &rsb->rsb_arg[2]; // Reset our record data so that recursive WHERE clauses work memcpy(record->rec_data, irsb->irsb_data, record->rec_length); } - else + else { rsb_ptr = &rsb->rsb_arg[0]; } @@ -3755,8 +3755,8 @@ bool RSBRecurse::get(thread_db* tdbb, RecordSource* rsb, irsb_recurse* irsb) irsb->irsb_mode = recurse; // We've got a record, map it into the target record - jrd_nod* map = (jrd_nod*) rsb_ptr[1]; - jrd_nod** ptr = map->nod_arg; + jrd_nod* map = (jrd_nod*) rsb_ptr[1]; + jrd_nod** ptr = map->nod_arg; const jrd_nod *const *end = ptr + map->nod_count; for (; ptr < end; ptr++) { EXE_assignment(tdbb, *ptr); @@ -3775,7 +3775,7 @@ void RSBRecurse::close(thread_db* tdbb, RecordSource* rsb, irsb_recurse* irsb) const USHORT streams = (USHORT)(U_IPTR) rsb->rsb_arg[rsb->rsb_count]; const ULONG inner_size = (ULONG)(U_IPTR) rsb->rsb_arg[streams + rsb->rsb_count + 1]; - while (irsb->irsb_level > 1) + while (irsb->irsb_level > 1) { RSE_close(tdbb, rsb->rsb_arg[2]); diff --git a/src/jrd/sdl.cpp b/src/jrd/sdl.cpp index 21e20df704..d6a99c29b4 100644 --- a/src/jrd/sdl.cpp +++ b/src/jrd/sdl.cpp @@ -106,9 +106,9 @@ const int op_scalar = 12; /* The structure for a loop is: - - - [body] + + + [body] [exit] */ @@ -149,11 +149,11 @@ SLONG SDL_compute_subscript(ISC_STATUS* status_vector, * * Functional description * Collapse a multi-dimension array reference into a vector - * reference. + * reference. * **************************************/ if (dimensions != desc->iad_dimensions) { - error(status_vector, Arg::Gds(isc_invalid_dimension) << Arg::Num(desc->iad_dimensions) << + error(status_vector, Arg::Gds(isc_invalid_dimension) << Arg::Num(desc->iad_dimensions) << Arg::Num(dimensions)); return -1; } @@ -342,7 +342,7 @@ int SDL_walk(ISC_STATUS* status_vector, ************************************** * * Functional description - * Walk a slice. + * Walk a slice. * **************************************/ DSC junk; @@ -363,7 +363,7 @@ int SDL_walk(ISC_STATUS* status_vector, case isc_sdl_struct: for (n = *p++; n; --n) { offset = p - sdl - 1; - if (!(p = sdl_desc(p, &junk))) + if (!(p = sdl_desc(p, &junk))) return error(status_vector, Arg::Gds(isc_invalid_sdl) << Arg::Num(offset)); } break; @@ -508,7 +508,7 @@ static const UCHAR* compile(const UCHAR* sdl, sdl_arg* arg) op = *p++; count = *p++; if (arg && count != arg->sdl_arg_desc->iad_dimensions) { - error(arg->sdl_arg_status_vector, + error(arg->sdl_arg_status_vector, Arg::Gds(isc_invalid_dimension) << Arg::Num(arg->sdl_arg_desc->iad_dimensions) << Arg::Num(count)); return NULL; @@ -591,7 +591,7 @@ static bool execute(sdl_arg* arg) dsc element_desc; Ods::InternalArrayDesc* array_desc = arg->sdl_arg_desc; - const Ods::InternalArrayDesc::iad_repeat* const range_end = + const Ods::InternalArrayDesc::iad_repeat* const range_end = array_desc->iad_rpt + array_desc->iad_dimensions; SLONG* variables = arg->sdl_arg_variables; const IPTR* next = arg->sdl_arg_compiled; @@ -723,7 +723,7 @@ static bool execute(sdl_arg* arg) } -static const UCHAR* get_range(const UCHAR* sdl, array_range* arg, +static const UCHAR* get_range(const UCHAR* sdl, array_range* arg, SLONG* min, SLONG* max) { /************************************** diff --git a/src/jrd/sdw.cpp b/src/jrd/sdw.cpp index 11909b4a0e..5211c0551c 100644 --- a/src/jrd/sdw.cpp +++ b/src/jrd/sdw.cpp @@ -85,7 +85,7 @@ void SDW_add(const TEXT* file_name, USHORT shadow_number, USHORT file_flags) // Verify database file path against DatabaseAccess entry of firebird.conf if (!JRD_verify_database_access(file_name)) { - ERR_post(Arg::Gds(isc_conf_access_denied) << Arg::Str("additional database file") << + ERR_post(Arg::Gds(isc_conf_access_denied) << Arg::Str("additional database file") << Arg::Str(file_name)); } @@ -93,14 +93,14 @@ void SDW_add(const TEXT* file_name, USHORT shadow_number, USHORT file_flags) if (dbb->dbb_flags & (DBB_force_write | DBB_no_fs_cache)) { - PIO_force_write(shadow_file, - dbb->dbb_flags & DBB_force_write, + 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); -/* dump out the header page, even if it is a conditional +/* dump out the header page, even if it is a conditional shadow--the page will be fixed up properly */ if (shadow->sdw_flags & SDW_conditional) @@ -159,7 +159,7 @@ int SDW_add_file(const TEXT* file_name, SLONG start, USHORT shadow_number) // Verify shadow file path against DatabaseAccess entry of firebird.conf if (!JRD_verify_database_access(file_name)) { - ERR_post(Arg::Gds(isc_conf_access_denied) << Arg::Str("database shadow") << + ERR_post(Arg::Gds(isc_conf_access_denied) << Arg::Str("database shadow") << Arg::Str(file_name)); } @@ -171,8 +171,8 @@ int SDW_add_file(const TEXT* file_name, SLONG start, USHORT shadow_number) if (dbb->dbb_flags & (DBB_force_write | DBB_no_fs_cache)) { - PIO_force_write(next, - dbb->dbb_flags & DBB_force_write, + PIO_force_write(next, + dbb->dbb_flags & DBB_force_write, dbb->dbb_flags & DBB_no_fs_cache); } @@ -184,7 +184,7 @@ int SDW_add_file(const TEXT* file_name, SLONG start, USHORT shadow_number) and set up to release it in case of error. Align the spare page buffer for raw disk access. */ - SCHAR* const spare_buffer = + SCHAR* const spare_buffer = FB_NEW(*tdbb->getDefaultPool()) char[dbb->dbb_page_size + MIN_PAGE_SIZE]; // And why doesn't the code check that the allocation succeeds? @@ -222,11 +222,11 @@ int SDW_add_file(const TEXT* file_name, SLONG start, USHORT shadow_number) next->fil_fudge = 1; /* Update the previous header page to point to new file -- - we can use the same header page, suitably modified, + we can use the same header page, suitably modified, because they all look pretty much the same at this point */ /******************* - Fix for bug 7925. drop_gdb wan not dropping secondary file in + Fix for bug 7925. drop_gdb wan not dropping secondary file in multi-shadow files. The structure was not being filled with the info. Commented some code so that the structure will always be filled. @@ -298,16 +298,16 @@ void SDW_check(void) ************************************** * * Functional description - * Check a shadow to see if it needs to + * Check a shadow to see if it needs to * be deleted or shut down. * **************************************/ Database* dbb = GET_DBB(); thread_db* tdbb = JRD_get_thread_data(); -/* first get rid of any shadows that need to be +/* first get rid of any shadows that need to be deleted or shutdown; deleted shadows must also - be shutdown + be shutdown Check to see if there is a valid shadow in the shadow set, if not then it is time to start an conditional shadow (if @@ -324,7 +324,7 @@ void SDW_check(void) shadow->sdw_file->fil_string, dbb->dbb_filename.c_str()); } - /* note that shutting down a shadow is destructive to + /* note that shutting down a shadow is destructive to the shadow block */ if (shadow->sdw_flags & SDW_shutdown) @@ -363,7 +363,7 @@ bool SDW_check_conditional(void) ************************************** * * Functional description - * Check if a conditional shadow exists + * Check if a conditional shadow exists * if so update meta data and return true * **************************************/ @@ -371,9 +371,9 @@ bool SDW_check_conditional(void) Database* dbb = tdbb->getDatabase(); CHECK_DBB(dbb); -/* first get rid of any shadows that need to be +/* first get rid of any shadows that need to be deleted or shutdown; deleted shadows must also - be shutdown + be shutdown Check to see if there is a valid shadow in the shadow set, if not then it is time to start an conditional shadow (if @@ -399,7 +399,7 @@ bool SDW_check_conditional(void) for (Shadow* shadow = dbb->dbb_shadow; shadow; shadow = shadow->sdw_next) { if ((shadow->sdw_flags & SDW_conditional) && - !(shadow->sdw_flags & (SDW_IGNORE | SDW_rollover))) + !(shadow->sdw_flags & (SDW_IGNORE | SDW_rollover))) { shadow->sdw_flags &= ~SDW_conditional; @@ -469,7 +469,7 @@ void SDW_dump_pages(void) window.win_flags = WIN_large_scan; window.win_scans = 1; - for (SLONG page_number = HEADER_PAGE + 1; page_number <= max; page_number++) + for (SLONG page_number = HEADER_PAGE + 1; page_number <= max; page_number++) { #ifdef SUPERSERVER_V2 if (!(page_number % dbb->dbb_prefetch_sequence)) { @@ -491,8 +491,8 @@ void SDW_dump_pages(void) /* when copying a database, it is possible that there are some pages defined in the pip that were never actually written to disk, in the case of a faked - page which was never written to disk because of a rollback; to prevent - checksum errors on this type of page, don't check for checksum when the + page which was never written to disk because of a rollback; to prevent + checksum errors on this type of page, don't check for checksum when the page type is 0 */ CCH_FETCH_NO_CHECKSUM(tdbb, &window, LCK_read, pag_undefined); @@ -572,9 +572,9 @@ void SDW_init(bool activate, bool delete_files) * * Functional description * Initialize shadowing by opening all shadow files and - * getting a lock on the semaphore for disk shadowing. - * When anyone tries to get an exclusive lock on this - * semaphore, it is a signal to check for a new file + * getting a lock on the semaphore for disk shadowing. + * When anyone tries to get an exclusive lock on this + * semaphore, it is a signal to check for a new file * to use as a shadow. * **************************************/ @@ -616,19 +616,19 @@ bool SDW_lck_update(thread_db* tdbb, SLONG sdw_update_flags) { /************************************** * - * S D W _ l c k _ u p d a t e + * S D W _ l c k _ u p d a t e * ************************************** * * Functional description * update the Lock struct with the flag * The update type flag indicates the type of corrective action - * to be taken by the ASTs of other procs attached to this DB. - * + * to be taken by the ASTs of other procs attached to this DB. + * * A non zero sdw_update_flag is passed, it indicates error handling * Two processes may encounter the Shadow array at the same time * and both will want to perform corrective action. Only one should - * be allowed. For that, + * be allowed. For that, * check if current data is zero, else return * write the pid into the lock data, read back to verify * if pid is different, another process has updated behind you, so @@ -934,12 +934,12 @@ void SDW_start(const TEXT* file_name, Firebird::PathName expanded_name(file_name); ISC_expand_filename(expanded_name, false); - PageSpace* pageSpace = + PageSpace* pageSpace = dbb->dbb_page_manager.findPageSpace(DB_PAGE_SPACE); jrd_file* dbb_file = pageSpace->file; - if (dbb_file && dbb_file->fil_string && - expanded_name == dbb_file->fil_string) + if (dbb_file && dbb_file->fil_string && + expanded_name == dbb_file->fil_string) { if (shadow && (shadow->sdw_flags & SDW_rollover)) return; @@ -949,7 +949,7 @@ void SDW_start(const TEXT* file_name, // Verify shadow file path against DatabaseAccess entry of firebird.conf if (!JRD_verify_database_access(expanded_name)) { - ERR_post(Arg::Gds(isc_conf_access_denied) << Arg::Str("database shadow") << + ERR_post(Arg::Gds(isc_conf_access_denied) << Arg::Str("database shadow") << Arg::Str(expanded_name)); } @@ -974,8 +974,8 @@ void SDW_start(const TEXT* file_name, if (dbb->dbb_flags & (DBB_force_write | DBB_no_fs_cache)) { - PIO_force_write(shadow_file, - dbb->dbb_flags & DBB_force_write, + PIO_force_write(shadow_file, + dbb->dbb_flags & DBB_force_write, dbb->dbb_flags & DBB_no_fs_cache); } @@ -1000,7 +1000,7 @@ void SDW_start(const TEXT* file_name, const header_page* shadow_header = (header_page*) spare_page; - /* + /* * NOTE ! NOTE! NOTE! * Starting V4.0, header pages can have over flow pages. For the shadow, * we are making an assumption that the shadow header page will not @@ -1023,7 +1023,7 @@ void SDW_start(const TEXT* file_name, (dbb_file->fil_string, reinterpret_cast(p), string_length) && check_for_file(reinterpret_cast(p), - string_length)) + string_length)) { ERR_punt(); } @@ -1171,7 +1171,7 @@ static int blocking_ast_shadowing(void* ast_object) * * Functional description * A blocking AST has been issued to give up - * the lock on the shadowing semaphore. + * the lock on the shadowing semaphore. * Do so after flagging the need to check for * new shadow files before doing the next physical write. * @@ -1240,12 +1240,12 @@ static void check_if_got_ast(jrd_file* file) { /************************************** * - * c h e c k _ i f _ g o t _ a s t + * c h e c k _ i f _ g o t _ a s t * ************************************** * * Functional description - * have we got the signal indicating a + * have we got the signal indicating a * a shadow update * **************************************/ @@ -1274,10 +1274,10 @@ static void copy_header(void) ************************************** * * Functional description - * Fetch the header page from the database + * Fetch the header page from the database * and write it to the shadow file. This is * done so that if this shadow is extended, - * the header page will be there for writing + * the header page will be there for writing * the name of the extend file. * **************************************/ @@ -1299,7 +1299,7 @@ static void update_dbb_to_sdw(Database* dbb) { /************************************** * - * u p d a t e _ d b b _ t o _ s d w + * u p d a t e _ d b b _ t o _ s d w * ************************************** * @@ -1325,7 +1325,7 @@ static void update_dbb_to_sdw(Database* dbb) /* close the main database file if possible and release all file blocks */ - PageSpace* pageSpace = + PageSpace* pageSpace = dbb->dbb_page_manager.findPageSpace(DB_PAGE_SPACE); PIO_close(pageSpace->file); diff --git a/src/jrd/sha.cpp b/src/jrd/sha.cpp index 8483a98f52..2d8d6d855e 100644 --- a/src/jrd/sha.cpp +++ b/src/jrd/sha.cpp @@ -15,7 +15,7 @@ #include "../common/classes/array.h" #include "../jrd/os/guid.h" -namespace +namespace { /* Useful defines & typedefs */ @@ -350,7 +350,7 @@ typedef Firebird::HalfStaticArray BinHash; void base64(Firebird::string& b64, const BinHash& bin) { b64.erase(); - const unsigned char* f = + const unsigned char* f = reinterpret_cast(bin.begin()); for (int i = bin.getCount(); i > 0; i -= 3, f += 3) { diff --git a/src/jrd/shut.cpp b/src/jrd/shut.cpp index 095a8f4ad6..ff89c2a8f2 100644 --- a/src/jrd/shut.cpp +++ b/src/jrd/shut.cpp @@ -54,7 +54,7 @@ union shutdown_data { }; -// Define this to true if you need to allow no-op behavior when requested shutdown mode +// Define this to true if you need to allow no-op behavior when requested shutdown mode // matches current. Logic of jrd8_create_database may need attention in this case too const bool IGNORE_SAME_MODE = false; @@ -107,7 +107,7 @@ bool SHUT_blocking_ast(thread_db* tdbb) default: fb_assert(false); } - + dbb->dbb_shutdown_delay = 0; // not tested anywhere return false; @@ -154,7 +154,7 @@ bool SHUT_database(thread_db* tdbb, SSHORT flag, SSHORT delay) /* Only platform's user locksmith can shutdown or bring online a database. */ - if (!attachment->locksmith()) + if (!attachment->locksmith()) { return false; } @@ -163,11 +163,11 @@ bool SHUT_database(thread_db* tdbb, SSHORT flag, SSHORT delay) // Check if requested shutdown mode is valid // Note that if we are already in requested mode we just return true. - // This is required to ensure backward compatible behavior (gbak relies on that, + // This is required to ensure backward compatible behavior (gbak relies on that, // user-written scripts may rely on this behaviour too) switch (shut_mode) { case isc_dpb_shut_full: - if (dbb->dbb_ast_flags & DBB_shutdown_full) + if (dbb->dbb_ast_flags & DBB_shutdown_full) return bad_mode(tdbb, IGNORE_SAME_MODE); break; case isc_dpb_shut_multi: @@ -185,14 +185,14 @@ bool SHUT_database(thread_db* tdbb, SSHORT flag, SSHORT delay) if (dbb->dbb_ast_flags & DBB_shutdown_single) return bad_mode(tdbb, IGNORE_SAME_MODE); break; - case isc_dpb_shut_normal: + case isc_dpb_shut_normal: if (!(dbb->dbb_ast_flags & DBB_shutdown)) return bad_mode(tdbb, IGNORE_SAME_MODE); return bad_mode(tdbb, false); default: return bad_mode(tdbb, false); // unexpected mode } - + try { // Reject exclusive and single-user shutdown attempts @@ -351,30 +351,30 @@ bool SHUT_online(thread_db* tdbb, SSHORT flag) if (!attachment->att_user->locksmith()) { return false; } - + const int shut_mode = flag & isc_dpb_shut_mode_mask; // Check if requested shutdown mode is valid switch (shut_mode) { case isc_dpb_shut_normal: - if (!(dbb->dbb_ast_flags & DBB_shutdown)) + if (!(dbb->dbb_ast_flags & DBB_shutdown)) return bad_mode(tdbb, IGNORE_SAME_MODE); // normal -> normal break; case isc_dpb_shut_multi: if (!(dbb->dbb_ast_flags & DBB_shutdown)) return bad_mode(tdbb, false); // normal -> multi - if (!(dbb->dbb_ast_flags & DBB_shutdown_full) && - !(dbb->dbb_ast_flags & DBB_shutdown_single)) + if (!(dbb->dbb_ast_flags & DBB_shutdown_full) && + !(dbb->dbb_ast_flags & DBB_shutdown_single)) { return bad_mode(tdbb, IGNORE_SAME_MODE); // multi -> multi } break; - case isc_dpb_shut_single: + case isc_dpb_shut_single: if (dbb->dbb_ast_flags & DBB_shutdown_single) return bad_mode(tdbb, IGNORE_SAME_MODE); //single -> single if (!(dbb->dbb_ast_flags & DBB_shutdown_full)) return bad_mode(tdbb, false); // !full -> single - break; + break; case isc_dpb_shut_full: if (dbb->dbb_ast_flags & DBB_shutdown_full) { @@ -384,7 +384,7 @@ bool SHUT_online(thread_db* tdbb, SSHORT flag) default: // isc_dpb_shut_full return bad_mode(tdbb, false); // unexpected mode } - + try { // Reject exclusive and single-user shutdown attempts @@ -435,7 +435,7 @@ bool SHUT_online(thread_db* tdbb, SSHORT flag) Firebird::stuff_exception(tdbb->tdbb_status_vector, ex); return false; } - + return true; } @@ -444,7 +444,7 @@ static bool bad_mode(thread_db* tdbb, bool ignore) { if (!ignore) { Database* dbb = tdbb->getDatabase(); - + ERR_build_status(tdbb->tdbb_status_vector, Arg::Gds(isc_bad_shutdown_mode) << Arg::Str(dbb->dbb_filename)); } return ignore; @@ -527,7 +527,7 @@ static bool shutdown_locks(thread_db* tdbb, SSHORT flag) /* Mark database and all active attachments as shutdown. */ dbb->dbb_ast_flags &= ~(DBB_shutdown | DBB_shutdown_single | DBB_shutdown_full); - + switch (flag & isc_dpb_shut_mode_mask) { case isc_dpb_shut_normal: break; @@ -545,7 +545,7 @@ static bool shutdown_locks(thread_db* tdbb, SSHORT flag) } Attachment* attachment; - + for (attachment = dbb->dbb_attachments; attachment; attachment = attachment->att_next) { diff --git a/src/jrd/sort.cpp b/src/jrd/sort.cpp index 5fabd0ca48..3288226058 100644 --- a/src/jrd/sort.cpp +++ b/src/jrd/sort.cpp @@ -969,7 +969,7 @@ void SORT_sort(thread_db* tdbb, sort_context* scb) CHECK_FILE(scb); - // Merge runs of low depth to free memory part of temp space + // Merge runs of low depth to free memory part of temp space // they use and to make total runs count lower. This is fast // because low depth runs usually sit in memory ULONG run_count = 0, low_depth_cnt = 0; @@ -1114,7 +1114,7 @@ void SORT_sort(thread_db* tdbb, sort_context* scb) run->run_buff_cache = false; } **/ - // Allocate space for runs. The more memory we assign to each run the + // Allocate space for runs. The more memory we assign to each run the // faster we will read scratch file and return sorted records to caller. // At first try to reuse free memory from temp space. Note that temp space // itself allocated memory by at least TempSpace::getMinBlockSize chunks. @@ -1564,7 +1564,7 @@ static inline FB_UINT64 find_file_space(sort_context* scb, ULONG size) * available, allocate space at the end. * **************************************/ - + return scb->scb_space->allocateSpace(size); } @@ -1582,7 +1582,7 @@ static inline void free_file_space(sort_context* scb, FB_UINT64 position, ULONG * **************************************/ - try + try { scb->scb_space->releaseSpace(position, size); } @@ -1649,7 +1649,7 @@ static sort_record* get_merge(merge_control* merge, sort_context* scb #ifdef SCROLLABLE_CURSORS if (mode == RSE_get_forward) { - run->run_record = + run->run_record = reinterpret_cast(NEXT_RUN_RECORD(run->run_record)); #endif @@ -1678,7 +1678,7 @@ static sort_record* get_merge(merge_control* merge, sort_context* scb #else } else { - run->run_record = + run->run_record = reinterpret_cast(PREV_RUN_RECORD(run->run_record)); if ((record = (sort_record*) run->run_record) >= reinterpret_cast(run->run_buffer)) @@ -1873,7 +1873,7 @@ static void init(sort_context* scb) // At this point we already allocated some memory for temp space so // growing sort buffer space is not a big compared to that - if (scb->scb_size_memory <= MAX_SORT_BUFFER_SIZE && scb->scb_runs && + if (scb->scb_size_memory <= MAX_SORT_BUFFER_SIZE && scb->scb_runs && scb->scb_runs->run_depth == MAX_MERGE_LEVEL) { void* mem = NULL; @@ -2042,7 +2042,7 @@ static ULONG allocate_memory(sort_context* scb, ULONG n, ULONG chunkSize, bool u ************************************** * * Functional description - * Allocate memory for first n runs + * Allocate memory for first n runs * **************************************/ const USHORT rec_size = scb->scb_longs << SHIFTLONG; @@ -2075,7 +2075,7 @@ static ULONG allocate_memory(sort_context* scb, ULONG n, ULONG chunkSize, bool u fb_assert(n > allocated); TempSpace::Segments segments(*scb->scb_pool, n - allocated); - allocated += tempSpace->allocateBatch(n - allocated, + allocated += tempSpace->allocateBatch(n - allocated, MAX_SORT_BUFFER_SIZE, chunkSize, segments); if (segments.getCount()) @@ -2085,7 +2085,7 @@ static ULONG allocate_memory(sort_context* scb, ULONG n, ULONG chunkSize, bool u { if (!run->run_buffer) { - const size_t runSize = MIN(seg->size / rec_size, run->run_records) * rec_size; + const size_t runSize = MIN(seg->size / rec_size, run->run_records) * rec_size; char* mem = seg->memory; run->run_mem_seek = seg->position; @@ -2121,7 +2121,7 @@ static void merge_runs(sort_context* scb, USHORT n) **************************************/ // the only place we call merge_runs with n != RUN_GROUP is SORT_sort - // and there n < RUN_GROUP * MAX_MERGE_LEVEL + // and there n < RUN_GROUP * MAX_MERGE_LEVEL merge_control blks[RUN_GROUP * MAX_MERGE_LEVEL]; fb_assert((n - 1) <= FB_NELEM(blks)); // stack var big enough? @@ -2152,7 +2152,7 @@ static void merge_runs(sort_context* scb, USHORT n) run_control* run = scb->scb_runs; CHECK_FILE(scb); - USHORT allocated = + USHORT allocated = allocate_memory(scb, n, MAX_SORT_BUFFER_SIZE, (run->run_depth > 0)); CHECK_FILE(scb); @@ -2583,8 +2583,8 @@ static void order_and_save(sort_context* scb) * * Functional description * The memory full of record pointers has been sorted, but more - * records remain, so the run will have to be written to scratch file. - * If target run can be allocated in contiguous chunk of memory then + * records remain, so the run will have to be written to scratch file. + * If target run can be allocated in contiguous chunk of memory then * just memcpy records into it. Else call more expensive order() to * physically rearrange records in sort space and write its run into * scratch file as one big chunk @@ -2595,19 +2595,19 @@ static void order_and_save(sort_context* scb) run_control* run = scb->scb_runs; run->run_records = 0; - sort_record** ptr = scb->scb_first_pointer + 1; // 1st ptr is low key - // scb_next_pointer points to the end of pointer memory or the beginning of records + sort_record** ptr = scb->scb_first_pointer + 1; // 1st ptr is low key + // scb_next_pointer points to the end of pointer memory or the beginning of records while (ptr < scb->scb_next_pointer) { // If the next pointer is null, it's record has been eliminated as a - // duplicate. This is the only easy case. + // duplicate. This is the only easy case. if (!(*ptr++)) continue; run->run_records++; } - const ULONG key_length = + const ULONG key_length = (scb->scb_longs - SIZEOF_SR_BCKPTR_IN_LONGS) * sizeof(ULONG); run->run_size = run->run_records * key_length; FB_UINT64 seek = run->run_seek = find_file_space(scb, run->run_size); @@ -2621,19 +2621,19 @@ static void order_and_save(sort_context* scb) while (ptr < scb->scb_next_pointer) { SR* record = (SR*) (*ptr++); - + if (!record) continue; // make record point back to the starting of SR struct. - // as all scb_*_pointer point to the key_id locations! + // as all scb_*_pointer point to the key_id locations! record = (SR*) (((SORTP*)record) - SIZEOF_SR_BCKPTR_IN_LONGS); memcpy(mem, record->sr_sort_record.sort_record_key, key_length); mem += key_length; } } - else + else { order(scb); @@ -2859,9 +2859,9 @@ static void sort_runs_by_seek(sort_context* scb, int n) Firebird::SortedArray< RunSort, Firebird::InlineStorage, FB_UINT64, RunSort - > + > runs(*scb->scb_pool, n); - + run_control* run; for (run = scb->scb_runs; run && n; run = run->run_next, n--) { runs.add(RunSort(run)); diff --git a/src/jrd/sqz.cpp b/src/jrd/sqz.cpp index cddf00f194..ea5823d75a 100644 --- a/src/jrd/sqz.cpp +++ b/src/jrd/sqz.cpp @@ -289,14 +289,14 @@ USHORT SQZ_differences(const SCHAR* rec1, * Functional description * Compute differences between two records. The difference * record, when applied to the first record, produces the - * second record. + * second record. * * difference_record := ... * * control_string := * := * - * Return the total length of the differences string. + * Return the total length of the differences string. * **************************************/ SCHAR *p; @@ -306,7 +306,7 @@ USHORT SQZ_differences(const SCHAR* rec1, MAX record size is currently 64K. Hence it is defined as a SLONG */ #define STUFF(val) if (out < end) *out++ = val; else return 32000; -/* WHY IS THIS RETURNING 32000 ??? +/* WHY IS THIS RETURNING 32000 ??? * It returns a large Positive value to indicate to the caller that we ran out * of buffer space in the 'out' argument. Thus we could not create a * successful differences record. Now it is upto the caller to check the @@ -315,9 +315,9 @@ USHORT SQZ_differences(const SCHAR* rec1, * information. Of course, the size for a 'differences' record is not expected * to go near 32000 in the future. If the case arises where we want to store * differences record of 32000 bytes and more, please change the return value - * above to accomodate a failure value. - * - * This was investigated as a part of solving bug 10206, bsriram - 25-Feb-1999. + * above to accomodate a failure value. + * + * This was investigated as a part of solving bug 10206, bsriram - 25-Feb-1999. */ const SCHAR* const start = out; diff --git a/src/jrd/status.cpp b/src/jrd/status.cpp index 847e7283da..0707248fb2 100644 --- a/src/jrd/status.cpp +++ b/src/jrd/status.cpp @@ -40,7 +40,7 @@ /** Check that we never overrun the status vector. The status - * vector is 20 elements. The maximum is 3 entries for a + * vector is 20 elements. The maximum is 3 entries for a * type. So check for 17 or less */ diff --git a/src/jrd/svc.cpp b/src/jrd/svc.cpp index 2f30ce3bed..c73274047c 100644 --- a/src/jrd/svc.cpp +++ b/src/jrd/svc.cpp @@ -137,7 +137,7 @@ namespace { bool spb_remote; // Parse service parameter block picking up options and things. - Options(ClumpletReader& spb) : + Options(ClumpletReader& spb) : spb_version(0), spb_trusted_role(false), spb_remote(false) @@ -151,7 +151,7 @@ namespace { for (spb.rewind(); !(spb.isEof()); spb.moveNext()) { - switch (spb.getClumpTag()) + switch (spb.getClumpTag()) { case isc_spb_sys_user_name: spb.getString(spb_sys_user_name); @@ -185,22 +185,22 @@ namespace { spb.getString(spb_address_path); spb_remote = true; { - ClumpletReader address_stack(ClumpletReader::UnTagged, + ClumpletReader address_stack(ClumpletReader::UnTagged, spb.getBytes(), spb.getClumpLength()); - while (!address_stack.isEof()) + while (!address_stack.isEof()) { - if (address_stack.getClumpTag() != isc_dpb_address) + if (address_stack.getClumpTag() != isc_dpb_address) { address_stack.moveNext(); continue; } - ClumpletReader address(ClumpletReader::UnTagged, + ClumpletReader address(ClumpletReader::UnTagged, address_stack.getBytes(), address_stack.getClumpLength()); - while (!address.isEof()) + while (!address.isEof()) { - switch (address.getClumpTag()) + switch (address.getClumpTag()) { case isc_dpb_addr_protocol: address.getString(spb_network_protocol); @@ -290,7 +290,7 @@ void Service::parseSwitches() --i; } break; - + case ' ': if (!inStr) { @@ -302,10 +302,10 @@ void Service::parseSwitches() argv.push(svc_parsed_sw.c_str()); - for (const char* p = svc_parsed_sw.begin(); + for (const char* p = svc_parsed_sw.begin(); p < svc_parsed_sw.end(); ++p) { - if (!*p) + if (!*p) { argv.push(p + 1); } @@ -315,7 +315,7 @@ void Service::parseSwitches() void Service::printf(const SCHAR* format, ...) { // Ensure that service is not detached. - if (svc_flags & SVC_detached) + if (svc_flags & SVC_detached) { return; } @@ -328,7 +328,7 @@ void Service::printf(const SCHAR* format, ...) const char* const end = buf.end(); - for (const char* p = buf.begin(); p < end && !(svc_flags & SVC_detached); ++p) + for (const char* p = buf.begin(); p < end && !(svc_flags & SVC_detached); ++p) { enqueueByte(*p); } @@ -341,7 +341,7 @@ bool Service::isService() void Service::started() { - if (!(svc_flags & SVC_evnt_fired)) + if (!(svc_flags & SVC_evnt_fired)) { MutexLockGuard guard(svc_mutex); svc_flags |= SVC_evnt_fired; @@ -375,7 +375,7 @@ void Service::putSLong(char tag, SLONG val) enqueueByte(val >> 16); enqueueByte(val >> 24); } - + void Service::putChar(char tag, char val) { enqueueByte(tag); @@ -389,7 +389,7 @@ void Service::setServiceStatus(const ISC_STATUS* status_vector) return; } - if (status_vector != svc_status) + if (status_vector != svc_status) { Arg::StatusVector svc(svc_status); Arg::StatusVector passed(status_vector); @@ -463,7 +463,7 @@ void Service::setServiceStatus(const USHORT facility, const USHORT errcode, cons } } - if (!duplicate) + if (!duplicate) { // if the status_vector has only warnings then adjust err_status_len int err_status_len = i; @@ -472,7 +472,7 @@ void Service::setServiceStatus(const USHORT facility, const USHORT errcode, cons ISC_STATUS_ARRAY warning_status; int warning_count = 0; - if (warning_indx) + if (warning_indx) { // copy current warning(s) to a temp buffer MOVE_CLEAR(warning_status, sizeof(warning_status)); @@ -659,11 +659,11 @@ const ULONG SERVER_CAPABILITIES_FLAG = REMOTE_HOP_SUPPORT | NO_SERVER_SHUTDOWN_S Service::Service(const TEXT* service_name, USHORT spb_length, const UCHAR* spb_data) - : svc_parsed_sw(getPool()), - svc_handle(0), svc_stdout_head(1), svc_stdout_tail(SVC_STDOUT_BUFFER_SIZE), + : svc_parsed_sw(getPool()), + svc_handle(0), svc_stdout_head(1), svc_stdout_tail(SVC_STDOUT_BUFFER_SIZE), svc_resp_alloc(getPool()), svc_resp_buf(0), svc_resp_ptr(0), svc_resp_buf_len(0), svc_resp_len(0), svc_flags(0), svc_user_flag(0), svc_spb_version(0), svc_do_shutdown(false), - svc_username(getPool()), svc_enc_password(getPool()), + svc_username(getPool()), svc_enc_password(getPool()), svc_trusted_login(getPool()), svc_trusted_role(false), svc_uses_security_database(false), svc_switches(getPool()), svc_perm_sw(getPool()), svc_address_path(getPool()), svc_strings_buffer(NULL) @@ -694,7 +694,7 @@ Service::Service(const TEXT* service_name, USHORT spb_length, const UCHAR* spb_d } if (!serv->serv_name) { - status_exception::raise(Arg::Gds(isc_service_att_err) << + status_exception::raise(Arg::Gds(isc_service_att_err) << Arg::Gds(isc_svcnotdef) << Arg::Str(svcname)); } @@ -710,9 +710,9 @@ Service::Service(const TEXT* service_name, USHORT spb_length, const UCHAR* spb_d } else { // If we have embedded service connection, let's check for unix OS auth - if ((!options.spb_trusted_login.hasData()) && - (!options.spb_remote) && - (!options.spb_user_name.hasData())) + if ((!options.spb_trusted_login.hasData()) && + (!options.spb_remote) && + (!options.spb_user_name.hasData())) { if (ISC_get_user(&options.spb_trusted_login, NULL, NULL, NULL)) { options.spb_trusted_login = SYSDBA_USER_NAME; @@ -732,7 +732,7 @@ Service::Service(const TEXT* service_name, USHORT spb_length, const UCHAR* spb_d fb_utils::readenv(ISC_PASSWORD, options.spb_password); } } - + if (!options.spb_user_name.hasData()) { // user name and password are required while // attaching to the services manager @@ -743,12 +743,12 @@ Service::Service(const TEXT* service_name, USHORT spb_length, const UCHAR* spb_d int id, group, node_id; const string remote = options.spb_network_protocol + - (options.spb_network_protocol.isEmpty() || + (options.spb_network_protocol.isEmpty() || options.spb_remote_address.isEmpty() ? "" : "/") + options.spb_remote_address; SecurityDatabase::verifyUser(name, options.spb_user_name.nullStr(), - options.spb_password.nullStr(), + options.spb_password.nullStr(), options.spb_password_enc.nullStr(), &id, &group, &node_id, remote); svc_uses_security_database = true; @@ -777,7 +777,7 @@ Service::Service(const TEXT* service_name, USHORT spb_length, const UCHAR* spb_d if (options.spb_command_line.hasData() && serv->serv_std_switches) switches += ' '; switches += options.spb_command_line; - + svc_flags = switches.hasData() ? SVC_cmd_line : 0; svc_perm_sw = switches; svc_user_flag = user_flag; @@ -792,14 +792,14 @@ Service::Service(const TEXT* service_name, USHORT spb_length, const UCHAR* spb_d // there is no OS authentication. If the password is not yet // encrypted, then encrypt it before saving it (since there is no // decrypt function). - if (options.spb_password_enc.hasData()) + if (options.spb_password_enc.hasData()) { svc_enc_password = options.spb_password_enc; } - else if (options.spb_password.hasData()) + else if (options.spb_password.hasData()) { svc_enc_password.resize(MAX_PASSWORD_LENGTH + 2); - ENC_crypt(svc_enc_password.begin(), svc_enc_password.length(), + ENC_crypt(svc_enc_password.begin(), svc_enc_password.length(), options.spb_password.c_str(), PASSWORD_SALT); svc_enc_password.recalculate_length(); svc_enc_password.erase(0, 2); @@ -850,7 +850,7 @@ void Service::detach() // Mark service as detached. finish(SVC_detached); - if (localDoShutdown) + if (localDoShutdown) { // run in separate thread to avoid blocking in remote gds__thread_start(svcShutdownThread, 0, 0, 0, 0); @@ -1115,7 +1115,7 @@ ISC_STATUS Service::query2(thread_db* tdbb, case isc_info_svc_get_env_msg: if (svc_user_flag & SVC_user_dba) { - switch (item) + switch (item) { case isc_info_svc_get_env: gds__prefix(buffer, ""); @@ -1131,7 +1131,7 @@ ISC_STATUS Service::query2(thread_db* tdbb, // because gds_prefix[_lock|_msg] return a zero-terminated // string. info = INF_put_item(item, strlen(buffer), buffer, info, end); - if (!info) + if (!info) { return 0; } @@ -1286,8 +1286,8 @@ ISC_STATUS Service::query2(thread_db* tdbb, (info = INF_put_item(item, length, reinterpret_cast - (svc_resp_ptr), - info, end))) + (svc_resp_ptr), + info, end))) { return 0; } @@ -1827,9 +1827,9 @@ void Service::start(USHORT spb_length, const UCHAR* spb_data) svc_id == isc_action_svc_properties) { /* add the username and password to the end of svc_switches if needed */ - if (svc_switches.hasData()) + if (svc_switches.hasData()) { - if (svc_trusted_login.hasData()) + if (svc_trusted_login.hasData()) { string auth = "-"; auth += TRUSTED_USER_SWITCH; @@ -1862,7 +1862,7 @@ void Service::start(USHORT spb_length, const UCHAR* spb_data) // All services except for get_ib_log require switches spb.rewind(); - if ((!svc_switches.hasData()) && svc_id != isc_action_svc_get_fb_log) + if ((!svc_switches.hasData()) && svc_id != isc_action_svc_get_fb_log) { status_exception::raise(Arg::Gds(isc_bad_spb_form)); } @@ -1891,13 +1891,13 @@ void Service::start(USHORT spb_length, const UCHAR* spb_data) // Check for the service being detached. This will prevent the thread // from waiting infinitely if the client goes away. - while (!(svc_flags & SVC_detached)) + while (!(svc_flags & SVC_detached)) { - // The semaphore will be released once the particular service + // The semaphore will be released once the particular service // has reached a point in which it can start to return // information to the client. This will allow isc_service_start // to include in its status vector information about the service's - // ability to start. + // ability to start. // This is needed since gds__thread_start will almost always succeed. if (svcStart.tryEnter(60)) { @@ -2106,7 +2106,7 @@ void Service::finish(USHORT flag) if (svc_flags & SVC_finished) { svc_flags &= ~SVC_thd_running; - if (svc_handle) + if (svc_handle) { THD_detach(svc_handle); svc_handle = 0; @@ -2162,15 +2162,15 @@ bool Service::process_switches(ClumpletReader& spb, string& switches) bool found = false; - do + do { - switch (svc_action) + switch (svc_action) { case isc_action_svc_nbak: case isc_action_svc_nrest: found = true; - switch (spb.getClumpTag()) + switch (spb.getClumpTag()) { case isc_spb_dbname: if (nbk_database.hasData()) @@ -2231,7 +2231,7 @@ bool Service::process_switches(ClumpletReader& spb, string& switches) found = true; } - switch (spb.getClumpTag()) + switch (spb.getClumpTag()) { case isc_spb_sql_role_name: case isc_spb_dbname: @@ -2243,7 +2243,7 @@ bool Service::process_switches(ClumpletReader& spb, string& switches) case isc_spb_sec_username: get_action_svc_string(spb, switches); break; - + default: return false; } @@ -2265,7 +2265,7 @@ bool Service::process_switches(ClumpletReader& spb, string& switches) found = true; } - switch (spb.getClumpTag()) + switch (spb.getClumpTag()) { case isc_spb_sec_userid: case isc_spb_sec_groupid: @@ -2431,7 +2431,7 @@ bool Service::process_switches(ClumpletReader& spb, string& switches) default: return false; } - + spb.moveNext(); } while (! spb.isEof()); @@ -2491,16 +2491,16 @@ bool Service::get_action_svc_bitmask(const ClumpletReader& spb, { const int opt = spb.getInt(); ISC_ULONG mask = 1; - for (int count = (sizeof(ISC_ULONG) * 8) - 1; count--; mask <<= 1) + for (int count = (sizeof(ISC_ULONG) * 8) - 1; count--; mask <<= 1) { - if (opt & mask) + if (opt & mask) { const TEXT* s_ptr = find_switch((opt & mask), table); if (!s_ptr) { return false; } - + switches += '-'; switches += s_ptr; switches += ' '; @@ -2529,7 +2529,7 @@ void Service::get_action_svc_data(const ClumpletReader& spb, } -bool Service::get_action_svc_parameter(UCHAR action, +bool Service::get_action_svc_parameter(UCHAR action, const in_sw_tab_t* table, string& switches) { diff --git a/src/jrd/tpc.cpp b/src/jrd/tpc.cpp index f56715248b..dad9da72b7 100644 --- a/src/jrd/tpc.cpp +++ b/src/jrd/tpc.cpp @@ -165,7 +165,7 @@ void TPC_set_state(thread_db* tdbb, SLONG number, SSHORT state) const SSHORT shift = TRANS_SHIFT(number); for (TxPageCache* tip_cache = dbb->dbb_tip_cache; tip_cache; - tip_cache = tip_cache->tpc_next) + tip_cache = tip_cache->tpc_next) { if (number < (SLONG)(tip_cache->tpc_base + trans_per_tip)) { UCHAR* address = tip_cache->tpc_transactions + byte; @@ -191,7 +191,7 @@ int TPC_snapshot_state(thread_db* tdbb, SLONG number) * Functional description * Get the current state of a transaction. * Look at the TIP cache first, but if it - * is marked as still alive we must do some + * is marked as still alive we must do some * further checking to see if it really is. * **************************************/ @@ -230,7 +230,7 @@ int TPC_snapshot_state(thread_db* tdbb, SLONG number) tip_cache->tpc_base, number); - /* committed or dead transactions always stay that + /* committed or dead transactions always stay that way, so no need to check their current state */ if (state == tra_committed || state == tra_dead) { @@ -258,8 +258,8 @@ int TPC_snapshot_state(thread_db* tdbb, SLONG number) LCK_release(tdbb, &temp_lock); /* as a last resort we must look at the TIP page to see - whether the transaction is committed or dead; to minimize - having to do this again we will check the state of all + whether the transaction is committed or dead; to minimize + having to do this again we will check the state of all other transactions on that page */ return TRA_fetch_state(tdbb, number); @@ -296,14 +296,14 @@ void TPC_update_cache(thread_db* tdbb, const Ods::tx_inv_page* tip_page, SLONG s const SLONG trans_per_tip = dbb->dbb_page_manager.transPerTIP; const SLONG first_trans = sequence * trans_per_tip; -/* while we're in the area we can check to see if there are - any tip cache pages we can release--this is cheaper and +/* while we're in the area we can check to see if there are + any tip cache pages we can release--this is cheaper and easier than finding out when a TIP page is dropped */ TxPageCache* tip_cache; while ( (tip_cache = dbb->dbb_tip_cache) ) { if (dbb->dbb_oldest_transaction >= - tip_cache->tpc_base + trans_per_tip) + tip_cache->tpc_base + trans_per_tip) { dbb->dbb_tip_cache = tip_cache->tpc_next; delete tip_cache; @@ -347,10 +347,10 @@ static TxPageCache* allocate_tpc(thread_db* tdbb, SLONG base) Database* dbb = tdbb->getDatabase(); const SLONG trans_per_tip = dbb->dbb_page_manager.transPerTIP; -/* allocate a TIP cache block with enough room for +/* allocate a TIP cache block with enough room for all desired transactions */ - TxPageCache* tip_cache = + TxPageCache* tip_cache = FB_NEW_RPT(*dbb->dbb_permanent, trans_per_tip / 4) TxPageCache(); tip_cache->tpc_base = base; @@ -358,7 +358,7 @@ static TxPageCache* allocate_tpc(thread_db* tdbb, SLONG base) } -static SLONG cache_transactions(thread_db* tdbb, TxPageCache** tip_cache_ptr, +static SLONG cache_transactions(thread_db* tdbb, TxPageCache** tip_cache_ptr, SLONG oldest) { /************************************** @@ -376,7 +376,7 @@ static SLONG cache_transactions(thread_db* tdbb, TxPageCache** tip_cache_ptr, Database* dbb = tdbb->getDatabase(); CHECK_DBB(dbb); -/* check the header page for the oldest and +/* check the header page for the oldest and newest transaction numbers */ #ifdef SUPERSERVER_V2 @@ -400,7 +400,7 @@ static SLONG cache_transactions(thread_db* tdbb, TxPageCache** tip_cache_ptr, tip_cache_ptr = &dbb->dbb_tip_cache; for (SLONG base = oldest - oldest % trans_per_tip; base <= top; - base += trans_per_tip) + base += trans_per_tip) { *tip_cache_ptr = allocate_tpc(tdbb, base); tip_cache_ptr = &(*tip_cache_ptr)->tpc_next; @@ -416,9 +416,9 @@ static SLONG cache_transactions(thread_db* tdbb, TxPageCache** tip_cache_ptr, // Moreover out tip cache can now contain an gap between last // cached tip page and new pages if our process was idle for long time - for (TxPageCache* tip_cache = dbb->dbb_tip_cache; - tip_cache && (tip_cache->tpc_base + trans_per_tip < hdr_oldest); - tip_cache = dbb->dbb_tip_cache) + for (TxPageCache* tip_cache = dbb->dbb_tip_cache; + tip_cache && (tip_cache->tpc_base + trans_per_tip < hdr_oldest); + tip_cache = dbb->dbb_tip_cache) { dbb->dbb_tip_cache = tip_cache->tpc_next; delete tip_cache; @@ -438,8 +438,8 @@ static int extend_cache(thread_db* tdbb, SLONG number) * * Functional description * Extend the transaction inventory page - * cache to include at least all transactions - * up to the passed transaction, and return + * cache to include at least all transactions + * up to the passed transaction, and return * the state of the passed transaction. * **************************************/ @@ -458,7 +458,7 @@ static int extend_cache(thread_db* tdbb, SLONG number) tip_cache = *tip_cache_ptr; } - const SLONG oldest = cache_transactions(tdbb, tip_cache_ptr, + const SLONG oldest = cache_transactions(tdbb, tip_cache_ptr, tip_cache->tpc_base + trans_per_tip); if (number < oldest) return tra_committed; @@ -466,7 +466,7 @@ static int extend_cache(thread_db* tdbb, SLONG number) // find the right block for this transaction and return the state for (tip_cache = dbb->dbb_tip_cache; tip_cache; - tip_cache = tip_cache->tpc_next) + tip_cache = tip_cache->tpc_next) { if (number < (SLONG) (tip_cache->tpc_base + trans_per_tip)) return TRA_state(tip_cache->tpc_transactions, tip_cache->tpc_base, diff --git a/src/jrd/unicode_util.cpp b/src/jrd/unicode_util.cpp index e2ca4946da..59042415b1 100644 --- a/src/jrd/unicode_util.cpp +++ b/src/jrd/unicode_util.cpp @@ -100,7 +100,7 @@ public: const char* id, UTransDirection dir, const UChar* rules, /* may be Null */ - int32_t rulesLength, /* -1 if null-terminated */ + int32_t rulesLength, /* -1 if null-terminated */ UParseError* parseError, /* may be Null */ UErrorCode* status); void (U_EXPORT2 *utransTransUChars)( @@ -196,7 +196,7 @@ USHORT UnicodeUtil::utf16ToKey(USHORT srcLen, const USHORT* src, USHORT dstLen, UConverter* conv = ucnv_open("BOCU-1", &status); fb_assert(U_SUCCESS(status)); - const int32_t len = ucnv_fromUChars(conv, reinterpret_cast(dst), dstLen, + const int32_t len = ucnv_fromUChars(conv, reinterpret_cast(dst), dstLen, // safe cast - alignment not changed reinterpret_cast(src), srcLen / sizeof(*src), &status); fb_assert(U_SUCCESS(status)); @@ -590,9 +590,9 @@ SSHORT UnicodeUtil::utf16Compare(ULONG len1, const USHORT* str1, ULONG len2, con *error_flag = false; // safe casts - alignment not changed - int32_t cmp = u_strCompare(reinterpret_cast(str1), len1 / sizeof(*str1), + int32_t cmp = u_strCompare(reinterpret_cast(str1), len1 / sizeof(*str1), reinterpret_cast(str2), len2 / sizeof(*str2), true); - + return (cmp < 0 ? -1 : (cmp > 0 ? 1 : 0)); } @@ -605,7 +605,7 @@ ULONG UnicodeUtil::utf16Length(ULONG len, const USHORT* str) } -ULONG UnicodeUtil::utf16Substring(ULONG srcLen, const USHORT* src, ULONG dstLen, USHORT* dst, +ULONG UnicodeUtil::utf16Substring(ULONG srcLen, const USHORT* src, ULONG dstLen, USHORT* dst, ULONG startPos, ULONG length) { fb_assert(srcLen % sizeof(*src) == 0); @@ -1203,7 +1203,7 @@ SSHORT UnicodeUtil::Utf16Collation::compare(ULONG len1, const USHORT* str1, return (SSHORT)icu->ucolStrColl(compareCollator, // safe casts - alignment not changed - reinterpret_cast(str1), len1, + reinterpret_cast(str1), len1, reinterpret_cast(str2), len2); } diff --git a/src/jrd/validation.cpp b/src/jrd/validation.cpp index 81d6c20ed2..50a77fbf7f 100644 --- a/src/jrd/validation.cpp +++ b/src/jrd/validation.cpp @@ -26,27 +26,27 @@ Database Validation and Repair ============================== - + Deej Bredenberg March 16, 1994 - Updated: 1996-Dec-11 David Schnepper + Updated: 1996-Dec-11 David Schnepper -I. TERMINOLOGY +I. TERMINOLOGY The following terminology will be helpful to understand in this discussion: - record fragment: The smallest recognizable piece of a record; multiple + record fragment: The smallest recognizable piece of a record; multiple fragments can be linked together to form a single version. record version: A single version of a record representing an INSERT, UPDATE - or DELETE by a particular transaction (note that deletion + or DELETE by a particular transaction (note that deletion of a record causes a new version to be stored as a deleted stub). record chain: A linked list of record versions chained together to represent a single logical "record". slot: The line number of the record on page. A - variable-length array on each data page stores the - offsets to the stored records on + variable-length array on each data page stores the + offsets to the stored records on that page, and the slot is an index into that array. For more information on data page format, see my paper on the internals @@ -54,38 +54,38 @@ I. TERMINOLOGY II. COMMAND OPTIONS - Here are all the options for gfix which have to do with validation, and + Here are all the options for gfix which have to do with validation, and what they do: - gfix switch dpb parameter - ----------- ------------- + gfix switch dpb parameter + ----------- ------------- -validate isc_dpb_verify (gds__dpb_verify prior to 4.0) Invoke validation and repair. All other switches modify this switch. - -full isc_dpb_records + -full isc_dpb_records Visit all records. Without this switch, only page structures will be - validated, which does involve some limited checking of records. + validated, which does involve some limited checking of records. - -mend isc_dpb_repair + -mend isc_dpb_repair Attempts to mend the database where it can to make it viable for reading; does not guarantee to retain data. - -no_update isc_dpb_no_update + -no_update isc_dpb_no_update - Specifies that orphan pages not be released, and allocated pages not + Specifies that orphan pages not be released, and allocated pages not be marked in use when found to be free. Actually a misleading switch - name since -mend will update the database, but if -mend is not specified + name since -mend will update the database, but if -mend is not specified and -no_update is specified, then no updates will occur to the database. -ignore isc_dpb_ignore - Tells the engine to ignore checksums in fetching pages. Validate will + Tells the engine to ignore checksums in fetching pages. Validate will report on the checksums, however. Should probably not even be a switch, - it should just always be in effect. Otherwise checksums will disrupt + it should just always be in effect. Otherwise checksums will disrupt the validation. Customers should be advised to always use it. NOTE: Unix 4.0 (ODS 8.0) does not have on-page checksums, and all platforms under ODS 9.0 (NevaStone & above) does not have @@ -103,20 +103,20 @@ III. OPERATION "Lock timeout during wait transaction -- Object "database_filename.fdb" is in use" - If other processes or servers are attached to the database, validate - waits for the exclusive lock on the database (i.e. waits for every + If other processes or servers are attached to the database, validate + waits for the exclusive lock on the database (i.e. waits for every other server to get out of the database). - NOTE: Ordinarily when processes gain exclusive access to the database, - all active transactions are marked as dead on the Transaction Inventory + NOTE: Ordinarily when processes gain exclusive access to the database, + all active transactions are marked as dead on the Transaction Inventory Pages. This feature is turned off for validation. IV. PHASES OF VALIDATION There are two phases to the validation, the first of which is a walk through - the entire database (described below). During this phase, all pages visited - are stored in a bitmap for later use during the garbage collection phase. - + the entire database (described below). During this phase, all pages visited + are stored in a bitmap for later use during the garbage collection phase. + A. Visiting Pages During the walk-through phase, any page that is fetched goes through a @@ -129,9 +129,9 @@ IV. PHASES OF VALIDATION "Page xxx wrong type (expected xxx encountered xxx)" - is returned. This could represent a) a problem with the database - being overwritten, b) a bug with InterBase page allocation mechanisms - in which one page was written over another, or c) a page which was + is returned. This could represent a) a problem with the database + being overwritten, b) a bug with InterBase page allocation mechanisms + in which one page was written over another, or c) a page which was allocated but never written to disk (most likely if the encountered page type was 0). @@ -153,16 +153,16 @@ IV. PHASES OF VALIDATION 2. Checksum If -ignore is specified, the checksum is specifically checked in - validate instead of in the engine. If the checksum is found to + validate instead of in the engine. If the checksum is found to be wrong, the error: - + "Checksum error on page xxx" is returned. This is harmless when found by validate, and the page - will still continue to be validated--if data structures can be - validated on page, they will be. If -mend is specified, the page - will be marked for write, so that when the page is written to disk - at the end of validation the checksum will automatically be + will still continue to be validated--if data structures can be + validated on page, they will be. If -mend is specified, the page + will be marked for write, so that when the page is written to disk + at the end of validation the checksum will automatically be recalculated. Note: For 4.0 only Windows & NLM platforms keep page checksums. @@ -171,10 +171,10 @@ IV. PHASES OF VALIDATION We check each page fetched against the page bitmap to make sure we have not visited already. If we have, the error: - + "Page xxx doubly allocated" - is returned. This should catch the case when a page of the same type + is returned. This should catch the case when a page of the same type is allocated for two different purposes. Data pages are not checked with the Revisit mechanism - when walking @@ -188,7 +188,7 @@ IV. PHASES OF VALIDATION 1. Orphan Pages - If any pages in the page inventory were not visited + If any pages in the page inventory were not visited during validation, the following error will be returned: "Page xxx is an orphan" @@ -198,12 +198,12 @@ IV. PHASES OF VALIDATION 2. Improperly Freed Pages - If any pages marked free in the page inventory were in fact - found to be in use during validation, the following error + If any pages marked free in the page inventory were in fact + found to be in use during validation, the following error will be returned: - + "Page xxx is use but marked free" (sic) - + If -no_update was not specified, the page will be marked in use on the PIP. @@ -224,37 +224,37 @@ V. WALK-THROUGH PHASE 4. Transaction Inventory pages If the system relation RDB$PAGES could not be read or did not - contain any TIP pages, the message: + contain any TIP pages, the message: "Transaction inventory pages lost" - - will be returned. If a particular page is missing from the + + will be returned. If a particular page is missing from the sequence as established by RDB$PAGE_SEQUENCE, then the following message will be returned: - + "Transaction inventory page lost, sequence xxx" - If -mend is specified, then a new TIP will be allocated on disk and - stored in RDB$PAGES in the proper sequence. All transactions which + If -mend is specified, then a new TIP will be allocated on disk and + stored in RDB$PAGES in the proper sequence. All transactions which would have been on that page are assumed committed. - + If a TIP page does not point to the next one in sequence, the following message will be returned: "Transaction inventory pages confused, sequence xxx" 5. Generator pages as identified in RDB$PAGES. - + B. Relation Walking All the relations in the database are walked. For each relation, all - indices defined on the relation are fetched, and all pointer and + indices defined on the relation are fetched, and all pointer and data pages associated with the relation are fetched (see below). But first, the metadata is scanned from RDB$RELATIONS to fetch the - format of the relation. If this information is missing or - corrupted the relation cannot be walked. - If any bugchecks are encountered from the scan, the following + format of the relation. If this information is missing or + corrupted the relation cannot be walked. + If any bugchecks are encountered from the scan, the following message is returned: "bugcheck during scan of table xxx ()" @@ -272,7 +272,7 @@ V. WALK-THROUGH PHASE D. Pointer Pages All the pointer pages for the relation are walked. As they are walked - all child data pages are walked (see below). If a pointer page cannot + all child data pages are walked (see below). If a pointer page cannot be found, the following message is returned: "Pointer page (sequence xxx) lost" @@ -280,11 +280,11 @@ V. WALK-THROUGH PHASE If the pointer page is not part of the relation we expected or if it is not marked as being in the proper sequence, the following message is returned: - + "Pointer page xxx is inconsistent" - + If each pointer page does not point to the next pointer page as - stored in the RDB$PAGE_SEQUENCE field in RDB$PAGES, the following + stored in the RDB$PAGE_SEQUENCE field in RDB$PAGES, the following error is returned: "Pointer page (sequence xxx) inconsistent" @@ -292,13 +292,13 @@ V. WALK-THROUGH PHASE E. Data Pages Each of the data pages referenced by the pointer page is fetched. - If any are found to be corrupt at the page level, and -mend is - specified, the page is deleted from its pointer page. This will + If any are found to be corrupt at the page level, and -mend is + specified, the page is deleted from its pointer page. This will cause a whole page of data to be lost. The data page is corrupt at the page level if it is not marked as - part of the current relation, or if it is not marked as being in - the proper sequence. If either of these conditions occurs, the + part of the current relation, or if it is not marked as being in + the proper sequence. If either of these conditions occurs, the following error is returned: "Data page xxx (sequence xxx) is confused" @@ -306,69 +306,69 @@ V. WALK-THROUGH PHASE F. Slot Validation Each of the slots on the data page is looked at, up to the count - of records stored on page. If the slot is non-zero, the record + of records stored on page. If the slot is non-zero, the record fragment at the specified offset is retrieved. If the record begins before the end of the slots array, or continues off the end of the page, the following error is returned: "Data page xxx (sequence xxx), line xxx is bad" - where "line" means the slot number. - - NOTE: If this condition is encountered, the data page is considered + where "line" means the slot number. + + NOTE: If this condition is encountered, the data page is considered corrupt at the page level (and thus will be removed from its pointer page if -mend is specified). - + G. Record Validation - + The record at each slot is looked at for basic validation, regardless - of whether -full is specified or not. The fragment could be any of the + of whether -full is specified or not. The fragment could be any of the following: 1. Back Version - If the fragment is marked as a back version, then it is skipped. + If the fragment is marked as a back version, then it is skipped. It will be fetched as part of its record. 2. Corrupt - If the fragment is determined to be corrupt for any reason, and -mend + If the fragment is determined to be corrupt for any reason, and -mend is specified, then the record header is marked as damaged. 3. Damaged If the fragment is marked damaged already from a previous visit or a previous validation, the following error is returned: - + "Record xxx is marked as damaged" - where xxx is the record number. + where xxx is the record number. - 4. Bad Transaction + 4. Bad Transaction - If the record is marked with a transaction id greater than the last + If the record is marked with a transaction id greater than the last transaction started in the database, the following error is returned: - + "Record xxx has bad transaction xxx" H. Record Walking If -full is specified, and the fragment is the first fragment in a logical record, then the record at this slot number is fully retrieved. This - involves retrieving all versions, and all fragments of each - particular version. In other + involves retrieving all versions, and all fragments of each + particular version. In other words, the entire logical record will be retrieved. 1. Back Versions - If there are any back versions, they are visited at this point. - If the back version is on another page, the page is fetched but - not validated since it will be walked separately. + If there are any back versions, they are visited at this point. + If the back version is on another page, the page is fetched but + not validated since it will be walked separately. If the slot number of the back version is greater than the max - records on page, or there is no record stored at that slot number, - or it is a blob record, or it is a record fragment, or the - fragment itself is invalid, the following error + records on page, or there is no record stored at that slot number, + or it is a blob record, or it is a record fragment, or the + fragment itself is invalid, the following error message is returned: "Chain for record xxx is broken" @@ -376,7 +376,7 @@ V. WALK-THROUGH PHASE 2. Incomplete If the record header is marked as incomplete, it means that there - are additional fragments to be fetched--the record was too large + are additional fragments to be fetched--the record was too large to be stored in one slot. A pointer is stored in the record to the next fragment in the list. @@ -384,12 +384,12 @@ V. WALK-THROUGH PHASE record version. If any of the fragments is not in a valid position, or is not the correct length, the following error is returned: - "Fragmented record xxx is corrupt" - + "Fragmented record xxx is corrupt" + Once the full record has been retrieved, the length of the format is - checked against the expected format stored in RDB$FORMATS (the - format number is stored with the record, representing the exact - format of the relation at the time the record was stored.) + checked against the expected format stored in RDB$FORMATS (the + format number is stored with the record, representing the exact + format of the relation at the time the record was stored.) If the length of the reconstructed record does not match the expected format length, the following error is returned: @@ -398,35 +398,35 @@ V. WALK-THROUGH PHASE For delta records (record versions which represent updates to the record) this check is not made. - I. Blob Walking + I. Blob Walking If the slot on the data page points to a blob record, then the blob - is fetched (even without -full). This has several cases, corresponding - to the various blob levels. (See the "Engine Internals" document for a + is fetched (even without -full). This has several cases, corresponding + to the various blob levels. (See the "Engine Internals" document for a discussion of blob levels.) - + Level Action - ----- ----------------------------------------------------------------- + ----- ----------------------------------------------------------------- 0 These are just records on page, and no further validation is done. 1 All the pages pointed to by the blob record are fetched and validated in sequence. - 2 All pages pointed to by the blob pointer pages are fetched and + 2 All pages pointed to by the blob pointer pages are fetched and validated. 3 The blob page is itself a blob pointer page; all its children are fetched and validated. For each blob page found, some further validation is done. If the - page does not point back to the lead page, the following error + page does not point back to the lead page, the following error is returned: "Warning: blob xxx appears inconsistent" - + where xxx corresponds to the blob record number. If any of the blob pages are not marked in the sequence we expect them to be in, the following error is returned: - + "Blob xxx is corrupt" - + Tip: the message for the same error in level 2 or 3 blobs is slightly different: @@ -452,27 +452,27 @@ V. WALK-THROUGH PHASE "Missing index root page" and the indices are not walked. Otherwise the index root page - is fetched and all indices on the page fetched. + is fetched and all indices on the page fetched. For each index, the btree pages are fetched from top-down, left to - right. + right. Basic validation is made on non-leaf pages to ensure that each node on page points to another index page. If -full validation is specified then the lower level page is fetched to ensure it is starting index - entry is consistent with the parent entry. - On leaf pages, the records pointed to by the index pages are not - fetched, the keys are looked at to ensure they are in correct + entry is consistent with the parent entry. + On leaf pages, the records pointed to by the index pages are not + fetched, the keys are looked at to ensure they are in correct ascending order. If a visited page is not part of the specified relation and index, the following error is returned: - + "Index xxx is corrupt at page xxx" - - If there are orphan child pages, i.e. a child page does not have its entry - as yet in the parent page, however the child's left sibling page has it's + + If there are orphan child pages, i.e. a child page does not have its entry + as yet in the parent page, however the child's left sibling page has it's btr_sibling updated, the following error is returned - + "Index xxx has orphan child page at page xxx" If the page does not contain the number of nodes we would have @@ -482,7 +482,7 @@ V. WALK-THROUGH PHASE While we are walking leaf pages, we keep a bitmap of all record numbers seen in the index. At the conclusion of the index walk - we compare this bitmap to the bitmap of all records in the + we compare this bitmap to the bitmap of all records in the relation (calculated during data page/Record Validation phase). If the bitmaps are not equal then we have a corrupt index and the following error is reported: @@ -512,9 +512,9 @@ VI. ADDITIONAL NOTES A. Damaged Records - If any corruption of a record fragment is seen during validation, the - record header is marked as "damaged". As far as I can see, this has no - effect on the engine per se. Records marked as damaged will still be + If any corruption of a record fragment is seen during validation, the + record header is marked as "damaged". As far as I can see, this has no + effect on the engine per se. Records marked as damaged will still be retrieved by the engine itself. There is some question in my mind as to whether this record should be retrieved at all during a gbak. @@ -523,18 +523,18 @@ VI. ADDITIONAL NOTES "Record xxx is marked as damaged" Note that when a damaged record is first detected, this message is not - actually printed. The record is simply marked as damaged. It is only + actually printed. The record is simply marked as damaged. It is only thereafter when the record is visited that this message will appear. So I would postulate that unless a full validation is done at some point, - you would not see this error message; once the full validation is done, + you would not see this error message; once the full validation is done, the message will be returned even if you do not specify -full. B. Damaged Blobs - Blob records marked as damaged cannot be opened and will not be deleted - from disk. This means that even during backup the blob structures marked + Blob records marked as damaged cannot be opened and will not be deleted + from disk. This means that even during backup the blob structures marked as damaged will not be fetched and backed up. (Why this is done - differently for blobs than for records I cannot say. + differently for blobs than for records I cannot say. Perhaps it was viewed as too difficult to try to retrieve a damaged blob.) */ @@ -571,7 +571,7 @@ VI. ADDITIONAL NOTES #ifdef DEBUG_VAL_VERBOSE #include "../jrd/dmp_proto.h" /* Control variable for verbose output during debug of - validation. + validation. 0 == logged errors only 1 == logical output also 2 == physical page output also */ @@ -620,27 +620,27 @@ enum RTN { static const TEXT msg_table[VAL_MAX_ERROR][66] = { - "Page %ld wrong type (expected %d encountered %d)", // 0 + "Page %ld wrong type (expected %d encountered %d)", // 0 "Checksum error on page %ld", "Page %ld doubly allocated", "Page %ld is used but marked free", "Page %ld is an orphan", - "Warning: blob %ld appears inconsistent", // 5 + "Warning: blob %ld appears inconsistent", // 5 "Blob %ld is corrupt", "Blob %ld is truncated", "Chain for record %ld is broken", "Data page %ld (sequence %ld) is confused", - "Data page %ld (sequence %ld), line %ld is bad", // 10 + "Data page %ld (sequence %ld), line %ld is bad", // 10 "Index %d is corrupt on page %ld level %d. File: %s, line: %d\n\t", "Pointer page (sequence %ld) lost", "Pointer page (sequence %ld) inconsistent", "Record %ld is marked as damaged", - "Record %ld has bad transaction %ld", // 15 + "Record %ld has bad transaction %ld", // 15 "Fragmented record %ld is corrupt", "Record %ld is wrong length", "Missing index root page", "Transaction inventory pages lost", - "Transaction inventory page lost, sequence %ld", // 20 + "Transaction inventory page lost, sequence %ld", // 20 "Transaction inventory pages confused, sequence %ld", "Relation has %ld orphan backversions (%ld in use)", "Index %d is corrupt (missing entries)", @@ -883,10 +883,10 @@ static void garbage_collect(thread_db* tdbb, vdr* control) PageManager& pageSpaceMgr = dbb->dbb_page_manager; PageSpace* pageSpace = pageSpaceMgr.findPageSpace(DB_PAGE_SPACE); fb_assert(pageSpace); - + WIN window(DB_PAGE_SPACE, -1); - for (SLONG sequence = 0, number = 0; number < control->vdr_max_page; sequence++) + for (SLONG sequence = 0, number = 0; number < control->vdr_max_page; sequence++) { const SLONG page_number = (sequence) ? sequence * pageSpaceMgr.pagesPerPIP - 1 : pageSpace->ppFirst; page_inv_page* page = 0; @@ -1104,7 +1104,7 @@ static RTN walk_chain(thread_db* tdbb, !line->dpg_length || (header->rhd_flags & (rhd_blob | rhd_fragment)) || walk_record(tdbb, control, relation, header, line->dpg_length, - head_number, delta_flag) != rtn_ok) + head_number, delta_flag) != rtn_ok) { CCH_RELEASE(tdbb, &window); return corrupt(tdbb, control, VAL_REC_CHAIN_BROKEN, @@ -1366,7 +1366,7 @@ static void walk_header(thread_db* tdbb, vdr* control, SLONG page_num) } } -static RTN walk_index(thread_db* tdbb, vdr* control, jrd_rel* relation, +static RTN walk_index(thread_db* tdbb, vdr* control, jrd_rel* relation, index_root_page& root_page, USHORT id) { /************************************** @@ -1377,10 +1377,10 @@ static RTN walk_index(thread_db* tdbb, vdr* control, jrd_rel* relation, * * Functional description * Walk all btree pages left-to-right and top-down. - * Check all the pointers and keys for consistency - * relative to each other, and check sibling pointers. + * Check all the pointers and keys for consistency + * relative to each other, and check sibling pointers. * - * NOTE: id is the internal index id, relative for each + * NOTE: id is the internal index id, relative for each * relation. It is 1 less than the user level index id. * So errors are reported against index id+1 * @@ -1440,10 +1440,10 @@ static RTN walk_index(thread_db* tdbb, vdr* control, jrd_rel* relation, WIN window(DB_PAGE_SPACE, -1); btree_page* page = 0; fetch_page(tdbb, control, next, pag_index, &window, &page); - - // remember each page for circular reference detection - visited_pages.set(next); - + + // remember each page for circular reference detection + visited_pages.set(next); + if ((next != page_number) && (page->btr_header.pag_flags & BTR_FLAG_COPY_MASK) != (flags & BTR_FLAG_COPY_MASK)) @@ -1458,24 +1458,24 @@ static RTN walk_index(thread_db* tdbb, vdr* control, jrd_rel* relation, if (!useAllRecordNumbers) nullKeyHandled = true; - - if (page->btr_relation != relation->rel_id || - page->btr_id != (UCHAR) (id % 256)) + + if (page->btr_relation != relation->rel_id || + page->btr_id != (UCHAR) (id % 256)) { corrupt(tdbb, control, VAL_INDEX_PAGE_CORRUPT, relation, id + 1, next, page->btr_level, __FILE__, __LINE__); CCH_RELEASE(tdbb, &window); return rtn_corrupt; } - - if (useJumpInfo) + + if (useJumpInfo) { IndexJumpInfo jumpInfo; pointer = BTreeNode::getPointerFirstNode(page, &jumpInfo); const USHORT headerSize = (pointer - (UCHAR*)page); // Check if firstNodeOffset is not out of page area. if ((jumpInfo.firstNodeOffset < headerSize) || - (jumpInfo.firstNodeOffset > page->btr_length)) + (jumpInfo.firstNodeOffset > page->btr_length)) { corrupt(tdbb, control, VAL_INDEX_PAGE_CORRUPT, relation, id + 1, next, page->btr_level, __FILE__, __LINE__); @@ -1497,7 +1497,7 @@ static RTN walk_index(thread_db* tdbb, vdr* control, jrd_rel* relation, } else { // Check if jump node has same length as data node prefix. - BTreeNode::readNode(&checknode, + BTreeNode::readNode(&checknode, (UCHAR*)page + jumpNode.offset, flags, leafPage); if ((jumpNode.prefix + jumpNode.length) != checknode.prefix) { corrupt(tdbb, control, VAL_INDEX_PAGE_CORRUPT, relation, @@ -1523,7 +1523,7 @@ static RTN walk_index(thread_db* tdbb, vdr* control, jrd_rel* relation, } // make sure the current key is not less than the previous key - bool duplicateNode = !firstNode && !node.isEndLevel && + bool duplicateNode = !firstNode && !node.isEndLevel && (key.key_length == (node.length + node.prefix)); q = node.data; p = key.key_data + node.prefix; @@ -1552,7 +1552,7 @@ static RTN walk_index(thread_db* tdbb, vdr* control, jrd_rel* relation, // not a MARKER, record number should be same or higher. if (duplicateNode) { if ((!unique || (unique && nullKeyNode)) && - (node.recordNumber < lastNode.recordNumber)) + (node.recordNumber < lastNode.recordNumber)) { corrupt(tdbb, control, VAL_INDEX_PAGE_CORRUPT, relation, id + 1, next, page->btr_level, __FILE__, __LINE__); @@ -1570,14 +1570,14 @@ static RTN walk_index(thread_db* tdbb, vdr* control, jrd_rel* relation, if (!nullKeyHandled && !nullKeyNode && !duplicateNode) { nullKeyNode = (leafPage || (!leafPage && !firstNode) ) && - !node.isEndLevel && (null_key->key_length == key.key_length) && + !node.isEndLevel && (null_key->key_length == key.key_length) && (memcmp(null_key->key_data, key.key_data, null_key->key_length) == 0); } if (firstNode) { firstNode = false; } - + if (node.isEndBucket || node.isEndLevel) { break; } @@ -1588,13 +1588,13 @@ static RTN walk_index(thread_db* tdbb, vdr* control, jrd_rel* relation, } // fetch the next page down (if full validation was specified) - if (!leafPage && control && (control->vdr_flags & vdr_records)) + if (!leafPage && control && (control->vdr_flags & vdr_records)) { const SLONG down_number = node.pageNumber; const RecordNumber down_record_number = node.recordNumber; - // Note: control == 0 for the fetch_page() call here - // as we don't want to mark the page as visited yet - we'll + // Note: control == 0 for the fetch_page() call here + // as we don't want to mark the page as visited yet - we'll // mark it when we visit it for real later on WIN down_window(DB_PAGE_SPACE, -1); btree_page* down_page = 0; @@ -1613,7 +1613,7 @@ static RTN walk_index(thread_db* tdbb, vdr* control, jrd_rel* relation, l = MIN(key.key_length, downNode.length); for (; l; l--, p++, q++) { if (*p < *q) { - corrupt(tdbb, control, VAL_INDEX_PAGE_CORRUPT, relation, + corrupt(tdbb, control, VAL_INDEX_PAGE_CORRUPT, relation, id + 1, next, page->btr_level, __FILE__, __LINE__); } else if (*p > *q) { @@ -1621,21 +1621,21 @@ static RTN walk_index(thread_db* tdbb, vdr* control, jrd_rel* relation, } } - // Only check record-number if this isn't the first page in + // Only check record-number if this isn't the first page in // the level and it isn't a MARKER. // Also don't check on primary/unique keys, because duplicates aren't // sorted on recordnumber, except for NULL keys. if (useAllRecordNumbers && down_page->btr_left_sibling && !(downNode.isEndBucket || downNode.isEndLevel) && - (!unique || (unique && nullKeyNode)) ) + (!unique || (unique && nullKeyNode)) ) { // Check record number if key is equal with node on - // pointer page. In that case record number on page + // pointer page. In that case record number on page // down should be same or larger. if ((l == 0) && (key.key_length == downNode.length) && (downNode.recordNumber < down_record_number)) { - corrupt(tdbb, control, VAL_INDEX_PAGE_CORRUPT, relation, + corrupt(tdbb, control, VAL_INDEX_PAGE_CORRUPT, relation, id + 1, next, page->btr_level, __FILE__, __LINE__); } } @@ -1649,8 +1649,8 @@ static RTN walk_index(thread_db* tdbb, vdr* control, jrd_rel* relation, BTreeNode::readNode(&downNode, pointer, flags, leafPage); const SLONG next_number = downNode.pageNumber; - if (!(downNode.isEndBucket || downNode.isEndLevel) && - (next_number != down_page->btr_sibling)) + if (!(downNode.isEndBucket || downNode.isEndLevel) && + (next_number != down_page->btr_sibling)) { corrupt(tdbb, control, VAL_INDEX_PAGE_CORRUPT, relation, id + 1, next, page->btr_level, __FILE__, __LINE__); @@ -1674,10 +1674,10 @@ static RTN walk_index(thread_db* tdbb, vdr* control, jrd_rel* relation, if (next == down) { if (page->btr_level) { IndexNode newPageNode; - BTreeNode::readNode(&newPageNode, + BTreeNode::readNode(&newPageNode, BTreeNode::getPointerFirstNode(page), flags, false); down = newPageNode.pageNumber; - } + } else { down = 0; } @@ -1693,7 +1693,7 @@ static RTN walk_index(thread_db* tdbb, vdr* control, jrd_rel* relation, } // check for circular referenes - if (next && visited_pages.test(next)) + if (next && visited_pages.test(next)) { corrupt(tdbb, control, VAL_INDEX_CYCLE, relation, id + 1, next); @@ -1707,7 +1707,7 @@ static RTN walk_index(thread_db* tdbb, vdr* control, jrd_rel* relation, if (control && (control->vdr_flags & vdr_records)) { Database::Checkout dcoHolder(dbb); RecordBitmap::Accessor accessor(control->vdr_rel_records); - if (accessor.getFirst()) + if (accessor.getFirst()) do { SINT64 next_number = accessor.current(); if (!RecordBitmap::test(control->vdr_idx_records, next_number)) { diff --git a/src/lock/driver.cpp b/src/lock/driver.cpp index 765a9255a6..f8afbd6f28 100644 --- a/src/lock/driver.cpp +++ b/src/lock/driver.cpp @@ -74,7 +74,7 @@ void main( int argc, char **argv) { /************************************** * - * m a i n + * m a i n * ************************************** * @@ -119,7 +119,7 @@ void main( int argc, char **argv) ISC_STATUS status = scanf("%s%s", op, arg); if (status == EOF) continue; - + if (!strcmp(op, "rel")) { const SSHORT n = atoi(arg); @@ -269,7 +269,7 @@ static int ast(void* slot_void) **************************************/ ISC_STATUS_ARRAY status_vector; int sw_release_use = sw_release; - + const int slot = (int)(IPTR) slot_void; // static cast printf("*** blocking AST for lock# %d ", slot); @@ -345,7 +345,7 @@ static int lookup_lock(const UCHAR* string) static void print_help() { /************************************** -* +* * p r i n t _ h e l p * ************************************** diff --git a/src/lock/print.cpp b/src/lock/print.cpp index 0f0558cfc8..8b467da158 100644 --- a/src/lock/print.cpp +++ b/src/lock/print.cpp @@ -26,7 +26,7 @@ * 2002.10.28 Sean Leyne - Code cleanup, removed obsolete "SGI" port * * 2002.10.29 Sean Leyne - Removed obsolete "Netware" port - * + * * 2008.04.04 Roman Simakov - Added html output support * */ @@ -104,9 +104,9 @@ public: HtmlLink(const TEXT* prefix, const SLONG value) { if (sw_html_format && value && prefix) - sprintf(strBuffer, "%6"SLONGFORMAT"", prefix, value, value); + sprintf(strBuffer, "%6"SLONGFORMAT"", prefix, value, value); else - sprintf(strBuffer, "%6"SLONGFORMAT, value); + sprintf(strBuffer, "%6"SLONGFORMAT, value); } operator const TEXT*() { @@ -124,7 +124,7 @@ static const TEXT history_names[][10] = { "SCAN", "DEAD", "ENTER", "BUG", "ACTIVE", "CLEANUP", "DEL_OWNER" }; -static const TEXT valid_switches[] = +static const TEXT valid_switches[] = "Valid switches are: -o, -p, -l, -r, -a, -h, -n, -s , -c, -i , -m \n"; // The same table is in lock.cpp, maybe worth moving to a common file? @@ -202,7 +202,7 @@ int CLIB_ROUTINE main( int argc, char *argv[]) bool sw_locks = false; bool sw_history = false; bool sw_owners = true; - + USHORT sw_interactive; // Those variables should be signed to accept negative values from atoi SSHORT sw_series; @@ -319,7 +319,7 @@ int CLIB_ROUTINE main( int argc, char *argv[]) exit(FINI_OK); } break; - + case 'm': sw_html_format = true; break; @@ -339,12 +339,12 @@ int CLIB_ROUTINE main( int argc, char *argv[]) SH_MEM_T shmem_data; - SLONG LOCK_size_mapped = 1024 * 1024; /* NS: we cannot use 0, otherwise the file - will be truncated when engine is not running + SLONG LOCK_size_mapped = 1024 * 1024; /* NS: we cannot use 0, otherwise the file + will be truncated when engine is not running and engine globals do not exist anymore */ ISC_STATUS_ARRAY status_vector; - + lhb* LOCK_header = (lhb*) ISC_map_file(status_vector, lock_file, prt_lock_init, @@ -357,7 +357,7 @@ int CLIB_ROUTINE main( int argc, char *argv[]) sprintf(expanded_lock_filename, lock_file, ISC_get_host(hostname, sizeof(hostname))); -/* Make sure the lock file is valid - if it's a zero length file we +/* Make sure the lock file is valid - if it's a zero length file we * can't look at the header without causing a BUS error by going * off the end of the mapped region. */ @@ -393,11 +393,11 @@ int CLIB_ROUTINE main( int argc, char *argv[]) if (LOCK_header->lhb_version != LHB_VERSION) { - if (LOCK_header->lhb_type == 0 && LOCK_header->lhb_version == 0) + if (LOCK_header->lhb_type == 0 && LOCK_header->lhb_version == 0) { FPRINTF(outfile, "\tLock table is empty.\n"); } - else + else { FPRINTF(outfile, "\tUnable to read lock table version %d.\n", LOCK_header->lhb_version); @@ -415,7 +415,7 @@ int CLIB_ROUTINE main( int argc, char *argv[]) } lhb* header = NULL; - + if (sw_consistency) { /* To avoid changes in the lock file while we are dumping it - make * a local buffer, lock the lock file, copy it, then unlock the @@ -562,7 +562,7 @@ int CLIB_ROUTINE main( int argc, char *argv[]) prt_history(outfile, LOCK_header, a_shb->shb_history, "Event log"); prt_html_end(outfile); - + if (header) gds__free(header); @@ -582,7 +582,7 @@ static void prt_lock_activity( ************************************** * * Functional description - * Print a time-series lock activity report + * Print a time-series lock activity report * **************************************/ time_t clock = time(NULL); @@ -838,7 +838,7 @@ static void prt_history( FPRINTF(outfile, " %s:\towner = %s, lock = %s, request = %s\n", history_names[history->his_operation], - (const TEXT*)HtmlLink(preOwn, history->his_process), + (const TEXT*)HtmlLink(preOwn, history->his_process), (const TEXT*)HtmlLink(preLock, history->his_lock), (const TEXT*)HtmlLink(preRequest, history->his_request)); if (history->his_next == history_header) @@ -858,7 +858,7 @@ static void prt_lock( ************************************** * * Functional description - * Print a formatted lock block + * Print a formatted lock block * **************************************/ if (sw_series && lock->lbl_series != sw_series) @@ -877,14 +877,14 @@ static void prt_lock( lock->lbl_series, (const TEXT*)HtmlLink(preLock, lock->lbl_parent), lock->lbl_state, lock->lbl_size, lock->lbl_length, lock->lbl_data); - if ((lock->lbl_series == Jrd::LCK_bdb || lock->lbl_series == Jrd::LCK_btr_dont_gc) && - lock->lbl_length == Jrd::PageNumber::getLockLen()) + if ((lock->lbl_series == Jrd::LCK_bdb || lock->lbl_series == Jrd::LCK_btr_dont_gc) && + lock->lbl_length == Jrd::PageNumber::getLockLen()) { // Since fb 2.1 lock keys for page numbers (series == 3) contains // page space number in high long of two-longs key. Lets print it // in : format const UCHAR* q = lock->lbl_key; - + SLONG key; memcpy(&key, q, sizeof(SLONG)); q += sizeof(SLONG); @@ -947,7 +947,7 @@ static void prt_lock( const lrq* request = (lrq*) ((UCHAR*) que_inst - OFFSET(lrq*, lrq_lbl_requests)); FPRINTF(outfile, "\t\tRequest %s, Owner: %s, State: %d (%d), Flags: 0x%02X\n", - (const TEXT*)HtmlLink(preRequest, SRQ_REL_PTR(request)), + (const TEXT*)HtmlLink(preRequest, SRQ_REL_PTR(request)), (const TEXT*)HtmlLink(preOwn, request->lrq_owner), request->lrq_state, request->lrq_requested, request->lrq_flags); } @@ -979,13 +979,13 @@ static void prt_owner(OUTFILE outfile, else { const SLONG rel_owner = SRQ_REL_PTR(owner); - FPRINTF(outfile, "OWNER BLOCK %6"SLONGFORMAT"\n", + FPRINTF(outfile, "OWNER BLOCK %6"SLONGFORMAT"\n", preOwn, rel_owner, rel_owner); } FPRINTF(outfile, "\tOwner id: %6"QUADFORMAT"d, type: %1d, pending: %s\n", owner->own_owner_id, owner->own_owner_type, (const TEXT*)HtmlLink(preRequest, owner->own_pending_request)); - + FPRINTF(outfile, "\tProcess id: %6d (%s), thread id: %6d\n", process->prc_process_id, ISC_check_process_existence(process->prc_process_id) ? "Alive" : "Dead", @@ -1040,7 +1040,7 @@ static void prt_owner_wait_cycle( * Functional description * For the given owner, print out the list of owners * being waited on. The printout is recursive, up to - * a limit. It is recommended this be used with + * a limit. It is recommended this be used with * the -c consistency mode. * **************************************/ @@ -1145,11 +1145,11 @@ static void prt_request(OUTFILE outfile, const lhb* LOCK_header, const lrq* requ else { const SLONG rel_request = SRQ_REL_PTR(request); - FPRINTF(outfile, "REQUEST BLOCK %6"SLONGFORMAT"\n", + FPRINTF(outfile, "REQUEST BLOCK %6"SLONGFORMAT"\n", preRequest, rel_request, rel_request); } FPRINTF(outfile, "\tOwner: %s, Lock: %s, State: %d, Mode: %d, Flags: 0x%02X\n", - (const TEXT*)HtmlLink(preOwn, request->lrq_owner), + (const TEXT*)HtmlLink(preOwn, request->lrq_owner), (const TEXT*)HtmlLink(preLock, request->lrq_lock), request->lrq_state, request->lrq_requested, request->lrq_flags); FPRINTF(outfile, "\tAST: 0x%p, argument: 0x%p\n", @@ -1193,7 +1193,7 @@ static void prt_que( ++count; FPRINTF(outfile, "%s (%ld):\tforward: %s, backward: %s\n", string, count, - (const TEXT*)HtmlLink(prefix, que_inst->srq_forward - que_offset), + (const TEXT*)HtmlLink(prefix, que_inst->srq_forward - que_offset), (const TEXT*)HtmlLink(prefix, que_inst->srq_backward - que_offset)); } @@ -1231,7 +1231,7 @@ static void prt_html_begin(OUTFILE outfile) { /************************************** * - * p r t _ h t m l _ b e g i n + * p r t _ h t m l _ b e g i n * ************************************** * @@ -1241,10 +1241,10 @@ static void prt_html_begin(OUTFILE outfile) **************************************/ if (!sw_html_format) return; - + FPRINTF(outfile, "%s", "Lock table"); FPRINTF(outfile, "
");
-	
+
 }
 
 static void prt_html_end(OUTFILE outfile)
@@ -1261,7 +1261,7 @@ static void prt_html_end(OUTFILE outfile)
 	 **************************************/
 	if (!sw_html_format)
 		return;
-	
+
 	FPRINTF(outfile, "
"); FPRINTF(outfile, ""); } diff --git a/src/misc/blrtable.cpp b/src/misc/blrtable.cpp index afe74939fe..c24ef2996c 100644 --- a/src/misc/blrtable.cpp +++ b/src/misc/blrtable.cpp @@ -69,7 +69,7 @@ struct VERB { const SCHAR* sub_type; }; -static const VERB verbs[] = +static const VERB verbs[] = { PAIR(nod_assignment, blr_assignment, e_asgn_length, 2, STATEMENT, VALUE), PAIR(nod_erase, blr_erase, e_erase_length, 0, STATEMENT, OTHER), diff --git a/src/misc/makeHeader.cpp b/src/misc/makeHeader.cpp index 8b08209460..01ccd5c85f 100644 --- a/src/misc/makeHeader.cpp +++ b/src/misc/makeHeader.cpp @@ -4,7 +4,7 @@ #include -void ProcessFile(FILE *in, bool stripFirstComment) +void ProcessFile(FILE *in, bool stripFirstComment) { char s[256]; bool striping = false; diff --git a/src/misc/memtest.cpp b/src/misc/memtest.cpp index 27ff2b30f1..96b381cc6d 100644 --- a/src/misc/memtest.cpp +++ b/src/misc/memtest.cpp @@ -1,6 +1,6 @@ /* * MTEST.C -- A test program to compare performance of memcpy()/memset() - * -- vs. MOV_fast*()/MOV_fill() functions. + * -- vs. MOV_fast*()/MOV_fill() functions. * * This program does speed tests on various implementions of "copy buffer" * and "initialize buffer" operations. It's purpose is as a development @@ -13,13 +13,13 @@ * Compiler optimization. * Automatic compiler in-lining optimization. * - * Because of the short nature of the operation being timed (eg: copy 20 + * Because of the short nature of the operation being timed (eg: copy 20 * bytes) - the operation is repeated several times for each 'timing'. * * Each timing run is then also repeated several times to take an average. * - * Program originally by Zouhair Janbay - modified - * 1996-Feb-09 David Schnepper + * Program originally by Zouhair Janbay - modified + * 1996-Feb-09 David Schnepper * The contents of this file are subject to the Interbase Public * License Version 1.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy diff --git a/src/qli/all.cpp b/src/qli/all.cpp index 9ff97c873e..470416e789 100644 --- a/src/qli/all.cpp +++ b/src/qli/all.cpp @@ -53,7 +53,7 @@ #define BLKDEF(type, root, tail) { sizeof(root), tail }, -static const struct +static const struct { SSHORT typ_root_length; SSHORT typ_tail_length; @@ -107,7 +107,7 @@ BLK ALLQ_alloc( PLB pool, UCHAR type, int count) FRB* best; size_t best_tail; - while (true) + while (true) { best = NULL; best_tail = 32767; diff --git a/src/qli/command.cpp b/src/qli/command.cpp index a57d918e25..ea2af5abb9 100644 --- a/src/qli/command.cpp +++ b/src/qli/command.cpp @@ -255,7 +255,7 @@ void CMD_rename_proc( qli_syntax* node) **************************************/ QPR old_proc = (QPR) node->syn_arg[0]; QPR new_proc = (QPR) node->syn_arg[1]; - + DBB database = old_proc->qpr_database; if (!database) database = QLI_databases; @@ -493,7 +493,7 @@ void CMD_transaction( qli_syntax* node) } - if (node->syn_count == 0) + if (node->syn_count == 0) { for (DBB db_iter = QLI_databases; db_iter; db_iter = db_iter->dbb_next) { diff --git a/src/qli/compile.cpp b/src/qli/compile.cpp index db5433b13c..e64b975a1b 100644 --- a/src/qli/compile.cpp +++ b/src/qli/compile.cpp @@ -595,7 +595,7 @@ static qli_nod* compile_expression( qli_nod* node, qli_req* request, bool intern case nod_substr: case nod_user_name: if (!internal_flag && request && request->req_receive && - computable(node, request)) + computable(node, request)) { compile_expression(node, request, true); return make_reference(node, request->req_receive); @@ -725,7 +725,7 @@ static qli_nod* compile_field( qli_nod* node, qli_req* request, bool internal_fl if (internal_flag) { if (computable(node, request)) return node; - + qli_par* parm = make_parameter(request->req_send, node); node->nod_export = parm; parm->par_desc = node->nod_desc; @@ -1101,7 +1101,7 @@ static qli_nod* compile_prompt( qli_nod* node) prompt_length = 8; break; - + case dtype_long: case dtype_real: prompt_length = 15; @@ -1385,7 +1385,7 @@ static qli_nod* compile_statement( qli_nod* node, qli_req* request, bool interna return node; default: - ERRQ_bugcheck(360); // Msg360 not yet implemented (compile_statement) + ERRQ_bugcheck(360); // Msg360 not yet implemented (compile_statement) return NULL; } } @@ -2012,7 +2012,7 @@ static qli_nod* make_reference( qli_nod* node, qli_msg* message) ERRQ_bugcheck(363); // Msg363 missing message qli_par* parm; - + // Look for an existing field reference for (parm = message->msg_parameters; parm; parm = parm->par_next) diff --git a/src/qli/dtr.cpp b/src/qli/dtr.cpp index 1e0e872fcc..b4d8762026 100644 --- a/src/qli/dtr.cpp +++ b/src/qli/dtr.cpp @@ -2,7 +2,7 @@ * PROGRAM: JRD Command Oriented Query Language * MODULE: dtr.cpp * DESCRIPTION: Top level driving module - * + * * The contents of this file are subject to the Interbase Public * License Version 1.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy @@ -58,7 +58,7 @@ using MsgFormat::SafeArg; -const char* STARTUP_FILE = "HOME"; // Assume its Unix +const char* STARTUP_FILE = "HOME"; // Assume its Unix extern TEXT *QLI_prompt; @@ -77,8 +77,8 @@ struct answer_t { static bool yes_no_loaded = false; static answer_t answer_table[] = { - { "NO", false }, // NO - { "YES", true }, // YES + { "NO", false }, // NO + { "YES", true }, // YES { "", false } }; @@ -92,16 +92,16 @@ int CLIB_ROUTINE main( int argc, char **argv) ************************************** * * Functional description - * Top level routine. + * Top level routine. * **************************************/ -// Look at options, if any +// Look at options, if any Firebird::PathName startup_file = STARTUP_FILE; #ifdef UNIX -// If a Unix system, get home directory from environment +// If a Unix system, get home directory from environment SCHAR home_directory[MAXPATHLEN]; if (!fb_utils::readenv("HOME", startup_file)) startup_file = ".qli_startup"; @@ -117,7 +117,7 @@ int CLIB_ROUTINE main( int argc, char **argv) sw_buffers = 0; strcpy(QLI_prompt_string, "QLI> "); strcpy(QLI_cont_string, "CON> "); -// Let's define the default number of columns on a machine by machine basis +// Let's define the default number of columns on a machine by machine basis QLI_columns = 80; #ifdef TRUSTED_AUTH QLI_trusted = false; @@ -151,7 +151,7 @@ int CLIB_ROUTINE main( int argc, char **argv) switch (UPPER(c)) { case 'A': if (argv >= arg_end) { - ERRQ_msg_put(23); // Msg23 Please retry, supplying an application script file name + ERRQ_msg_put(23); // Msg23 Please retry, supplying an application script file name exit(FINI_ERROR); } @@ -217,7 +217,7 @@ int CLIB_ROUTINE main( int argc, char **argv) isc_set_debug(debug_value); break; - /* This switch's name is arbitrary; since it is an internal + /* This switch's name is arbitrary; since it is an internal mechanism it can be changed at will */ case 'Y': @@ -229,8 +229,8 @@ int CLIB_ROUTINE main( int argc, char **argv) break; default: - ERRQ_msg_put(469, SafeArg() << c); - // Msg469 qli: ignoring unknown switch %c + ERRQ_msg_put(469, SafeArg() << c); + // Msg469 qli: ignoring unknown switch %c break; } } @@ -238,7 +238,7 @@ int CLIB_ROUTINE main( int argc, char **argv) enable_signals(); if (banner_flag) - ERRQ_msg_put(24); // Msg24 Welcome to QLI Query Language Interpreter + ERRQ_msg_put(24); // Msg24 Welcome to QLI Query Language Interpreter if (version_flag) ERRQ_msg_put(25, SafeArg() << GDS_VERSION); // Msg25 qli version %s @@ -256,14 +256,14 @@ int CLIB_ROUTINE main( int argc, char **argv) PAR_token(); } catch (const Firebird::Exception&) { - // try again + // try again got_started = false; ERRQ_pending(); } } QLI_error = NULL; -// Loop until end of file or forced exit +// Loop until end of file or forced exit while (QLI_line) { plb* temp = QLI_default_pool = ALLQ_pool(); @@ -276,7 +276,7 @@ int CLIB_ROUTINE main( int argc, char **argv) LEX_fini(); ALLQ_fini(); #ifdef DEBUG_GDS_ALLOC -/* Report any memory leaks noticed. +/* Report any memory leaks noticed. * We don't particularly care about QLI specific memory leaks, so all * QLI allocations have been marked as "don't report". However, much * of the test-base uses QLI so having a report when QLI finishes @@ -328,14 +328,14 @@ static bool process_statement(bool flush_flag) **************************************/ DBB dbb; -// Clear database active flags in preparation for a new statement +// Clear database active flags in preparation for a new statement QLI_abort = false; for (dbb = QLI_databases; dbb; dbb = dbb->dbb_next) dbb->dbb_flags &= ~DBB_active; -// If the last statement wrote out anything to the terminal, skip a line +// If the last statement wrote out anything to the terminal, skip a line if (QLI_skip_line) { printf("\n"); @@ -348,10 +348,10 @@ static bool process_statement(bool flush_flag) enable_signals(); -// Enable error unwinding and enable the unwinding environment +// Enable error unwinding and enable the unwinding environment try { - + /* Set up the appropriate prompt and get the first significant token. If we don't get one, we're at end of file */ @@ -360,7 +360,7 @@ static bool process_statement(bool flush_flag) /* This needs to be done after setting QLI_prompt to prevent * and infinite loop in LEX/next_line. */ -// If there was a prior syntax error, flush the token stream +// If there was a prior syntax error, flush the token stream if (flush_flag) LEX_flush(); @@ -391,14 +391,14 @@ static bool process_statement(bool flush_flag) EXEC_poll_abort(); -// If the statement was EXIT, force end of file on command input +// If the statement was EXIT, force end of file on command input if (syntax_tree->syn_type == nod_exit) { QLI_line = NULL; return false; } -// If the statement was quit, ask the user if he want to rollback +// If the statement was quit, ask the user if he want to rollback if (syntax_tree->syn_type == nod_quit) { QLI_line = NULL; @@ -422,13 +422,13 @@ static bool process_statement(bool flush_flag) if (!expanded_tree) return false; -// Compile the statement +// Compile the statement qli_nod* execution_tree = CMPQ_compile(expanded_tree); if (!execution_tree) return false; -// Generate any BLR needed to support the request +// Generate any BLR needed to support the request if (!GEN_generate(execution_tree)) return false; @@ -440,14 +440,14 @@ static bool process_statement(bool flush_flag) dbb->dbb_statistics = (int *) gds__alloc((SLONG) sizeof(PERF)); #ifdef DEBUG_GDS_ALLOC - // We don't care about QLI specific memory leaks for V4.0 - gds_alloc_flag_unfreed((void *) dbb->dbb_statistics); // QLI: don't care + // We don't care about QLI specific memory leaks for V4.0 + gds_alloc_flag_unfreed((void *) dbb->dbb_statistics); // QLI: don't care #endif } perf_get_info(&dbb->dbb_handle, (perf *)dbb->dbb_statistics); } -// Execute the request, for better or worse +// Execute the request, for better or worse EXEC_top(execution_tree); @@ -461,20 +461,20 @@ static bool process_statement(bool flush_flag) if (dbb->dbb_flags & DBB_active) { ERRQ_msg_get(505, report, sizeof(report)); - // Msg505 " reads = !r writes = !w fetches = !f marks = !m\n" + // Msg505 " reads = !r writes = !w fetches = !f marks = !m\n" size_t used_len = strlen(report); ERRQ_msg_get(506, report + used_len, sizeof(report) - used_len); - // Msg506 " elapsed = !e cpu = !u system = !s mem = !x, buffers = !b" + // Msg506 " elapsed = !e cpu = !u system = !s mem = !x, buffers = !b" perf_get_info(&dbb->dbb_handle, &statistics); perf_format((perf*) dbb->dbb_statistics, &statistics, report, buffer, 0); - ERRQ_msg_put(26, SafeArg() << dbb->dbb_filename << buffer); // Msg26 Statistics for database %s %s + ERRQ_msg_put(26, SafeArg() << dbb->dbb_filename << buffer); // Msg26 Statistics for database %s %s QLI_skip_line = true; } } } -// Release resources associated with the request +// Release resources associated with the request GEN_release(); @@ -510,48 +510,48 @@ static void CLIB_ROUTINE signal_arith_excp(USHORT sig, USHORT code, USHORT scp) switch (code) { #ifdef FPE_INOVF_TRAP case FPE_INTOVF_TRAP: - msg_number = 14; // Msg14 integer overflow + msg_number = 14; // Msg14 integer overflow break; #endif #ifdef FPE_INTDIV_TRAP case FPE_INTDIV_TRAP: - msg_number = 15; // Msg15 integer division by zero + msg_number = 15; // Msg15 integer division by zero break; #endif #ifdef FPE_FLTOVF_TRAP case FPE_FLTOVF_TRAP: - msg_number = 16; // Msg16 floating overflow trap + msg_number = 16; // Msg16 floating overflow trap break; #endif #ifdef FPE_FLTDIV_TRAP case FPE_FLTDIV_TRAP: - msg_number = 17; // Msg17 floating division by zero + msg_number = 17; // Msg17 floating division by zero break; #endif #ifdef FPE_FLTUND_TRAP case FPE_FLTUND_TRAP: - msg_number = 18; // Msg18 floating underflow trap + msg_number = 18; // Msg18 floating underflow trap break; #endif #ifdef FPE_FLTOVF_FAULT case FPE_FLTOVF_FAULT: - msg_number = 19; // Msg19 floating overflow fault + msg_number = 19; // Msg19 floating overflow fault break; #endif #ifdef FPE_FLTUND_FAULT case FPE_FLTUND_FAULT: - msg_number = 20; // Msg20 floating underflow fault + msg_number = 20; // Msg20 floating underflow fault break; #endif default: - msg_number = 21; // Msg21 arithmetic exception + msg_number = 21; // Msg21 arithmetic exception } #else msg_number = 21; @@ -606,7 +606,7 @@ static bool yes_no(USHORT number, const TEXT* arg1) yes_no_loaded = true; // Msg498 NO if (!ERRQ_msg_get(498, answer_table[0].answer, sizeof(answer_table[0].answer))) - strcpy(answer_table[0].answer, "NO"); // default if msg_get fails + strcpy(answer_table[0].answer, "NO"); // default if msg_get fails // Msg497 YES if (!ERRQ_msg_get(497, answer_table[1].answer, sizeof(answer_table[1].answer))) diff --git a/src/qli/eval.cpp b/src/qli/eval.cpp index 06cc2a5a71..08ddadb5df 100644 --- a/src/qli/eval.cpp +++ b/src/qli/eval.cpp @@ -108,7 +108,7 @@ int EVAL_boolean( qli_nod* node) if (!(value1 = EVAL_value(node->nod_arg[0])) || (value1->dsc_missing & DSC_missing) || !(value2 = EVAL_value(node->nod_arg[1])) || - (value2->dsc_missing & DSC_missing)) + (value2->dsc_missing & DSC_missing)) { return false; } @@ -355,7 +355,7 @@ dsc* EVAL_value(qli_nod* node) **************************************/ DSC *values[4]; -// Start by evaluating sub-expressions (where appropriate) +// Start by evaluating sub-expressions (where appropriate) dsc* desc = &node->nod_desc; fb_assert(node->nod_count < 5); @@ -402,7 +402,7 @@ dsc* EVAL_value(qli_nod* node) case nod_add: if ((values[0]->dsc_missing & DSC_missing) || - (values[1]->dsc_missing & DSC_missing)) + (values[1]->dsc_missing & DSC_missing)) { desc->dsc_missing = DSC_missing; return desc; @@ -423,7 +423,7 @@ dsc* EVAL_value(qli_nod* node) case nod_subtract: if ((values[0]->dsc_missing & DSC_missing) || - (values[1]->dsc_missing & DSC_missing)) + (values[1]->dsc_missing & DSC_missing)) { desc->dsc_missing = DSC_missing; return desc; @@ -445,7 +445,7 @@ dsc* EVAL_value(qli_nod* node) case nod_divide: if ((values[0]->dsc_missing & DSC_missing) || - (values[1]->dsc_missing & DSC_missing)) + (values[1]->dsc_missing & DSC_missing)) { desc->dsc_missing = DSC_missing; return desc; @@ -457,7 +457,7 @@ dsc* EVAL_value(qli_nod* node) case nod_multiply: if ((values[0]->dsc_missing & DSC_missing) || - (values[1]->dsc_missing & DSC_missing)) + (values[1]->dsc_missing & DSC_missing)) { desc->dsc_missing = DSC_missing; return desc; @@ -624,7 +624,7 @@ static dsc* execute_concatenate( qli_nod* node, const dsc* value1, const dsc* va TEXT temp2[32]; const TEXT* address2; USHORT length2 = MOVQ_get_string(value2, &address2, (vary*)temp2, sizeof(temp2)); - + dsc* desc = &node->nod_desc; vary* avary = (vary*) desc->dsc_address; TEXT* p = avary->vary_string; @@ -735,7 +735,7 @@ static DSC *execute_prompt( qli_nod* node) vary* data = (vary*) desc->dsc_address; TEXT* value = - (desc->dsc_length - 2 <= static_cast(sizeof(buffer))) ? + (desc->dsc_length - 2 <= static_cast(sizeof(buffer))) ? buffer : data->vary_string; const int length = (desc->dsc_length - 2 <= static_cast(sizeof(buffer))) ? @@ -947,7 +947,7 @@ static bool sleuth( qli_nod* node, const dsc* desc1, const dsc* desc2, const dsc * **************************************/ -// Get operator definition string (control string) +// Get operator definition string (control string) TEXT temp1[TEMP_LENGTH]; const TEXT* p1; @@ -962,8 +962,8 @@ static bool sleuth( qli_nod* node, const dsc* desc1, const dsc* desc2, const dsc // Merge search and control strings TEXT control[256]; - l2 = sleuth_merge((const UCHAR*) p2, (const UCHAR*) (p2 + l2), - (const UCHAR*) p1, (const UCHAR*) (p1 + l1), + l2 = sleuth_merge((const UCHAR*) p2, (const UCHAR*) (p2 + l2), + (const UCHAR*) p1, (const UCHAR*) (p1 + l1), (UCHAR*) control); // If source is not a blob, do a simple search @@ -1044,7 +1044,7 @@ static bool sleuth_check( { if (sleuth_check(flags, search, end_search, match, end_match)) return true; - if (search < end_search) + if (search < end_search) { const UCHAR d = *search++; if (c != cond_upper(d, flags)) @@ -1091,7 +1091,7 @@ static bool sleuth_check( { if (sleuth_check(flags, search, end_search, match, end_match)) return true; - if (search < end_search) + if (search < end_search) { if (!sleuth_class(flags, char_class, end_class, *search++)) return false; @@ -1228,7 +1228,7 @@ static int sleuth_merge( // Interpret matching string, substituting where appropriate UCHAR c; - while (c = *match++) + while (c = *match++) { const UCHAR* p; @@ -1358,7 +1358,7 @@ static bool string_function( if (node->nod_type == nod_starts) { if (l1 < l2) return false; - + if (l2) return memcmp(p1, p2, l2) == 0; diff --git a/src/qli/exe.cpp b/src/qli/exe.cpp index cb4046c73b..a759aa6678 100644 --- a/src/qli/exe.cpp +++ b/src/qli/exe.cpp @@ -80,7 +80,7 @@ static void transaction_state(qli_nod*, DBB); const int COUNT_ITEMS = 4; -static const SCHAR count_info[] = +static const SCHAR count_info[] = { isc_info_req_select_count, isc_info_req_insert_count, @@ -134,7 +134,7 @@ void EXEC_execute( qli_nod* node) EXEC_poll_abort(); if (node) { - switch (node->nod_type) + switch (node->nod_type) { case nod_abort: execute_abort(node); @@ -442,7 +442,7 @@ void EXEC_start_request( qli_req* request, qli_msg* message) **************************************/ ISC_STATUS_ARRAY status_vector; - if (message) + if (message) { map_data(message); if (!isc_start_and_send(status_vector, &request->req_handle, @@ -453,7 +453,7 @@ void EXEC_start_request( qli_req* request, qli_msg* message) return; } } - else + else { if (!isc_start_request(status_vector, &request->req_handle, &request->req_database-> dbb_transaction, 0)) @@ -522,7 +522,7 @@ static DSC *assignment( qli_nod* from_node, /* If there is a value present, do any assignment; otherwise null fill */ - if (*missing_flag = to_desc->dsc_missing = from_desc->dsc_missing) + if (*missing_flag = to_desc->dsc_missing = from_desc->dsc_missing) { if (from_desc->dsc_length) memset(from_desc->dsc_address, 0, from_desc->dsc_length); @@ -690,7 +690,7 @@ static bool copy_blob( qli_nod* value, qli_par* parameter) ISC_STATUS_ARRAY status_vector; UserBlob to_blob(status_vector); UserBlob from_blob(status_vector); - + if (!to_blob.create(to_dbb->dbb_handle, to_dbb->dbb_transaction, *(ISC_QUAD*) to_desc->dsc_address)) { diff --git a/src/qli/expand.cpp b/src/qli/expand.cpp index e2b288ad74..d0310b45d0 100644 --- a/src/qli/expand.cpp +++ b/src/qli/expand.cpp @@ -879,7 +879,7 @@ static qli_nod* expand_expression( qli_syntax* input, qli_lls* stack) */ if ((value = input->syn_arg[s_stt_value]) && (input->syn_arg[s_prt_distinct] - || (input->syn_type != nod_agg_count))) + || (input->syn_type != nod_agg_count))) { node->nod_arg[e_stt_value] = expand_expression(value, stack->lls_next); @@ -1417,7 +1417,7 @@ static qli_nod* expand_print( qli_syntax* input, qli_lls* right, qli_lls* left) break; } -// If no print object showed up, complain! +// If no print object showed up, complain! if (!count) IBERROR(150); // Msg150 No items in print list @@ -1811,7 +1811,7 @@ static qli_nod* expand_rse( qli_syntax* input, qli_lls** stack) expand_expression(input->syn_arg[e_rse_boolean], new_stack)); -// Handle implicit boolean from SQL xxx IN (yyy FROM relation) +// Handle implicit boolean from SQL xxx IN (yyy FROM relation) if (input->syn_arg[s_rse_outer]) { qli_nod* eql_node = make_node((enum nod_t)(IPTR)input->syn_arg[s_rse_op], 2); @@ -2267,7 +2267,7 @@ static int generate_fields( qli_ctx* context, qli_lls* values, qli_syntax* rse) * input to a store or update. * **************************************/ - + if (context->ctx_type == CTX_VARIABLE) return 0; if (context->ctx_type == CTX_AGGREGATE) @@ -2512,7 +2512,7 @@ static bool invalid_syn_field( const qli_syntax* syn_node, const qli_syntax* lis return true; bool invalid = false; - + if (syn_node->syn_type == nod_field) { const nam* fctx = NULL; const nam* fname = (NAM) syn_node->syn_arg[0]; @@ -2892,7 +2892,7 @@ static qli_fld* resolve( qli_syntax* node, qli_lls* stack, qli_ctx** out_context { if (ptr == base) return field; - + name = *--ptr; if (compare_names(name, relation->rel_symbol)) diff --git a/src/qli/format.cpp b/src/qli/format.cpp index 92ecf86591..4879b43662 100644 --- a/src/qli/format.cpp +++ b/src/qli/format.cpp @@ -285,7 +285,7 @@ TEXT* FMT_format(qli_lls* stack) qli_print_item* item = (qli_print_item*) temp->lls_object; if (item->itm_type != item_value) continue; - const USHORT n = + const USHORT n = decompose_header(item->itm_query_header, segments, lengths); const SSHORT segment = j - (number_segments - n); if (segment < 0) @@ -488,7 +488,7 @@ void FMT_print( qli_nod* list, qli_prt* print) case item_skip: { put_line(print, &p, buffer, '\n'); - print_blobs(print, (qli_print_item**) list->nod_arg, + print_blobs(print, (qli_print_item**) list->nod_arg, (qli_print_item**) ptr); for (USHORT l = item->itm_count - 1; l > 0; --l) put_line(print, &p, buffer, '\n'); @@ -722,7 +722,7 @@ static USHORT decompose_header(const SCHAR* string, } } else - { + { TEXT c; while (c = *string++) { *segments = string; @@ -1232,7 +1232,7 @@ static void print_blobs( qli_prt* print, qli_print_item** first, qli_print_item* return; qli_print_item** ptr; - + USHORT length = 0; for (ptr = first; ptr < last; ptr++) { const qli_print_item* item = *ptr; diff --git a/src/qli/gener.cpp b/src/qli/gener.cpp index 9b33217231..20ed74cd6b 100644 --- a/src/qli/gener.cpp +++ b/src/qli/gener.cpp @@ -601,7 +601,7 @@ static void gen_compile( qli_req* request) ISC_STATUS_ARRAY status_vector; if (isc_compile_request(status_vector, &dbb->dbb_handle, &request->req_handle, length, - (const char*) rlb->rlb_base)) + (const char*) rlb->rlb_base)) { GEN_rlb_release (rlb); ERRQ_database_error(dbb, status_vector); @@ -658,12 +658,12 @@ static void gen_descriptor(const dsc* desc, qli_req* request) STUFF(blr_short); STUFF(desc->dsc_scale); break; - + case dtype_int64: STUFF(blr_int64); STUFF(desc->dsc_scale); break; - + case dtype_long: STUFF(blr_long); STUFF(desc->dsc_scale); @@ -777,7 +777,7 @@ static void gen_expression(qli_nod* node, qli_req* request) qli_map* map = (qli_map*) node->nod_arg[e_map_map]; const qli_ctx* context = (qli_ctx*) node->nod_arg[e_map_context]; if (context->ctx_request != request && - map->map_node->nod_type == nod_field) + map->map_node->nod_type == nod_field) { gen_field(map->map_node, request); return; @@ -1056,7 +1056,7 @@ static void gen_for( qli_nod* node, qli_req* request) gen_rse(node->nod_arg[e_for_rse], request); STUFF(blr_begin); -// If data is to be received (included EOF), build a send +// If data is to be received (included EOF), build a send const qli_par* eof = 0; dsc desc; diff --git a/src/qli/hsh.cpp b/src/qli/hsh.cpp index 7cf0ef2ce1..aba84b24b2 100644 --- a/src/qli/hsh.cpp +++ b/src/qli/hsh.cpp @@ -143,7 +143,7 @@ qli_symbol* HSH_lookup(const SCHAR* string, int length) * **************************************/ scompare_t scompare = scompare_ins; - + if (length > 1 && string[0] == '"') { // This logic differs from DSQL. See how LEX_token works. @@ -178,7 +178,7 @@ void HSH_remove( qli_symbol* symbol) for (qli_symbol** next = &hash_table[h]; *next; next = &(*next)->sym_collision) { - if (symbol == *next) + if (symbol == *next) { qli_symbol* homonym = symbol->sym_homonym; if (homonym) { diff --git a/src/qli/lex.cpp b/src/qli/lex.cpp index 9a360adb9c..e7f1df9b83 100644 --- a/src/qli/lex.cpp +++ b/src/qli/lex.cpp @@ -225,12 +225,12 @@ qli_tok* LEX_edit_string(void) return NULL; } - while (!(classes(c) & (CHR_white | CHR_eol))) + while (!(classes(c) & (CHR_white | CHR_eol))) { *p++ = c; if (classes(c) & CHR_quote) { - for (;;) + for (;;) { const SSHORT d = nextchar(false); if (d == '\n') { @@ -307,10 +307,10 @@ qli_tok* LEX_filename(void) for (;;) { c = nextchar(true); char char_class = classes(c); - if (c == '"' && c != save) + if (c == '"' && c != save) { *p++ = c; - for (;;) + for (;;) { c = nextchar(true); char_class = classes(c); diff --git a/src/qli/mov.cpp b/src/qli/mov.cpp index 23dc69daf4..85c7ce22d6 100644 --- a/src/qli/mov.cpp +++ b/src/qli/mov.cpp @@ -59,7 +59,7 @@ const char* const YESTERDAY = "YESTERDAY"; const int PRECISION = 10000; -struct dtypes_t +struct dtypes_t { USHORT type; const TEXT* description; @@ -100,7 +100,7 @@ int MOVQ_compare(const dsc* arg1, const dsc* arg2) * **************************************/ -// Handle the simple (matched) ones first +// Handle the simple (matched) ones first if (arg1->dsc_dtype == arg2->dsc_dtype && arg1->dsc_scale == arg2->dsc_scale) @@ -223,7 +223,7 @@ int MOVQ_compare(const dsc* arg1, const dsc* arg2) dsc desc; SLONG date[2]; - + switch (arg1->dsc_dtype) { case dtype_timestamp: desc.dsc_dtype = dtype_timestamp; @@ -354,11 +354,11 @@ int MOVQ_decompose(const TEXT* string, USHORT length, SLONG* return_value) const TEXT* p = string; const TEXT* const end = p + length; - for (; p < end; p++) + for (; p < end; p++) { if (*p == ',') continue; - + if (DIGIT(*p)) { value = value * 10 + *p - '0'; if (fraction) @@ -394,7 +394,7 @@ int MOVQ_decompose(const TEXT* string, USHORT length, SLONG* return_value) if (p < end) { SSHORT exp = 0; sign = false; - for (p++; p < end; p++) + for (p++; p < end; p++) { if (DIGIT(*p)) exp = exp * 10 + *p - '0'; @@ -609,7 +609,7 @@ SLONG MOVQ_get_long(const dsc* desc, SSHORT scale) } -int MOVQ_get_string(const dsc* desc, const TEXT** address, vary* temp, +int MOVQ_get_string(const dsc* desc, const TEXT** address, vary* temp, USHORT length) { /************************************** @@ -693,7 +693,7 @@ if (((ALT_DSC*) from)->dsc_combined_type == ((ALT_DSC*) to)->dsc_combined_type) { if (length) memcpy(p, q, length); - + return; } @@ -767,7 +767,7 @@ if (((ALT_DSC*) from)->dsc_combined_type == ((ALT_DSC*) to)->dsc_combined_type) case dtype_text: case dtype_cstring: case dtype_varying: - switch (from->dsc_dtype) + switch (from->dsc_dtype) { case dtype_varying: case dtype_cstring: @@ -776,7 +776,7 @@ if (((ALT_DSC*) from)->dsc_combined_type == ((ALT_DSC*) to)->dsc_combined_type) length = MOVQ_get_string(from, &ptr, 0, 0); const TEXT* s = ptr; - switch (to->dsc_dtype) + switch (to->dsc_dtype) { case dtype_text: { @@ -934,11 +934,11 @@ static double double_from_text(const dsc* desc) bool fraction = false, sign = false; double value = 0; const TEXT* const end = p + length; - for (; p < end; p++) + for (; p < end; p++) { if (*p == ',') continue; - + if (DIGIT(*p)) { value = value * 10. + (*p - '0'); if (fraction) diff --git a/src/qli/parse.cpp b/src/qli/parse.cpp index e351a0c5fe..d17ffd800d 100644 --- a/src/qli/parse.cpp +++ b/src/qli/parse.cpp @@ -1359,7 +1359,7 @@ static int parse_dtype( USHORT * length, USHORT * scale) *length = sizeof(SSHORT); dtype = dtype_short; break; - + case KW_BIGINT: *length = sizeof(SINT64); dtype = dtype_int64; @@ -1875,10 +1875,10 @@ static TEXT* parse_header(void) const TEXT* q = QLI_token->tok_string; while (*q && p < end) *p++ = *q++; - + if (p == end && *q) ERRQ_syntax(184); // Msg184 quoted header segment - + PAR_real_token(); if (!PAR_match(KW_SLASH)) break; @@ -3315,7 +3315,7 @@ static qli_syntax* parse_relation(void) if (!QLI_databases) IBERROR(207); // Msg207 a database has not been readied ERRQ_print_error(208, context->sym_string); - // Msg208 expected \"relation_name\", encountered \"%s\" + // Msg208 expected \"relation_name\", encountered \"%s\" } if (! (node->syn_arg[s_rel_relation] = (qli_syntax*) parse_qualified_relation())) @@ -3424,7 +3424,7 @@ static qli_syntax* parse_report(void) PAR_match(KW_OF); if (PAR_match(KW_REPORT)) { qli_brk* control = (qli_brk*) ALLOCD(type_brk); - qli_brk** ptr = + qli_brk** ptr = (top) ? &report->rpt_top_rpt : &report->rpt_bottom_rpt; control->brk_next = *ptr; *ptr = control; @@ -3441,7 +3441,7 @@ static qli_syntax* parse_report(void) control->brk_line = parse_print_list(); } else { - qli_brk** ptr = + qli_brk** ptr = (top) ? &report->rpt_top_breaks : &report->rpt_bottom_breaks; if (!*ptr) { /* control breaks should only be on sorted fields, set up list @@ -3893,7 +3893,7 @@ static qli_syntax* parse_show(void) sw = show_matching_language; else if (PAR_match(KW_VERSION)) sw = show_version; - else if (PAR_match(KW_RELATION)) + else if (PAR_match(KW_RELATION)) { if (!(value = (BLK) parse_qualified_relation())) ERRQ_syntax(216); // Msg216 relation name @@ -4137,7 +4137,7 @@ static qli_syntax* parse_sort(void) while (true) { PAR_real(); - if (!sql_flag) + if (!sql_flag) { if (PAR_match(KW_ASCENDING)) { direction = 0; @@ -4354,7 +4354,7 @@ static int parse_sql_dtype( USHORT* length, USHORT* scale, USHORT* precision, dtype = dtype_long; *sub_type = dsc_num_type_decimal; break; - + case KW_NUMERIC: *length = sizeof(SLONG); dtype = dtype_long; @@ -4366,7 +4366,7 @@ static int parse_sql_dtype( USHORT* length, USHORT* scale, USHORT* precision, //if (dtype == dtype_long || dtype == dtype_real || dtype == dtype_double) { if (keyword == KW_DECIMAL || keyword == KW_NUMERIC) { - if (PAR_match(KW_LEFT_PAREN)) + if (PAR_match(KW_LEFT_PAREN)) { const USHORT logLength = parse_ordinal(); if (logLength < 1) @@ -4383,14 +4383,14 @@ static int parse_sql_dtype( USHORT* length, USHORT* scale, USHORT* precision, *length = sizeof(SINT64); dtype = dtype_int64; } - + if (PAR_match(KW_COMMA)) { const bool l = (PAR_match(KW_MINUS)) ? true : false; *scale = parse_ordinal(); if (*scale > logLength) ERRQ_syntax(510); // Msg510 "Field scale exceeds allowed range" - + if (l || *scale > 0) // We need to have it negative in system tables. *scale = -(*scale); } @@ -4519,7 +4519,7 @@ static qli_syntax* parse_sql_grant_revoke( USHORT type) privileges |= PRV_delete; continue; } - if (PAR_match(KW_UPDATE)) + if (PAR_match(KW_UPDATE)) { privileges |= PRV_update; diff --git a/src/qli/picstr.cpp b/src/qli/picstr.cpp index d5f7428858..8daa1304fc 100644 --- a/src/qli/picstr.cpp +++ b/src/qli/picstr.cpp @@ -283,7 +283,7 @@ pics* PIC_analyze(const TEXT* string, const dsc* desc) picture->pic_nmonths || picture->pic_years || picture->pic_hours || - picture->pic_julians) + picture->pic_julians) { picture->pic_type = pic_date; } @@ -448,9 +448,9 @@ static const TEXT* default_edit_string(const dsc* desc, TEXT* buff) break; case dtype_int64: - /* replace 16 with 20 later + /* replace 16 with 20 later (as soon as I have sorted out the rounding issues) - FSG*/ + FSG*/ if (!scale) return "-(16)9"; if (scale < 0 && scale > -16) @@ -800,7 +800,7 @@ static void edit_float( const dsc* desc, pics* picture, TEXT** output) *out++ = ' '; bool is_signed = false; - + for (;;) { const TEXT e = generate(picture); TEXT c = e; diff --git a/src/qli/report.cpp b/src/qli/report.cpp index ae9574bfec..b30bcdbd1b 100644 --- a/src/qli/report.cpp +++ b/src/qli/report.cpp @@ -308,7 +308,7 @@ static void top_break( qli_brk* control, qli_prt* print) * Execute a control break. * **************************************/ - for (; control; control = control->brk_next) + for (; control; control = control->brk_next) { for (qli_lls* stack = control->brk_statisticals; stack; stack = stack->lls_next) { diff --git a/src/remote/inet_server.cpp b/src/remote/inet_server.cpp index 2835fcff93..27b7d88e65 100644 --- a/src/remote/inet_server.cpp +++ b/src/remote/inet_server.cpp @@ -145,7 +145,7 @@ int CLIB_ROUTINE server_main( int argc, char** argv) // 01 Sept 2003, Nickolay Samofatov // In GCC version 3.1-3.3 we need to install special error handler -// in order to get meaningful terminate() error message on stderr. +// in order to get meaningful terminate() error message on stderr. // In GCC 3.4 or later this is the default. //#if __GNUC__ == 3 && __GNUC_MINOR__ >= 1 && __GNUC_MINOR__ < 4 // std::set_terminate (__gnu_cxx::__verbose_terminate_handler); @@ -224,7 +224,7 @@ int CLIB_ROUTINE server_main( int argc, char** argv) case '?': printf("Firebird TCP/IP server options are:\n"); printf(" -d : debug on\n"); - + #ifndef SUPERSERVER // These options are not applicable to super server printf(" -m : multiclient - on\n"); @@ -240,10 +240,10 @@ int CLIB_ROUTINE server_main( int argc, char** argv) printf(" -h|? : print this help\n"); printf("\n"); printf(" (The following -e options used to be -h options)\n"); - printf(" -e : set firebird_root path\n"); - printf(" -el : set runtime firebird_lock dir\n"); - printf(" -em : set firebird_msg dir path\n"); - printf(" -z : print version\n"); + printf(" -e : set firebird_root path\n"); + printf(" -el : set runtime firebird_lock dir\n"); + printf(" -em : set firebird_msg dir path\n"); + printf(" -z : print version\n"); exit(FINI_OK); case 'Z': @@ -383,7 +383,7 @@ int CLIB_ROUTINE server_main( int argc, char** argv) } /* Server tries to attach to security2.fdb to make sure everything is OK - This code fixes bug# 8429 + all other bug of that kind - from + This code fixes bug# 8429 + all other bug of that kind - from now on the server exits if it cannot attach to the database (wrong or no license, not enough memory, etc. */ @@ -487,7 +487,7 @@ static int shutdownInetServer(const int reason, const int, void*) **************************************************** * * Functional description - * In order to avoid blocking of the thread, + * In order to avoid blocking of the thread, * which received SIGTERM, run in separate thread. * **************************************/ @@ -500,7 +500,7 @@ static int shutdownInetServer(const int reason, const int, void*) serverClosing = true; - // shutdown main thread - send self-signal to close select() + // shutdown main thread - send self-signal to close select() // in main thread and wait for it to get into safe state #ifdef UNIX kill(getpid(), SIGUSR1); @@ -518,7 +518,7 @@ static void shutdownInit() ISC_STATUS_ARRAY status; fb_shutdown_callback(status, shutdownInetServer, fb_shut_postproviders, 0); - if (status[0] == 1 && status[1] > 0) + if (status[0] == 1 && status[1] > 0) { gds__log_status("Error in shutdownInit()", status); isc_print_status(status); @@ -535,7 +535,7 @@ static int tryStopMainThread() **************************************************** * * Functional description - * Called by main thread to test is not shutdown started. + * Called by main thread to test is not shutdown started. * **************************************/ return serverClosing ? 1 : 0; diff --git a/src/remote/os/win32/chop.cpp b/src/remote/os/win32/chop.cpp index 800024ab3a..ec18ddaa88 100644 --- a/src/remote/os/win32/chop.cpp +++ b/src/remote/os/win32/chop.cpp @@ -43,7 +43,7 @@ char *ChopFileName( char *szName, char *szShortName, ULONG dwLen) * * Both szName and szShort name can be the same pointer. * - * Inputs: + * Inputs: * szName - Null terminated input path/filename. * szShortName - Output buffer for truncated path/filename. * dwLen - Length to truncate to. diff --git a/src/remote/os/win32/ibconfig.cpp b/src/remote/os/win32/ibconfig.cpp index 6da451ecce..fbaaa8338d 100644 --- a/src/remote/os/win32/ibconfig.cpp +++ b/src/remote/os/win32/ibconfig.cpp @@ -86,7 +86,7 @@ static void FillSysdbaSPB(char*, const char*); // which is used in the help file. static DWORD aMenuHelpIDs1[][2] = { {IDC_MODRES, ibs_modify}, // This has to be the first entry because - // we modify the value of ibs_modify to + // we modify the value of ibs_modify to // ibs_reset when the button text changes. {IDC_MINSIZETEXT, ibs_min_process_work_set}, @@ -188,7 +188,7 @@ LRESULT CALLBACK FirebirdPage(HWND hDlg, UINT unMsg, WPARAM wParam, OsVersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); if (GetVersionEx((LPOSVERSIONINFO) & OsVersionInfo) && - OsVersionInfo.dwMajorVersion < 4) + OsVersionInfo.dwMajorVersion < 4) { SetBkMode((HDC) wParam, TRANSPARENT); return (LRESULT) hIBGrayBrush; @@ -258,11 +258,11 @@ LRESULT CALLBACK FirebirdPage(HWND hDlg, UINT unMsg, WPARAM wParam, SetWindowLongPtr(hDlg, DWLP_MSGRESULT, FALSE); break; } - case PSN_SETACTIVE: // When the page is about to recieve + case PSN_SETACTIVE: // When the page is about to recieve { // focus - // This modifies the bubble help table to bring up - // the appropriate help topic based on whether the text - // is "Modify..." or "Reset". It assumes that the first + // This modifies the bubble help table to bring up + // the appropriate help topic based on whether the text + // is "Modify..." or "Reset". It assumes that the first // entry is the first one. aMenuHelpIDs1[0][1] = bModifyMode ? ibs_reset : ibs_modify; break; @@ -425,7 +425,7 @@ void RefreshIBControls(HWND hDlg, BOOL bEnable) SendDlgItemMessage(hDlg, IDC_MODRES, WM_SETTEXT, 0, (LPARAM) szButtonName); -// This modifies the bubble help table to bring up the appropriate help +// This modifies the bubble help table to bring up the appropriate help // topic based on whether the text is "Modify..." or "Reset". It assumes // that the first entry is the first one. aMenuHelpIDs1[0][1] = bEnable ? ibs_reset : ibs_modify; @@ -605,7 +605,7 @@ BOOL CALLBACK PasswordDlgProc(HWND hDlg, UINT unMsg, WPARAM wParam, OsVersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); if (GetVersionEx((LPOSVERSIONINFO) & OsVersionInfo) && - OsVersionInfo.dwMajorVersion < 4) + OsVersionInfo.dwMajorVersion < 4) { SetBkMode((HDC) wParam, TRANSPARENT); return (LRESULT) hIBGrayBrush; @@ -750,7 +750,7 @@ void FillSysdbaSPB(char *szSpb, const char* szPasswd) void HelpCmd( HWND hWnd, HINSTANCE hInst, WPARAM wId) { /**************************************************************** - * + * * H e l p C m d * **************************************************************** @@ -761,7 +761,7 @@ void HelpCmd( HWND hWnd, HINSTANCE hInst, WPARAM wId) * nId - The help message Id. * * Description: Invoke the Windows Help facility with context of nId. - * + * *****************************************************************/ SCHAR szPathFileName[1024 + 256 + 1]; diff --git a/src/remote/os/win32/property.cpp b/src/remote/os/win32/property.cpp index 90ca4e1f5d..4e8d188354 100644 --- a/src/remote/os/win32/property.cpp +++ b/src/remote/os/win32/property.cpp @@ -171,7 +171,7 @@ LRESULT CALLBACK GeneralPage(HWND hDlg, UINT unMsg, WPARAM wParam, * Description: This is the window procedure for the "General" page dialog * of the property sheet dialog box. All the Property Sheet * related events are passed as WM_NOTIFY messages and they - * are identified within the LPARAM which will be pointer to + * are identified within the LPARAM which will be pointer to * the NMDR structure *****************************************************************************/ diff --git a/src/remote/os/win32/srvr_w32.cpp b/src/remote/os/win32/srvr_w32.cpp index 531048537c..d8e7ee6d53 100644 --- a/src/remote/os/win32/srvr_w32.cpp +++ b/src/remote/os/win32/srvr_w32.cpp @@ -224,7 +224,7 @@ int WINAPI WinMain(HINSTANCE hThisInst, { port = INET_reconnect(connection_handle, status_vector); - if (port) + if (port) { SRVR_multi_thread(port, server_flag); port = NULL; @@ -362,10 +362,10 @@ static THREAD_ENTRY_DECLARE wnet_connect_wait_thread(THREAD_ENTRY_PARAM) fb_utils::init_status(status_vector); rem_port* port = WNET_connect(protocol_wnet, NULL, status_vector, server_flag); - if (!port) + if (!port) { const ISC_STATUS err = status_vector[1]; - if (err) + if (err) { if (err == isc_net_server_shutdown) break; @@ -401,10 +401,10 @@ static THREAD_ENTRY_DECLARE xnet_connect_wait_thread(THREAD_ENTRY_PARAM) fb_utils::init_status(status_vector); rem_port* port = XNET_connect(NULL, NULL, status_vector, server_flag); - if (!port) + if (!port) { const ISC_STATUS err = status_vector[1]; - if (err) + if (err) { if (err == isc_net_server_shutdown) break; diff --git a/src/remote/os/win32/window.cpp b/src/remote/os/win32/window.cpp index 2d5d770688..0d6aa96dcb 100644 --- a/src/remote/os/win32/window.cpp +++ b/src/remote/os/win32/window.cpp @@ -172,7 +172,7 @@ LRESULT CALLBACK WindowFunc(HWND hWnd, * lParam - LPARAM parameter for the message * * Return: FALSE indicates that the message has not been handled - * TRUE indicates the message has been handled + * TRUE indicates the message has been handled * * Description: This is main window procedure for the Firebird server. This * traps all the Firebird significant messages and processes @@ -193,7 +193,7 @@ LRESULT CALLBACK WindowFunc(HWND hWnd, /* If we are running as a non-service server, then query the user * to determine if we should end the session. Otherwise, assume that * the server is a service and could be servicing remote clients and - * therefore should not be shut down. + * therefore should not be shut down. */ if (usServerFlags & SRVR_non_service) { return CanEndServer(hWnd, true); @@ -207,7 +207,7 @@ LRESULT CALLBACK WindowFunc(HWND hWnd, * the server is a service and could be servicing remote clients and * therefore should not be shut down. The DestroyWindow() will destroy * the hidden window created by the server for IPC. This should get - * destroyed when the user session ends. + * destroyed when the user session ends. */ if (usServerFlags & SRVR_non_service) { if (CanEndServer(hWnd, false)) { @@ -225,7 +225,7 @@ LRESULT CALLBACK WindowFunc(HWND hWnd, switch (wParam) { case IDM_CANCEL: if ((usServerFlags & SRVR_non_service) - && (!(usServerFlags & SRVR_no_icon))) + && (!(usServerFlags & SRVR_no_icon))) { ShowWindow(hWnd, bInTaskBar ? SW_HIDE : SW_MINIMIZE); } @@ -300,7 +300,7 @@ LRESULT CALLBACK WindowFunc(HWND hWnd, break; case WM_RBUTTONUP: - // The TrackPopupMenu() is inconsistant if called from here? + // The TrackPopupMenu() is inconsistant if called from here? // This is the only way I could make it work. PostMessage(hWnd, WM_COMMAND, (WPARAM) IDM_OPENPOPUP, 0); break; @@ -309,7 +309,7 @@ LRESULT CALLBACK WindowFunc(HWND hWnd, case WM_CREATE: if ((usServerFlags & SRVR_non_service) - && (!(usServerFlags & SRVR_no_icon))) + && (!(usServerFlags & SRVR_no_icon))) { HICON hIcon = (HICON) LoadImage(hInstance, MAKEINTRESOURCE(IDI_IBSVR_SMALL), @@ -324,7 +324,7 @@ LRESULT CALLBACK WindowFunc(HWND hWnd, nid.hIcon = hIcon; lstrcpy(nid.szTip, GDS_VERSION); - // This will be true in the explorer interface + // This will be true in the explorer interface bInTaskBar = Shell_NotifyIcon(NIM_ADD, &nid); if (hIcon) @@ -433,7 +433,7 @@ LRESULT CALLBACK WindowFunc(HWND hWnd, } /* Fall through to MOVEPENDING if we receive a QUERYDEVICE for the * same device twice. This will occur if we say yes to the removal - * of a controller. The OS will prompt for the removal of all + * of a controller. The OS will prompt for the removal of all * devices connected to that controller. If you respond no, the * OS will prompt you again, and then remove the device anyway... */ diff --git a/src/remote/os/win32/wnet.cpp b/src/remote/os/win32/wnet.cpp index cfd65c1a41..c25c9a0269 100644 --- a/src/remote/os/win32/wnet.cpp +++ b/src/remote/os/win32/wnet.cpp @@ -159,7 +159,7 @@ rem_port* WNET_analyze(const Firebird::PathName& file_name, cnct->p_cnct_file.cstr_address = reinterpret_cast(file_name.c_str()); /* Note: prior to V3.1E a receivers could not in truth handle more - then 5 protocol descriptions; however, this restriction does not + then 5 protocol descriptions; however, this restriction does not apply to Windows since it was created in 4.0 */ /* If we want user verification, we can't speak anything less than version 7 */ @@ -284,11 +284,11 @@ rem_port* WNET_analyze(const Firebird::PathName& file_name, port->port_protocol = packet->p_acpt.p_acpt_version; -/* once we've decided on a protocol, concatenate the version +/* once we've decided on a protocol, concatenate the version string to reflect it... */ Firebird::string temp; - temp.printf("%s/P%d", port->port_version->str_data, + temp.printf("%s/P%d", port->port_version->str_data, port->port_protocol & FB_PROTOCOL_MASK); delete port->port_version; port->port_version = REMOTE_make_string(temp.c_str()); @@ -373,7 +373,7 @@ rem_port* WNET_connect(const TEXT* name, if (port->port_handle == INVALID_HANDLE_VALUE) { const DWORD dwError = GetLastError(); - if (dwError == ERROR_CALL_NOT_IMPLEMENTED) + if (dwError == ERROR_CALL_NOT_IMPLEMENTED) { disconnect(port); wnet_shutdown = true; @@ -508,7 +508,7 @@ static int accept_connection( rem_port* port, const P_CNCT* cnct) /* Pick up account and password, if given */ - Firebird::ClumpletReader id(Firebird::ClumpletReader::UnTagged, + Firebird::ClumpletReader id(Firebird::ClumpletReader::UnTagged, cnct->p_cnct_user_id.cstr_address, cnct->p_cnct_user_id.cstr_length); for (id.rewind(); !id.isEof(); id.moveNext()) @@ -578,7 +578,7 @@ static rem_port* alloc_port( rem_port* parent) xdrwnet_create(&port->port_receive, port, port->port_buffer, 0, XDR_DECODE); - if (parent) + if (parent) { delete port->port_connection; port->port_connection = REMOTE_make_string(parent->port_connection->str_data); @@ -664,7 +664,7 @@ static rem_port* aux_request( rem_port* vport, PACKET* packet) ************************************** * * Functional description - * A remote interface has requested the server prepare an auxiliary + * A remote interface has requested the server prepare an auxiliary * connection; the server calls aux_request to set up the connection. * Send the servers process id on the packet. If at a later time * a multi client server is used, there may be a need to @@ -673,7 +673,7 @@ static rem_port* aux_request( rem_port* vport, PACKET* packet) **************************************/ rem_port* new_port = NULL; // If this is the client, we will return NULL - const DWORD server_pid = (vport->port_server_flags & SRVR_multi_client) ? + const DWORD server_pid = (vport->port_server_flags & SRVR_multi_client) ? ++event_counter : GetCurrentProcessId(); vport->port_async = new_port = alloc_port(vport->port_parent); new_port->port_server_flags = vport->port_server_flags; @@ -804,7 +804,7 @@ static void disconnect(rem_port* port) CloseHandle(port->port_event); port->port_event = INVALID_HANDLE_VALUE; } - if (port->port_handle) + if (port->port_handle) { CloseHandle(port->port_handle); port->port_handle = 0; @@ -827,7 +827,7 @@ static void force_close(rem_port* port) * **************************************/ - if (port->port_event != INVALID_HANDLE_VALUE) + if (port->port_event != INVALID_HANDLE_VALUE) { port->port_state = rem_port::BROKEN; @@ -1461,7 +1461,7 @@ static int packet_receive( BOOL status = ReadFile(port->port_handle, buffer, buffer_length, &n, &ovrl); DWORD dwError = GetLastError(); - if (!status && dwError == ERROR_IO_PENDING) + if (!status && dwError == ERROR_IO_PENDING) { status = GetOverlappedResult(port->port_handle, &ovrl, &n, TRUE); dwError = GetLastError(); @@ -1469,7 +1469,7 @@ static int packet_receive( if (!status && dwError != ERROR_BROKEN_PIPE) { return wnet_error(port, "ReadFile", isc_net_read_err, dwError); } - + if (!n) { if (port->port_flags & PORT_detached) @@ -1497,7 +1497,7 @@ static int packet_send( rem_port* port, const SCHAR* buffer, SSHORT buffer_lengt ************************************** * * Functional description - * Send some data on it's way. + * Send some data on it's way. * **************************************/ const SCHAR* data = buffer; @@ -1509,7 +1509,7 @@ static int packet_send( rem_port* port, const SCHAR* buffer, SSHORT buffer_lengt BOOL status = WriteFile(port->port_handle, data, length, &n, &ovrl); DWORD dwError = GetLastError(); - if (!status && dwError == ERROR_IO_PENDING) + if (!status && dwError == ERROR_IO_PENDING) { status = GetOverlappedResult(port->port_handle, &ovrl, &n, TRUE); dwError = GetLastError(); diff --git a/src/remote/protocol.cpp b/src/remote/protocol.cpp index aee852d32a..2e13aafe96 100644 --- a/src/remote/protocol.cpp +++ b/src/remote/protocol.cpp @@ -315,7 +315,7 @@ bool_t xdr_protocol(XDR* xdrs, PACKET* p) { tail = &dummy; } - + MAP(xdr_short, reinterpret_cast(tail->p_cnct_version)); MAP(xdr_enum, @@ -331,7 +331,7 @@ bool_t xdr_protocol(XDR* xdrs, PACKET* p) { connect->p_cnct_count = CNCT_VERSIONS; } - + DEBUG_PRINTSIZE(xdrs, p->p_operation); return P_TRUE(xdrs, p); } @@ -555,13 +555,13 @@ bool_t xdr_protocol(XDR* xdrs, PACKET* p) MAP(xdr_short, reinterpret_cast(event->p_event_database)); MAP(xdr_cstring_const, event->p_event_items); - + // Nickolay Samofatov: these values are parsed, but are ignored by the client. // Values are useful only for debugging, anyway since upper words of pointers // are trimmed for 64-bit clients MAP(xdr_long, reinterpret_cast(event->p_event_ast)); MAP(xdr_long, event->p_event_arg); - + MAP(xdr_long, event->p_event_rid); DEBUG_PRINTSIZE(xdrs, p->p_operation); return P_TRUE(xdrs, p); @@ -597,14 +597,14 @@ bool_t xdr_protocol(XDR* xdrs, PACKET* p) slice_response = &p->p_slr; if (slice_response->p_slr_sdl) { if (!xdr_slice(xdrs, &slice->p_slc_slice, slice_response->p_slr_sdl_length, - slice_response->p_slr_sdl)) + slice_response->p_slr_sdl)) { return P_FALSE(xdrs, p); } } else if (!xdr_slice(xdrs, &slice->p_slc_slice, slice->p_slc_sdl.cstr_length, - slice->p_slc_sdl.cstr_address)) + slice->p_slc_sdl.cstr_address)) { return P_FALSE(xdrs, p); } @@ -616,7 +616,7 @@ bool_t xdr_protocol(XDR* xdrs, PACKET* p) MAP(xdr_long, reinterpret_cast(slice_response->p_slr_length)); if (!xdr_slice (xdrs, &slice_response->p_slr_slice, slice_response->p_slr_sdl_length, - slice_response->p_slr_sdl)) + slice_response->p_slr_sdl)) { return P_FALSE(xdrs, p); } @@ -785,7 +785,7 @@ bool_t xdr_protocol(XDR* xdrs, PACKET* p) return P_TRUE(xdrs, p); } - + case op_authenticate_user: { p_authenticate *stuff = &p->p_authenticate_user; @@ -901,7 +901,7 @@ static bool alloc_cstring(XDR* xdrs, return true; if (cstring->cstr_length > cstring->cstr_allocated && - cstring->cstr_allocated) + cstring->cstr_allocated) { free_cstring(xdrs, cstring); } @@ -1001,7 +1001,7 @@ static bool_t xdr_cstring( XDR* xdrs, CSTRING* cstring) !(*xdrs->x_ops->x_putbytes) (xdrs, reinterpret_cast< const SCHAR*>(cstring->cstr_address), - cstring->cstr_length)) + cstring->cstr_length)) { return FALSE; } @@ -1015,7 +1015,7 @@ static bool_t xdr_cstring( XDR* xdrs, CSTRING* cstring) return FALSE; if (!(*xdrs->x_ops->x_getbytes) (xdrs, reinterpret_cast(cstring->cstr_address), - cstring->cstr_length)) + cstring->cstr_length)) { return FALSE; } @@ -1657,7 +1657,7 @@ static bool_t xdr_status_vector( SLONG vec; XDR temp_xdrs; - + while (true) { if (xdrs->x_op == XDR_ENCODE) vec = (SLONG) * vector++; @@ -1665,7 +1665,7 @@ static bool_t xdr_status_vector( return FALSE; if (xdrs->x_op == XDR_DECODE) *vector++ = (ISC_STATUS) vec; - + switch ((USHORT) vec) { case isc_arg_end: @@ -1750,7 +1750,7 @@ static bool_t xdr_trrq_blr(XDR* xdrs, CSTRING* blr) procedure->rpr_out_msg = NULL; delete procedure->rpr_out_format; procedure->rpr_out_format = NULL; - + REM_MSG message = PARSE_messages(blr->cstr_address, blr->cstr_length); if (message != (REM_MSG) -1) { while (message) { diff --git a/src/remote/remote.cpp b/src/remote/remote.cpp index 079895b8f1..3f537e4162 100644 --- a/src/remote/remote.cpp +++ b/src/remote/remote.cpp @@ -62,13 +62,13 @@ void REMOTE_cleanup_transaction( Rtr* transaction) ************************************** * * Functional description - * A transaction is being committed or rolled back. + * A transaction is being committed or rolled back. * Purge any active messages in case the user calls * receive while we still have something cached. * **************************************/ for (Rrq* request = transaction->rtr_rdb->rdb_requests; request; - request = request->rrq_next) + request = request->rrq_next) { if (request->rrq_rtr == transaction) { REMOTE_reset_request(request, 0); @@ -112,51 +112,51 @@ ULONG REMOTE_compute_batch_size(rem_port* port, * ... * * - * + * * end-of-batch is indicated by setting p_sqldata_messages to * 0 in the op_fetch_response. End of cursor is indicated * by setting p_sqldata_status to a non-zero value. Note * that a fetch CAN be attempted after end of cursor, this * is sent to the server for the server to return the appropriate - * error code. - * + * error code. + * * Each data block has one overhead packet * to indicate the data is present. - * + * * (See also op_send in receive_msg() - which is a kissing cousin * to this routine) - * + * * Here we make a guess for the optimal number of records to * send in each batch. This is important as we wait for the * whole batch to be received before we return the first item * to the client program. How many are cached on the client also * impacts client-side memory utilization. - * + * * We optimize the number by how many can fit into a packet. * The client calculates this number (n from the list above) * and sends it to the server. - * - * I asked why it is that the client doesn't just ask for a packet - * full of records and let the server return however many fits in - * a packet. According to Sudesh, this is because of a bug in - * Superserver which showed up in the WIN_NT 4.2.x kits. So I - * imagine once we up the protocol so that we can be sure we're not - * talking to a 4.2 kit, then we can make this optimization. + * + * I asked why it is that the client doesn't just ask for a packet + * full of records and let the server return however many fits in + * a packet. According to Sudesh, this is because of a bug in + * Superserver which showed up in the WIN_NT 4.2.x kits. So I + * imagine once we up the protocol so that we can be sure we're not + * talking to a 4.2 kit, then we can make this optimization. * - Deej 2/28/97 - * - * Note: A future optimization can look at setting the packet + * + * Note: A future optimization can look at setting the packet * size to optimize the transfer. * * Note: This calculation must use worst-case to determine the * packing. Should the data record have VARCHAR data, it is * often possible to fit more than the packing specification - * into each packet. This is also a candidate for future + * into each packet. This is also a candidate for future * optimization. - * + * * The data size is either the XDR data representation, or the * actual message size (rounded up) if this is a symmetric - * architecture connection. - * + * architecture connection. + * **************************************/ const USHORT MAX_PACKETS_PER_BATCH = 4; /* packets - picked by SWAG */ @@ -200,7 +200,7 @@ const USHORT MIN_ROWS_PER_BATCH = 10; /* data rows - picked by SWAG */ ULONG result = (num_packets * port->port_buff_size - buffer_used) / row_size; -/* Must always send some messages, even if message size is more +/* Must always send some messages, even if message size is more than packet size. */ result = MAX(result, MIN_ROWS_PER_BATCH); @@ -311,7 +311,7 @@ void REMOTE_free_packet( rem_port* port, PACKET * packet, bool partial) } } #ifdef DEBUG_XDR_MEMORY - // All packet memory allocations should now be voided. + // All packet memory allocations should now be voided. // note: this code will may work properly if partial == true for (n = 0; n < P_MALLOC_SIZE; n++) @@ -342,7 +342,7 @@ void REMOTE_get_timeout_params(rem_port* port, Firebird::ClumpletReader* pb) fb_assert(isc_dpb_connect_timeout == isc_spb_connect_timeout); - port->port_connect_timeout = pb && pb->find(isc_dpb_connect_timeout) ? + port->port_connect_timeout = pb && pb->find(isc_dpb_connect_timeout) ? pb->getInt() : Config::getConnectionTimeout(); port->port_flags |= PORT_dummy_pckt_set; @@ -562,7 +562,7 @@ void REMOTE_save_status_strings( ISC_STATUS* vector) * Functional description * There has been a failure during attach/create database. * The included string have been allocated off of the database block, - * which is going to be released before the message gets passed + * which is going to be released before the message gets passed * back to the user. So, to preserve information, copy any included * strings to a special buffer. * @@ -571,7 +571,7 @@ void REMOTE_save_status_strings( ISC_STATUS* vector) if (!attachFailures) { - try + try { attachFailures = FB_NEW(*getDefaultMemoryPool()) Firebird::CircularStringsBuffer; /* FREE: freed by exit handler cleanup_memory() */ @@ -700,15 +700,15 @@ bool_t REMOTE_getbytes (XDR * xdrs, SCHAR * buff, u_int count) xdrs->x_private = xdrs->x_base; } } - + return TRUE; } #endif //REM_SERVER #ifdef TRUSTED_AUTH -ServerAuth::ServerAuth(const char* fName, int fLen, const Firebird::ClumpletWriter& pb, +ServerAuth::ServerAuth(const char* fName, int fLen, const Firebird::ClumpletWriter& pb, ServerAuth::Part2* p2, P_OP op) -: fileName(*getDefaultMemoryPool()), clumplet(*getDefaultMemoryPool()), +: fileName(*getDefaultMemoryPool()), clumplet(*getDefaultMemoryPool()), part2(p2), operation(op) { fileName.assign(fName, fLen); diff --git a/src/remote/xdr.cpp b/src/remote/xdr.cpp index 1f01607c70..433368bff6 100644 --- a/src/remote/xdr.cpp +++ b/src/remote/xdr.cpp @@ -207,7 +207,7 @@ bool_t xdr_bytes(XDR * xdrs, { /************************************** * - * x d r _ b y t e s + * x d r _ b y t e s * ************************************** * diff --git a/src/remote/xnet.cpp b/src/remote/xnet.cpp index 7108b66d87..0bd91ae16a 100644 --- a/src/remote/xnet.cpp +++ b/src/remote/xnet.cpp @@ -129,7 +129,7 @@ static HANDLE xnet_response_event = 0; static DWORD current_process_id; // XNET endpoint is the IPC prefix name used to access the server. -// It may have to be dynamically determined and has to be initialized +// It may have to be dynamically determined and has to be initialized // before the protocol can be used. It is initialized at the following points: // - XNET_reconnect (classic servant size) // - connect_client (client side) @@ -172,7 +172,7 @@ inline void make_event_name(char* buffer, size_t size, const char* format, ULONG static int xnet_error(rem_port*, ISC_STATUS, int); static void xnet_log_error(const char* err_msg, const ISC_STATUS* status = NULL) -{ +{ if (status && status[1]) { Firebird::string str("XNET error: "); @@ -245,7 +245,7 @@ rem_port* XNET_analyze(const Firebird::PathName& file_name, cnct->p_cnct_file.cstr_address = reinterpret_cast(file_name.c_str()); // Note: prior to V3.1E a recievers could not in truth handle more - // then 5 protocol descriptions; however, the interprocess server + // then 5 protocol descriptions; however, the interprocess server // was created in 4.0 so this does not apply. cnct->p_cnct_user_id.cstr_length = user_id.getBufferLength(); @@ -366,11 +366,11 @@ rem_port* XNET_analyze(const Firebird::PathName& file_name, port->port_protocol = packet->p_acpt.p_acpt_version; - // Once we've decided on a protocol, concatenate the version + // Once we've decided on a protocol, concatenate the version // string to reflect it... Firebird::string temp; - temp.printf("%s/P%d", port->port_version->str_data, + temp.printf("%s/P%d", port->port_version->str_data, port->port_protocol & FB_PROTOCOL_MASK); delete port->port_version; @@ -407,7 +407,7 @@ rem_port* XNET_connect(const TEXT* name, if (xnet_shutdown) { Arg::StatusVector temp; - temp << Arg::Gds(isc_net_server_shutdown) << Arg::Str("XNET"); + temp << Arg::Gds(isc_net_server_shutdown) << Arg::Str("XNET"); temp.copyTo(status_vector); return NULL; @@ -451,7 +451,7 @@ rem_port* XNET_reconnect(ULONG client_pid, ISC_STATUS* status_vector) // current_process_id used as map number current_process_id = getpid(); - try + try { TEXT name_buffer[BUFFER_TINY]; make_obj_name(name_buffer, sizeof(name_buffer), XNET_RESPONSE_EVENT); @@ -476,7 +476,7 @@ rem_port* XNET_reconnect(ULONG client_pid, ISC_STATUS* status_vector) cleanup_mapping(xpm); } - if (xnet_response_event) + if (xnet_response_event) { SetEvent(xnet_response_event); // to prevent client blocking CloseHandle(xnet_response_event); @@ -511,7 +511,7 @@ static bool connect_init(ISC_STATUS* status) try { make_obj_name(name_buffer, sizeof(name_buffer), XNET_CONNECT_MUTEX); xnet_connect_mutex = OpenMutex(MUTEX_ALL_ACCESS, TRUE, name_buffer); - if (!xnet_connect_mutex) + if (!xnet_connect_mutex) { if (ERRNO == ERROR_FILE_NOT_FOUND) { @@ -542,16 +542,16 @@ static bool connect_init(ISC_STATUS* status) Firebird::system_error::raise(ERR_STR("OpenFileMapping")); } - xnet_connect_map = + xnet_connect_map = MapViewOfFile(xnet_connect_map_h, FILE_MAP_WRITE, 0, 0, XNET_CONNECT_RESPONZE_SIZE); if (!xnet_connect_map) { Firebird::system_error::raise(ERR_STR("MapViewOfFile")); } - + return true; } - catch (const Firebird::Exception& ex) + catch (const Firebird::Exception& ex) { stuff_exception(status, ex); connect_fini(); @@ -675,7 +675,7 @@ static rem_port* alloc_port(rem_port* parent, xdrxnet_create(&port->port_send, port, send_buffer, send_length, XDR_ENCODE); xdrxnet_create(&port->port_receive, port, receive_buffer, 0, XDR_DECODE); - if (parent) + if (parent) { delete port->port_connection; port->port_connection = REMOTE_make_string(parent->port_connection->str_data); @@ -770,7 +770,7 @@ static rem_port* aux_connect(rem_port* port, PACKET* packet, t_event_ast ast) // send and receive events channels - xcc->xcc_send_channel = &xps->xps_channels[XPS_CHANNEL_C2S_EVENTS]; + xcc->xcc_send_channel = &xps->xps_channels[XPS_CHANNEL_C2S_EVENTS]; xcc->xcc_recv_channel = &xps->xps_channels[XPS_CHANNEL_S2C_EVENTS]; UCHAR* const channel_c2s_client_ptr = @@ -811,7 +811,7 @@ static rem_port* aux_connect(rem_port* port, PACKET* packet, t_event_ast ast) } delete xcc; } - + return NULL; } } @@ -903,7 +903,7 @@ static rem_port* aux_request(rem_port* port, PACKET* packet) // send and receive events channels - xcc->xcc_send_channel = &xps->xps_channels[XPS_CHANNEL_S2C_EVENTS]; + xcc->xcc_send_channel = &xps->xps_channels[XPS_CHANNEL_S2C_EVENTS]; xcc->xcc_recv_channel = &xps->xps_channels[XPS_CHANNEL_C2S_EVENTS]; UCHAR* const channel_s2c_client_ptr = @@ -949,7 +949,7 @@ static rem_port* aux_request(rem_port* port, PACKET* packet) } delete xcc; } - + return NULL; } } @@ -1004,7 +1004,7 @@ static void cleanup_mapping(XPM xpm) // if this was the last area for this map, unmap it xpm->xpm_count--; - if (!xpm->xpm_count && global_client_maps) + if (!xpm->xpm_count && global_client_maps) { UnmapViewOfFile(xpm->xpm_address); CloseHandle(xpm->xpm_handle); @@ -1013,7 +1013,7 @@ static void cleanup_mapping(XPM xpm) for (XPM* pxpm = &global_client_maps; *pxpm; pxpm = &(*pxpm)->xpm_next) { - if (*pxpm == xpm) + if (*pxpm == xpm) { *pxpm = xpm->xpm_next; break; @@ -1094,7 +1094,7 @@ static rem_port* connect_client(PACKET* packet, ISC_STATUS* status_vector) // under restricted account in the same session as the client fb_utils::copy_terminate(xnet_endpoint, Config::getIpcName(), sizeof(xnet_endpoint)); - if (!connect_init(status_vector)) + if (!connect_init(status_vector)) { // The client may not have permissions to create global objects, // but still be able to connect to a local server that has such permissions. @@ -1118,7 +1118,7 @@ static rem_port* connect_client(PACKET* packet, ISC_STATUS* status_vector) if (err != WAIT_OBJECT_0) { connect_fini(); - + temp << SYS_ERR(err); temp.copyTo(status_vector); @@ -1131,7 +1131,7 @@ static rem_port* connect_client(PACKET* packet, ISC_STATUS* status_vector) // detect server faults on response PXNET_RESPONSE(xnet_connect_map)->map_num = XNET_INVALID_MAP_NUM; - PXNET_RESPONSE(xnet_connect_map)->proc_id = current_process_id; + PXNET_RESPONSE(xnet_connect_map)->proc_id = current_process_id; SetEvent(xnet_connect_event); @@ -1152,11 +1152,11 @@ static rem_port* connect_client(PACKET* packet, ISC_STATUS* status_vector) memcpy(&response, xnet_connect_map, XNET_CONNECT_RESPONZE_SIZE); ReleaseMutex(xnet_connect_mutex); connect_fini(); - } // xnet_mutex scope + } // xnet_mutex scope if (response.map_num == XNET_INVALID_MAP_NUM) { xnet_log_error("Server failed to respond on connect request"); - + Arg::StatusVector temp; temp << Arg::Gds(isc_net_connect_err); temp.copyTo(status_vector); @@ -1288,12 +1288,12 @@ static rem_port* connect_client(PACKET* packet, ISC_STATUS* status_vector) raise_lostconn_or_syserror(ERR_STR("OpenEvent")); } - // added this here from the server side as this part is called by the client + // added this here from the server side as this part is called by the client // and the server address need not be valid for the client -smistry 10/29/98 xcc->xcc_recv_channel = &xps->xps_channels[XPS_CHANNEL_S2C_DATA]; xcc->xcc_send_channel = &xps->xps_channels[XPS_CHANNEL_C2S_DATA]; - // we also need to add client side flags or channel pointer as they + // we also need to add client side flags or channel pointer as they // differ from the server side const ULONG avail = @@ -1320,11 +1320,11 @@ static rem_port* connect_client(PACKET* packet, ISC_STATUS* status_vector) return port; } - catch (const Firebird::Exception& ex) + catch (const Firebird::Exception& ex) { stuff_exception(status_vector, ex); - if (xcc) + if (xcc) cleanup_comm(xcc); else if (xpm) cleanup_mapping(xpm); @@ -1386,7 +1386,7 @@ static rem_port* connect_server(ISC_STATUS* status_vector, USHORT flag) ULONG timestamp = (ULONG) time(NULL); XPM xpm = NULL; - try + try { xpm = get_free_slot(&map_num, &slot_num, ×tamp); @@ -1403,7 +1403,7 @@ static rem_port* connect_server(ISC_STATUS* status_vector, USHORT flag) return port; } - catch (const Firebird::Exception& ex) + catch (const Firebird::Exception& ex) { stuff_exception(status_vector, ex); xnet_log_error("Failed to allocate server port for communication", status_vector); @@ -1431,7 +1431,7 @@ static rem_port* connect_server(ISC_STATUS* status_vector, USHORT flag) if (xnet_shutdown) { Arg::StatusVector temp; - temp << Arg::Gds(isc_net_server_shutdown) << Arg::Str("XNET"); + temp << Arg::Gds(isc_net_server_shutdown) << Arg::Str("XNET"); temp.copyTo(status_vector); } @@ -1482,7 +1482,7 @@ static void disconnect(rem_port* port) } gds__unregister_cleanup((FPTR_VOID_PTR)(exit_handler), port); - + cleanup_port(port); } @@ -1597,7 +1597,7 @@ static int send_full( rem_port* port, PACKET * packet) static int send_partial( rem_port* port, PACKET * packet) -{ +{ /************************************** * * s e n d _ p a r t i a l @@ -1786,7 +1786,7 @@ static bool_t xnet_getbytes(XDR * xdrs, SCHAR * buff, u_int count) to_copy = bytecount; else to_copy = xdrs->x_handy; - + if (xdrs->x_handy) { if (to_copy == sizeof(SLONG)) *((SLONG*)buff) = *((SLONG*)xdrs->x_private); @@ -2189,7 +2189,7 @@ static bool make_map(ULONG map_number, *map_address = MapViewOfFile(*map_handle, FILE_MAP_WRITE, 0, 0, XPS_MAPPED_SIZE(global_slots_per_map, global_pages_per_slot)); - if (!(*map_address)) + if (!(*map_address)) Firebird::system_error::raise(ERR_STR("MapViewOfFile")); } catch (const Firebird::Exception&) @@ -2330,7 +2330,7 @@ static bool server_init(ISC_STATUS* status, USHORT flag) Firebird::system_error::raise(ERR_STR("MapViewOfFile")); } } - catch (const Firebird::Exception& ex) + catch (const Firebird::Exception& ex) { stuff_exception(status, ex); xnet_log_error("XNET server initialization failed", status); @@ -2391,7 +2391,7 @@ static XPM get_free_slot(ULONG* map_num, ULONG* slot_num, ULONG* timestamp) // if the mapped file structure has not yet been initialized, // make one now - if (!xpm) + if (!xpm) { free_map = xnet_next_free_map_num++; diff --git a/src/utilities/analyse.cpp b/src/utilities/analyse.cpp index 5832f42526..c45f3fc9fa 100644 --- a/src/utilities/analyse.cpp +++ b/src/utilities/analyse.cpp @@ -100,7 +100,7 @@ void main( int argc, char **argv) bool detail = true; char** end; - for (end = argv + argc, ++argv; argv < end; argv++) + for (end = argv + argc, ++argv; argv < end; argv++) { const char* s = *argv; if (*s++ == '-') @@ -146,7 +146,7 @@ void main( int argc, char **argv) n = get_long(); if (n < MAX_PAGES) ++read_counts[n]; - + if (detail && (page = db_read(n))) analyse(n, "Read", page, ++sequence); reads++; @@ -156,7 +156,7 @@ void main( int argc, char **argv) n = get_long(); if (n < MAX_PAGES) ++write_counts[n]; - + if (detail && (page = db_read(n))) analyse(n, "Write", page, ++sequence); writes++; diff --git a/src/utilities/create_db.cpp b/src/utilities/create_db.cpp index 9d0cca0d42..56ac8e6b49 100644 --- a/src/utilities/create_db.cpp +++ b/src/utilities/create_db.cpp @@ -44,10 +44,10 @@ int main(int argc, char** argv) return -3; } - Firebird::ClumpletWriter dpb(Firebird::ClumpletReader::Tagged, + Firebird::ClumpletWriter dpb(Firebird::ClumpletReader::Tagged, MAX_DPB_SIZE, isc_dpb_version1); dpb.insertByte(isc_dpb_set_db_readonly, TRUE); - isc_attach_database(sv, 0, argv[1], &db, dpb.getBufferLength(), + isc_attach_database(sv, 0, argv[1], &db, dpb.getBufferLength(), reinterpret_cast(dpb.getBuffer())); if (sv[0] == 1 && sv[1] > 0) { diff --git a/src/utilities/fbcpl/ctrlpan.cpp b/src/utilities/fbcpl/ctrlpan.cpp index 3cab39ad8a..21b9e182cb 100644 --- a/src/utilities/fbcpl/ctrlpan.cpp +++ b/src/utilities/fbcpl/ctrlpan.cpp @@ -17,7 +17,7 @@ CControlPanel::~CControlPanel() { } -////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// // Callback function (exported) // static member functions (callbacks) @@ -65,7 +65,7 @@ LONG APIENTRY CControlPanel::CPlApplet(HWND hwndCPl, UINT uMsg, ///////////////////////////////////////////////////////////////////////////////////////// // Default command handlers -LONG CControlPanel::OnDblclk(HWND hwndCPl, UINT uAppNum, LONG lData) +LONG CControlPanel::OnDblclk(HWND hwndCPl, UINT uAppNum, LONG lData) { // Show the dialog return 0; // OK @@ -86,7 +86,7 @@ LONG CControlPanel::OnInit() return 1; // OK } -LONG CControlPanel::OnInquire(UINT uAppNum, NEWCPLINFO* pInfo) +LONG CControlPanel::OnInquire(UINT uAppNum, NEWCPLINFO* pInfo) { // Fill in the data pInfo->dwSize = sizeof(NEWCPLINFO); // important @@ -100,12 +100,12 @@ LONG CControlPanel::OnInquire(UINT uAppNum, NEWCPLINFO* pInfo) return 0; // OK (don't send CPL_INQUIRE msg) } -LONG CControlPanel::OnSelect(UINT uAppNum, LONG lData) +LONG CControlPanel::OnSelect(UINT uAppNum, LONG lData) { return 1; // not handled } -LONG CControlPanel::OnStop(UINT uAppNum, LONG lData) +LONG CControlPanel::OnStop(UINT uAppNum, LONG lData) { return 1; // not handled } diff --git a/src/utilities/fbcpl/fbpanel.cpp b/src/utilities/fbcpl/fbpanel.cpp index 8cd33eb5ed..de9ab2889b 100644 --- a/src/utilities/fbcpl/fbpanel.cpp +++ b/src/utilities/fbcpl/fbpanel.cpp @@ -2,39 +2,39 @@ * PROGRAM: Firebird 2.0 control panel applet * MODULE: fbpanel.cpp * DESCRIPTION: The FBPanel unit does the following things: - * - It manages the display of the icon in the - * Control Panel manager - * - It tests whether Firebird is installed - * - If Fb is installed it sets the status of items + * - It manages the display of the icon in the + * Control Panel manager + * - It tests whether Firebird is installed + * - If Fb is installed it sets the status of items * that can be read from the Firebird registry entries * and launches the Applet. * - * Everything else is handled by the fbdialog unit. This is - * not a good thing as UI stuff is integrated with management - * and diagnostic stuff. A better design for Fb 2.0 would be - * to separate everything out and share the code with the - * existing command line tools that manage services and + * Everything else is handled by the fbdialog unit. This is + * not a good thing as UI stuff is integrated with management + * and diagnostic stuff. A better design for Fb 2.0 would be + * to separate everything out and share the code with the + * existing command line tools that manage services and * installation settings. * - * The contents of this file are subject to the Initial Developer's - * Public License Version 1.0 (the "License"); you may not use this - * file except in compliance with the License. You may obtain a copy + * The contents of this file are subject to the Initial Developer's + * Public License Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy * of the License here: * * http://www.ibphoenix.com?a=ibphoenix&page=ibp_idpl. * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing rights * and limitations under the License. - * + * * The Initial Developer of the Original Code is Paul Reeves. * * The Original Code is (C) 2003 Paul Reeves . * * All Rights Reserved. - * - * Contributor(s): ______________________________________. + * + * Contributor(s): ______________________________________. * */ @@ -47,7 +47,7 @@ #include -LONG CFBPanel::OnInquire(UINT uAppNum, NEWCPLINFO* pInfo) +LONG CFBPanel::OnInquire(UINT uAppNum, NEWCPLINFO* pInfo) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); @@ -75,7 +75,7 @@ LONG CFBPanel::OnDblclk(HWND hwndCPl, UINT uAppNum, LONG lData) try { // Check if Firebird is installed by reading the registry HKEY hkey; - if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, REG_KEY_ROOT_INSTANCES, 0, KEY_QUERY_VALUE, &hkey) + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, REG_KEY_ROOT_INSTANCES, 0, KEY_QUERY_VALUE, &hkey) == ERROR_SUCCESS) { char rootpath[MAX_PATH - 2]; @@ -86,9 +86,9 @@ LONG CFBPanel::OnDblclk(HWND hwndCPl, UINT uAppNum, LONG lData) PathAddBackslash(rootpath); dlg.m_Root_Path = rootpath; } - + RegCloseKey(hkey); - + dlg.m_FB_Version = "not known"; CString afilename = dlg.m_Root_Path + "bin\\gbak.exe"; buffer_size = GetFileVersionInfoSize( const_cast ((LPCTSTR) afilename), 0); @@ -120,9 +120,9 @@ LONG CFBPanel::OnDblclk(HWND hwndCPl, UINT uAppNum, LONG lData) /**/ } delete[] VersionInfo; - + // Show the dialog box - if (dlg.DoModal() != IDOK) + if (dlg.DoModal() != IDOK) return 0; } } @@ -132,6 +132,6 @@ LONG CFBPanel::OnDblclk(HWND hwndCPl, UINT uAppNum, LONG lData) dlg.MessageBox("Firebird does not appear to be installed correctly.", "Installation Error", MB_OK); } return 0; -} - +} + diff --git a/src/utilities/gsec/call_service.cpp b/src/utilities/gsec/call_service.cpp index 85323ec9fe..340936d327 100644 --- a/src/utilities/gsec/call_service.cpp +++ b/src/utilities/gsec/call_service.cpp @@ -32,16 +32,16 @@ const size_t SERVER_PART = 200; const size_t RESULT_BUF_SIZE = 512; /** - + isValidServer - + @brief Validates server name for non-local protocol. - Replaces the original ugly macro. - Now the function that calls isValidServer is responsible - for returning NULL to its invoker in turn. It simply makes - sure there's something in the string containing the server's name; + Replaces the original ugly macro. + Now the function that calls isValidServer is responsible + for returning NULL to its invoker in turn. It simply makes + sure there's something in the string containing the server's name; otherwise it fills the status vector with an error. - + @param status @param server @@ -61,13 +61,13 @@ static bool isValidServer(ISC_STATUS* status, const TEXT* server) /** - + serverSizeValidate - - @brief Validates server name in order to avoid - buffer overflow later. Server name may be NULL + + @brief Validates server name in order to avoid + buffer overflow later. Server name may be NULL in case of local access, we take it into account. - + @param status @param server @@ -94,7 +94,7 @@ static int typeBuffer(ISC_STATUS*, char*, int, internal_user_data&, FPTR_SECURITY_CALLBACK, void*, Firebird::string&); -// all this spb-writing functions should be gone +// all this spb-writing functions should be gone // as soon as we create SvcClumpletWriter inline void stuffSpbByte(char*& spb, char data) @@ -133,12 +133,12 @@ static void stuffSpb2(char*& spb, char param, const TEXT* value) /** - + attachRemoteServiceManager - - @brief Opens connection with service manager + + @brief Opens connection with service manager on server using protocol, login username/password. - + @param status @param username @@ -149,9 +149,9 @@ static void stuffSpb2(char*& spb, char param, const TEXT* value) **/ isc_svc_handle attachRemoteServiceManager(ISC_STATUS* status, const TEXT* username, - const TEXT* password, + const TEXT* password, bool trusted, - int protocol, + int protocol, const TEXT* server) { char service[SERVICE_SIZE]; @@ -195,12 +195,12 @@ isc_svc_handle attachRemoteServiceManager(ISC_STATUS* status, /** - + attachRemoteServiceManager - - @brief Opens connection with service manager on server + + @brief Opens connection with service manager on server with protocol in it's name, login username/password. - + @param status @param username @@ -210,7 +210,7 @@ isc_svc_handle attachRemoteServiceManager(ISC_STATUS* status, **/ isc_svc_handle attachRemoteServiceManager(ISC_STATUS* status, const TEXT* username, - const TEXT* password, + const TEXT* password, bool trusted, const TEXT* server) { @@ -239,28 +239,28 @@ isc_svc_handle attachRemoteServiceManager(ISC_STATUS* status, fb_assert((size_t)(spb - spb_buffer) <= sizeof(spb_buffer)); isc_svc_handle svc_handle = 0; - isc_service_attach(status, + isc_service_attach(status, static_cast(strlen(service)), - service, &svc_handle, - static_cast(spb - spb_buffer), + service, &svc_handle, + static_cast(spb - spb_buffer), spb_buffer); return status[1] ? 0 : svc_handle; } /** - + userInfoToSpb - + @brief Writes data from awful borland's struct internal_user_data to not less awful borland's format of spb. - + @param spb @param userInfo **/ -static void userInfoToSpb(char*& spb, +static void userInfoToSpb(char*& spb, const internal_user_data& userInfo) { stuffSpb2(spb, isc_spb_sec_username, userInfo.user_name); @@ -300,12 +300,12 @@ static void userInfoToSpb(char*& spb, /** - + callRemoteServiceManager - - @brief Calls service manager to execute command, + + @brief Calls service manager to execute command, specified in userInfo - + @param status @param handle @@ -314,8 +314,8 @@ static void userInfoToSpb(char*& spb, @param functionArg **/ -void callRemoteServiceManager(ISC_STATUS* status, - isc_svc_handle handle, +void callRemoteServiceManager(ISC_STATUS* status, + isc_svc_handle handle, const internal_user_data& userInfo, FPTR_SECURITY_CALLBACK outputFunction, void* functionArg) @@ -330,7 +330,7 @@ void callRemoteServiceManager(ISC_STATUS* status, return; } - switch (userInfo.operation) + switch (userInfo.operation) { case ADD_OPER: stuffSpbByte(spb, isc_action_svc_add_user); @@ -365,9 +365,9 @@ void callRemoteServiceManager(ISC_STATUS* status, if (userInfo.database_name_entered) { stuffSpb2(spb, isc_spb_dbname, userInfo.database_name); } - + fb_assert((size_t)(spb - spb_buffer) <= sizeof(spb_buffer)); - isc_service_start(status, &handle, 0, + isc_service_start(status, &handle, 0, static_cast(spb - spb_buffer), spb_buffer); spb = spb_buffer; @@ -380,7 +380,7 @@ void callRemoteServiceManager(ISC_STATUS* status, ISC_STATUS_ARRAY temp_status; ISC_STATUS* local_status = status[1] ? temp_status : status; memset(local_status, 0, sizeof(ISC_STATUS_ARRAY)); - + if (userInfo.operation == DIS_OPER) { const char request[] = {isc_info_svc_get_users}; int startQuery = 0; @@ -390,14 +390,14 @@ void callRemoteServiceManager(ISC_STATUS* status, for (;;) { isc_resv_handle reserved = 0; - isc_service_query(local_status, &handle, &reserved, spb - spb_buffer, - spb_buffer, sizeof(request), request, RESULT_BUF_SIZE - startQuery, + isc_service_query(local_status, &handle, &reserved, spb - spb_buffer, + spb_buffer, sizeof(request), request, RESULT_BUF_SIZE - startQuery, &resultBuffer[startQuery]); if (local_status[1]) { return; } - startQuery = typeBuffer(local_status, resultBuffer, startQuery, uData, + startQuery = typeBuffer(local_status, resultBuffer, startQuery, uData, outputFunction, functionArg, text); if (startQuery < 0) { @@ -415,7 +415,7 @@ void callRemoteServiceManager(ISC_STATUS* status, for (;;) { isc_resv_handle reserved = 0; - isc_service_query(local_status, &handle, &reserved, spb - spb_buffer, + isc_service_query(local_status, &handle, &reserved, spb - spb_buffer, spb_buffer, 1, &request, RESULT_BUF_SIZE, resultBuffer); if (local_status[1]) { @@ -441,7 +441,7 @@ void callRemoteServiceManager(ISC_STATUS* status, text += p; } } - + } if (! text.isEmpty()) @@ -455,24 +455,24 @@ void callRemoteServiceManager(ISC_STATUS* status, /** - + detachRemoteServiceManager - + @brief Close service manager - + @param status @param handle **/ -void detachRemoteServiceManager(ISC_STATUS* status, +void detachRemoteServiceManager(ISC_STATUS* status, isc_svc_handle handle) { isc_service_detach(status, &handle); } -// all this spb-parsing functions should be gone +// all this spb-parsing functions should be gone // as soon as we create SvcClumpletReader static void parseString2(const char*& p, char* buffer, size_t bufSize, size_t& loop) @@ -497,7 +497,7 @@ static void parseString2(const char*& p, char* buffer, size_t bufSize, size_t& l static void parseLong(const char*& p, int& ul, size_t& loop) { ul = isc_vax_integer(p, sizeof(ULONG)); - + const size_t len2 = sizeof(ULONG) + 1; if (len2 > loop) { @@ -510,11 +510,11 @@ static void parseLong(const char*& p, int& ul, size_t& loop) /** - + typeBuffer - + @brief Prints data, returned by service, using outputFunction - + @param status @param buf @@ -568,12 +568,12 @@ static int typeBuffer(ISC_STATUS* status, char* buf, int offset, while (*p != isc_info_end) { fb_assert(p[loop] == isc_info_end); - try + try { switch (*p++) { case isc_spb_sec_username: - if (uData.user_name[0]) + if (uData.user_name[0]) { if (outputFunction) { diff --git a/src/utilities/gsec/gsec.cpp b/src/utilities/gsec/gsec.cpp index 80e47cc9f9..31b682f082 100644 --- a/src/utilities/gsec/gsec.cpp +++ b/src/utilities/gsec/gsec.cpp @@ -157,7 +157,7 @@ int gsec(Firebird::UtilSvc* uSvc) Jrd::SecurityDatabase::getPath(database_name); databaseName = database_name; } - + Firebird::PathName serverName; bool useServices = !uSvc->isService(); switch (ISC_extract_host(databaseName, serverName, true)) @@ -169,25 +169,25 @@ int gsec(Firebird::UtilSvc* uSvc) serverName = "\\\\" + serverName + "\\"; break; } - + if (!useServices) { serverName = ""; } databaseName.copyTo(user_data->database_name, sizeof(user_data->database_name)); - + FB_API_HANDLE db_handle = 0; - if (! useServices) + if (! useServices) { Firebird::ClumpletWriter dpb(Firebird::ClumpletReader::Tagged, MAX_DPB_SIZE, isc_dpb_version1); dpb.insertByte(isc_dpb_gsec_attach, 1); // not 0 - yes, I'm gsec uSvc->getAddressPath(dpb); - if (user_data->dba_trust_user_name_entered) + if (user_data->dba_trust_user_name_entered) { uSvc->checkService(); - dpb.insertString(isc_dpb_trusted_auth, + dpb.insertString(isc_dpb_trusted_auth, user_data->dba_trust_user_name, strlen(user_data->dba_trust_user_name)); if (user_data->trusted_role && !user_data->sql_role_name_entered) { @@ -197,32 +197,32 @@ int gsec(Firebird::UtilSvc* uSvc) else { #ifdef TRUSTED_AUTH - if (user_data->trusted_auth) + if (user_data->trusted_auth) { dpb.insertTag(isc_dpb_trusted_auth); } #endif - if (user_data->dba_user_name_entered) + if (user_data->dba_user_name_entered) { - dpb.insertString(isc_dpb_user_name, + dpb.insertString(isc_dpb_user_name, user_data->dba_user_name, strlen(user_data->dba_user_name)); } - if (user_data->dba_password_entered) + if (user_data->dba_password_entered) { - dpb.insertString(tdsec->utilSvc->isService() ? - isc_dpb_password_enc : isc_dpb_password, + dpb.insertString(tdsec->utilSvc->isService() ? + isc_dpb_password_enc : isc_dpb_password, user_data->dba_password, strlen(user_data->dba_password)); } } if (user_data->sql_role_name_entered) { - dpb.insertString(isc_dpb_sql_role_name, + dpb.insertString(isc_dpb_sql_role_name, user_data->sql_role_name, strlen(user_data->sql_role_name)); } - if (isc_attach_database(status, 0, databaseName.c_str(), &db_handle, - dpb.getBufferLength(), + if (isc_attach_database(status, 0, databaseName.c_str(), &db_handle, + dpb.getBufferLength(), reinterpret_cast(dpb.getBuffer()))) { GSEC_error_redirect(status, GsecMsg15); @@ -265,9 +265,9 @@ int gsec(Firebird::UtilSvc* uSvc) uSvc->started(); if (! useServices) { - ret = SECURITY_exec_line(status, db_handle, + ret = SECURITY_exec_line(status, db_handle, user_data, data_print, NULL); - if (ret) + if (ret) { GSEC_print(ret, user_data->user_name); if (status[1]) @@ -304,7 +304,7 @@ int gsec(Firebird::UtilSvc* uSvc) ret = 0; break; } - if (user_data->dba_user_name_entered || + if (user_data->dba_user_name_entered || user_data->dba_password_entered || user_data->database_name_entered #ifdef TRUSTED_AUTH @@ -1081,7 +1081,7 @@ static SSHORT parse_cmd_line(Firebird::UtilSvc::ArgvType& argv, tsec* tdsec) * * Functional description * Read the command line - * returns 0 on normal completion, + * returns 0 on normal completion, * 1 if user chooses to quit * -1 on error or if user asks for help * @@ -1134,13 +1134,13 @@ void GSEC_print_status(const ISC_STATUS* status_vector, bool exitOnError) * to allow redirecting output. * **************************************/ - if (status_vector) + if (status_vector) { const ISC_STATUS* vector = status_vector; tsec* tdsec = tsec::getSpecific(); SCHAR s[1024]; - while (fb_interpret(s, sizeof(s), &vector)) + while (fb_interpret(s, sizeof(s), &vector)) { const char* nl = (s[0] ? s[strlen(s) - 1] != '\n' : true) ? "\n" : ""; util_output("%s%s", s, nl); @@ -1168,7 +1168,7 @@ static void util_output(const SCHAR* format, ...) { Firebird::string buf; buf.vprintf(format, arglist); - + tdsec->utilSvc->output(buf.c_str()); } va_end(arglist); diff --git a/src/utilities/gstat/ppg.cpp b/src/utilities/gstat/ppg.cpp index deec26f55e..770e0d50d9 100644 --- a/src/utilities/gstat/ppg.cpp +++ b/src/utilities/gstat/ppg.cpp @@ -40,7 +40,7 @@ // gstat directly reads database files, therefore using namespace Ods; -void PPG_print_header(const header_page* header, SLONG page, +void PPG_print_header(const header_page* header, SLONG page, bool nocreation, Firebird::UtilSvc* uSvc) { /************************************** diff --git a/src/utilities/guard/guard.cpp b/src/utilities/guard/guard.cpp index 4f0ec18ef2..a595d4d2c5 100644 --- a/src/utilities/guard/guard.cpp +++ b/src/utilities/guard/guard.cpp @@ -131,7 +131,7 @@ int CLIB_ROUTINE main( int argc, char **argv) Firebird::string user_name; /* holds the user name */ ISC_get_user(&user_name, NULL, NULL, NULL); - if (user_name != INTERBASE_USER && + if (user_name != INTERBASE_USER && user_name != "root" && user_name != FIREBIRD_USER && user_name != INTERBASE_USER_SHORT) @@ -214,7 +214,7 @@ int CLIB_ROUTINE main( int argc, char **argv) UTIL_ex_unlock(fd_guard); exit(-4); } - + if (pidfilename) { FILE *pf = fopen(pidfilename, "w"); if (pf) @@ -290,7 +290,7 @@ int CLIB_ROUTINE main( int argc, char **argv) else { /* Normal shutdown - don't restart the server */ gds__log("%s: %s normal shutdown.\n", - prog_name, process_name); + prog_name, process_name); done = true; } } while (!done); diff --git a/src/utilities/guard/util.cpp b/src/utilities/guard/util.cpp index 44c51c3abd..5a8e3ed448 100644 --- a/src/utilities/guard/util.cpp +++ b/src/utilities/guard/util.cpp @@ -75,15 +75,15 @@ pid_t UTIL_start_process(const char* process, const char* process2, char** argv, ************************************** * * Functional description - * - * This function is used to create the specified process, + * + * This function is used to create the specified process, * * Returns Codes: * -1 Process spawn failed. - * pid Successful creation. PID is returned. - * - * Note: Make sure that the argument list ends with a null - * and the first argument is large enough to hold the complete + * pid Successful creation. PID is returned. + * + * Note: Make sure that the argument list ends with a null + * and the first argument is large enough to hold the complete * expanded process name. (MAXPATHLEN recommended) * **************************************/ @@ -137,7 +137,7 @@ int UTIL_wait_for_child(pid_t child_pid, const volatile sig_atomic_t& shutting_d ************************************** * * Functional description - * + * * This function is used to wait for the child specified by child_pid * * Return code: @@ -200,7 +200,7 @@ int UTIL_shutdown_child(pid_t child_pid, ************************************** * * Functional description - * + * * Terminates child using TERM signal, then KILL if it does not finish * within specified timeout * @@ -253,12 +253,12 @@ int UTIL_ex_lock(const TEXT* file) { /************************************** * - * U T I L _ e x _ l o c k + * U T I L _ e x _ l o c k * ************************************** * * Functional description - * + * * This function is used to exclusively lock a file. * * Return Codes: @@ -307,12 +307,12 @@ void UTIL_ex_unlock( int fd_file) { /************************************** * - * U T I L _ e x _ l o c k + * U T I L _ e x _ l o c k * ************************************** * * Functional description - * + * * This function is used to unlock the exclusive file. * **************************************/ @@ -339,12 +339,12 @@ int UTIL_set_handler(int sig, void (*handler) (int), bool restart) { /************************************** * - * U T I L _ s e t _ h a n d l e r + * U T I L _ s e t _ h a n d l e r * ************************************** * * Functional description - * + * * This function sets signal handler * **************************************/ diff --git a/src/utilities/ibmgr/ibmgr.cpp b/src/utilities/ibmgr/ibmgr.cpp index 08ee30c691..f1cf683a0d 100644 --- a/src/utilities/ibmgr/ibmgr.cpp +++ b/src/utilities/ibmgr/ibmgr.cpp @@ -155,7 +155,7 @@ int CLIB_ROUTINE main( int argc, char **argv) /* Shutdown is not in progress and we are not attached to service yet. - But obviously we will need attachment. + But obviously we will need attachment. */ ibmgr_data.shutdown = false; ibmgr_data.attached = 0; @@ -201,7 +201,7 @@ int CLIB_ROUTINE main( int argc, char **argv) int local_argc; SCHAR* local_argv[MAXARGS]; TEXT stuff[MAXSTUFF]; - + for (;;) { if (get_line(&local_argc, local_argv, stuff)) break; @@ -390,7 +390,7 @@ static SSHORT get_switches( pf.copyTo(ibmgr_data->pidfile, sizeof(ibmgr_data->pidfile)); break; } - + case IN_SW_IBMGR_0: SRVRMGR_msg_get(MSG_INVPAR, msg); fprintf(OUTFILE, "%s\n", msg); @@ -529,7 +529,7 @@ static SSHORT get_switches( case IN_SW_IBMGR_HOST: /* The above switches are separate case: they can be - used as operation or parameter switches. If an + used as operation or parameter switches. If an operation has already been specified, we assume it is a switch else we set an implied operation type OP_SET. @@ -592,7 +592,7 @@ static SSHORT get_switches( case IN_SW_IBMGR_IGNORE: case IN_SW_IBMGR_POOL: - /* These switches are operation modifiers or + /* These switches are operation modifiers or suboperations. Each of them makes sense only in a contex of certain operation. So, let's make sure it is a right contex. @@ -622,7 +622,7 @@ static SSHORT get_switches( err_msg_no = MSG_INVSWOP; break; } - + switch (in_sw) { case IN_SW_IBMGR_ONCE: @@ -645,7 +645,7 @@ static SSHORT get_switches( err_msg_no = MSG_INVSWOP; break; } - + switch (in_sw) { case IN_SW_IBMGR_NOW: @@ -681,7 +681,7 @@ static SSHORT get_switches( case IN_SW_IBMGR_Z: /* This is also a separate case - it could be - operation switch or just switch. Also, + operation switch or just switch. Also, does not matter how many times version switch was specified, we output version only once */ @@ -713,7 +713,7 @@ static SSHORT get_switches( } break; } - + default: #ifdef DEV_BUILD fprintf(OUTFILE, "ASSERT: file %s line %"LINEFORMAT": in_sw = %d\n", @@ -839,7 +839,7 @@ static SSHORT parse_cmd_line( int argc, TEXT** argv, bool zapPasswd) * * returns: * - * FB_SUCCESS on normal completion, + * FB_SUCCESS on normal completion, * ACT_QUIT if user chooses to quit * ACT_PROMT used by main() to switch into * the prompt mode diff --git a/src/utilities/ibmgr/srvrmgr.cpp b/src/utilities/ibmgr/srvrmgr.cpp index 03419984e7..133b5fc39c 100644 --- a/src/utilities/ibmgr/srvrmgr.cpp +++ b/src/utilities/ibmgr/srvrmgr.cpp @@ -105,7 +105,7 @@ USHORT SRVRMGR_exec_line(ibmgr_data_t* data) /* If reattach is true and we currently attached, then we will detach from service. This is potentially dangerous - situation, because if shutdown is true (server shutdown + situation, because if shutdown is true (server shutdown was initiated) server will be shutdowned. I do not check the shutdown flag here because reattach could be true only if shutdown has not been initiated. @@ -203,7 +203,7 @@ void SRVRMGR_msg_get( USHORT number, TEXT * msg) */ const char* rs = 0; - + switch (number) { case MSG_PROMPT: rs = "FBMGR>"; @@ -298,7 +298,7 @@ void SRVRMGR_msg_get( USHORT number, TEXT * msg) default: rs = "can not get an error message"; } - + strcpy(msg, rs); } @@ -477,7 +477,7 @@ static bool start_server( ibmgr_data_t* data) */ TEXT path[MAXPATHLEN]; gds__prefix(path, SERVER_GUARDIAN); - + // CVC: Newer compilers won't accept assigning literal strings to non-const // char pointers, so this code prevents changing argv's type to const TEXT* argv[4] // that may not be accepted by execv(). @@ -557,11 +557,11 @@ static bool start_server( ibmgr_data_t* data) || WIFSIGNALED(exit_status))) { printf("Guardian process %ld terminated with code %ld\n", - pid, WEXITSTATUS(exit_status)); + pid, WEXITSTATUS(exit_status)); break; } -#else +#else if (ret_value == pid) { diff --git a/src/utilities/install/install.cpp b/src/utilities/install/install.cpp index 72f52d893b..e9cc24500f 100644 --- a/src/utilities/install/install.cpp +++ b/src/utilities/install/install.cpp @@ -3,25 +3,25 @@ * MODULE: install.cpp * DESCRIPTION: Functions which help installing components to WinSysDir * - * The contents of this file are subject to the Initial Developer's - * Public License Version 1.0 (the "License"); you may not use this - * file except in compliance with the License. You may obtain a copy + * The contents of this file are subject to the Initial Developer's + * Public License Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy * of the License here: * * http://www.ibphoenix.com?a=ibphoenix&page=ibp_idpl. * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing rights * and limitations under the License. * * The Original Code is (C) 2003 Olivier Mascia. - * + * * The Initial Developer of the Original Code is Olivier Mascia. * * All Rights Reserved. - * - * Contributor(s): ______________________________________. + * + * Contributor(s): ______________________________________. * */ @@ -71,18 +71,18 @@ USHORT CLIENT_install(const TEXT * rootdir, USHORT client, bool sw_force, * Depending on the USHORT client parameter, installs FBCLIENT.DLL or * GDS32.DLL in the Windows System directory. * - * When installing and -force is NOT used then - * + * When installing and -force is NOT used then + * * test for existence of client library * if earlier version then copy, increment shared library count * if same version then do nothing * if later version then do nothing * * If -force is supplied then - * + * * test for existence of client library * if the version doesn't match then copy, increment shared library count - * else do nothing + * else do nothing * **************************************/ @@ -121,16 +121,16 @@ USHORT CLIENT_install(const TEXT * rootdir, USHORT client, bool sw_force, status = GetVersion(target, targetverMS, targetverLS, err_handler); if (client == CLIENT_GDS) { - //Our patching logic is to only change the Major.minor version + //Our patching logic is to only change the Major.minor version //number from A.B to 6.3. This leaves the release.build number //intact. Ie, after patching v1.5.3.3106 it will return v6.3.3.3106 //This means that when considering whether to install our new patched //version our initial comparison of (newverMS =targetverMS) will always - //be true. So, we are left with comparing targetverLS against newverLS. - //However, a gds32 installed from 1.5.3 is going to leave us with - //a point release greater than the point release in v2.0.0 so our - //comparison will fail and the new library will not be copied. To - //avoind this we must mask out the point release and just work + //be true. So, we are left with comparing targetverLS against newverLS. + //However, a gds32 installed from 1.5.3 is going to leave us with + //a point release greater than the point release in v2.0.0 so our + //comparison will fail and the new library will not be copied. To + //avoind this we must mask out the point release and just work //on the build number when comparing the gds32 version. // //This solution will be fine as long as we don't reset the build number @@ -164,7 +164,7 @@ USHORT CLIENT_install(const TEXT * rootdir, USHORT client, bool sw_force, lstrcpy(workfile, sysdir); lstrcat(workfile, "\\_"); lstrcat(workfile, FBCLIENT_NAME); - + if (CopyFile(fbdll, workfile, FALSE) == 0) { return (*err_handler) (GetLastError(), @@ -189,7 +189,7 @@ USHORT CLIENT_install(const TEXT * rootdir, USHORT client, bool sw_force, DeleteFile(workfile); return (*err_handler) (werr, "MoveFile(_FBCLIENT.DLL, 'target')"); } - + // Failed moving because a destination target file already exists // Let's try again by attempting a remove of the destination if (DeleteFile(target) != 0) @@ -202,7 +202,7 @@ USHORT CLIENT_install(const TEXT * rootdir, USHORT client, bool sw_force, return FB_SUCCESS; } } - + // Deleting the target failed OR moving after target delete failed. // Let's try once more using reboot-time update. HMODULE kernel32 = LoadLibrary("KERNEL32.DLL"); @@ -231,7 +231,7 @@ USHORT CLIENT_install(const TEXT * rootdir, USHORT client, bool sw_force, DeleteFile(workfile); return (*err_handler) (werr, "MoveFileEx(replace 'target')"); } - + FreeLibrary(kernel32); IncrementSharedCount(target, err_handler); return FB_INSTALL_COPY_REQUIRES_REBOOT; @@ -252,7 +252,7 @@ USHORT CLIENT_install(const TEXT * rootdir, USHORT client, bool sw_force, lstrcpy(sworkfile, ssysdir); lstrcat(sworkfile, "\\_"); lstrcat(sworkfile, FBCLIENT_NAME); - + TEXT starget[MAXPATHLEN]; lstrcpy(starget, ssysdir); lstrcat(starget, "\\"); @@ -297,12 +297,12 @@ USHORT CLIENT_remove(const TEXT * rootdir, USHORT client, bool sw_force, * from the Windows System directory. * * when removing and -force is NOT used - * + * * test for existence of client library * if version matches then decrement shared library count - * if count=0 then delete library, remove entry from shared library + * if count=0 then delete library, remove entry from shared library * if version doesn't match then do nothing. It is not ours. - * + * * when removing and -force IS used * * test for existence of client library @@ -440,7 +440,7 @@ USHORT GetVersion(const TEXT* filename, DWORD& verMS, DWORD& verLS, // We'll keep hfile opened until we have read version so that the file // can't be deleted between check for existence and version read. - + DWORD dwUnused; DWORD rsize = GetFileVersionInfoSize(const_cast(filename), &dwUnused); if (rsize == 0) @@ -548,7 +548,7 @@ USHORT PatchVersion(const TEXT* filename, DWORD verMS, } else i = 0; } - + if (p >= end) { UnmapViewOfFile(mem); @@ -571,14 +571,14 @@ USHORT PatchVersion(const TEXT* filename, DWORD verMS, printf("ProductVersionMS : %8.8x\n", ffi->dwProductVersionMS); printf("ProductVersionLS : %8.8x\n", ffi->dwProductVersionLS); */ - + /* // The start of the full VS_VERSIONINFO pseudo structure is located 6 bytes // before the above "lookup" value. This "vi" (versioninfo) pointer points // to the same block of bytes that would have been returned by the // GetFileVersionInfo API. BYTE* vi = p - sizeof(lookup) - 6; - + // The first WORD of this pseudo structure is its byte length WORD viLength = *(WORD*)vi; @@ -612,7 +612,7 @@ USHORT PatchVersion(const TEXT* filename, DWORD verMS, else i = 0; } */ - + /* // Let's patch the ProductVersion strings. // This patch assumes the original version string has a major version and @@ -644,7 +644,7 @@ USHORT PatchVersion(const TEXT* filename, DWORD verMS, else i = 0; } */ - + UnmapViewOfFile(mem); CloseHandle(hmap); CloseHandle(hfile); diff --git a/src/utilities/install/install_client.cpp b/src/utilities/install/install_client.cpp index 34fe13103b..9a98276ee9 100644 --- a/src/utilities/install/install_client.cpp +++ b/src/utilities/install/install_client.cpp @@ -3,25 +3,25 @@ * MODULE: install_client.cpp * DESCRIPTION: Program which install the FBCLIENT.DLL or GDS32.DLL * - * The contents of this file are subject to the Initial Developer's - * Public License Version 1.0 (the "License"); you may not use this - * file except in compliance with the License. You may obtain a copy + * The contents of this file are subject to the Initial Developer's + * Public License Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy * of the License here: * * http://www.ibphoenix.com?a=ibphoenix&page=ibp_idpl. * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing rights * and limitations under the License. * * The Original Code is (C) 2003 Olivier Mascia. - * + * * The Initial Developer of the Original Code is Olivier Mascia. * * All Rights Reserved. - * - * Contributor(s): ______________________________________. + * + * Contributor(s): ______________________________________. * */ @@ -176,7 +176,7 @@ int CLIB_ROUTINE main( int argc, char **argv) USHORT status; switch (sw_command) { - + case COMMAND_INSTALL: status = CLIENT_install(directory, sw_client, sw_force, inst_error); switch (status) diff --git a/src/utilities/install/install_reg.cpp b/src/utilities/install/install_reg.cpp index b33b504b56..0f3483afd7 100644 --- a/src/utilities/install/install_reg.cpp +++ b/src/utilities/install/install_reg.cpp @@ -40,8 +40,8 @@ static const struct USHORT code; } commands[] = { - {"INSTALL", 1, COMMAND_INSTALL}, - {"REMOVE", 1, COMMAND_REMOVE}, + {"INSTALL", 1, COMMAND_INSTALL}, + {"REMOVE", 1, COMMAND_REMOVE}, {NULL, 0, 0} }; diff --git a/src/utilities/install/install_svc.cpp b/src/utilities/install/install_svc.cpp index 8caa2097fa..0ac85e0a4a 100644 --- a/src/utilities/install/install_svc.cpp +++ b/src/utilities/install/install_svc.cpp @@ -178,7 +178,7 @@ int CLIB_ROUTINE main( int argc, char **argv) case 'C': sw_arch = ARCH_CS; break; - + case 'M': sw_arch = ARCH_SCS; break; @@ -245,7 +245,7 @@ int CLIB_ROUTINE main( int argc, char **argv) full_username[sizeof(full_username) - 1] = '\0'; CharToOem(full_username, oem_username); - + username = full_username; if (password == 0) @@ -253,12 +253,12 @@ int CLIB_ROUTINE main( int argc, char **argv) printf("Enter %s user password : ", oem_username); p = keyb_password; const TEXT* const pass_end = p + sizeof(keyb_password) - 1; // keep room for '\0' - + while (p < pass_end && (*p++ = getch()) != '\r') putch('*'); // Win32 only - + *(p - 1) = '\0'; // Cuts at '\r' - + printf("\n"); OemToChar(keyb_password, keyb_password); password = keyb_password; @@ -560,7 +560,7 @@ static USHORT svc_query_ex(SC_HANDLE manager) ********************************************** * * Functional description - * Report (print) the status and configuration + * Report (print) the status and configuration * of all installed Firebird services. * If none are installed return FB_FAILURE * so as to allow a call to svc_query for the @@ -575,9 +575,9 @@ static USHORT svc_query_ex(SC_HANDLE manager) DWORD pcbBytesNeeded = 0; USHORT rc = FB_FAILURE; - EnumServicesStatus(manager, SERVICE_WIN32, SERVICE_STATE_ALL, NULL, 0, + EnumServicesStatus(manager, SERVICE_WIN32, SERVICE_STATE_ALL, NULL, 0, &pcbBytesNeeded, &lpServicesReturned, &lpResumeHandle); - + if ( GetLastError() == ERROR_MORE_DATA ) { const DWORD dwBytes = pcbBytesNeeded + sizeof(ENUM_SERVICE_STATUS); @@ -597,15 +597,15 @@ static USHORT svc_query_ex(SC_HANDLE manager) serverServiceName = service_data[i].lpServiceName; if ( serverServiceName.substr(0, 8) == "Firebird" ) { - svc_query(service_data[i].lpServiceName, + svc_query(service_data[i].lpServiceName, service_data[i].lpDisplayName, manager); firebirdServicesInstalled = true; } } - + delete[] service_data; - + if ( firebirdServicesInstalled ) rc = FB_SUCCESS; else diff --git a/src/utilities/install/services.cpp b/src/utilities/install/services.cpp index 6f3ef2383d..f252919f15 100644 --- a/src/utilities/install/services.cpp +++ b/src/utilities/install/services.cpp @@ -64,7 +64,7 @@ USHORT SERVICES_install(SC_HANDLE manager, char exe_name[MAX_PATH]; int len = strlen(directory); const char last_char = len ? directory[len - 1] : '\\'; - const char* exe_format = + const char* exe_format = (last_char == '\\' || last_char == '/') ? "%s%s.exe" : "%s\\%s.exe"; len = snprintf(exe_name, sizeof(exe_name), exe_format, directory, executable); @@ -76,7 +76,7 @@ USHORT SERVICES_install(SC_HANDLE manager, const char* path_format = (strchr(exe_name, ' ') ? "\"%s\"" : "%s"); sprintf(path_name, path_format, exe_name); - if (switches) + if (switches) { len = sizeof(path_name) - strlen(path_name) - 1; if (len < strlen(switches) + 1) { @@ -117,7 +117,7 @@ USHORT SERVICES_install(SC_HANDLE manager, return (*err_handler) (errnum, "CreateService", NULL); } - // Now enter the description string and failure actions into the service + // Now enter the description string and failure actions into the service // config, if this is available on the current platform. HMODULE advapi32 = LoadLibrary("ADVAPI32.DLL"); if (advapi32 != 0) @@ -206,7 +206,7 @@ USHORT SERVICES_remove(SC_HANDLE manager, if (GetLastError() == ERROR_SERVICE_DOES_NOT_EXIST) break; } - else + else CloseServiceHandle(service); Sleep(100); // A small nap is always good for health :) @@ -235,7 +235,7 @@ USHORT SERVICES_start(SC_HANDLE manager, const SC_HANDLE service = OpenService(manager, service_name, SERVICE_START | SERVICE_QUERY_STATUS); - + if (service == NULL) return (*err_handler) (GetLastError(), "OpenService", NULL); @@ -301,7 +301,7 @@ USHORT SERVICES_stop(SC_HANDLE manager, const SC_HANDLE service = OpenService(manager, service_name, SERVICE_STOP | SERVICE_QUERY_STATUS); - + if (service == NULL) return (*err_handler) (GetLastError(), "OpenService", NULL); diff --git a/src/utilities/nbackup.cpp b/src/utilities/nbackup.cpp index 02af519434..d697c1e97f 100644 --- a/src/utilities/nbackup.cpp +++ b/src/utilities/nbackup.cpp @@ -26,7 +26,7 @@ * Adriano dos Santos Fernandes * */ - + #include "firebird.h" @@ -79,12 +79,12 @@ void usage(UtilSvc* uSvc, const char* message, ...) va_start(params, message); msg.vprintf(message, params); va_end(params); - + if (uSvc->isService()) (Arg::Gds(isc_random) << msg).raise(); fprintf(stderr, "ERROR: %s.\n\n", msg.c_str()); - fprintf(stderr, + fprintf(stderr, "Physical Backup Manager Copyright (C) 2004 Firebird development team\n" " Original idea is of Sean Leyne \n" " Designed and implemented by Nickolay Samofatov \n" @@ -109,17 +109,17 @@ void usage(UtilSvc* uSvc, const char* message, ...) exit(FINI_ERROR); } -void missing_parameter_for_switch(UtilSvc* uSvc, const char* sw) +void missing_parameter_for_switch(UtilSvc* uSvc, const char* sw) { usage(uSvc, "Missing parameter for switch %s", sw); -} +} void singleAction(UtilSvc* uSvc) { usage(uSvc, "Only one of -L, -N, -F, -B or -R should be specified"); } -namespace +namespace { const int MSG_LEN = 1024; const size_t NBACKUP_FAILURE_SPACE = MSG_LEN * 4; @@ -200,11 +200,11 @@ struct inc_header class NBackup { public: - NBackup(UtilSvc* _uSvc, const PathName& _database, const string& _username, + NBackup(UtilSvc* _uSvc, const PathName& _database, const string& _username, const string& _password, bool _run_db_triggers, const string& _trustedUser, bool _trustedRole) - : uSvc(_uSvc), newdb(0), trans(0), database(_database), - username(_username), password(_password), trustedUser(_trustedUser), + : uSvc(_uSvc), newdb(0), trans(0), database(_database), + username(_username), password(_password), trustedUser(_trustedUser), run_db_triggers(_run_db_triggers), trustedRole(_trustedRole), dbase(0), backup(0), db_size_pages(0) { @@ -246,8 +246,8 @@ private: ULONG db_size_pages; // In pages // IO functions - size_t read_file(FILE_HANDLE &file, void *buffer, size_t bufsize); - void write_file(FILE_HANDLE &file, void *buffer, size_t bufsize); + size_t read_file(FILE_HANDLE &file, void *buffer, size_t bufsize); + void write_file(FILE_HANDLE &file, void *buffer, size_t bufsize); void seek_file(FILE_HANDLE &file, SINT64 pos); void pr_error(const ISC_STATUS* status, const char* operation) const; @@ -274,7 +274,7 @@ size_t NBackup::read_file(FILE_HANDLE &file, void *buffer, size_t bufsize) #ifdef WIN_NT DWORD bytesDone; if (!ReadFile(file, buffer, bufsize, &bytesDone, NULL)) - b_error::raise(uSvc, "IO error (%d) reading file: %s", + b_error::raise(uSvc, "IO error (%d) reading file: %s", GetLastError(), &file == &dbase ? dbname.c_str() : &file == &backup ? bakname.c_str() : "unknown"); @@ -282,7 +282,7 @@ size_t NBackup::read_file(FILE_HANDLE &file, void *buffer, size_t bufsize) #else const ssize_t res = read(file, buffer, bufsize); if (res < 0) - b_error::raise(uSvc, "IO error (%d) reading file: %s", + b_error::raise(uSvc, "IO error (%d) reading file: %s", errno, &file == &dbase ? dbname.c_str() : &file == &backup ? bakname.c_str() : "unknown"); @@ -297,14 +297,14 @@ void NBackup::write_file(FILE_HANDLE &file, void *buffer, size_t bufsize) if (!WriteFile(file, buffer, bufsize, &bytesDone, NULL) || bytesDone != bufsize) { - b_error::raise(uSvc, "IO error (%d) writing file: %s", + b_error::raise(uSvc, "IO error (%d) writing file: %s", GetLastError(), &file == &dbase ? dbname.c_str() : &file == &backup ? bakname.c_str() : "unknown"); } #else if (write(file, buffer, bufsize) != (ssize_t)bufsize) - b_error::raise(uSvc, "IO error (%d) writing file: %s", + b_error::raise(uSvc, "IO error (%d) writing file: %s", errno, &file == &dbase ? dbname.c_str() : &file == &backup ? bakname.c_str() : "unknown"); @@ -317,18 +317,18 @@ void NBackup::seek_file(FILE_HANDLE &file, SINT64 pos) LARGE_INTEGER offset; offset.QuadPart = pos; DWORD error; - if (SetFilePointer(dbase, offset.LowPart, &offset.HighPart, + if (SetFilePointer(dbase, offset.LowPart, &offset.HighPart, FILE_BEGIN) == INVALID_SET_FILE_POINTER && (error = GetLastError()) != NO_ERROR) { - b_error::raise(uSvc, "IO error (%d) seeking file: %s", + b_error::raise(uSvc, "IO error (%d) seeking file: %s", error, &file == &dbase ? dbname.c_str() : &file == &backup ? bakname.c_str() : "unknown"); } #else if (lseek(file, pos, SEEK_SET) == (off_t) - 1) - b_error::raise(uSvc, "IO error (%d) seeking file: %s", + b_error::raise(uSvc, "IO error (%d) seeking file: %s", errno, &file == &dbase ? dbname.c_str() : &file == &backup ? bakname.c_str() : "unknown"); @@ -338,15 +338,15 @@ void NBackup::seek_file(FILE_HANDLE &file, SINT64 pos) void NBackup::open_database_write() { #ifdef WIN_NT - dbase = CreateFile(dbname.c_str(), GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, + dbase = CreateFile(dbname.c_str(), GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (dbase == INVALID_HANDLE_VALUE) b_error::raise(uSvc, "Error (%d) opening database file: %s", GetLastError(), dbname.c_str()); #else dbase = open(dbname.c_str(), O_RDWR | O_LARGEFILE); if (dbase < 0) - b_error::raise(uSvc, "Error (%d) opening database file: %s", errno, dbname.c_str()); + b_error::raise(uSvc, "Error (%d) opening database file: %s", errno, dbname.c_str()); #endif } @@ -355,13 +355,13 @@ void NBackup::open_database_scan() #ifdef WIN_NT // On Windows we use unbuffered IO to work around bug in Windows Server 2003 // which has little problems with managing size of disk cache. If you read - // very large file (5 GB or more) on this platform filesystem page cache + // very large file (5 GB or more) on this platform filesystem page cache // consumes all RAM of machine and causes excessive paging of user programs // and OS itself. Basically, reading any large file brings the whole system // down for extended period of time. Documented workaround is to avoid using // system cache when reading large files. dbase = CreateFile(dbname.c_str(), - GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, + GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN | FILE_FLAG_NO_BUFFERING, NULL); if (dbase == INVALID_HANDLE_VALUE) @@ -369,21 +369,21 @@ void NBackup::open_database_scan() #else dbase = open(dbname.c_str(), O_RDONLY | O_LARGEFILE); if (dbase < 0) - b_error::raise(uSvc, "Error (%d) opening database file: %s", errno, dbname.c_str()); + b_error::raise(uSvc, "Error (%d) opening database file: %s", errno, dbname.c_str()); #endif } void NBackup::create_database() { #ifdef WIN_NT - dbase = CreateFile(dbname.c_str(), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_DELETE, + dbase = CreateFile(dbname.c_str(), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_DELETE, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL); if (dbase == INVALID_HANDLE_VALUE) b_error::raise(uSvc, "Error (%d) creating database file: %s", GetLastError(), dbname.c_str()); #else dbase = open(dbname.c_str(), O_RDWR | O_CREAT | O_EXCL | O_LARGEFILE, 0660); if (dbase < 0) - b_error::raise(uSvc, "Error (%d) creating database file: %s", errno, dbname.c_str()); + b_error::raise(uSvc, "Error (%d) creating database file: %s", errno, dbname.c_str()); #endif } @@ -399,14 +399,14 @@ void NBackup::close_database() void NBackup::open_backup_scan() { #ifdef WIN_NT - backup = CreateFile(bakname.c_str(), GENERIC_READ, 0, + backup = CreateFile(bakname.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL); if (backup == INVALID_HANDLE_VALUE) b_error::raise(uSvc, "Error (%d) opening backup file: %s", GetLastError(), bakname.c_str()); #else backup = open(bakname.c_str(), O_RDONLY | O_LARGEFILE); if (backup < 0) - b_error::raise(uSvc, "Error (%d) opening backup file: %s", errno, bakname.c_str()); + b_error::raise(uSvc, "Error (%d) opening backup file: %s", errno, bakname.c_str()); #endif } @@ -416,8 +416,8 @@ void NBackup::create_backup() if (bakname == "stdout") { backup = GetStdHandle(STD_OUTPUT_HANDLE); } - else { - backup = CreateFile(bakname.c_str(), GENERIC_WRITE, FILE_SHARE_DELETE, + else { + backup = CreateFile(bakname.c_str(), GENERIC_WRITE, FILE_SHARE_DELETE, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL); } if (backup == INVALID_HANDLE_VALUE) @@ -452,11 +452,11 @@ void NBackup::fixup_database() if (read_file(dbase, &header, sizeof(header)) != sizeof(header)) b_error::raise(uSvc, "Unexpected end of database file", errno); const int backup_state = header.hdr_flags & Ods::hdr_backup_mask; - if (backup_state != Jrd::nbak_state_stalled) + if (backup_state != Jrd::nbak_state_stalled) b_error::raise(uSvc, "Database is not in state (%d) to be safely fixed up", backup_state); header.hdr_flags = (header.hdr_flags & ~Ods::hdr_backup_mask) | Jrd::nbak_state_normal; seek_file(dbase, 0); - write_file(dbase, &header, sizeof(header)); + write_file(dbase, &header, sizeof(header)); close_database(); } @@ -509,7 +509,7 @@ void NBackup::attach_database() if (!run_db_triggers) dpb.insertByte(isc_dpb_no_db_triggers, 1); - if (isc_attach_database(status, 0, database.c_str(), &newdb, + if (isc_attach_database(status, 0, database.c_str(), &newdb, dpb.getBufferLength(), reinterpret_cast(dpb.getBuffer()))) { pr_error(status, "attach database"); @@ -530,7 +530,7 @@ void NBackup::internal_lock_database() { if (isc_start_transaction(status, &trans, 1, &newdb, 0, NULL)) pr_error(status, "start transaction"); - if (isc_dsql_execute_immediate(status, &newdb, &trans, 0, + if (isc_dsql_execute_immediate(status, &newdb, &trans, 0, "ALTER DATABASE BEGIN BACKUP", 1, NULL)) pr_error(status, "begin backup"); if (isc_commit_transaction(status, &trans)) @@ -557,7 +557,7 @@ void NBackup::internal_unlock_database() { if (isc_start_transaction(status, &trans, 1, &newdb, 0, NULL)) pr_error(status, "start transaction"); - if (isc_dsql_execute_immediate(status, &newdb, &trans, 0, + if (isc_dsql_execute_immediate(status, &newdb, &trans, 0, "ALTER DATABASE END BACKUP", 1, NULL)) pr_error(status, "end backup"); if (isc_commit_transaction(status, &trans)) @@ -576,9 +576,9 @@ void NBackup::lock_database(bool get_size) if (db_size_pages && (!uSvc->isService())) printf("%d\n", db_size_pages); } - } + } catch (const Exception&) { - detach_database(); + detach_database(); throw; } detach_database(); @@ -589,9 +589,9 @@ void NBackup::unlock_database() attach_database(); try { internal_unlock_database(); - } + } catch (const Exception&) { - detach_database(); + detach_database(); throw; } detach_database(); @@ -641,7 +641,7 @@ void NBackup::backup_database(int level, const PathName& fname) case 100: // No more records available b_error::raise(uSvc, "Cannot find record for database \"%s\" backup level %d " "in the backup history", database.c_str(), level - 1); - case 0: + case 0: if (guid_null || scn_null) b_error::raise(uSvc, "Internal error. History query returned null SCN or GUID"); prev_guid[sizeof(prev_guid) - 1] = 0; @@ -656,7 +656,7 @@ void NBackup::backup_database(int level, const PathName& fname) // Lock database for backup internal_lock_database(); - database_locked = true; + database_locked = true; get_database_size(); detach_database(); @@ -677,11 +677,11 @@ void NBackup::backup_database(int level, const PathName& fname) } // Level 0 backup is a full reconstructed database image that can be - // used directly after fixup. Incremenal backups of other levels are + // used directly after fixup. Incremenal backups of other levels are // consisted of header followed by page data. Each page is preceded // by 4-byte integer page number - // Actual IO is optimized to get maximum performance + // Actual IO is optimized to get maximum performance // from the IO subsystem while taking as little CPU time as possible // NOTE: this is still possible to improve performance by implementing @@ -697,9 +697,9 @@ void NBackup::backup_database(int level, const PathName& fname) // Read database header char unaligned_header_buffer[SECTOR_ALIGNMENT * 2]; - Ods::header_page *header = + Ods::header_page *header = reinterpret_cast( - FB_ALIGN((IPTR) unaligned_header_buffer, SECTOR_ALIGNMENT)); + FB_ALIGN((IPTR) unaligned_header_buffer, SECTOR_ALIGNMENT)); if (read_file(dbase, header, SECTOR_ALIGNMENT/*sizeof(*header)*/) != SECTOR_ALIGNMENT/*sizeof(*header)*/) b_error::raise(uSvc, "Unexpected end of file when reading header of database file"); if ((header->hdr_flags & Ods::hdr_backup_mask) != Jrd::nbak_state_stalled) @@ -712,7 +712,7 @@ void NBackup::backup_database(int level, const PathName& fname) page_buff = reinterpret_cast( FB_ALIGN( (IPTR) unaligned_page_buffer.getBuffer( - header->hdr_page_size + SECTOR_ALIGNMENT), + header->hdr_page_size + SECTOR_ALIGNMENT), SECTOR_ALIGNMENT ) ); @@ -744,7 +744,7 @@ void NBackup::backup_database(int level, const PathName& fname) if (!guid_found) b_error::raise(uSvc, "Internal error. Cannot get backup guid clumplet"); - + // Write data to backup file ULONG backup_scn = header->hdr_header.pag_scn - 1; if (level) { @@ -762,8 +762,8 @@ void NBackup::backup_database(int level, const PathName& fname) ULONG curPage = 0; - // Starting from ODS 11.1 we can expand file but never use some last - // pages in it. There are no need to backup this empty pages. More, + // Starting from ODS 11.1 we can expand file but never use some last + // pages in it. There are no need to backup this empty pages. More, // we can't be sure its not used pages have right SCN assigned. // How many pages are really used we know from pip_header.reserved // where stored number of pages allocated from this pointer page. @@ -771,7 +771,7 @@ void NBackup::backup_database(int level, const PathName& fname) const bool isODS11_x = ((header->hdr_ods_version & ~ODS_FIREBIRD_FLAG) == 11) && (header->hdr_ods_minor_original >= 1); ULONG lastPage = 1; // first PIP must be at page number 1 - const ULONG pagesPerPIP = + const ULONG pagesPerPIP = (header->hdr_page_size - OFFSETA(Ods::page_inv_page*, pip_bits)) * 8; while (true) { @@ -787,7 +787,7 @@ void NBackup::backup_database(int level, const PathName& fname) } else write_file(backup, page_buff, header->hdr_page_size); - + if ((db_size_pages != 0) && (db_size == 0)) break; @@ -817,7 +817,7 @@ void NBackup::backup_database(int level, const PathName& fname) break; } } - } + } close_database(); close_backup(); @@ -834,7 +834,7 @@ void NBackup::backup_database(int level, const PathName& fname) isc_stmt_handle stmt = 0; if (isc_dsql_allocate_statement(status, &newdb, &stmt)) pr_error(status, "allocate statement"); - if (isc_dsql_prepare(status, &trans, &stmt, 0, + if (isc_dsql_prepare(status, &trans, &stmt, 0, "insert into rdb$backup_history(rdb$backup_id, rdb$timestamp," "rdb$backup_level, rdb$guid, rdb$scn, rdb$file_name)" "values(gen_id(rdb$backup_history, 1), 'now', ?, ?, ?, ?)", @@ -868,7 +868,7 @@ void NBackup::backup_database(int level, const PathName& fname) if (isc_commit_transaction(status, &trans)) pr_error(status, "commit history insert"); - } + } catch (const Exception&) { if (delete_backup) remove(bakname.c_str()); @@ -895,7 +895,7 @@ void NBackup::backup_database(int level, const PathName& fname) void NBackup::restore_database(const BackupFiles& files) { // We set this flag when database file is in inconsistent state - bool delete_database = false; + bool delete_database = false; const int filecount = files.getCount(); #ifndef WIN_NT create_database(); @@ -918,7 +918,7 @@ void NBackup::restore_database(const BackupFiles& files) scanf("%255s", temp); bakname = temp; } - if (bakname == ".") + if (bakname == ".") { close_database(); if (!curLevel) { @@ -959,18 +959,18 @@ void NBackup::restore_database(const BackupFiles& files) if (curLevel) { inc_header bakheader; if (read_file(backup, &bakheader, sizeof(bakheader)) != sizeof(bakheader)) - b_error::raise(uSvc, "Unexpected end of file when reading header of backup file: %s", bakname.c_str()); - if (memcmp(bakheader.signature, backup_signature, sizeof(backup_signature)) != 0) + b_error::raise(uSvc, "Unexpected end of file when reading header of backup file: %s", bakname.c_str()); + if (memcmp(bakheader.signature, backup_signature, sizeof(backup_signature)) != 0) b_error::raise(uSvc, "Invalid incremental backup file: %s", bakname.c_str()); if (bakheader.version != 1) b_error::raise(uSvc, "Unsupported version %d of incremental backup file: %s", bakheader.version, bakname.c_str()); if (bakheader.level != curLevel) - b_error::raise(uSvc, "Invalid level %d of incremental backup file: %s, expected %d", + b_error::raise(uSvc, "Invalid level %d of incremental backup file: %s, expected %d", bakheader.level, bakname.c_str(), curLevel); // We may also add SCN check, but GUID check covers this case too if (memcmp(&bakheader.prev_guid, &prev_guid, sizeof(FB_GUID)) != 0) { - b_error::raise(uSvc, + b_error::raise(uSvc, "Wrong order of backup files or " "invalid incremental backup file detected, file: %s", bakname.c_str()); } @@ -980,9 +980,9 @@ void NBackup::restore_database(const BackupFiles& files) ULONG pageNum; const size_t bytesDone = read_file(backup, &pageNum, sizeof(pageNum)); if (bytesDone == 0) - break; - if (bytesDone != sizeof(pageNum) || - read_file(backup, page_buffer, bakheader.page_size) != bakheader.page_size) + break; + if (bytesDone != sizeof(pageNum) || + read_file(backup, page_buffer, bakheader.page_size) != bakheader.page_size) { b_error::raise(uSvc, "Unexpected end of backup file: %s", bakname.c_str()); } @@ -994,14 +994,14 @@ void NBackup::restore_database(const BackupFiles& files) else { #ifdef WIN_NT if (!CopyFile(bakname.c_str(), dbname.c_str(), TRUE)) { - b_error::raise(uSvc, "Error (%d) creating database file: %s via copying from: %s", + b_error::raise(uSvc, "Error (%d) creating database file: %s via copying from: %s", GetLastError(), dbname.c_str(), bakname.c_str()); } delete_database = true; // database is possibly broken open_database_write(); #else // Use relatively small buffer to make use of prefetch and lazy flush - char buffer[65536]; + char buffer[65536]; while (true) { const size_t bytesRead = read_file(backup, buffer, sizeof(buffer)); if (bytesRead == 0) @@ -1009,7 +1009,7 @@ void NBackup::restore_database(const BackupFiles& files) write_file(dbase, buffer, bytesRead); } seek_file(dbase, 0); -#endif +#endif // Read database header Ods::header_page header; if (read_file(dbase, &header, sizeof(header)) != sizeof(header)) @@ -1048,7 +1048,7 @@ void NBackup::restore_database(const BackupFiles& files) close_backup(); curLevel++; } - } + } catch (const Exception&) { delete[] page_buffer; if (delete_database) @@ -1164,7 +1164,7 @@ void nbackup(UtilSvc* uSvc) break; } - if (op != nbNone) + if (op != nbNone) singleAction(uSvc); if (++itr >= argc) @@ -1175,7 +1175,7 @@ void nbackup(UtilSvc* uSvc) break; case 'L': - if (op != nbNone) + if (op != nbNone) singleAction(uSvc); if (++itr >= argc) @@ -1186,7 +1186,7 @@ void nbackup(UtilSvc* uSvc) break; case 'N': - if (op != nbNone) + if (op != nbNone) singleAction(uSvc); if (++itr >= argc) @@ -1197,7 +1197,7 @@ void nbackup(UtilSvc* uSvc) break; case 'B': - if (op != nbNone) + if (op != nbNone) singleAction(uSvc); if (++itr >= argc) @@ -1217,7 +1217,7 @@ void nbackup(UtilSvc* uSvc) break; case 'R': - if (op != nbNone) + if (op != nbNone) singleAction(uSvc); if (++itr >= argc) diff --git a/src/utilities/print_event.cpp b/src/utilities/print_event.cpp index d172450734..6244da556a 100644 --- a/src/utilities/print_event.cpp +++ b/src/utilities/print_event.cpp @@ -79,7 +79,7 @@ static void event_list(void) { /************************************** * - * e v e n t _ l i s t + * e v e n t _ l i s t * ************************************** * @@ -99,7 +99,7 @@ static void event_list(void) if (database_event->evnt_parent) continue; - /* Print out the magic name for the database, this name + /* Print out the magic name for the database, this name comes from the lock key_id for the database, on Unix this is comprised of the device number and inode */ @@ -107,7 +107,7 @@ static void event_list(void) const UCHAR* p = (UCHAR *) database_event->evnt_name; for (ULONG l = database_event->evnt_length; l; --l) printf("%02x", *p++); - + printf(" count: %6ld\n", database_event->evnt_count); { // scope @@ -190,7 +190,7 @@ static void event_table_dump(void) event_hdr* block = 0; for (SLONG offset = sizeof(evh); offset < EVENT_header->evh_length; - offset += block->hdr_length) + offset += block->hdr_length) { printf("\n%.5ld ", offset); block = (event_hdr*) SRQ_ABS_PTR(offset); diff --git a/src/utilities/rebuild/rebuild.cpp b/src/utilities/rebuild/rebuild.cpp index 819871afb9..71f98d4bca 100644 --- a/src/utilities/rebuild/rebuild.cpp +++ b/src/utilities/rebuild/rebuild.cpp @@ -512,7 +512,7 @@ static void dump( { /************************************** * - * d u m p + * d u m p * ************************************** * @@ -563,7 +563,7 @@ static void dump_tips( FILE * file, RBDB rbdb) { /************************************** * - * d u m p _ t i p s + * d u m p _ t i p s * ************************************** * @@ -678,7 +678,7 @@ static void format_pip( page_inv_page* page, int page_size, int last_flag) * * Functional description * Fake a fully RBDB_allocated (all pages RBDB_allocated) page inventory - * page. + * page. * **************************************/ page->pag_type = pag_pages; @@ -716,7 +716,7 @@ static void format_tip( tx_inv_page* page, int page_size, SLONG next_page) /* The "next" tip page number is included for redundancy, but is not actually read by the engine, so can be safely left zero. If known, it would nice - to supply it. + to supply it. */ page->tip_next = next_page; @@ -804,7 +804,7 @@ static void get_range( get_switch(*argv, token); if (token->swc_switch) return; - if ((*token->swc_string == ':') || (*token->swc_string == ',')) + if ((*token->swc_string == ':') || (*token->swc_string == ',')) { const TEXT* p = token->swc_string; if (*++p) { @@ -893,8 +893,8 @@ static header_page* open_database( RBDB rbdb, ULONG pg_size) if (header->hdr_ods_version != ODS_VERSION | ODS_TYPE_CURRENT) { printf("Wrong ODS version, expected %d type %04x, encountered %d type %04x.\n", - ODS_VERSION, ODS_TYPE_CURRENT, - header->hdr_ods_version & ~ODS_TYPE_MASK, + ODS_VERSION, ODS_TYPE_CURRENT, + header->hdr_ods_version & ~ODS_TYPE_MASK, header->hdr_ods_version & ODS_TYPE_MASK ); rbdb->rbdb_valid = FALSE; @@ -937,8 +937,8 @@ static void print_db_header( FILE* file, const header_page* header) **************************************/ fprintf(file, "Database header page information:\n"); fprintf(file, " Page size\t\t\t%d\n", header->hdr_page_size); - fprintf(file, " ODS version\t\t\t%d type %04x\n", - header->hdr_ods_version & ~ODS_TYPE_MASK, + fprintf(file, " ODS version\t\t\t%d type %04x\n", + header->hdr_ods_version & ~ODS_TYPE_MASK, header->hdr_ods_version & ODS_TYPE_MASK); fprintf(file, " PAGES\t\t\t%d\n", header->hdr_PAGES); fprintf(file, " next page\t\t\t%d\n", header->hdr_next_page); @@ -979,7 +979,7 @@ fprintf (" Creation date \n", header->hdr_creation_date); fprintf(file, "\n Variable header data:\n"); SLONG number; - + const UCHAR* p = header->hdr_data; for (const UCHAR* const end = p + header->hdr_page_size; p < end && *p != HDR_end; p += 2 + p[1]) @@ -1046,7 +1046,7 @@ static void rebuild( RBDB rbdb) { /************************************** * - * r e b u i l d + * r e b u i l d * ************************************** * @@ -1184,7 +1184,7 @@ static void write_headers( (blob->pag_flags & blp_pointers) ? "pointers" : "data"); break; } - + case pag_ids: fprintf(file, "generator page, checksum %d\n\n", page->pag_checksum); diff --git a/src/vulcan/PathName.cpp b/src/vulcan/PathName.cpp index d82b3b9e5a..bc133db9a6 100644 --- a/src/vulcan/PathName.cpp +++ b/src/vulcan/PathName.cpp @@ -1,19 +1,19 @@ /* - * - * The contents of this file are subject to the Initial - * Developer's Public License Version 1.0 (the "License"); - * you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * http://www.ibphoenix.com/idpl.html. * - * Software distributed under the License is distributed on - * an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either - * express or implied. See the License for the specific + * The contents of this file are subject to the Initial + * Developer's Public License Version 1.0 (the "License"); + * you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * http://www.ibphoenix.com/idpl.html. + * + * Software distributed under the License is distributed on + * an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either + * express or implied. See the License for the specific * language governing rights and limitations under the License. * * The contents of this file or any work derived from this file - * may not be distributed under any other license whatsoever - * without the express prior written permission of the original + * may not be distributed under any other license whatsoever + * without the express prior written permission of the original * author. * * @@ -22,7 +22,7 @@ * Copyright (c) 2004 James A. Starkey * All Rights Reserved. */ - + #include #include #include @@ -70,7 +70,7 @@ const char* PathName::getWorkingDirectory() #else if (workingDirectory [0]) return workingDirectory; - + #ifdef HAVE_GETCWD getcwd(workingDirectory, sizeof (workingDirectory)); #else @@ -89,13 +89,13 @@ int PathName::findWorkingDirectory(int dpbLength, const UCHAR* dpb, int bufferLe if (dpbLength <= 0 || *p++ != isc_dpb_version1) return 0; - + for (int length = 0; p < end; p += length) { const UCHAR verb = *p++; length = *p++; length += (*p++) << 8; - + if (verb == isc_dpb_working_directory) { const int l = MIN (bufferLength - 1, length); @@ -104,20 +104,20 @@ int PathName::findWorkingDirectory(int dpbLength, const UCHAR* dpb, int bufferLe return length; } } - - return 0; + + return 0; } Firebird::string PathName::expandFilename(const char* fileName, int dpbLength, const UCHAR* dpb) { char workingDirectory [MAXPATHLEN]; const char *directory; - + if (findWorkingDirectory (dpbLength, dpb, sizeof (workingDirectory), workingDirectory)) directory = workingDirectory; else directory = getWorkingDirectory(); - + return expandFilename (fileName, directory); } @@ -125,7 +125,7 @@ Firebird::string PathName::expandFilename(const char* fileName, const char* work { char buffer [MAXPATHLEN]; int length = merge (fileName, workingDirectory, sizeof (buffer), buffer); - + #ifdef _WIN32 for (char *p = buffer; *p; ++p) { @@ -140,15 +140,15 @@ Firebird::string PathName::expandFilename(const char* fileName, const char* work int PathName::merge(const char* fileName, const char* workingDirectory, int bufferLength, char* buffer) { const char* const endBuffer = buffer + bufferLength - 1; - + if (isAbsolute (fileName)) { char* rc = copyCanonical (fileName, buffer, endBuffer); return rc - buffer; } - + // Copy working directory, making slashes canonical - + char* q = copyCanonical (workingDirectory, buffer, endBuffer); #ifdef _WIN32 @@ -160,14 +160,14 @@ int PathName::merge(const char* fileName, const char* workingDirectory, int buff return q - buffer; } #endif - + // And add a trailing slash, if necessary - + if (q == buffer || q [-1] != '/') *q++ = '/'; // Handle self relative segments - + const char* p = fileName; while (*p == '.') { @@ -185,16 +185,16 @@ int PathName::merge(const char* fileName, const char* workingDirectory, int buff else if (!p [1]) ++p; } - + // skip over extra separators in the file name - + while (IS_SEPARATOR (*p)) ++p; // and move in the final filename - + q = copyCanonical (p, q, endBuffer); - + return q - buffer; } @@ -205,8 +205,8 @@ bool PathName::isAbsolute(const char* fileName) fileName [1] == ':' && (fileName [2] == '/' || fileName [2] == '\\')) || (fileName[0] == '/' && fileName[1] == '/') || (fileName[0] == '\\' && fileName[1] == '\\'); - - + + #else return fileName [0] == '/'; #endif @@ -216,7 +216,7 @@ char* PathName::copyCanonical(const char* fileName, char* buffer, const char* en { char* q = buffer; const char* p = fileName; - + #ifdef _WIN32 if (IS_SEPARATOR (*p)) { @@ -224,7 +224,7 @@ char* PathName::copyCanonical(const char* fileName, char* buffer, const char* en ++p; } #endif - + while (*p && q < endBuffer) { char c = *p++; @@ -236,9 +236,9 @@ char* PathName::copyCanonical(const char* fileName, char* buffer, const char* en } *q++ = c; } - + *q = 0; - + return q; } @@ -254,7 +254,7 @@ bool PathName::hasDirectory(const char* fileName) if (IS_SEPARATOR (*p)) return true; } - + return false; } @@ -264,5 +264,5 @@ bool PathName::pathsEquivalent(const char* path1, const char* path2) return stricmp(path1, path2) == 0; #else return strcmp (path1, path2) == 0; -#endif +#endif } diff --git a/src/vulcan/RefObject.cpp b/src/vulcan/RefObject.cpp index e7fdaa0af6..09c393afd3 100644 --- a/src/vulcan/RefObject.cpp +++ b/src/vulcan/RefObject.cpp @@ -1,19 +1,19 @@ /* - * - * The contents of this file are subject to the Initial - * Developer's Public License Version 1.0 (the "License"); - * you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * http://www.ibphoenix.com/idpl.html. * - * Software distributed under the License is distributed on - * an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either - * express or implied. See the License for the specific + * The contents of this file are subject to the Initial + * Developer's Public License Version 1.0 (the "License"); + * you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * http://www.ibphoenix.com/idpl.html. + * + * Software distributed under the License is distributed on + * an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either + * express or implied. See the License for the specific * language governing rights and limitations under the License. * * The contents of this file or any work derived from this file - * may not be distributed under any other license whatsoever - * without the express prior written permission of the original + * may not be distributed under any other license whatsoever + * without the express prior written permission of the original * author. * *