rename WebPDecBuffer::memory -> private_memory
This makes it clear that it shouldn't be used externally. Change-Id: I10c04c6606abbe851b6a3b424832803e842b2057
This commit is contained in:
parent
fb5d659bbd
commit
9f01ce3afa
@ -60,7 +60,7 @@ static VP8StatusCode AllocateBuffer(WebPDecBuffer* const buffer) {
|
|||||||
return VP8_STATUS_INVALID_PARAM;
|
return VP8_STATUS_INVALID_PARAM;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!buffer->is_external_memory && buffer->memory == NULL) {
|
if (!buffer->is_external_memory && buffer->private_memory == NULL) {
|
||||||
uint8_t* output;
|
uint8_t* output;
|
||||||
WEBP_CSP_MODE mode = buffer->colorspace;
|
WEBP_CSP_MODE mode = buffer->colorspace;
|
||||||
int stride;
|
int stride;
|
||||||
@ -87,7 +87,7 @@ static VP8StatusCode AllocateBuffer(WebPDecBuffer* const buffer) {
|
|||||||
return VP8_STATUS_INVALID_PARAM;
|
return VP8_STATUS_INVALID_PARAM;
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer->memory = output = (uint8_t*)malloc((size_t)total_size);
|
buffer->private_memory = output = (uint8_t*)malloc((size_t)total_size);
|
||||||
if (output == NULL) {
|
if (output == NULL) {
|
||||||
return VP8_STATUS_OUT_OF_MEMORY;
|
return VP8_STATUS_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
@ -164,8 +164,8 @@ int WebPInitDecBufferInternal(WebPDecBuffer* const buffer, int version) {
|
|||||||
void WebPFreeDecBuffer(WebPDecBuffer* const buffer) {
|
void WebPFreeDecBuffer(WebPDecBuffer* const buffer) {
|
||||||
if (buffer) {
|
if (buffer) {
|
||||||
if (!buffer->is_external_memory)
|
if (!buffer->is_external_memory)
|
||||||
free(buffer->memory);
|
free(buffer->private_memory);
|
||||||
buffer->memory = NULL;
|
buffer->private_memory = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,9 +173,9 @@ void WebPCopyDecBuffer(const WebPDecBuffer* const src,
|
|||||||
WebPDecBuffer* const dst) {
|
WebPDecBuffer* const dst) {
|
||||||
if (src && dst) {
|
if (src && dst) {
|
||||||
*dst = *src;
|
*dst = *src;
|
||||||
if (src->memory) {
|
if (src->private_memory) {
|
||||||
dst->is_external_memory = 1; // dst buffer doesn't own the memory.
|
dst->is_external_memory = 1; // dst buffer doesn't own the memory.
|
||||||
dst->memory = NULL;
|
dst->private_memory = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -184,9 +184,9 @@ void WebPCopyDecBuffer(const WebPDecBuffer* const src,
|
|||||||
void WebPGrabDecBuffer(WebPDecBuffer* const src, WebPDecBuffer* const dst) {
|
void WebPGrabDecBuffer(WebPDecBuffer* const src, WebPDecBuffer* const dst) {
|
||||||
if (src && dst) {
|
if (src && dst) {
|
||||||
*dst = *src;
|
*dst = *src;
|
||||||
if (src->memory) {
|
if (src->private_memory) {
|
||||||
src->is_external_memory = 1; // src relinquishes ownership
|
src->is_external_memory = 1; // src relinquishes ownership
|
||||||
src->memory = NULL;
|
src->private_memory = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -139,12 +139,14 @@ typedef struct { // view as YUVA
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
WEBP_CSP_MODE colorspace; // Colorspace.
|
WEBP_CSP_MODE colorspace; // Colorspace.
|
||||||
int width, height; // Dimensions.
|
int width, height; // Dimensions.
|
||||||
int is_external_memory; // If true, the *memory pointer is not owned.
|
int is_external_memory; // If true, 'internal_memory' pointer is not used.
|
||||||
union {
|
union {
|
||||||
WebPRGBABuffer RGBA;
|
WebPRGBABuffer RGBA;
|
||||||
WebPYUVABuffer YUVA;
|
WebPYUVABuffer YUVA;
|
||||||
} u; // nameless union of buffer parameters.
|
} u; // Nameless union of buffer parameters.
|
||||||
uint8_t* memory; // main pointer (when is_external_memory is false)
|
uint8_t* private_memory; // Internally allocated memory (only when
|
||||||
|
// is_external_memory is false). Should not be used
|
||||||
|
// externally, but accessed via the buffer union.
|
||||||
} WebPDecBuffer;
|
} WebPDecBuffer;
|
||||||
|
|
||||||
// Internal, version-checked, entry point
|
// Internal, version-checked, entry point
|
||||||
|
Loading…
x
Reference in New Issue
Block a user