Print values in host byte order

Merge from widevine of http://go/wvgerrit/14361

In oemcrypto_test, we look at some control duration and control
bits. These are stored in network byte order.  However, it is easier
to read error messages if they are converted to host byte order before
printing them.

Change-Id: I116b5f43957351b0e40e05331c282c248128903c
This commit is contained in:
Fred Gylys-Colwell
2015-05-14 15:54:38 -07:00
parent d2e91faf8e
commit 7fffdcdbd9

View File

@@ -883,10 +883,12 @@ class Session {
if (sts != OEMCrypto_ERROR_NOT_IMPLEMENTED) { if (sts != OEMCrypto_ERROR_NOT_IMPLEMENTED) {
ASSERT_EQ(OEMCrypto_SUCCESS, sts); ASSERT_EQ(OEMCrypto_SUCCESS, sts);
ASSERT_EQ(sizeof(block), size); ASSERT_EQ(sizeof(block), size);
ASSERT_EQ(license_.keys[i].control.duration, // control duration and bits stored in network byte order. For printing
block.duration) << "For key " << i; // we change to host byte order.
ASSERT_EQ(license_.keys[i].control.control_bits, ASSERT_EQ(htonl(license_.keys[i].control.duration),
block.control_bits) << "For key " << i; htonl(block.duration)) << "For key " << i;
ASSERT_EQ(htonl(license_.keys[i].control.control_bits),
htonl(block.control_bits)) << "For key " << i;
} }
} }
} }