mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Fixes for some clang static analysis warnings.
This commit is contained in:
parent
f04f16e60b
commit
78aac0995a
16 changed files with 62 additions and 17 deletions
|
|
@ -728,6 +728,7 @@ String ComponentLayout::getComponentMemberVariableName (Component* comp) const
|
||||||
|
|
||||||
void ComponentLayout::setComponentMemberVariableName (Component* comp, const String& newName)
|
void ComponentLayout::setComponentMemberVariableName (Component* comp, const String& newName)
|
||||||
{
|
{
|
||||||
|
jassert (comp != nullptr);
|
||||||
const String oldName (getComponentMemberVariableName (comp));
|
const String oldName (getComponentMemberVariableName (comp));
|
||||||
|
|
||||||
comp->getProperties().set ("memberName", String::empty);
|
comp->getProperties().set ("memberName", String::empty);
|
||||||
|
|
@ -782,6 +783,7 @@ String ComponentLayout::getComponentVirtualClassName (Component* comp) const
|
||||||
|
|
||||||
void ComponentLayout::setComponentVirtualClassName (Component* comp, const String& newName)
|
void ComponentLayout::setComponentVirtualClassName (Component* comp, const String& newName)
|
||||||
{
|
{
|
||||||
|
jassert (comp != nullptr);
|
||||||
const String name (CodeHelpers::makeValidIdentifier (newName, false, false, true));
|
const String name (CodeHelpers::makeValidIdentifier (newName, false, false, true));
|
||||||
|
|
||||||
if (name != getComponentVirtualClassName (comp))
|
if (name != getComponentVirtualClassName (comp))
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,7 @@ public:
|
||||||
}
|
}
|
||||||
else if (mode == imageBrush)
|
else if (mode == imageBrush)
|
||||||
{
|
{
|
||||||
|
jassert (document != nullptr);
|
||||||
loadImage (document);
|
loadImage (document);
|
||||||
|
|
||||||
Rectangle<int> r (imageAnchor.getRectangle (parentArea, document->getComponentLayout()));
|
Rectangle<int> r (imageAnchor.getRectangle (parentArea, document->getComponentLayout()));
|
||||||
|
|
|
||||||
|
|
@ -977,7 +977,10 @@ bool PaintElementPath::getPoint (int index, int pointNumber, double& x, double&
|
||||||
const PathPoint* const p = points [index];
|
const PathPoint* const p = points [index];
|
||||||
|
|
||||||
if (p == nullptr)
|
if (p == nullptr)
|
||||||
|
{
|
||||||
|
x = y = 0;
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
jassert (pointNumber < 3 || p->type == Path::Iterator::cubicTo);
|
jassert (pointNumber < 3 || p->type == Path::Iterator::cubicTo);
|
||||||
jassert (pointNumber < 2 || p->type == Path::Iterator::cubicTo || p->type == Path::Iterator::quadraticTo);
|
jassert (pointNumber < 2 || p->type == Path::Iterator::cubicTo || p->type == Path::Iterator::quadraticTo);
|
||||||
|
|
|
||||||
|
|
@ -215,6 +215,8 @@ void ComponentLayoutEditor::refreshAllComponents()
|
||||||
for (int i = layout.getNumComponents(); --i >= 0;)
|
for (int i = layout.getNumComponents(); --i >= 0;)
|
||||||
{
|
{
|
||||||
Component* const c = layout.getComponent (i);
|
Component* const c = layout.getComponent (i);
|
||||||
|
jassert (c != nullptr);
|
||||||
|
|
||||||
ComponentOverlayComponent* overlay = getOverlayCompFor (c);
|
ComponentOverlayComponent* overlay = getOverlayCompFor (c);
|
||||||
|
|
||||||
bool isNewOverlay = false;
|
bool isNewOverlay = false;
|
||||||
|
|
|
||||||
|
|
@ -218,6 +218,8 @@ void EditingPanelBase::setZoom (double newScale, int anchorX, int anchorY)
|
||||||
magnifier->setScaleFactor (newScale);
|
magnifier->setScaleFactor (newScale);
|
||||||
|
|
||||||
resized();
|
resized();
|
||||||
|
|
||||||
|
jassert (viewport != nullptr);
|
||||||
anchor = viewport->getLocalPoint (editor, anchor);
|
anchor = viewport->getLocalPoint (editor, anchor);
|
||||||
|
|
||||||
viewport->setViewPosition (jlimit (0, jmax (0, viewport->getViewedComponent()->getWidth() - viewport->getViewWidth()),
|
viewport->setViewPosition (jlimit (0, jmax (0, viewport->getViewedComponent()->getWidth() - viewport->getViewWidth()),
|
||||||
|
|
|
||||||
|
|
@ -161,6 +161,7 @@ int ResourceEditorPanel::getColumnAutoSizeWidth (int columnId)
|
||||||
for (int i = document.getResources().size(); --i >= 0;)
|
for (int i = document.getResources().size(); --i >= 0;)
|
||||||
{
|
{
|
||||||
const BinaryResources::BinaryResource* const r = document.getResources() [i];
|
const BinaryResources::BinaryResource* const r = document.getResources() [i];
|
||||||
|
jassert (r != nullptr);
|
||||||
String text;
|
String text;
|
||||||
|
|
||||||
if (columnId == 1)
|
if (columnId == 1)
|
||||||
|
|
|
||||||
|
|
@ -2660,7 +2660,7 @@ void update_metadata_(const FLAC__StreamEncoder *encoder)
|
||||||
b[3] = (FLAC__byte)xx; xx >>= 8;
|
b[3] = (FLAC__byte)xx; xx >>= 8;
|
||||||
b[2] = (FLAC__byte)xx; xx >>= 8;
|
b[2] = (FLAC__byte)xx; xx >>= 8;
|
||||||
b[1] = (FLAC__byte)xx; xx >>= 8;
|
b[1] = (FLAC__byte)xx; xx >>= 8;
|
||||||
b[0] = (FLAC__byte)xx; xx >>= 8;
|
b[0] = (FLAC__byte)xx; //xx >>= 8;
|
||||||
xx = encoder->private_->seek_table->points[i].stream_offset;
|
xx = encoder->private_->seek_table->points[i].stream_offset;
|
||||||
b[15] = (FLAC__byte)xx; xx >>= 8;
|
b[15] = (FLAC__byte)xx; xx >>= 8;
|
||||||
b[14] = (FLAC__byte)xx; xx >>= 8;
|
b[14] = (FLAC__byte)xx; xx >>= 8;
|
||||||
|
|
@ -2669,10 +2669,10 @@ void update_metadata_(const FLAC__StreamEncoder *encoder)
|
||||||
b[11] = (FLAC__byte)xx; xx >>= 8;
|
b[11] = (FLAC__byte)xx; xx >>= 8;
|
||||||
b[10] = (FLAC__byte)xx; xx >>= 8;
|
b[10] = (FLAC__byte)xx; xx >>= 8;
|
||||||
b[9] = (FLAC__byte)xx; xx >>= 8;
|
b[9] = (FLAC__byte)xx; xx >>= 8;
|
||||||
b[8] = (FLAC__byte)xx; xx >>= 8;
|
b[8] = (FLAC__byte)xx; //xx >>= 8;
|
||||||
x = encoder->private_->seek_table->points[i].frame_samples;
|
x = encoder->private_->seek_table->points[i].frame_samples;
|
||||||
b[17] = (FLAC__byte)x; x >>= 8;
|
b[17] = (FLAC__byte)x; x >>= 8;
|
||||||
b[16] = (FLAC__byte)x; x >>= 8;
|
b[16] = (FLAC__byte)x; //x >>= 8;
|
||||||
if(encoder->private_->write_callback(encoder, b, 18, 0, 0, encoder->private_->client_data) != FLAC__STREAM_ENCODER_WRITE_STATUS_OK) {
|
if(encoder->private_->write_callback(encoder, b, 18, 0, 0, encoder->private_->client_data) != FLAC__STREAM_ENCODER_WRITE_STATUS_OK) {
|
||||||
encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
|
encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR;
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -471,7 +471,7 @@ static int fit_line(lsfit_acc *a,int fits,int *y0,int *y1,
|
||||||
xb+= x0;
|
xb+= x0;
|
||||||
yb+= *y0;
|
yb+= *y0;
|
||||||
x2b+= x0 * x0;
|
x2b+= x0 * x0;
|
||||||
y2b+= *y0 * *y0;
|
//y2b+= *y0 * *y0;
|
||||||
xyb+= *y0 * x0;
|
xyb+= *y0 * x0;
|
||||||
bn++;
|
bn++;
|
||||||
}
|
}
|
||||||
|
|
@ -480,7 +480,7 @@ static int fit_line(lsfit_acc *a,int fits,int *y0,int *y1,
|
||||||
xb+= x1;
|
xb+= x1;
|
||||||
yb+= *y1;
|
yb+= *y1;
|
||||||
x2b+= x1 * x1;
|
x2b+= x1 * x1;
|
||||||
y2b+= *y1 * *y1;
|
//y2b+= *y1 * *y1;
|
||||||
xyb+= *y1 * x1;
|
xyb+= *y1 * x1;
|
||||||
bn++;
|
bn++;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -853,7 +853,7 @@ static int _fetch_and_process_packet(OggVorbis_File *vf,
|
||||||
if(ret)return(ret);
|
if(ret)return(ret);
|
||||||
vf->current_serialno=vf->os.serialno;
|
vf->current_serialno=vf->os.serialno;
|
||||||
vf->current_link++;
|
vf->current_link++;
|
||||||
link=0;
|
//link=0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1561,6 +1561,7 @@ int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos){
|
||||||
break;
|
break;
|
||||||
}else
|
}else
|
||||||
result=ogg_stream_packetout(&vf->os,NULL);
|
result=ogg_stream_packetout(&vf->os,NULL);
|
||||||
|
(void) result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2158,6 +2159,8 @@ static void _ov_getlap(OggVorbis_File *vf,vorbis_info *vi,vorbis_dsp_state *vd,
|
||||||
memcpy(lappcm[i]+lapcount,pcm[i],sizeof(**pcm)*samples);
|
memcpy(lappcm[i]+lapcount,pcm[i],sizeof(**pcm)*samples);
|
||||||
lapcount+=samples;
|
lapcount+=samples;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
(void) lapcount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -235,8 +235,14 @@ public:
|
||||||
ElementType operator[] (const int index) const
|
ElementType operator[] (const int index) const
|
||||||
{
|
{
|
||||||
const ScopedLockType lock (getLock());
|
const ScopedLockType lock (getLock());
|
||||||
return isPositiveAndBelow (index, numUsed) ? data.elements [index]
|
|
||||||
: ElementType();
|
if (isPositiveAndBelow (index, numUsed))
|
||||||
|
{
|
||||||
|
jassert (data.elements != nullptr);
|
||||||
|
return data.elements [index];
|
||||||
|
}
|
||||||
|
|
||||||
|
return ElementType();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns one of the elements in the array, without checking the index passed in.
|
/** Returns one of the elements in the array, without checking the index passed in.
|
||||||
|
|
@ -251,7 +257,7 @@ public:
|
||||||
inline ElementType getUnchecked (const int index) const
|
inline ElementType getUnchecked (const int index) const
|
||||||
{
|
{
|
||||||
const ScopedLockType lock (getLock());
|
const ScopedLockType lock (getLock());
|
||||||
jassert (isPositiveAndBelow (index, numUsed));
|
jassert (isPositiveAndBelow (index, numUsed) && data.elements != nullptr);
|
||||||
return data.elements [index];
|
return data.elements [index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -267,7 +273,7 @@ public:
|
||||||
inline ElementType& getReference (const int index) const noexcept
|
inline ElementType& getReference (const int index) const noexcept
|
||||||
{
|
{
|
||||||
const ScopedLockType lock (getLock());
|
const ScopedLockType lock (getLock());
|
||||||
jassert (isPositiveAndBelow (index, numUsed));
|
jassert (isPositiveAndBelow (index, numUsed) && data.elements != nullptr);
|
||||||
return data.elements [index];
|
return data.elements [index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -388,6 +394,7 @@ public:
|
||||||
{
|
{
|
||||||
const ScopedLockType lock (getLock());
|
const ScopedLockType lock (getLock());
|
||||||
data.ensureAllocatedSize (numUsed + 1);
|
data.ensureAllocatedSize (numUsed + 1);
|
||||||
|
jassert (data.elements != nullptr);
|
||||||
|
|
||||||
if (isPositiveAndBelow (indexToInsertAt, numUsed))
|
if (isPositiveAndBelow (indexToInsertAt, numUsed))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -108,6 +108,8 @@ public:
|
||||||
{
|
{
|
||||||
if (minNumElements > numAllocated)
|
if (minNumElements > numAllocated)
|
||||||
setAllocatedSize ((minNumElements + minNumElements / 2 + 8) & ~7);
|
setAllocatedSize ((minNumElements + minNumElements / 2 + 8) & ~7);
|
||||||
|
|
||||||
|
jassert (numAllocated <= 0 || elements != nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Minimises the amount of storage allocated so that it's no more than
|
/** Minimises the amount of storage allocated so that it's no more than
|
||||||
|
|
|
||||||
|
|
@ -129,8 +129,13 @@ public:
|
||||||
inline ObjectClass* operator[] (const int index) const noexcept
|
inline ObjectClass* operator[] (const int index) const noexcept
|
||||||
{
|
{
|
||||||
const ScopedLockType lock (getLock());
|
const ScopedLockType lock (getLock());
|
||||||
return isPositiveAndBelow (index, numUsed) ? data.elements [index]
|
if (isPositiveAndBelow (index, numUsed))
|
||||||
: static_cast <ObjectClass*> (nullptr);
|
{
|
||||||
|
jassert (data.elements != nullptr);
|
||||||
|
return data.elements [index];
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns a pointer to the object at this index in the array, without checking whether the index is in-range.
|
/** Returns a pointer to the object at this index in the array, without checking whether the index is in-range.
|
||||||
|
|
@ -141,7 +146,7 @@ public:
|
||||||
inline ObjectClass* getUnchecked (const int index) const noexcept
|
inline ObjectClass* getUnchecked (const int index) const noexcept
|
||||||
{
|
{
|
||||||
const ScopedLockType lock (getLock());
|
const ScopedLockType lock (getLock());
|
||||||
jassert (isPositiveAndBelow (index, numUsed));
|
jassert (isPositiveAndBelow (index, numUsed) && data.elements != nullptr);
|
||||||
return data.elements [index];
|
return data.elements [index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -248,6 +253,7 @@ public:
|
||||||
{
|
{
|
||||||
const ScopedLockType lock (getLock());
|
const ScopedLockType lock (getLock());
|
||||||
data.ensureAllocatedSize (numUsed + 1);
|
data.ensureAllocatedSize (numUsed + 1);
|
||||||
|
jassert (data.elements != nullptr);
|
||||||
data.elements [numUsed++] = const_cast <ObjectClass*> (newObject);
|
data.elements [numUsed++] = const_cast <ObjectClass*> (newObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -279,6 +285,7 @@ public:
|
||||||
indexToInsertAt = numUsed;
|
indexToInsertAt = numUsed;
|
||||||
|
|
||||||
data.ensureAllocatedSize (numUsed + 1);
|
data.ensureAllocatedSize (numUsed + 1);
|
||||||
|
jassert (data.elements != nullptr);
|
||||||
|
|
||||||
ObjectClass** const e = data.elements + indexToInsertAt;
|
ObjectClass** const e = data.elements + indexToInsertAt;
|
||||||
const int numToMove = numUsed - indexToInsertAt;
|
const int numToMove = numUsed - indexToInsertAt;
|
||||||
|
|
@ -431,6 +438,7 @@ public:
|
||||||
numElementsToAdd = arrayToAddFrom.size() - startIndex;
|
numElementsToAdd = arrayToAddFrom.size() - startIndex;
|
||||||
|
|
||||||
data.ensureAllocatedSize (numUsed + numElementsToAdd);
|
data.ensureAllocatedSize (numUsed + numElementsToAdd);
|
||||||
|
jassert (data.elements != nullptr);
|
||||||
|
|
||||||
while (--numElementsToAdd >= 0)
|
while (--numElementsToAdd >= 0)
|
||||||
{
|
{
|
||||||
|
|
@ -471,6 +479,7 @@ public:
|
||||||
numElementsToAdd = arrayToAddFrom.size() - startIndex;
|
numElementsToAdd = arrayToAddFrom.size() - startIndex;
|
||||||
|
|
||||||
data.ensureAllocatedSize (numUsed + numElementsToAdd);
|
data.ensureAllocatedSize (numUsed + numElementsToAdd);
|
||||||
|
jassert (data.elements != nullptr);
|
||||||
|
|
||||||
while (--numElementsToAdd >= 0)
|
while (--numElementsToAdd >= 0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -297,6 +297,7 @@ public:
|
||||||
{
|
{
|
||||||
const ScopedLockType lock (getLock());
|
const ScopedLockType lock (getLock());
|
||||||
data.ensureAllocatedSize (numUsed + 1);
|
data.ensureAllocatedSize (numUsed + 1);
|
||||||
|
jassert (data.elements != nullptr);
|
||||||
data.elements [numUsed++] = newObject;
|
data.elements [numUsed++] = newObject;
|
||||||
|
|
||||||
if (newObject != nullptr)
|
if (newObject != nullptr)
|
||||||
|
|
@ -327,6 +328,7 @@ public:
|
||||||
indexToInsertAt = numUsed;
|
indexToInsertAt = numUsed;
|
||||||
|
|
||||||
data.ensureAllocatedSize (numUsed + 1);
|
data.ensureAllocatedSize (numUsed + 1);
|
||||||
|
jassert (data.elements != nullptr);
|
||||||
|
|
||||||
ObjectClass** const e = data.elements + indexToInsertAt;
|
ObjectClass** const e = data.elements + indexToInsertAt;
|
||||||
const int numToMove = numUsed - indexToInsertAt;
|
const int numToMove = numUsed - indexToInsertAt;
|
||||||
|
|
@ -393,6 +395,7 @@ public:
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
data.ensureAllocatedSize (numUsed + 1);
|
data.ensureAllocatedSize (numUsed + 1);
|
||||||
|
jassert (data.elements != nullptr);
|
||||||
data.elements [numUsed++] = newObject;
|
data.elements [numUsed++] = newObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,16 @@
|
||||||
#define juce_breakDebugger { __asm int 3 }
|
#define juce_breakDebugger { __asm int 3 }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if JUCE_CLANG && defined (__has_feature) && ! defined (JUCE_ANALYZER_NORETURN)
|
||||||
|
#if __has_feature (attribute_analyzer_noreturn)
|
||||||
|
inline void __attribute__((analyzer_noreturn)) juce_assert_noreturn() {}
|
||||||
|
#define JUCE_ANALYZER_NORETURN juce_assert_noreturn();
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef JUCE_ANALYZER_NORETURN
|
||||||
|
#define JUCE_ANALYZER_NORETURN
|
||||||
|
#endif
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
#if JUCE_DEBUG || DOXYGEN
|
#if JUCE_DEBUG || DOXYGEN
|
||||||
|
|
@ -97,7 +107,7 @@
|
||||||
It is only compiled in a debug build, (unless JUCE_LOG_ASSERTIONS is enabled for your build).
|
It is only compiled in a debug build, (unless JUCE_LOG_ASSERTIONS is enabled for your build).
|
||||||
@see jassert
|
@see jassert
|
||||||
*/
|
*/
|
||||||
#define jassertfalse { juce_LogCurrentAssertion; if (juce::juce_isRunningUnderDebugger()) juce_breakDebugger; }
|
#define jassertfalse { juce_LogCurrentAssertion; if (juce::juce_isRunningUnderDebugger()) juce_breakDebugger; JUCE_ANALYZER_NORETURN }
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
/** Platform-independent assertion macro.
|
/** Platform-independent assertion macro.
|
||||||
|
|
|
||||||
|
|
@ -200,7 +200,7 @@ png_user_version_check(png_structrp png_ptr, png_const_charp user_png_ver)
|
||||||
"Application built with libpng-");
|
"Application built with libpng-");
|
||||||
pos = png_safecat(m, (sizeof m), pos, user_png_ver);
|
pos = png_safecat(m, (sizeof m), pos, user_png_ver);
|
||||||
pos = png_safecat(m, (sizeof m), pos, " but running with ");
|
pos = png_safecat(m, (sizeof m), pos, " but running with ");
|
||||||
pos = png_safecat(m, (sizeof m), pos, png_libpng_ver);
|
png_safecat(m, (sizeof m), pos, png_libpng_ver);
|
||||||
|
|
||||||
png_warning(png_ptr, m);
|
png_warning(png_ptr, m);
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -1720,7 +1720,7 @@ png_icc_profile_error(png_const_structrp png_ptr, png_colorspacerp colorspace,
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
/* The 'reason' is an arbitrary message, allow +79 maximum 195 */
|
/* The 'reason' is an arbitrary message, allow +79 maximum 195 */
|
||||||
pos = png_safecat(message, (sizeof message), pos, reason);
|
png_safecat(message, (sizeof message), pos, reason);
|
||||||
|
|
||||||
/* This is recoverable, but make it unconditionally an app_error on write to
|
/* This is recoverable, but make it unconditionally an app_error on write to
|
||||||
* avoid writing invalid ICC profiles into PNG files. (I.e. we handle them
|
* avoid writing invalid ICC profiles into PNG files. (I.e. we handle them
|
||||||
|
|
|
||||||
|
|
@ -3862,7 +3862,7 @@ png_read_filter_row_paeth_multibyte_pixel(png_row_infop row_info, png_bytep row,
|
||||||
if (pb < pa) pa = pb, a = b;
|
if (pb < pa) pa = pb, a = b;
|
||||||
if (pc < pa) a = c;
|
if (pc < pa) a = c;
|
||||||
|
|
||||||
c = b;
|
//c = b;
|
||||||
a += *row;
|
a += *row;
|
||||||
*row++ = (png_byte)a;
|
*row++ = (png_byte)a;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue