Fix gcc10 compiler warnings

- fix attribute format for MINGW in tinycbor/cbor.h
- add pragma to prevent "unaligned pointer" warning in cmddata.c. We know what we are doing there.
- whitespace fixes
This commit is contained in:
pwpiwi 2021-01-29 08:26:33 +01:00
commit 8ac5d5cba1
2 changed files with 59 additions and 52 deletions

View file

@ -815,7 +815,7 @@ int FSKrawDemod(const char *Cmd, bool verbose)
setDemodBuf(BitStream,size,0);
setClockGrid(rfLen, startIdx);
// Now output the bitstream to the scrollback by line of 16 bits
// Now output the bitstream to the scrollback by line of 16 bits
if (verbose || g_debugMode) {
PrintAndLog("\nUsing Clock:%u, invert:%u, fchigh:%u, fclow:%u", (unsigned int)rfLen, (unsigned int)invert, (unsigned int)fchigh, (unsigned int)fclow);
PrintAndLog("%s decoded bitstream:",GetFSKType(fchigh,fclow,invert));
@ -1206,13 +1206,16 @@ int getSamples(int n, bool silent)
uint8_t bits_per_sample = 8;
//Old devices without this feature would send 0 at arg[0]
if(response.arg[0] > 0)
{
if(response.arg[0] > 0) {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Waddress-of-packed-member"
sample_config *sc = (sample_config *) response.d.asBytes;
#pragma GCC diagnostic pop
if (!silent) PrintAndLog("Samples @ %d bits/smpl, decimation 1:%d ", sc->bits_per_sample
, sc->decimation);
bits_per_sample = sc->bits_per_sample;
}
if(bits_per_sample < 8)
{
if (!silent) PrintAndLog("Unpacking...");

View file

@ -581,7 +581,11 @@ enum CborPrettyFlags {
typedef CborError (*CborStreamFunction)(void *token, const char *fmt, ...)
#ifdef __GNUC__
__attribute__((__format__(printf, 2, 3)))
#if defined(__MINGW32__) || defined(__MINGW64__)
__attribute__((__format__(__MINGW_PRINTF_FORMAT, 2, 3)))
#else
__attribute__((__format__(printf, 2, 3)))
#endif
#endif
;