Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Unified Diff: tools/battor_agent/battor_protocol_types_unittest.cc

Issue 1634263004: tools/battor_agent: Fixes VS warnings for protocol types unit test (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/battor_agent/battor_protocol_types_unittest.cc
diff --git a/tools/battor_agent/battor_protocol_types_unittest.cc b/tools/battor_agent/battor_protocol_types_unittest.cc
index dac04771111318e1b9053be58a67edfb377050b0..46416cdd44b25cc2f0efb5e9f7f8870ead90dd34 100644
--- a/tools/battor_agent/battor_protocol_types_unittest.cc
+++ b/tools/battor_agent/battor_protocol_types_unittest.cc
@@ -16,7 +16,8 @@ namespace battor {
namespace {
// Prints the character array as hex to a comma-separated list.
-std::string CharArrayToFormattedString(const char* arr, size_t length) {
+std::string CharArrayToFormattedString(const unsigned char* arr,
+ size_t length) {
std::string s;
char num_buff[6];
@@ -36,7 +37,7 @@ const BattOrEEPROM kUnserializedEEPROM{
};
// The serialized version of the above EEPROM.
-const char kSerializedEEPROM[] = {
+const unsigned char kSerializedEEPROM[] = {
0x00, 0x00, 0x00, 0x01, 0x02, 0x00, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c,
0x6e, 0x6f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00,
@@ -54,8 +55,8 @@ TEST(BattOrProtocolTypeTest, EEPROMSerializesCorrectly) {
// the EEPROM will change in the future and we'll need to update the
// serialized version when it does, it makes sense to print the bytes as a
// string that can just be copied and pasted into kSerializedEEPROM.
- const char* eeprom_bytes =
- reinterpret_cast<const char*>(&kUnserializedEEPROM);
+ const unsigned char* eeprom_bytes =
+ reinterpret_cast<const unsigned char*>(&kUnserializedEEPROM);
ASSERT_EQ(
CharArrayToFormattedString(kSerializedEEPROM, sizeof(kSerializedEEPROM)),
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698