From 7fffdcdbd94ba9002234108b7c478b2602a40b79 Mon Sep 17 00:00:00 2001 From: Fred Gylys-Colwell Date: Thu, 14 May 2015 15:54:38 -0700 Subject: [PATCH] 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 --- libwvdrmengine/oemcrypto/test/oemcrypto_test.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libwvdrmengine/oemcrypto/test/oemcrypto_test.cpp b/libwvdrmengine/oemcrypto/test/oemcrypto_test.cpp index 4a76c5b0..13f07be2 100644 --- a/libwvdrmengine/oemcrypto/test/oemcrypto_test.cpp +++ b/libwvdrmengine/oemcrypto/test/oemcrypto_test.cpp @@ -883,10 +883,12 @@ class Session { if (sts != OEMCrypto_ERROR_NOT_IMPLEMENTED) { ASSERT_EQ(OEMCrypto_SUCCESS, sts); ASSERT_EQ(sizeof(block), size); - ASSERT_EQ(license_.keys[i].control.duration, - block.duration) << "For key " << i; - ASSERT_EQ(license_.keys[i].control.control_bits, - block.control_bits) << "For key " << i; + // control duration and bits stored in network byte order. For printing + // we change to host byte order. + ASSERT_EQ(htonl(license_.keys[i].control.duration), + htonl(block.duration)) << "For key " << i; + ASSERT_EQ(htonl(license_.keys[i].control.control_bits), + htonl(block.control_bits)) << "For key " << i; } } }