From 829e097f832b4c4c41733f9b77121888204d993e Mon Sep 17 00:00:00 2001 From: Marco Nelissen Date: Tue, 13 May 2014 16:22:19 -0700 Subject: Fix typos and pointer math. Change-Id: I07f33a57454d013844b56bc3e57fe0a271e8b38c --- include/ndk/NdkMediaCodec.h | 2 +- include/ndk/NdkMediaCrypto.h | 2 +- media/ndk/NdkMediaCodec.cpp | 12 +++++------- media/ndk/NdkMediaCrypto.cpp | 2 +- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/include/ndk/NdkMediaCodec.h b/include/ndk/NdkMediaCodec.h index 5233fe3..28d121c 100644 --- a/include/ndk/NdkMediaCodec.h +++ b/include/ndk/NdkMediaCodec.h @@ -179,7 +179,7 @@ AMediaCodecCryptoInfo *AMediaCodecCryptoInfo_new( size_t *encryptedbytes); /** - * delete an AMediaCodecCryptoInfo create previously with AMediaCodecCryptoInfo_new, or + * delete an AMediaCodecCryptoInfo created previously with AMediaCodecCryptoInfo_new, or * obtained from AMediaExtractor */ int AMediaCodecCryptoInfo_delete(AMediaCodecCryptoInfo*); diff --git a/include/ndk/NdkMediaCrypto.h b/include/ndk/NdkMediaCrypto.h index 0bcba9f..83eaad2 100644 --- a/include/ndk/NdkMediaCrypto.h +++ b/include/ndk/NdkMediaCrypto.h @@ -39,7 +39,7 @@ typedef struct AMediaCrypto AMediaCrypto; typedef uint8_t AMediaUUID[16]; -bool AMediaCrypto_isCryptoSchemeSupport(const AMediaUUID uuid); +bool AMediaCrypto_isCryptoSchemeSupported(const AMediaUUID uuid); bool AMediaCrypto_requiresSecureDecoderComponent(const char *mime); diff --git a/media/ndk/NdkMediaCodec.cpp b/media/ndk/NdkMediaCodec.cpp index 1f62fa2..ac05920 100644 --- a/media/ndk/NdkMediaCodec.cpp +++ b/media/ndk/NdkMediaCodec.cpp @@ -369,7 +369,7 @@ int AMediaCodec_queueSecureInputBuffer( if (err != 0) { ALOGE("queSecureInputBuffer: %s", errormsg.c_str()); } - delete subSamples; + delete [] subSamples; return translate_error(err); } @@ -396,13 +396,11 @@ AMediaCodecCryptoInfo *AMediaCodecCryptoInfo_new( ret->mode = mode; // clearbytes and encryptedbytes point at the actual data, which follows - ret->clearbytes = (size_t*) ((&ret->encryptedbytes) + sizeof(ret->encryptedbytes)); - ret->encryptedbytes = (size_t*) (ret->clearbytes + (sizeof(size_t) * numsubsamples)); + ret->clearbytes = (size_t*) (ret + 1); // point immediately after the struct + ret->encryptedbytes = ret->clearbytes + numsubsamples; // point after the clear sizes - size_t *dst = ret->clearbytes; - memcpy(dst, clearbytes, numsubsamples * sizeof(size_t)); - dst += numsubsamples * sizeof(size_t); - memcpy(dst, encryptedbytes, numsubsamples * sizeof(size_t)); + memcpy(ret->clearbytes, clearbytes, numsubsamples * sizeof(size_t)); + memcpy(ret->encryptedbytes, encryptedbytes, numsubsamples * sizeof(size_t)); return ret; } diff --git a/media/ndk/NdkMediaCrypto.cpp b/media/ndk/NdkMediaCrypto.cpp index 25dfe6a..d57f42b 100644 --- a/media/ndk/NdkMediaCrypto.cpp +++ b/media/ndk/NdkMediaCrypto.cpp @@ -74,7 +74,7 @@ struct AMediaCrypto { extern "C" { -bool AMediaCrypto_isCryptoSchemeSupport(const AMediaUUID uuid) { +bool AMediaCrypto_isCryptoSchemeSupported(const AMediaUUID uuid) { sp crypto = makeCrypto(); if (crypto == NULL) { return false; -- cgit v1.1