Chromium Code Reviews| Index: net/dns/record_rdata_unittest.cc |
| diff --git a/net/dns/record_rdata_unittest.cc b/net/dns/record_rdata_unittest.cc |
| index 30ce8be302b72226e2b473a8674fdcd52acf035e..69eb0936fc404e94ab684ced7a13441495b50689 100644 |
| --- a/net/dns/record_rdata_unittest.cc |
| +++ b/net/dns/record_rdata_unittest.cc |
| @@ -17,26 +17,27 @@ TEST(RecordRdataTest, ParseSrvRecord) { |
| // These are just the rdata portions of the DNS records, rather than complete |
| // records, but it works well enough for this test. |
| - const char record[] = { |
| - '\x00', '\x01', |
| - '\x00', '\x02', |
| - '\x00', '\x50', |
| - '\x03', 'w', 'w', 'w', |
| - '\x06', 'g', 'o', 'o', 'g', 'l', 'e', |
| - '\x03', 'c', 'o', 'm', |
| - '\x00', |
| - '\x01', '\x01', |
| - '\x01', '\x02', |
| - '\x01', '\x03', |
| - '\x04', 'w', 'w', 'w', '2', |
| - '\xc0', '\x0a', // Pointer to "google.com" |
| + const uint8 record[] = { |
| + 0x00, 0x01, |
| + 0x00, 0x02, |
| + 0x00, 0x50, |
| + 0x03, 'w', 'w', 'w', |
| + 0x06, 'g', 'o', 'o', 'g', 'l', 'e', |
| + 0x03, 'c', 'o', 'm', |
| + 0x00, |
| + 0x01, 0x01, |
| + 0x01, 0x02, |
| + 0x01, 0x03, |
| + 0x04, 'w', 'w', 'w', '2', |
| + 0xc0, 0x0a, // Pointer to "google.com" |
| }; |
| DnsRecordParser parser(record, sizeof(record), 0); |
| const unsigned first_record_len = 22; |
| - base::StringPiece record1_strpiece(record, first_record_len); |
| + const char* record_cc = reinterpret_cast<const char*>(record); |
| + base::StringPiece record1_strpiece(record_cc, first_record_len); |
|
szym
2013/08/01 14:28:27
This is done 8 times in this file. Suggest helper
Mostyn Bramley-Moore
2013/08/01 14:56:24
Done.
|
| base::StringPiece record2_strpiece( |
| - record + first_record_len, sizeof(record) - first_record_len); |
| + record_cc + first_record_len, sizeof(record) - first_record_len); |
| record1_obj = SrvRecordRdata::Create(record1_strpiece, parser); |
| ASSERT_TRUE(record1_obj != NULL); |
| @@ -64,12 +65,13 @@ TEST(RecordRdataTest, ParseARecord) { |
| // These are just the rdata portions of the DNS records, rather than complete |
| // records, but it works well enough for this test. |
| - const char record[] = { |
| - '\x7F', '\x00', '\x00', '\x01' // 127.0.0.1 |
| + const uint8 record[] = { |
| + 0x7F, 0x00, 0x00, 0x01 // 127.0.0.1 |
| }; |
| DnsRecordParser parser(record, sizeof(record), 0); |
| - base::StringPiece record_strpiece(record, sizeof(record)); |
| + base::StringPiece record_strpiece( |
| + reinterpret_cast<const char*>(record), sizeof(record)); |
| record_obj = ARecordRdata::Create(record_strpiece, parser); |
| ASSERT_TRUE(record_obj != NULL); |
| @@ -85,15 +87,16 @@ TEST(RecordRdataTest, ParseAAAARecord) { |
| // These are just the rdata portions of the DNS records, rather than complete |
| // records, but it works well enough for this test. |
| - const char record[] = { |
| - '\x12', '\x34', '\x56', '\x78', |
| - '\x00', '\x00', '\x00', '\x00', |
| - '\x00', '\x00', '\x00', '\x00', |
| - '\x00', '\x00', '\x00', '\x09' // 1234:5678::9A |
| + const uint8 record[] = { |
| + 0x12, 0x34, 0x56, 0x78, |
| + 0x00, 0x00, 0x00, 0x00, |
| + 0x00, 0x00, 0x00, 0x00, |
| + 0x00, 0x00, 0x00, 0x09 // 1234:5678::9A |
| }; |
| DnsRecordParser parser(record, sizeof(record), 0); |
| - base::StringPiece record_strpiece(record, sizeof(record)); |
| + base::StringPiece record_strpiece( |
| + reinterpret_cast<const char*>(record), sizeof(record)); |
| record_obj = AAAARecordRdata::Create(record_strpiece, parser); |
| ASSERT_TRUE(record_obj != NULL); |
| @@ -110,15 +113,16 @@ TEST(RecordRdataTest, ParseCnameRecord) { |
| // These are just the rdata portions of the DNS records, rather than complete |
| // records, but it works well enough for this test. |
| - const char record[] = { |
| - '\x03', 'w', 'w', 'w', |
| - '\x06', 'g', 'o', 'o', 'g', 'l', 'e', |
| - '\x03', 'c', 'o', 'm', |
| - '\x00' |
| + const uint8 record[] = { |
| + 0x03, 'w', 'w', 'w', |
| + 0x06, 'g', 'o', 'o', 'g', 'l', 'e', |
| + 0x03, 'c', 'o', 'm', |
| + 0x00 |
| }; |
| DnsRecordParser parser(record, sizeof(record), 0); |
| - base::StringPiece record_strpiece(record, sizeof(record)); |
| + base::StringPiece record_strpiece( |
| + reinterpret_cast<const char*>(record), sizeof(record)); |
| record_obj = CnameRecordRdata::Create(record_strpiece, parser); |
| ASSERT_TRUE(record_obj != NULL); |
| @@ -134,15 +138,16 @@ TEST(RecordRdataTest, ParsePtrRecord) { |
| // These are just the rdata portions of the DNS records, rather than complete |
| // records, but it works well enough for this test. |
| - const char record[] = { |
| - '\x03', 'w', 'w', 'w', |
| - '\x06', 'g', 'o', 'o', 'g', 'l', 'e', |
| - '\x03', 'c', 'o', 'm', |
| - '\x00' |
| + const uint8 record[] = { |
| + 0x03, 'w', 'w', 'w', |
| + 0x06, 'g', 'o', 'o', 'g', 'l', 'e', |
| + 0x03, 'c', 'o', 'm', |
| + 0x00 |
| }; |
| DnsRecordParser parser(record, sizeof(record), 0); |
| - base::StringPiece record_strpiece(record, sizeof(record)); |
| + base::StringPiece record_strpiece( |
| + reinterpret_cast<const char*>(record), sizeof(record)); |
| record_obj = PtrRecordRdata::Create(record_strpiece, parser); |
| ASSERT_TRUE(record_obj != NULL); |
| @@ -158,14 +163,15 @@ TEST(RecordRdataTest, ParseTxtRecord) { |
| // These are just the rdata portions of the DNS records, rather than complete |
| // records, but it works well enough for this test. |
| - const char record[] = { |
| - '\x03', 'w', 'w', 'w', |
| - '\x06', 'g', 'o', 'o', 'g', 'l', 'e', |
| - '\x03', 'c', 'o', 'm' |
| + const uint8 record[] = { |
| + 0x03, 'w', 'w', 'w', |
| + 0x06, 'g', 'o', 'o', 'g', 'l', 'e', |
| + 0x03, 'c', 'o', 'm' |
| }; |
| DnsRecordParser parser(record, sizeof(record), 0); |
| - base::StringPiece record_strpiece(record, sizeof(record)); |
| + base::StringPiece record_strpiece( |
| + reinterpret_cast<const char*>(record), sizeof(record)); |
| record_obj = TxtRecordRdata::Create(record_strpiece, parser); |
| ASSERT_TRUE(record_obj != NULL); |
| @@ -186,16 +192,17 @@ TEST(RecordRdataTest, ParseNsecRecord) { |
| // These are just the rdata portions of the DNS records, rather than complete |
| // records, but it works well enough for this test. |
| - const char record[] = { |
| - '\x03', 'w', 'w', 'w', |
| - '\x06', 'g', 'o', 'o', 'g', 'l', 'e', |
| - '\x03', 'c', 'o', 'm', |
| - '\x00', |
| - '\x00', '\x02', '\x40', '\x01' |
| + const uint8 record[] = { |
| + 0x03, 'w', 'w', 'w', |
| + 0x06, 'g', 'o', 'o', 'g', 'l', 'e', |
| + 0x03, 'c', 'o', 'm', |
| + 0x00, |
| + 0x00, 0x02, 0x40, 0x01 |
| }; |
| DnsRecordParser parser(record, sizeof(record), 0); |
| - base::StringPiece record_strpiece(record, sizeof(record)); |
| + base::StringPiece record_strpiece( |
| + reinterpret_cast<const char*>(record), sizeof(record)); |
| record_obj = NsecRecordRdata::Create(record_strpiece, parser); |
| ASSERT_TRUE(record_obj != NULL); |