Skip to content

Commit fd5a024

Browse files
committed
Fix clang warnings.
1 parent ab4b1d0 commit fd5a024

File tree

7 files changed

+54
-47
lines changed

7 files changed

+54
-47
lines changed

src/common/ThreadStart.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ class ThreadFinishSync
171171
threadArg->exceptionHandler(ex, threadRoutine);
172172
}
173173

174-
if (cleanup)
174+
if (cleanup != nullptr)
175175
cleanup(threadArg);
176176
closing = true;
177177
}

src/common/TimeZoneUtil.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,11 +1057,10 @@ ISC_TIMESTAMP_TZ TimeZoneUtil::dateToTimeStampTz(const ISC_DATE& date, Callbacks
10571057

10581058
//-------------------------------------
10591059

1060-
TimeZoneRuleIterator::TimeZoneRuleIterator(USHORT aId, const ISC_TIMESTAMP_TZ& aFrom, const ISC_TIMESTAMP_TZ& aTo)
1061-
: id(aId),
1062-
icuLib(UnicodeUtil::getConversionICU()),
1060+
TimeZoneRuleIterator::TimeZoneRuleIterator(USHORT id, const ISC_TIMESTAMP_TZ& aFrom, const ISC_TIMESTAMP_TZ& aTo)
1061+
: icuLib(UnicodeUtil::getConversionICU()),
10631062
toTicks(TimeStamp::timeStampToTicks(aTo.utc_timestamp)),
1064-
icuCalendar(getDesc(aId)->getCalendar(icuLib))
1063+
icuCalendar(getDesc(id)->getCalendar(icuLib))
10651064
{
10661065
UErrorCode icuErrorCode = U_ZERO_ERROR;
10671066

src/common/TimeZoneUtil.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ class IcuCalendarWrapper
199199
class TimeZoneRuleIterator
200200
{
201201
public:
202-
TimeZoneRuleIterator(USHORT aId, const ISC_TIMESTAMP_TZ& aFrom, const ISC_TIMESTAMP_TZ& aTo);
202+
TimeZoneRuleIterator(USHORT id, const ISC_TIMESTAMP_TZ& aFrom, const ISC_TIMESTAMP_TZ& aTo);
203203

204204
public:
205205
bool next();
@@ -211,7 +211,6 @@ class TimeZoneRuleIterator
211211
SSHORT dstOffset;
212212

213213
private:
214-
const USHORT id;
215214
UnicodeUtil::ConversionICU& icuLib;
216215
SINT64 startTicks;
217216
SINT64 toTicks;

src/common/classes/array.h

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ class Array : protected Storage
186186
void copyFrom(const Array<T, Storage>& source)
187187
{
188188
ensureCapacity(source.count, false);
189-
memcpy(data, source.data, sizeof(T) * source.count);
189+
memcpy(static_cast<void*>(data), source.data, sizeof(T) * source.count);
190190
count = source.count;
191191
}
192192

@@ -244,7 +244,7 @@ class Array : protected Storage
244244
fb_assert(index <= count);
245245
fb_assert(count < FB_MAX_SIZEOF);
246246
ensureCapacity(count + 1);
247-
memmove(data + index + 1, data + index, sizeof(T) * (count++ - index));
247+
memmove(static_cast<void*>(data + index + 1), data + index, sizeof(T) * (count++ - index));
248248
data[index] = item;
249249
}
250250

@@ -253,8 +253,8 @@ class Array : protected Storage
253253
fb_assert(index <= count);
254254
fb_assert(count <= FB_MAX_SIZEOF - items.count);
255255
ensureCapacity(count + items.count);
256-
memmove(data + index + items.count, data + index, sizeof(T) * (count - index));
257-
memcpy(data + index, items.data, items.count);
256+
memmove(static_cast<void*>(data + index + items.count), data + index, sizeof(T) * (count - index));
257+
memcpy(static_cast<void*>(data + index), items.data, items.count);
258258
count += items.count;
259259
}
260260

@@ -263,8 +263,8 @@ class Array : protected Storage
263263
fb_assert(index <= count);
264264
fb_assert(count <= FB_MAX_SIZEOF - itemsCount);
265265
ensureCapacity(count + itemsCount);
266-
memmove(data + index + itemsCount, data + index, sizeof(T) * (count - index));
267-
memcpy(data + index, items, sizeof(T) * itemsCount);
266+
memmove(static_cast<void*>(data + index + itemsCount), data + index, sizeof(T) * (count - index));
267+
memcpy(static_cast<void*>(data + index), items, sizeof(T) * itemsCount);
268268
count += itemsCount;
269269
}
270270

