Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
66bfb4f
Null pointers done
Zakk0n Aug 27, 2025
3ec8851
Fixed pointer that should not be dereferenced
lDeathlWhisperl Aug 29, 2025
4608d5b
fix: ensure null termination when converting string_view to string
3qupo Sep 2, 2025
49b01df
fix: correcting the passing of arguments to a function and loop
3qupo Sep 2, 2025
fd6857c
fix: initializing a variable of type FB_UINT64 with a null value
3qupo Aug 29, 2025
a6988a4
initializing a variable of type SINT64 with a null value
3qupo Aug 29, 2025
4e97b5c
changed the .ebb file, but the warning didn't go away
3qupo Sep 1, 2025
7ec3f4b
initializing a variable of type USHORT with a null value
3qupo Sep 1, 2025
a6db65e
initializing a pointer of type SLONG* nullptr
3qupo Sep 1, 2025
0fe3203
initializing a pointer of type UCHAR* nullptr
3qupo Sep 1, 2025
533aab5
initializing variables with zero and default value
3qupo Sep 1, 2025
bf4e792
Fix snprintf return value
annafilimonova1 Sep 3, 2025
96f1dc0
Fix unused parameters
annafilimonova1 Sep 3, 2025
64ef6a7
Fix calling virtual methods in constructor
annafilimonova1 Sep 3, 2025
e6dd217
fix: Initialize can_use_more to prevent compiler warning
laBobberto Sep 3, 2025
0e585d9
fix: Initialize long_value to prevent potential errors
laBobberto Sep 3, 2025
2bebfda
fix: Initialize value variable to improve code robustness
laBobberto Sep 3, 2025
c1ed5c5
fix: Initialize 'length' variable in blr_print_dtype
laBobberto Sep 3, 2025
80189d0
fix: Fixed warning about uninitialized variable n
laBobberto Sep 3, 2025
85d238a
fix: Initialize savNumber variable in BlockNode::execute
laBobberto Sep 3, 2025
dae2d52
fix: Initialize parentStream in EraseNode::pass1Erase
laBobberto Sep 3, 2025
9744edb
fix: Initialize returnsPos in ExecBlockNode::genBlr
laBobberto Sep 3, 2025
95d4f4e
fix: Initialize stream variables in ModifyNode::pass1Modify
laBobberto Sep 3, 2025
f151bfe
fix: Initialize parentStream variable in StoreNode::pass1Store
laBobberto Sep 3, 2025
d507bd2
fix: Initialize 'value' pointer in validateExpressions
laBobberto Sep 3, 2025
362b2c1
fix: Fix using uninitialized variable in stringToKey
laBobberto Sep 3, 2025
b4bced0
fix: Initialize merge_pool pointer in Sort::sort method
laBobberto Sep 3, 2025
50d02ae
fix: Initialize 'value' variable in CVT_get_double
laBobberto Sep 3, 2025
59c6b11
fix: Initialize ret_code variable in main loop
laBobberto Sep 3, 2025
389068b
fix: Initialize minlen variable in EXE_assignment
laBobberto Sep 3, 2025
70dc2e3
fix: Initialize select_node pointer in FilteredStream::evaluateBoolean
laBobberto Sep 3, 2025
94c1f5f
fix Initialize variables in convertGregorianDateToWeekDate
laBobberto Sep 3, 2025
b727260
fix: Initialize variables in BTR_reserve_slot
laBobberto Sep 3, 2025
7444677
fix: Initialize multiKeyLength in compress function
laBobberto Sep 3, 2025
0667b62
fix: Fix use of uninitialized ptr and length in compress
laBobberto Sep 3, 2025
64963c8
Delete skipfile.txt
3qupo Sep 4, 2025
ee32271
fix implicit conversion
sirisospro Sep 4, 2025
fa01cd9
Unserialized and uninitialized done
Zakk0n Sep 4, 2025
81edec9
changed else if condition to else
lDeathlWhisperl Sep 5, 2025
b14decb
fix format type
sirisospro Sep 6, 2025
7025b08
fix missing label
sirisospro Sep 6, 2025
e18f681
fix unused parameter
sirisospro Sep 6, 2025
46b1515
fix enumeration value in switch
sirisospro Sep 6, 2025
242501c
fix disregarded value
sirisospro Sep 8, 2025
daf766b
Fixed disregarded return
lDeathlWhisperl Sep 18, 2025
5c87edb
fix format type
sirisospro Sep 23, 2025
c719015
Merge pull request #22 from sirisospro/data_types_warns
craftmaster1231 Sep 25, 2025
ee8047e
Merge pull request #31 from annafilimonova1/fix_virtual_methods
craftmaster1231 Sep 25, 2025
56ef78d
Merge pull request #30 from annafilimonova1/fix_unused_params
craftmaster1231 Sep 25, 2025
4a77e6e
Merge pull request #17 from Zakk0n/Unserialized_Uninitialized
craftmaster1231 Sep 30, 2025
a0ddf89
Merge pull request #10 from lDeathlWhisperl/fix_opaque_data_structure…
craftmaster1231 Sep 30, 2025
722d47d
fix: Refactor filters.cpp logic for 'can_use_more' and remove redunda…
laBobberto Sep 30, 2025
ec9541b
fix: Initialize value in PATTERN_expand and align comment (gpre/pat.cpp)
laBobberto Sep 30, 2025
3cc0fb2
fix: add assert 'value'
laBobberto Sep 30, 2025
1f3be44
fix: Narrow scope of merge_pool pointer in Sort::sort method
laBobberto Oct 1, 2025
0284e5a
fix: Scope ret_code outside of loop and initialize with NORMAL_EXIT i…
laBobberto Oct 1, 2025
7abf372
fix: Initialize select_node in FilteredStream::evaluateBoolean and re…
laBobberto Oct 1, 2025
8f70f84
fix: Refactor weekDate logic to remove unnecessary initialization and…
laBobberto Oct 1, 2025
687c238
refactor: Narrow scope of 'len' and 'space' in BTR_reserve_slot to el…
laBobberto Oct 1, 2025
e7fc91b
refactoring: remove unnecessary else
laBobberto Oct 1, 2025
d0d88ab
refactoring: while and if blocks using merge_pool
laBobberto Oct 1, 2025
7b65a8e
fix_snprintf_retval: use static_cast
annafilimonova1 Oct 2, 2025
c6185ab
fix: initialization custom types in 'StmtNodes.cpp'.
laBobberto Oct 3, 2025
4a7916a
fix: moving the preassignment of 'len', 'space' to the end of the for…
laBobberto Oct 5, 2025
2cc6b6f
fix: Initializing yearNumber with y and weekNumber with computed valu…
laBobberto Oct 5, 2025
108d0fa
refactor: move ret_code declaration into loop scope
laBobberto Oct 5, 2025
8f23b0a
refactor: remove old comment and add new
laBobberto Oct 5, 2025
1519ed2
refactor: move returnsPos declaration to its actual usage point insid…
laBobberto Oct 5, 2025
91d3a10
fix disregarded value
sirisospro Oct 6, 2025
2d89042
Added default init
lDeathlWhisperl Oct 7, 2025
3d40fb5
Added fb_assert
lDeathlWhisperl Oct 7, 2025
1e7eedc
fixed implicit conversion
lDeathlWhisperl Oct 7, 2025
930f693
Added default init
lDeathlWhisperl Oct 7, 2025
e175d7b
Added fb_assert
lDeathlWhisperl Oct 7, 2025
e556c38
Merge pull request #13 from lDeathlWhisperl/fix_disregarded_function_…
craftmaster1231 Oct 8, 2025
9a73c13
assert snprintf return value in StatusArg.cpp
annafilimonova1 Oct 11, 2025
a7412ff
Merge pull request #29 from annafilimonova1/fix_snprintf_retval
craftmaster1231 Oct 13, 2025
d104619
Merge remote-tracking branch 'origin/master_fix_warns' into disregard…
sirisospro Oct 19, 2025
163d580
fix unused parameter
sirisospro Oct 20, 2025
c3f70f8
fix enumeration value in switch
sirisospro Oct 20, 2025
c265239
fix missing label
sirisospro Oct 20, 2025
4e21aab
Merge pull request #23 from sirisospro/other_warns
craftmaster1231 Oct 27, 2025
f61cff8
Merge pull request #28 from sirisospro/disregarded_value_warns
craftmaster1231 Oct 27, 2025
9464971
refactor: indentation fixed
laBobberto Oct 28, 2025
5a10754
refactor: optimize week date conversion with bitwise operations
laBobberto Oct 28, 2025
b122e4d
refactor: the type of the variable `len` has been changed to const US…
laBobberto Oct 29, 2025
a13dca2
Merge pull request #18 from laBobberto/uninitialized_variables
craftmaster1231 Dec 12, 2025
c284505
Merge pull request #33 from lDeathlWhisperl/fix_forming_nullptr
craftmaster1231 Dec 12, 2025
6aca13d
Merge branch 'master_fix_warns' into fix_variable_may_be_uninitialized
craftmaster1231 Dec 12, 2025
3e66832
Merge pull request #9 from lDeathlWhisperl/fix_variable_may_be_uninit…
craftmaster1231 Dec 12, 2025
88d1557
Merge pull request #12 from lDeathlWhisperl/fix_implicit_conversion
craftmaster1231 Dec 12, 2025
09efd7f
Merge pull request #14 from lDeathlWhisperl/fix_garbage_value
craftmaster1231 Dec 12, 2025
f43dd1a
fixed implicit type conversion errors
3qupo Dec 13, 2025
bfa093b
the default value for trig_t has been added and initialized
3qupo Dec 13, 2025
f335f7c
the default value is 0 as there will be a recalculation
3qupo Dec 13, 2025
0989f39
Merge pull request #4 from 3qupo/fix_by_initialization
craftmaster1231 Dec 17, 2025
e89decc
Merge pull request #5 from 3qupo/fix_passing_arguments
craftmaster1231 Dec 17, 2025
e8a6aee
Merge branch 'master_fix_warns' into master_fix_branch_fix_conflicts
craftmaster1231 Mar 10, 2026
fe60534
Merge pull request #45 from craftmaster1231/master_fix_branch_fix_con…
craftmaster1231 Mar 10, 2026
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 @@ -1602,7 +1602,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;
ULONG num_segments;
const UCHAR* p = blob_info;

