Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/burp/burp.h
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,7 @@ enum att_type {
// Trigger types

enum trig_t {
trig_none = 0,
trig_pre_store = 1, // default
trig_pre_modify, // default
trig_post_erase // default
Expand Down
12 changes: 6 additions & 6 deletions src/burp/restore.epp
Original file line number Diff line number Diff line change
Expand Up @@ -1608,7 +1608,7 @@ bool get_acl(BurpGlobals* tdgbl, const TEXT* owner_nm, ISC_QUAD* blob_id, ISC_QU

ULONG length = 0;
UCHAR item;
USHORT max_segment;
USHORT max_segment = 0;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong initialization. In this case USHRT_MAX is a safe assumption.

ULONG num_segments;
const UCHAR* p = blob_info;

Expand Down Expand Up @@ -1783,7 +1783,7 @@ void get_array(BurpGlobals* tdgbl, burp_rel* relation, UCHAR* record_buffer)
SLONG fld_ranges[2 * MAX_DIMENSION];
SLONG slice_length = 0;
SLONG *range;
const SLONG* end_ranges;
const SLONG* end_ranges = nullptr;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fld_ranges is the right default here.

scan_attr_t scan_next_attr;
skip_init(&scan_next_attr);
att_type attribute;
Expand Down Expand Up @@ -1851,7 +1851,7 @@ void get_array(BurpGlobals* tdgbl, burp_rel* relation, UCHAR* record_buffer)
SLONG last_element_dim[MAX_DIMENSION];
if (return_length != slice_length)
{
int upper, lower;
int upper = 0, lower = 0;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is remains of old C code. Move this declaration to usage instead.

//
// Ugh! The full array wasn't returned and versions of gbak prior to
// V3.2I don't explicitly signal this. We must recompute the top
Expand Down Expand Up @@ -3386,7 +3386,7 @@ void get_data(BurpGlobals* tdgbl, burp_rel* relation, WriteRelationReq* req)
}
}

UCHAR* p;
UCHAR* p = nullptr;
if (tdgbl->gbl_sw_transportable)
{
if (get(tdgbl) != att_xdr_length)
Expand Down Expand Up @@ -9097,7 +9097,7 @@ bool get_db_creator(BurpGlobals* tdgbl)
att_type attribute;
scan_attr_t scan_next_attr;
TEXT usr[GDS_NAME_LEN];
SSHORT uType;
SSHORT uType = 0;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pointless because of initialization of typeSet below. But if your AI insist - initialize usr as well for symmetry.

bool userSet, typeSet;

userSet = typeSet = false;
Expand Down Expand Up @@ -9422,7 +9422,7 @@ bool get_trigger_old (BurpGlobals* tdgbl, burp_rel* relation)
* Get a trigger definition for a relation.
*
**************************************/
enum trig_t type;
enum trig_t type = trig_none;
Copy link
Copy Markdown
Contributor

@aafemt aafemt Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For completeness you should also add a check that a meaningful value was assigned below and throw an error if type is still trig_none.

att_type attribute;
TEXT name[GDS_NAME_LEN];
scan_attr_t scan_next_attr;
Expand Down
3 changes: 2 additions & 1 deletion src/dsql/DdlNodes.epp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,8 @@ static void checkForeignKeyTempScope(thread_db* tdbb, jrd_tra* transaction,
{
AutoCacheRequest request(tdbb, drq_l_rel_info, DYN_REQUESTS);
QualifiedName masterRelName;
rel_t masterType, childType;
rel_t masterType = rel_persistent;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is basically wrong and will fail in the case if the table has several foreign keys. It must be fixed, not polished.

rel_t childType = rel_persistent;

FOR(REQUEST_HANDLE request TRANSACTION_HANDLE transaction)
RLC_M IN RDB$RELATION_CONSTRAINTS CROSS
Expand Down
2 changes: 1 addition & 1 deletion src/jrd/cvt2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,7 @@ USHORT CVT2_make_string2(const dsc* desc, TTypeId to_interp, UCHAR** address, Mo
**************************************/
UCHAR* from_buf;
USHORT from_len;
TTypeId from_interp;
USHORT from_interp = 0;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First, replacing a specific type with a generic one is a bad idea.
Second, right initial value would be ttype_none, but I would suggest to refactor this routine instead.


fb_assert(desc != NULL);
fb_assert(address != NULL);
Expand Down
2 changes: 1 addition & 1 deletion src/jrd/os/posix/unix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ bool PIO_header(thread_db* tdbb, UCHAR* address, unsigned length)
const auto dbb = tdbb->getDatabase();

unsigned i;
SINT64 bytes;
SINT64 bytes = 0;

PageSpace* const pageSpace = dbb->dbb_page_manager.findPageSpace(DB_PAGE_SPACE);
jrd_file* const file = pageSpace->file;
Expand Down
2 changes: 1 addition & 1 deletion src/remote/client/interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2011,7 +2011,7 @@ unsigned char* Attachment::getLocalInfo(UCharBuffer& info, unsigned int buffer_l
break;
}

FB_UINT64 value;
FB_UINT64 value = 0;
bool skip = false;

switch (*item)
Expand Down