From b2ee00d9caf9531ffe0fdcd66f82db18e4d46601 Mon Sep 17 00:00:00 2001 From: Leon Scroggins III Date: Thu, 7 Jan 2021 15:37:34 -0500 Subject: Fix null annotations in AImageDecoder Bug: 160984428 Test: I27033454b2b8b683db727190b834b970c9732d8e Make AImageDecoder_delete _Nullable. This matches AImageDecoderFrameInfo_delete. It also makes sense because it just calls "delete", and even if it didn't, it does conceptually the same thing, so it should be safe to pass null. Fix annotation for AImageDecoder_create*. Although the pointer must not be null, the pointer it points to can, both as input and as output. This change doesn't seem to affect my local build system (it doesn't warn if I pass a pointer to a pointer which points to null without this change), this is more accurate. Change-Id: I0bf4e160b21169b81a377378bb65cbfd2ef809b2 --- include/android/imagedecoder.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/android/imagedecoder.h b/include/android/imagedecoder.h index c439e5142a..b5f3b10650 100644 --- a/include/android/imagedecoder.h +++ b/include/android/imagedecoder.h @@ -196,7 +196,7 @@ typedef struct AImageDecoder AImageDecoder; * supported. */ int AImageDecoder_createFromAAsset(struct AAsset* _Nonnull asset, - AImageDecoder* _Nonnull * _Nonnull outDecoder) + AImageDecoder* _Nullable * _Nonnull outDecoder) __INTRODUCED_IN(30); /** @@ -227,7 +227,7 @@ int AImageDecoder_createFromAAsset(struct AAsset* _Nonnull asset, * - {@link ANDROID_IMAGE_DECODER_UNSUPPORTED_FORMAT}: The format is not * supported. */ -int AImageDecoder_createFromFd(int fd, AImageDecoder* _Nonnull * _Nonnull outDecoder) +int AImageDecoder_createFromFd(int fd, AImageDecoder* _Nullable * _Nonnull outDecoder) __INTRODUCED_IN(30); /** @@ -258,7 +258,7 @@ int AImageDecoder_createFromFd(int fd, AImageDecoder* _Nonnull * _Nonnull outDec * supported. */ int AImageDecoder_createFromBuffer(const void* _Nonnull buffer, size_t length, - AImageDecoder* _Nonnull * _Nonnull outDecoder) + AImageDecoder* _Nullable * _Nonnull outDecoder) __INTRODUCED_IN(30); /** @@ -266,7 +266,7 @@ int AImageDecoder_createFromBuffer(const void* _Nonnull buffer, size_t length, * * Available since API level 30. */ -void AImageDecoder_delete(AImageDecoder* _Nonnull decoder) __INTRODUCED_IN(30); +void AImageDecoder_delete(AImageDecoder* _Nullable decoder) __INTRODUCED_IN(30); /** * Choose the desired output format. -- cgit v1.2.3-59-g8ed1b