Cppcheck warnings.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2017-03-09 12:23:36 +02:00
parent ec7961c628
commit 778cbb2a70
3 changed files with 16 additions and 12 deletions

View File

@ -3170,7 +3170,6 @@ void DL_Dxf::writeMText(DL_WriterA& dw,
// Creare text chunks of 250 characters each: // Creare text chunks of 250 characters each:
int length = static_cast<int>(data.text.length()); int length = static_cast<int>(data.text.length());
// cppcheck-suppress arrayIndexOutOfBounds
char chunk[251]; char chunk[251];
int i; int i;
for (i=250; i<length; i+=250) for (i=250; i<length; i+=250)
@ -3186,7 +3185,6 @@ QT_WARNING_PUSH
QT_WARNING_DISABLE_MSVC(4996) QT_WARNING_DISABLE_MSVC(4996)
strncpy(chunk, &data.text.c_str()[i-250], 250); strncpy(chunk, &data.text.c_str()[i-250], 250);
QT_WARNING_POP QT_WARNING_POP
// cppcheck-suppress arrayIndexOutOfBounds
chunk[250]='\0'; chunk[250]='\0';
dw.dxfString(1, chunk); dw.dxfString(1, chunk);

View File

@ -55,6 +55,7 @@ struct PosterData
QRect rect; // rect section QRect rect; // rect section
}; };
// cppcheck-suppress noConstructor
class VPoster class VPoster
{ {
Q_DECLARE_TR_FUNCTIONS(VPoster) Q_DECLARE_TR_FUNCTIONS(VPoster)

View File

@ -107,22 +107,27 @@ enum { HAVE_TRAP_INSTRUCTION = 0 };
__attribute__((gnu_inline, always_inline)) __attribute__((gnu_inline, always_inline))
__inline__ static void debug_break(void) __inline__ static void debug_break(void)
{ {
if (HAVE_TRAP_INSTRUCTION) { #if defined(_WIN32) || defined(_WIN64)
/* SIGTRAP available only on POSIX-compliant operating systems
* use builtin trap instead */
HAVE_TRAP_INSTRUCTIO ? trap_instruction() : __builtin_trap();
#else
if (HAVE_TRAP_INSTRUCTION)
{
trap_instruction(); trap_instruction();
} else if (DEBUG_BREAK_PREFER_BUILTIN_TRAP_TO_SIGTRAP) { }
else if (DEBUG_BREAK_PREFER_BUILTIN_TRAP_TO_SIGTRAP)
{
/* raises SIGILL on Linux x86{,-64}, to continue in gdb: /* raises SIGILL on Linux x86{,-64}, to continue in gdb:
* (gdb) handle SIGILL stop nopass * (gdb) handle SIGILL stop nopass
* */ * */
__builtin_trap(); __builtin_trap();
} else {
#if defined(_WIN32) || defined(_WIN64)
/* SIGTRAP available only on POSIX-compliant operating systems
* use builtin trap instead */
__builtin_trap();
#else
raise(SIGTRAP);
#endif
} }
else
{
raise(SIGTRAP);
}
#endif
} }
#ifdef __cplusplus #ifdef __cplusplus