@@ -285,39 +285,39 @@ class Array : protected Storage
285285
{
286286
fb_assert(count <= FB_MAX_SIZEOF - itemsCount);
287287
ensureCapacity(count + itemsCount);
288-
memcpy(data + count, items, sizeof(T) * itemsCount);
288+
memcpy(static_cast<void*>(data + count), items, sizeof(T) * itemsCount);
289289
count += itemsCount;
290290
}
291291

292292
T* remove(const size_type index) noexcept
293293
{
294-
fb_assert(index < count);
295-
memmove(data + index, data + index + 1, sizeof(T) * (--count - index));
294+
fb_assert(index < count);
295+
memmove(static_cast<void*>(data + index), data + index + 1, sizeof(T) * (--count - index));
296296
return &data[index];
297297
}
298298

299299
T* removeRange(const size_type from, const size_type to) noexcept
300300
{
301-
fb_assert(from <= to);
302-
fb_assert(to <= count);
303-
memmove(data + from, data + to, sizeof(T) * (count - to));
301+
fb_assert(from <= to);
302+
fb_assert(to <= count);
303+
memmove(static_cast<void*>(data + from), data + to, sizeof(T) * (count - to));
304304
count -= (to - from);
305305
return &data[from];
306306
}
307307

308308
T* removeCount(const size_type index, const size_type n) noexcept
309309
{
310-
fb_assert(index + n <= count);
311-
memmove(data + index, data + index + n, sizeof(T) * (count - index - n));
310+
fb_assert(index + n <= count);
311+
memmove(static_cast<void*>(data + index), data + index + n, sizeof(T) * (count - index - n));
312312
count -= n;
313313
return &data[index];
314314
}
315315

316316
T* remove(T* itr) noexcept
317317
{
318318
const size_type index = itr - begin();
319-
fb_assert(index < count);
320-
memmove(data + index, data + index + 1, sizeof(T) * (--count - index));
319+
fb_assert(index < count);
320+
memmove(static_cast<void*>(data + index), data + index + 1, sizeof(T) * (--count - index));
321321
return &data[index];
322322
}
323323

@@ -337,7 +337,7 @@ class Array : protected Storage
337337
{
338338
fb_assert(newCount >= count);
339339
ensureCapacity(newCount);
340-
memset(data + count, 0, sizeof(T) * (newCount - count));
340+
memset(static_cast<void*>(data + count), 0, sizeof(T) * (newCount - count));
341341
count = newCount;
342342
}
343343

@@ -371,7 +371,7 @@ class Array : protected Storage
371371
{
372372
fb_assert(count <= FB_MAX_SIZEOF - L.count);
373373
ensureCapacity(count + L.count);
374-
memcpy(data + count, L.data, sizeof(T) * L.count);
374+
memcpy(static_cast<void*>(data + count), L.data, sizeof(T) * L.count);
375375
count += L.count;
376376
}
377377

@@ -383,7 +383,7 @@ class Array : protected Storage
383383
void assign(const T* items, const size_type itemsCount)
384384
{
385385
resize(itemsCount);
386-
memcpy(data, items, sizeof(T) * count);
386+
memcpy(static_cast<void*>(data), items, sizeof(T) * count);
387387
}
388388

389389
size_type getCount() const noexcept { return count; }
@@ -403,7 +403,7 @@ class Array : protected Storage
403403
{
404404
fb_assert(count <= FB_MAX_SIZEOF - itemsSize);
405405
ensureCapacity(count + itemsSize);
406-
memcpy(data + count, items, sizeof(T) * itemsSize);
406+
memcpy(static_cast<void*>(data + count), items, sizeof(T) * itemsSize);
407407
count += itemsSize;
408408
}
409409

@@ -533,7 +533,7 @@ class Array : protected Storage
533533
T* newdata = static_cast<T*>
534534
(this->getPool().allocate(sizeof(T) * newcapacity ALLOC_ARGS));
535535
if (preserve)
536-
memcpy(newdata, data, sizeof(T) * count);
536+
memcpy(static_cast<void*>(newdata), data, sizeof(T) * count);
537537
freeData();
538538
data = newdata;
539539
capacity = newcapacity;

src/dsql/AggNodes.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -902,8 +902,9 @@ void ListAggNode::make(DsqlCompilerScratch* dsqlScratch, dsc* desc)
902902
bool ListAggNode::setParameterType(DsqlCompilerScratch* dsqlScratch,
903903
std::function<void (dsc*)> makeDesc, bool forceVarChar)
904904
{
905-
return PASS1_set_parameter_type(dsqlScratch, arg, makeDesc, forceVarChar) |
906-
PASS1_set_parameter_type(dsqlScratch, delimiter, makeDesc, forceVarChar);
905+
const bool argType = PASS1_set_parameter_type(dsqlScratch, arg, makeDesc, forceVarChar);
906+
const bool delimiterType = PASS1_set_parameter_type(dsqlScratch, delimiter, makeDesc, forceVarChar);
907+
return argType || delimiterType;
907908
}
908909

909910
void ListAggNode::getDesc(thread_db* tdbb, CompilerScratch* csb, dsc* desc)

src/dsql/ExprNodes.cpp

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -653,8 +653,9 @@ void ArithmeticNode::setParameterName(dsql_par* parameter) const
653653
bool ArithmeticNode::setParameterType(DsqlCompilerScratch* dsqlScratch,
654654
std::function<void (dsc*)> makeDesc, bool forceVarChar)
655655
{
656-
return PASS1_set_parameter_type(dsqlScratch, arg1, makeDesc, forceVarChar) |
657-
PASS1_set_parameter_type(dsqlScratch, arg2, makeDesc, forceVarChar);
656+
const bool arg1Type = PASS1_set_parameter_type(dsqlScratch, arg1, makeDesc, forceVarChar);
657+
const bool arg2Type = PASS1_set_parameter_type(dsqlScratch, arg2, makeDesc, forceVarChar);
658+
return arg1Type || arg2Type;
658659
}
659660

660661
void ArithmeticNode::genBlr(DsqlCompilerScratch* dsqlScratch)
@@ -3273,8 +3274,10 @@ bool AtNode::setParameterType(DsqlCompilerScratch* dsqlScratch,
32733274
desc->setNullable(true);
32743275
};
32753276

3276-
return PASS1_set_parameter_type(dsqlScratch, dateTimeArg, makeDesc, forceVarChar) |
3277-
PASS1_set_parameter_type(dsqlScratch, zoneArg, makeZoneDesc, forceVarChar);
3277+
const bool dateTimeArgType = PASS1_set_parameter_type(dsqlScratch, dateTimeArg, makeDesc, forceVarChar);
3278+
const bool zoneArgType = PASS1_set_parameter_type(dsqlScratch, zoneArg, makeZoneDesc, forceVarChar);
3279+
3280+
return dateTimeArgType || zoneArgType;
32783281
}
32793282

32803283
void AtNode::genBlr(DsqlCompilerScratch* dsqlScratch)
@@ -4107,8 +4110,9 @@ void ConcatenateNode::setParameterName(dsql_par* parameter) const
41074110
bool ConcatenateNode::setParameterType(DsqlCompilerScratch* dsqlScratch,
41084111
std::function<void (dsc*)> makeDesc, bool forceVarChar)
41094112
{
4110-
return PASS1_set_parameter_type(dsqlScratch, arg1, makeDesc, forceVarChar) |
4111-
PASS1_set_parameter_type(dsqlScratch, arg2, makeDesc, forceVarChar);
4113+
const bool arg1Type = PASS1_set_parameter_type(dsqlScratch, arg1, makeDesc, forceVarChar);
4114+
const bool arg2Type = PASS1_set_parameter_type(dsqlScratch, arg2, makeDesc, forceVarChar);
4115+
return arg1Type || arg2Type;
41124116
}
41134117

41144118
void ConcatenateNode::genBlr(DsqlCompilerScratch* dsqlScratch)
@@ -11893,9 +11897,10 @@ void SubstringNode::setParameterName(dsql_par* parameter) const
1189311897
bool SubstringNode::setParameterType(DsqlCompilerScratch* dsqlScratch,
1189411898
std::function<void (dsc*)> makeDesc, bool forceVarChar)
1189511899
{
11896-
return PASS1_set_parameter_type(dsqlScratch, expr, makeDesc, forceVarChar) |
11897-
PASS1_set_parameter_type(dsqlScratch, start, makeDesc, forceVarChar) |
11898-
PASS1_set_parameter_type(dsqlScratch, length, makeDesc, forceVarChar);
11900+
const bool exprType = PASS1_set_parameter_type(dsqlScratch, expr, makeDesc, forceVarChar);
11901+
const bool startType = PASS1_set_parameter_type(dsqlScratch, start, makeDesc, forceVarChar);
11902+
const bool lengthType = PASS1_set_parameter_type(dsqlScratch, length, makeDesc, forceVarChar);
11903+
return exprType || startType || lengthType;
1189911904
}
1190011905

