From f8f159dc9e658f45127a4266174aef06db8b4412 Mon Sep 17 00:00:00 2001 From: robocop Date: Mon, 31 May 2004 02:34:35 +0000 Subject: [PATCH] Changing some variables that have a trailing underscore to allow conflict with C++ keywords or engine structs. --- src/dsql/make.cpp | 4 ++-- src/dudley/generate.cpp | 17 ++++++++++------- src/gpre/cmd.cpp | 39 ++++++++++++++++++++------------------- src/jrd/ini.epp | 22 +++++++++++----------- src/jrd/met.epp | 6 +++--- src/jrd/sdw.cpp | 10 +++++----- 6 files changed, 51 insertions(+), 47 deletions(-) diff --git a/src/dsql/make.cpp b/src/dsql/make.cpp index 44ec05b650..f83b01af87 100644 --- a/src/dsql/make.cpp +++ b/src/dsql/make.cpp @@ -1675,14 +1675,14 @@ dsql_sym* MAKE_symbol(dsql_dbb* database, @param charset **/ -dsql_str* MAKE_tagged_string(const char* str_, size_t length, const char* charset) +dsql_str* MAKE_tagged_string(const char* strvar, size_t length, const char* charset) { tsql* tdsql = DSQL_get_thread_data(); dsql_str* string = FB_NEW_RPT(*tdsql->tsql_default, length) dsql_str; string->str_charset = charset; string->str_length = length; - memcpy(string->str_data, str_, length); + memcpy(string->str_data, strvar, length); return string; } diff --git a/src/dudley/generate.cpp b/src/dudley/generate.cpp index 1826cb3da6..8e16d5bd25 100644 --- a/src/dudley/generate.cpp +++ b/src/dudley/generate.cpp @@ -42,7 +42,7 @@ static inline void check_blr(str* blr, const int l) } } -int GENERATE_acl( SCL class_, UCHAR * buffer) +int GENERATE_acl( SCL sec_class, UCHAR * buffer) { /************************************** * @@ -54,22 +54,25 @@ int GENERATE_acl( SCL class_, UCHAR * buffer) * Generate an access control list. * **************************************/ - UCHAR *p, *q, **id, c; - SCE item; + UCHAR** id; USHORT i; - p = buffer; + UCHAR* p = buffer; *p++ = ACL_version; - for (item = class_->scl_entries; item; item = item->sce_next) { + for (SCE item = sec_class->scl_entries; item; item = item->sce_next) { *p++ = ACL_id_list; for (i = 0, id = item->sce_idents; i < id_max; id++, i++) - if (q = *id) { + { + const UCHAR* q = *id; + if (q) { *p++ = i; - *p++ = strlen((char*) q); + *p++ = strlen((const char*) q); + UCHAR c; while (c = *q++) *p++ = UPPER(c); } + } *p++ = priv_end; *p++ = ACL_priv_list; for (i = 0; i < priv_max; i++) diff --git a/src/gpre/cmd.cpp b/src/gpre/cmd.cpp index 96ab89cbb2..dc0ac6fb46 100644 --- a/src/gpre/cmd.cpp +++ b/src/gpre/cmd.cpp @@ -25,7 +25,7 @@ // //____________________________________________________________ // -// $Id: cmd.cpp,v 1.36 2004-05-24 17:13:36 brodsom Exp $ +// $Id: cmd.cpp,v 1.37 2004-05-31 02:34:21 robocop Exp $ // #include "firebird.h" @@ -466,7 +466,8 @@ 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) +static void create_check_constraint( gpre_req* request, const act* action, + cnstrt* constraint) { gpre_trg* trigger = (gpre_trg*) MSC_alloc(TRG_LEN); @@ -516,7 +517,7 @@ static void create_trg_firing_cond( gpre_req* request, const cnstrt* constraint) fb_assert(prim_key_num_flds > 0); // generate blr - request->add_byte(blr_if); + request->add_byte(blr_if); if (prim_key_num_flds > 1) request->add_byte(blr_or); @@ -606,8 +607,7 @@ static void create_matching_blr(gpre_req* request, const cnstrt* constraint) for_key_fld = for_key_fld->lls_next; prim_key_fld = prim_key_fld->lls_next; - } - while (num_flds < for_key_num_flds); + } while (num_flds < for_key_num_flds); request->add_byte(blr_end); } @@ -799,7 +799,6 @@ static void create_set_default_trg(gpre_req* request, cnstrt* constraint, bool on_upd_trg) { - USHORT offset, length; gpre_rel* rel; gpre_req* req; act* request_action; @@ -828,7 +827,7 @@ static void create_set_default_trg(gpre_req* request, // the trigger blr request->add_byte(isc_dyn_trg_blr); - offset = request->req_blr - request->req_base; + const USHORT offset = request->req_blr - request->req_base; request->add_word(0); if (request->req_flags & REQ_blr_version4) @@ -1048,7 +1047,7 @@ static void create_set_default_trg(gpre_req* request, } request->add_byte(blr_eoc); - length = request->req_blr - request->req_base - offset - 2; + 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 @@ -1783,8 +1782,8 @@ static bool create_view(gpre_req* request, SSHORT position = 0; bool non_updateable = false; - GPRE_NOD* ptr; - const GPRE_NOD* end; + gpre_nod** ptr; + const gpre_nod* const* end; for (ptr = fields->nod_arg, end = ptr + fields->nod_count; ptr < end; ptr++, field = (field) ? field->fld_next : NULL) @@ -2321,9 +2320,9 @@ static void put_array_info( gpre_req* request, const gpre_fld* field) // static void put_blr(gpre_req* request, - USHORT operator_, GPRE_NOD node, pfn_local_trigger_cb routine) + USHORT blr_operator, GPRE_NOD node, pfn_local_trigger_cb routine) { - request->add_byte(operator_); + request->add_byte(blr_operator); const USHORT offset = request->req_blr - request->req_base; request->add_word(0); if (request->req_flags & REQ_blr_version4) @@ -2603,10 +2602,10 @@ 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 operator_, SSHORT number) +static void put_numeric( gpre_req* request, USHORT blr_operator, SSHORT number) { - request->add_byte(operator_); + request->add_byte(blr_operator); request->add_word(2); request->add_word(number); } @@ -2682,10 +2681,10 @@ static void put_symbol(gpre_req* request, int ddl_operator, // static void put_trigger_blr(gpre_req* request, - USHORT operator_, + USHORT blr_operator, GPRE_NOD node, pfn_local_trigger_cb routine) { - request->add_byte(operator_); + request->add_byte(blr_operator); const USHORT offset = request->req_blr - request->req_base; request->add_word(0); if (request->req_flags & REQ_blr_version4) @@ -2723,12 +2722,12 @@ static void put_trigger_blr(gpre_req* request, static void put_view_trigger_blr(gpre_req* request, const gpre_rel* relation, - USHORT operator_, + USHORT blr_operator, gpre_trg* trigger, GPRE_NOD view_boolean, gpre_ctx** contexts, GPRE_NOD set_list) { gpre_rse* node = (gpre_rse*) trigger->trg_boolean; - request->add_byte(operator_); + request->add_byte(blr_operator); const USHORT offset = request->req_blr - request->req_base; request->add_word(0); if (request->req_flags & REQ_blr_version4) @@ -2819,7 +2818,8 @@ static void replace_field_names(gpre_nod* const input, } gpre_nod** ptr = input->nod_arg; - for (gpre_nod** const end = ptr + input->nod_count; ptr < end; ptr++) { + for (const gpre_nod* const* const end = ptr + input->nod_count; ptr < end; ptr++) + { if ((*ptr)->nod_type == nod_field) { ref* reference = (REF) (*ptr)->nod_arg[0]; gpre_fld* rse_field = reference->ref_field; @@ -2871,3 +2871,4 @@ static void set_statistics( gpre_req* request, const act* action) request->add_end(); } + diff --git a/src/jrd/ini.epp b/src/jrd/ini.epp index afff49d918..180170d9c3 100644 --- a/src/jrd/ini.epp +++ b/src/jrd/ini.epp @@ -502,16 +502,16 @@ void INI_init(void) Database* dbb = tdbb->tdbb_database; CHECK_DBB(dbb); - const UCHAR* fld_; - for (const UCHAR* relfld = relfields; relfld[RFLD_R_NAME]; relfld = fld_ + 1) + const UCHAR* fld; + for (const UCHAR* relfld = relfields; relfld[RFLD_R_NAME]; relfld = fld + 1) { jrd_rel* relation = MET_relation(tdbb, relfld[RFLD_R_ID]); relation->rel_flags |= REL_system; - relation->rel_name = (/* const_cast */ TEXT*)names[relfld[RFLD_R_NAME]]; + relation->rel_name = const_cast(names[relfld[RFLD_R_NAME]]); relation->rel_length = strlen(relation->rel_name); int n = 0; - for (fld_ = relfld + RFLD_RPT; fld_[RFLD_F_NAME]; - fld_ += RFLD_F_LENGTH) + for (fld = relfld + RFLD_RPT; fld[RFLD_F_NAME]; + fld += RFLD_F_LENGTH) { n++; } @@ -539,15 +539,15 @@ void INI_init(void) format->fmt_count = n; Format::fmt_desc_iterator desc = format->fmt_desc.begin(); - for (fld_ = relfld + RFLD_RPT; fld_[RFLD_F_NAME]; - fld_ += RFLD_F_LENGTH, desc++, itr++) + for (fld = relfld + RFLD_RPT; fld[RFLD_F_NAME]; + fld += RFLD_F_LENGTH, desc++, itr++) { - const gfld* gfield = &gfields[fld_[RFLD_F_ID]]; + const gfld* gfield = &gfields[fld[RFLD_F_ID]]; desc->dsc_length = gfield->gfld_length; desc->dsc_dtype = gfield->gfld_dtype; jrd_fld* field = FB_NEW_RPT(*dbb->dbb_permanent, 0) jrd_fld(); *itr = field; - field->fld_name = names[fld_[RFLD_F_NAME]]; + field->fld_name = names[fld[RFLD_F_NAME]]; field->fld_length = strlen(field->fld_name); } } @@ -575,7 +575,7 @@ void INI_init2(void) const USHORT minor_original = dbb->dbb_minor_original; vec* vector = dbb->dbb_relations; - const UCHAR* fld; + const UCHAR* fld; for (const UCHAR* relfld = relfields; relfld[RFLD_R_NAME]; relfld = fld + 1) { if (relfld[RFLD_R_MINOR] > ENCODE_ODS(major_version, minor_original)) @@ -1047,7 +1047,7 @@ static void add_relation_fields( USHORT minor_version) jrd_req* s_handle = NULL; jrd_req* m_handle = NULL; - const UCHAR* fld; + const UCHAR* fld; for (const UCHAR* relfld = relfields; relfld[RFLD_R_NAME]; relfld = fld + 1) { int n = 0; diff --git a/src/jrd/met.epp b/src/jrd/met.epp index 4490bb1e69..71b8d7580b 100644 --- a/src/jrd/met.epp +++ b/src/jrd/met.epp @@ -37,7 +37,7 @@ * 2004.01.16 Vlad Horsun: added support for default parameters */ /* -$Id: met.epp,v 1.128 2004-05-27 16:25:59 alexpeshkoff Exp $ +$Id: met.epp,v 1.129 2004-05-31 02:34:31 robocop Exp $ */ // This MUST be at the top of the file #ifdef DARWIN @@ -1034,7 +1034,7 @@ jrd_fld* MET_get_field(jrd_rel* relation, USHORT id) } -void MET_get_shadow_files( thread_db* tdbb, bool deleteVar) +void MET_get_shadow_files( thread_db* tdbb, bool delete_files) { /************************************** * @@ -1063,7 +1063,7 @@ void MET_get_shadow_files( thread_db* tdbb, bool deleteVar) { const USHORT file_flags = X.RDB$FILE_FLAGS; SDW_start(X.RDB$FILE_NAME, X.RDB$SHADOW_NUMBER, file_flags, - deleteVar); + delete_files); /* if the shadow exists, mark the appropriate shadow block as found for the purposes of this routine; diff --git a/src/jrd/sdw.cpp b/src/jrd/sdw.cpp index aa1e90a7be..a4a4ebfad7 100644 --- a/src/jrd/sdw.cpp +++ b/src/jrd/sdw.cpp @@ -561,7 +561,7 @@ void SDW_get_shadows(void) -void SDW_init(bool activate, bool delete_) +void SDW_init(bool activate, bool delete_files) { /************************************** * @@ -607,7 +607,7 @@ void SDW_init(bool activate, bool delete_) LCK_lock(tdbb, lock, LCK_SR, TRUE); CCH_RELEASE(tdbb, &window); - MET_get_shadow_files(tdbb, delete_); + MET_get_shadow_files(tdbb, delete_files); } @@ -877,7 +877,7 @@ void SDW_shutdown_shadow(Shadow* shadow) void SDW_start( const TEXT* file_name, - USHORT shadow_number, USHORT file_flags, bool delete_) + USHORT shadow_number, USHORT file_flags, bool delete_files) { /************************************** * @@ -888,7 +888,7 @@ void SDW_start( * Functional description * Commence shadowing on a previously created shadow file. * - * is TRUE if we are not actually starting shadowing, + * is true if we are not actually starting shadowing, * but deleting inaccessible shadow files. * **************************************/ @@ -1054,7 +1054,7 @@ void SDW_start( } if (spare_buffer) delete[] spare_buffer; - if (file_flags & FILE_manual && !delete_) { + if (file_flags & FILE_manual && !delete_files) { ERR_post(isc_shadow_missing, isc_arg_number, (SLONG) shadow_number, 0); }