From 6f68e07aa5cc72efc57475d2dd508f6727e177b3 Mon Sep 17 00:00:00 2001 From: Jon Trulson Date: Thu, 3 Mar 2016 14:47:12 -0700 Subject: [PATCH] pn532: fix narrowing conversions (c++11) Signed-off-by: Jon Trulson Signed-off-by: Mihai Tudor Panu --- src/pn532/pn532.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pn532/pn532.cxx b/src/pn532/pn532.cxx index 997c9f89..d0e7b221 100644 --- a/src/pn532/pn532.cxx +++ b/src/pn532/pn532.cxx @@ -993,7 +993,8 @@ bool PN532::mifareclassic_WriteNDEFURI (uint8_t sectorNumber, // in NDEF records // Setup the sector buffer (w/pre-formatted TLV wrapper and NDEF message) - uint8_t sectorbuffer1[16] = {0x00, 0x00, 0x03, len+5, 0xD1, 0x01, len+1, + uint8_t sectorbuffer1[16] = {0x00, 0x00, 0x03, static_cast(len+5), + 0xD1, 0x01, static_cast(len+1), 0x55, uriIdentifier, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; uint8_t sectorbuffer2[16] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -1330,11 +1331,11 @@ bool PN532::ntag2xx_WriteNDEFURI (NDEF_URI_T uriIdentifier, char * url, each lock bit can lock (4 bit + 4 bits) */ /* NDEF Message TLV - URI Record */ 0x03, /* Tag Field (0x03 = NDEF Message) */ - len+5, /* Payload Length (not including 0xFE trailer) */ + static_cast(len+5), /* Payload Length (not including 0xFE trailer) */ 0xD1, /* NDEF Record Header (TNF=0x1:Well known record + SR + ME + MB) */ 0x01, /* Type Length for the record type indicator */ - len+1, /* Payload len */ + static_cast(len+1), /* Payload len */ 0x55, /* Record Type Indicator (0x55 or 'U' = URI Record) */ uriIdentifier /* URI Prefix (ex. 0x01 = "http://www.") */ };