shithub: libvpx

Download patch

ref: 4aa8ea5917f1a3bf0f82caab9485e5755109a175
parent: 91e5e5a680148cea2100c54b3792c8483eb88867
author: Tom Finegan <tomfinegan@google.com>
date: Mon Mar 3 13:04:35 EST 2014

vp8_decrypt_test.c: Silence MSVC data loss warning.

- Change type of encrypt_buffer() offset argument to ptrdiff_t, and change the
  type of the size argument to size_t.
- Update size argument encrypt_buffer() in vp8_boolcoder_test.c with
  same.

Change-Id: Ie29c7c82c73318bee01b89c6fb4c4e1442eef03c

--- a/test/vp8_boolcoder_test.cc
+++ b/test/vp8_boolcoder_test.cc
@@ -35,14 +35,14 @@
   0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xf0
 };
 
-void encrypt_buffer(uint8_t *buffer, int size) {
-  for (int i = 0; i < size; ++i) {
+void encrypt_buffer(uint8_t *buffer, size_t size) {
+  for (size_t i = 0; i < size; ++i) {
     buffer[i] ^= secret_key[i & 15];
   }
 }
 
 void test_decrypt_cb(void *decrypt_state, const uint8_t *input,
-                           uint8_t *output, int count) {
+                     uint8_t *output, int count) {
   const size_t offset = input - reinterpret_cast<uint8_t*>(decrypt_state);
   for (int i = 0; i < count; i++) {
     output[i] = input[i] ^ secret_key[(offset + i) & 15];
--- a/test/vp8_decrypt_test.cc
+++ b/test/vp8_decrypt_test.cc
@@ -26,9 +26,9 @@
   0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xf0
 };
 
-void encrypt_buffer(const uint8_t *src, uint8_t *dst,
-                    int size, int offset = 0) {
-  for (int i = 0; i < size; ++i) {
+void encrypt_buffer(const uint8_t *src, uint8_t *dst, size_t size,
+                    ptrdiff_t offset) {
+  for (size_t i = 0; i < size; ++i) {
     dst[i] = src[i] ^ test_key[(offset + i) & 15];
   }
 }
@@ -61,7 +61,7 @@
 
 #if CONFIG_DECRYPT
   std::vector<uint8_t> encrypted(video.frame_size());
-  encrypt_buffer(video.cxdata(), &encrypted[0], video.frame_size());
+  encrypt_buffer(video.cxdata(), &encrypted[0], video.frame_size(), 0);
   vp8_decrypt_init di = { test_decrypt_cb, &encrypted[0] };
   decoder.Control(VP8D_SET_DECRYPTOR, &di);
 #endif  // CONFIG_DECRYPT