Expand Down Expand Up @@ -1777,7 +1777,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;
scan_attr_t scan_next_attr;
skip_init(&scan_next_attr);
att_type attribute;
Expand Down Expand Up @@ -1843,7 +1843,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;
//
// 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 @@ -3375,7 +3375,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 @@ -9078,7 +9078,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;
bool userSet, typeSet;

userSet = typeSet = false;
Expand Down Expand Up @@ -9401,7 +9401,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
Contributor

Choose a reason for hiding this comment

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

This value is better to be named trig_invalid and a check for valid type was assigned should be added.

att_type attribute;
TEXT name[GDS_NAME_LEN];
scan_attr_t scan_next_attr;
Expand Down
2 changes: 1 addition & 1 deletion src/common/CvtFormat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1347,7 +1347,7 @@ namespace
break;
}
if (strOffset >= strLength)
cb->err(Arg::Gds(isc_data_for_format_is_exhausted) << string(it->patternStr.data()));
cb->err(Arg::Gds(isc_data_for_format_is_exhausted) << string(it->patternStr.data(), it->patternStr.length()));

std::string_view patternStr = it->patternStr;

Expand Down
4 changes: 4 additions & 0 deletions src/common/DynamicStrings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ unsigned makeDynamicStrings(unsigned length, ISC_STATUS* const dst, const ISC_ST
case isc_arg_cstring:
fb_assert(string);
*to++ = (ISC_STATUS)(IPTR) string;
if (!string)
break;
memcpy(string, reinterpret_cast<const char*>(from[1]), from[0]);
string += *from++;
*string++ = '\0';
Expand All @@ -97,6 +99,8 @@ unsigned makeDynamicStrings(unsigned length, ISC_STATUS* const dst, const ISC_ST
case isc_arg_sql_state:
fb_assert(string);
*to++ = (ISC_STATUS)(IPTR) string;
if (!string)
break;
strcpy(string, reinterpret_cast<const char*>(*from));
string += strlen(string);
string++;
Expand Down
26 changes: 16 additions & 10 deletions src/common/StatusArg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ StatusVector::ImplStatusVector::ImplStatusVector(const ISC_STATUS* s) noexcept
{
fb_assert(s);

clear();
ImplStatusVector::clear();

// special case - empty initialized status vector, no warnings
if (s[0] != isc_arg_gds || s[1] != 0 || s[2] != 0)
Expand All @@ -78,7 +78,7 @@ StatusVector::ImplStatusVector::ImplStatusVector(const IStatus* s) noexcept
{
fb_assert(s);

clear();
ImplStatusVector::clear();

if (s->getState() & IStatus::STATE_ERRORS)
append(s->getErrors());
Expand All @@ -91,9 +91,9 @@ StatusVector::ImplStatusVector::ImplStatusVector(const Exception& ex) noexcept
m_status_vector(*getDefaultMemoryPool()),
m_strings(*getDefaultMemoryPool())
{
clear();
ImplStatusVector::clear();

assign(ex);
ImplStatusVector::assign(ex);
}

StatusVector::StatusVector(ISC_STATUS k, ISC_STATUS c) :
Expand Down Expand Up @@ -143,7 +143,7 @@ void StatusVector::ImplStatusVector::assign(const StatusVector& v) noexcept

void StatusVector::ImplStatusVector::assign(const Exception& ex) noexcept
{
clear();
ImplStatusVector::clear();
Copy link
Contributor

Choose a reason for hiding this comment

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

Using of class name inside of the class' methods is completely pointless.

ex.stuffException(m_status_vector);
putStrArg(0);
}
Expand Down Expand Up @@ -263,7 +263,7 @@ bool StatusVector::ImplStatusVector::append(const ISC_STATUS* const from, const
if (!count)
return true; // not sure it's the best option here

unsigned lenBefore = length();
unsigned lenBefore = ImplStatusVector::length();
ISC_STATUS* s = m_status_vector.getBuffer(lenBefore + count + 1);
unsigned int copied =
fb_utils::copyStatus(&s[lenBefore], count + 1, from, count);
Expand All @@ -273,7 +273,7 @@ bool StatusVector::ImplStatusVector::append(const ISC_STATUS* const from, const

if (!m_warning)
{
for (unsigned n = 0; n < length(); )
for (unsigned n = 0; n < ImplStatusVector::length(); )
{
if (m_status_vector[n] == isc_arg_warning)
{
Expand Down Expand Up @@ -407,19 +407,25 @@ Num::Num(ISC_STATUS s) noexcept :
Int64::Int64(SINT64 val) noexcept :
Str(text)
{
snprintf(text, sizeof(text), "%" SQUADFORMAT, val);
[[maybe_unused]] auto result = snprintf(text, sizeof(text), "%" SQUADFORMAT, val);
fb_assert(result >= 0);
}

Int64::Int64(FB_UINT64 val) noexcept :
Str(text)
{
snprintf(text, sizeof(text), "%" UQUADFORMAT, val);
[[maybe_unused]] auto result = snprintf(text, sizeof(text), "%" UQUADFORMAT, val);
fb_assert(result >= 0);
}

Quad::Quad(const ISC_QUAD* quad) noexcept :
Str(text)
{
snprintf(text, sizeof(text), "%x:%x", quad->gds_quad_high, quad->gds_quad_low);
[[maybe_unused]] auto result = snprintf(text, sizeof(text), "%x:%x",
static_cast<unsigned int>(quad->gds_quad_high),
quad->gds_quad_low
);
fb_assert(result >= 0);
}

Interpreted::Interpreted(const char* text) noexcept :
Expand Down
6 changes: 3 additions & 3 deletions src/common/StatusArg.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ class Base
virtual void clear() noexcept { }
virtual void append(const StatusVector&) noexcept { }
virtual void prepend(const StatusVector&) noexcept { }
virtual void assign(const StatusVector& ex) noexcept { }
virtual void assign(const Exception& ex) noexcept { }
virtual void assign(const StatusVector&) noexcept { }
virtual void assign(const Exception&) noexcept { }
virtual ISC_STATUS copyTo(ISC_STATUS*) const noexcept { return 0; }
virtual void copyTo(IStatus*) const noexcept { }
virtual void appendTo(IStatus*) const noexcept { }
Expand Down Expand Up @@ -145,7 +145,7 @@ class StatusVector : public Base
m_status_vector(*getDefaultMemoryPool()),
m_strings(*getDefaultMemoryPool())
{
clear();
ImplStatusVector::clear();
}

explicit ImplStatusVector(const ISC_STATUS* s) noexcept;
Expand Down
51 changes: 18 additions & 33 deletions src/common/classes/NoThrowTimeStamp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,51 +341,36 @@ int NoThrowTimeStamp::convertGregorianDateToWeekDate(const struct tm& times) noe
{
// Algorithm for Converting Gregorian Dates to ISO 8601 Week Date by Rick McCarty, 1999
// http://personal.ecu.edu/mccartyr/ISOwdALG.txt

const int y = times.tm_year + 1900;
const int dayOfYearNumber = times.tm_yday + 1;
const int dayOfYear = times.tm_yday + 1;

// Find the jan1Weekday for y (Monday=1, Sunday=7)
const int yy = (y - 1) % 100;
const int c = (y - 1) - yy;
const int g = yy + yy / 4;
const int jan1Weekday = 1 + (((((c / 100) % 4) * 5) + g) % 7);
const int y_1 = y - 1;
const int yy = y_1 % 100;
const int c = y_1 - yy;
const int g = yy + (yy >> 2);
Copy link
Contributor

Choose a reason for hiding this comment

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

Modern compilers are clever enough to reuse pieces of calculation and replace division by 4 with shifts, but division is better readable by human.

const int jan1Weekday = 1 + (((((c / 100) & 3) * 5) + g) % 7);

// Find the weekday for y m d
const int h = dayOfYearNumber + (jan1Weekday - 1);
const int weekday = 1 + ((h - 1) % 7);
const int weekday = 1 + ((dayOfYear + jan1Weekday - 2) % 7);

// Find if y m d falls in yearNumber y-1, weekNumber 52 or 53
int yearNumber, weekNumber;

if ((dayOfYearNumber <= (8 - jan1Weekday)) && (jan1Weekday > 4))
if ((dayOfYear <= (8 - jan1Weekday)) & (jan1Weekday > 4))
{
yearNumber = y - 1;
weekNumber = ((jan1Weekday == 5) || ((jan1Weekday == 6) &&
isLeapYear(yearNumber))) ? 53 : 52;
const int prevYearLeap = (!(y_1 & 3) && ((y_1 % 100) || !(y_1 % 400)));
const int is53 = (jan1Weekday == 5) | ((jan1Weekday == 6) & prevYearLeap);
return 52 + is53;
}
else
{
yearNumber = y;

// Find if y m d falls in yearNumber y+1, weekNumber 1
const int i = isLeapYear(y) ? 366 : 365;

if ((i - dayOfYearNumber) < (4 - weekday))
{
yearNumber = y + 1;
weekNumber = 1;
}
// Find if y m d falls in yearNumber y+1, weekNumber 1
const int daysInYear = 365 + (!(y & 3) && ((y % 100) || !(y % 400)));
if ((daysInYear - dayOfYear) < (4 - weekday))
{
return 1;
}

// Find if y m d falls in yearNumber y, weekNumber 1 through 53
if (yearNumber == y)
{
const int j = dayOfYearNumber + (7 - weekday) + (jan1Weekday - 1);
weekNumber = j / 7;
if (jan1Weekday > 4)
weekNumber--;
}
const int j = dayOfYear + (7 - weekday) + (jan1Weekday - 1);
const int weekNumber = (j / 7) - (jan1Weekday > 4); // Subtract 1 if jan1Weekday > 4

return weekNumber;
}
Expand Down
2 changes: 1 addition & 1 deletion src/common/cvt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1433,7 +1433,7 @@ double CVT_get_double(const dsc* desc, DecimalStatus decSt, ErrorFunction err, b
* Convert something arbitrary to a double precision number
*
**************************************/
double value;
double value = 0.0;

switch (desc->dsc_dtype)
{
Expand Down
2 changes: 1 addition & 1 deletion src/common/isc_sync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1473,7 +1473,7 @@ SharedMemoryBase::SharedMemoryBase(const TEXT* filename, ULONG length, IpcObject
#endif
#endif

memset(sh_mem_mutex->mtx_mutex, 0, sizeof(*(sh_mem_mutex->mtx_mutex)));
memset(sh_mem_mutex->mtx_mutex, 0, sizeof(sh_mem_mutex->mtx_mutex));
Copy link
Contributor

Choose a reason for hiding this comment

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

This change is definitely wrong.

//int state = LOG_PTHREAD_ERROR(pthread_mutex_init(sh_mem_mutex->mtx_mutex, &mattr));
state = pthread_mutex_init(sh_mem_mutex->mtx_mutex, &mattr);

Expand Down
4 changes: 1 addition & 3 deletions src/common/unicode_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1853,7 +1853,7 @@ USHORT UnicodeUtil::Utf16Collation::stringToKey(USHORT srcLen, const USHORT* src
if (keys)
{
UCHAR lastCharKey[BUFFER_TINY]; // sort key for a single character
ULONG prefixLen, lastCharKeyLen;
ULONG prefixLen = 0, lastCharKeyLen = 0;

srcLenLong -= i;

Expand All @@ -1877,8 +1877,6 @@ USHORT UnicodeUtil::Utf16Collation::stringToKey(USHORT srcLen, const USHORT* src
fb_assert(lastCharKey[lastCharKeyLen - 1] == '\0');
--lastCharKeyLen;
}
else
prefixLen = 0;

bool fallbackToPrefixKey = false;

Expand Down
5 changes: 3 additions & 2 deletions src/dsql/DdlNodes.epp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,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;
rel_t childType = rel_persistent;

FOR(REQUEST_HANDLE request TRANSACTION_HANDLE transaction)
RLC_M IN RDB$RELATION_CONSTRAINTS CROSS
Expand Down Expand Up @@ -402,7 +403,7 @@ void defineComputed(DsqlCompilerScratch* dsqlScratch, RelationSourceNode* relati
// Save the size of the field if it is specified.
dsc saveDesc;
saveDesc.dsc_dtype = 0;
bool saveCharSetIdSpecified;
bool saveCharSetIdSpecified = false;

if (field && field->dtype)
{
Expand Down
14 changes: 8 additions & 6 deletions src/dsql/StmtNodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ BlockNode* BlockNode::pass2(thread_db* tdbb, CompilerScratch* csb)
const StmtNode* BlockNode::execute(thread_db* tdbb, Request* request, ExeState* exeState) const
{
jrd_tra* transaction = request->req_transaction;
SavNumber savNumber;
SavNumber savNumber = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

It is better to move this declaration to the points of real use to make sure that savepoint zero is never used by any mistake.


switch (request->req_operation)
{
Expand Down Expand Up @@ -2494,7 +2494,7 @@ void EraseNode::pass1Erase(thread_db* tdbb, CompilerScratch* csb, EraseNode* nod

jrd_rel* parent = NULL;
jrd_rel* view = NULL;
StreamType parentStream;
StreamType parentStream = 0;

for (;;)
{
Expand Down Expand Up @@ -5173,7 +5173,6 @@ void ExecBlockNode::genBlr(DsqlCompilerScratch* dsqlScratch)
{
inputStart = dsqlScratch->variables.getCount();
dsqlScratch->genParameters(parameters, returns);
returnsPos = dsqlScratch->variables.getCount() - dsqlScratch->outputVariables.getCount();
}

if (parameters.hasData())
Expand All @@ -5188,6 +5187,8 @@ void ExecBlockNode::genBlr(DsqlCompilerScratch* dsqlScratch)
{
// This validation is needed only for subroutines. Standard EXECUTE BLOCK moves input
// parameters to variables and are then validated.
// Number of input parameters to validate (total variables minus output variables)
const unsigned returnsPos = dsqlScratch->variables.getCount() - dsqlScratch->outputVariables.getCount();

for (unsigned i = inputStart; i < returnsPos; ++i)
{
Expand Down Expand Up @@ -8035,7 +8036,7 @@ void ModifyNode::pass1Modify(thread_db* tdbb, CompilerScratch* csb, ModifyNode*

jrd_rel* parent = NULL;
jrd_rel* view = NULL;
StreamType parentStream, parentNewStream;
StreamType parentStream = 0, parentNewStream = 0;

// To support nested views, loop until we hit a table or a view with user-defined triggers
// (which means no update).
Expand Down Expand Up @@ -9090,7 +9091,7 @@ bool StoreNode::pass1Store(thread_db* tdbb, CompilerScratch* csb, StoreNode* nod

jrd_rel* parent = NULL;
jrd_rel* view = NULL;
StreamType parentStream;
StreamType parentStream = 0;

// To support nested views, loop until we hit a table or a view with user-defined triggers
// (which means no update).
Expand Down Expand Up @@ -12437,7 +12438,7 @@ static void validateExpressions(thread_db* tdbb, const Array<ValidateInfo>& vali
if (i->boolean->execute(tdbb, request) == TriState(false))
{
// Validation error -- report result
const char* value;
const char* value = nullptr;
VaryStr<TEMP_STR_LENGTH> temp;

const dsc* desc = EVL_expr(tdbb, request, i->value);
Expand All @@ -12449,6 +12450,7 @@ static void validateExpressions(thread_db* tdbb, const Array<ValidateInfo>& vali
else if (!length)
value = "";
else
fb_assert(value);
const_cast<char*>(value)[length] = 0; // safe cast - data is actually on the stack

string name;
Expand Down
2 changes: 2 additions & 0 deletions src/gpre/c_cxx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2668,6 +2668,8 @@ static void gen_put_segment( const act* action, int column)
args.pat_ident1 = blob->blb_len_ident;
args.pat_ident2 = blob->blb_buff_ident;
args.pat_string1 = global_status_name;
args.pat_long1 = NULL;
Copy link
Contributor

Choose a reason for hiding this comment

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

Here and in other places where variable type is SLONG: assign zero instead of NULL, please.

args.pat_long2 = NULL;
PATTERN_expand((USHORT) column, pattern1, &args);

set_sqlcode(action, column);
Expand Down
Loading