1190111906
void SubstringNode::genBlr(DsqlCompilerScratch* dsqlScratch)
@@ -12217,9 +12222,10 @@ void SubstringSimilarNode::setParameterName(dsql_par* parameter) const
1221712222
bool SubstringSimilarNode::setParameterType(DsqlCompilerScratch* dsqlScratch,
1221812223
std::function<void (dsc*)> makeDesc, bool forceVarChar)
1221912224
{
12220-
return PASS1_set_parameter_type(dsqlScratch, expr, makeDesc, forceVarChar) |
12221-
PASS1_set_parameter_type(dsqlScratch, pattern, makeDesc, forceVarChar) |
12222-
PASS1_set_parameter_type(dsqlScratch, escape, makeDesc, forceVarChar);
12225+
const bool exprType = PASS1_set_parameter_type(dsqlScratch, expr, makeDesc, forceVarChar);
12226+
const bool patternType = PASS1_set_parameter_type(dsqlScratch, pattern, makeDesc, forceVarChar);
12227+
const bool escapeType = PASS1_set_parameter_type(dsqlScratch, escape, makeDesc, forceVarChar);
12228+
return exprType || patternType || escapeType;
1222312229
}
1222412230

1222512231
void SubstringSimilarNode::genBlr(DsqlCompilerScratch* dsqlScratch)
@@ -12745,8 +12751,9 @@ void TrimNode::setParameterName(dsql_par* parameter) const
1274512751
bool TrimNode::setParameterType(DsqlCompilerScratch* dsqlScratch,
1274612752
std::function<void (dsc*)> makeDesc, bool forceVarChar)
1274712753
{
12748-
return PASS1_set_parameter_type(dsqlScratch, value, makeDesc, forceVarChar) |
12749-
PASS1_set_parameter_type(dsqlScratch, trimChars, makeDesc, forceVarChar);
12754+
const bool valueType = PASS1_set_parameter_type(dsqlScratch, value, makeDesc, forceVarChar);
12755+
const bool trimCharsType = PASS1_set_parameter_type(dsqlScratch, trimChars, makeDesc, forceVarChar);
12756+
return valueType || trimCharsType;
1275012757
}
1275112758

1275212759
void TrimNode::genBlr(DsqlCompilerScratch* dsqlScratch)
@@ -14118,8 +14125,9 @@ void ValueIfNode::setParameterName(dsql_par* parameter) const
1411814125
bool ValueIfNode::setParameterType(DsqlCompilerScratch* dsqlScratch,
1411914126
std::function<void (dsc*)> makeDesc, bool forceVarChar)
1412014127
{
14121-
return PASS1_set_parameter_type(dsqlScratch, trueValue, makeDesc, forceVarChar) |
14122-
PASS1_set_parameter_type(dsqlScratch, falseValue, makeDesc, forceVarChar);
14128+
const bool trueValueType = PASS1_set_parameter_type(dsqlScratch, trueValue, makeDesc, forceVarChar);
14129+
const bool falseValueType = PASS1_set_parameter_type(dsqlScratch, falseValue, makeDesc, forceVarChar);
14130+
return trueValueType || falseValueType;
1412314131
}
1412414132

1412514133
void ValueIfNode::genBlr(DsqlCompilerScratch* dsqlScratch)

src/jrd/recsrc/RecursiveStream.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ void RecursiveStream::cleanupLevel(Request* request, Impure* impure) const
311311
{
312312
record_param* const rpb = &request->req_rpb[stream];
313313
Record* const tempRecord = rpb->rpb_record;
314-
memmove(rpb, p, sizeof(record_param));
314+
memmove(static_cast<void*>(rpb), p, sizeof(record_param));
315315
p += sizeof(record_param);
316316

317317
// We just restored record of current recursion level, delete record

0 commit comments

Comments
 (0)