Skip to content

Commit

Permalink
UartOW.cpp example: Use .data() string accessor instead of .c_str().
Browse files Browse the repository at this point in the history
.c_str() works accidentally, but is technically incorrect as these
"strings" can have embedded 0 bytes in them.

Signed-off-by: Jon Trulson <jtrulson@ics.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
  • Loading branch information
jontrulson authored and arfoll committed Jan 19, 2017
1 parent c3332f5 commit e386300
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion examples/c++/UartOW.cpp
Expand Up @@ -59,7 +59,7 @@ main(int argc, char** argv)
while (!id.empty()) {
// hack so we don't need to cast each element of the romcode
// for printf purposes
uint8_t* ptr = (uint8_t*) id.c_str();
uint8_t* ptr = (uint8_t*) id.data();

// The first byte (0) is the device type (family) code.
// The last byte (7) is the rom code CRC value. The
Expand Down

0 comments on commit e386300

Please sign in to comment.