mirror of
https://github.com/webmproject/libwebp.git
synced 2024-11-19 20:08:28 +01:00
cosmetics: remove use of 'sanity' / 'master'
replace with more inclusive terms or remove the comment entirely if the meaning was already clear. Bug: webp:507 Change-Id: Ica3bbf751ebf79f6668df6e6209af770248ff4ca
This commit is contained in:
parent
29b6129c78
commit
1f5791398c
@ -816,7 +816,7 @@ RIFF/WEBP
|
|||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
[vp8spec]: http://tools.ietf.org/html/rfc6386
|
[vp8spec]: http://tools.ietf.org/html/rfc6386
|
||||||
[webpllspec]: https://chromium.googlesource.com/webm/libwebp/+/master/doc/webp-lossless-bitstream-spec.txt
|
[webpllspec]: https://chromium.googlesource.com/webm/libwebp/+/HEAD/doc/webp-lossless-bitstream-spec.txt
|
||||||
[iccspec]: http://www.color.org/icc_specs2.xalter
|
[iccspec]: http://www.color.org/icc_specs2.xalter
|
||||||
[metadata]: http://www.metadataworkinggroup.org/pdf/mwg_guidance.pdf
|
[metadata]: http://www.metadataworkinggroup.org/pdf/mwg_guidance.pdf
|
||||||
[rfc 1166]: http://tools.ietf.org/html/rfc1166
|
[rfc 1166]: http://tools.ietf.org/html/rfc1166
|
||||||
|
@ -495,7 +495,7 @@ static int ParseFrameArgs(const char* args, WebPMuxFrameInfo* const info) {
|
|||||||
|
|
||||||
WarnAboutOddOffset(info);
|
WarnAboutOddOffset(info);
|
||||||
|
|
||||||
// Note: The sanity of the following conversion is checked by
|
// Note: The validity of the following conversion is checked by
|
||||||
// WebPMuxPushFrame().
|
// WebPMuxPushFrame().
|
||||||
info->dispose_method = (WebPMuxAnimDispose)dispose_method;
|
info->dispose_method = (WebPMuxAnimDispose)dispose_method;
|
||||||
|
|
||||||
|
@ -274,7 +274,7 @@ int ReadJPEG(const uint8_t* const data, size_t data_size,
|
|||||||
ctx.data = data;
|
ctx.data = data;
|
||||||
ctx.data_size = data_size;
|
ctx.data_size = data_size;
|
||||||
|
|
||||||
memset((j_decompress_ptr)&dinfo, 0, sizeof(dinfo)); // for setjmp sanity
|
memset((j_decompress_ptr)&dinfo, 0, sizeof(dinfo)); // for setjmp safety
|
||||||
dinfo.err = jpeg_std_error(&jerr.pub);
|
dinfo.err = jpeg_std_error(&jerr.pub);
|
||||||
jerr.pub.error_exit = my_error_exit;
|
jerr.pub.error_exit = my_error_exit;
|
||||||
|
|
||||||
|
@ -183,7 +183,7 @@ const uint8_t* VP8DecompressAlphaRows(VP8Decoder* const dec,
|
|||||||
assert(dec != NULL && io != NULL);
|
assert(dec != NULL && io != NULL);
|
||||||
|
|
||||||
if (row < 0 || num_rows <= 0 || row + num_rows > height) {
|
if (row < 0 || num_rows <= 0 || row + num_rows > height) {
|
||||||
return NULL; // sanity check.
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dec->is_alpha_decoded_) {
|
if (!dec->is_alpha_decoded_) {
|
||||||
|
@ -117,7 +117,6 @@ static VP8StatusCode AllocateBuffer(WebPDecBuffer* const buffer) {
|
|||||||
}
|
}
|
||||||
total_size = size + 2 * uv_size + a_size;
|
total_size = size + 2 * uv_size + a_size;
|
||||||
|
|
||||||
// Security/sanity checks
|
|
||||||
output = (uint8_t*)WebPSafeMalloc(total_size, sizeof(*output));
|
output = (uint8_t*)WebPSafeMalloc(total_size, sizeof(*output));
|
||||||
if (output == NULL) {
|
if (output == NULL) {
|
||||||
return VP8_STATUS_OUT_OF_MEMORY;
|
return VP8_STATUS_OUT_OF_MEMORY;
|
||||||
|
@ -335,7 +335,7 @@ int VP8GetHeaders(VP8Decoder* const dec, VP8Io* const io) {
|
|||||||
io->scaled_width = io->width;
|
io->scaled_width = io->width;
|
||||||
io->scaled_height = io->height;
|
io->scaled_height = io->height;
|
||||||
|
|
||||||
io->mb_w = io->width; // sanity check
|
io->mb_w = io->width; // for soundness
|
||||||
io->mb_h = io->height; // ditto
|
io->mb_h = io->height; // ditto
|
||||||
|
|
||||||
VP8ResetProba(&dec->proba_);
|
VP8ResetProba(&dec->proba_);
|
||||||
|
@ -1514,7 +1514,7 @@ static int AllocateInternalBuffers32b(VP8LDecoder* const dec, int final_width) {
|
|||||||
assert(dec->width_ <= final_width);
|
assert(dec->width_ <= final_width);
|
||||||
dec->pixels_ = (uint32_t*)WebPSafeMalloc(total_num_pixels, sizeof(uint32_t));
|
dec->pixels_ = (uint32_t*)WebPSafeMalloc(total_num_pixels, sizeof(uint32_t));
|
||||||
if (dec->pixels_ == NULL) {
|
if (dec->pixels_ == NULL) {
|
||||||
dec->argb_cache_ = NULL; // for sanity check
|
dec->argb_cache_ = NULL; // for soundness
|
||||||
dec->status_ = VP8_STATUS_OUT_OF_MEMORY;
|
dec->status_ = VP8_STATUS_OUT_OF_MEMORY;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1524,7 +1524,7 @@ static int AllocateInternalBuffers32b(VP8LDecoder* const dec, int final_width) {
|
|||||||
|
|
||||||
static int AllocateInternalBuffers8b(VP8LDecoder* const dec) {
|
static int AllocateInternalBuffers8b(VP8LDecoder* const dec) {
|
||||||
const uint64_t total_num_pixels = (uint64_t)dec->width_ * dec->height_;
|
const uint64_t total_num_pixels = (uint64_t)dec->width_ * dec->height_;
|
||||||
dec->argb_cache_ = NULL; // for sanity check
|
dec->argb_cache_ = NULL; // for soundness
|
||||||
dec->pixels_ = (uint32_t*)WebPSafeMalloc(total_num_pixels, sizeof(uint8_t));
|
dec->pixels_ = (uint32_t*)WebPSafeMalloc(total_num_pixels, sizeof(uint8_t));
|
||||||
if (dec->pixels_ == NULL) {
|
if (dec->pixels_ == NULL) {
|
||||||
dec->status_ = VP8_STATUS_OUT_OF_MEMORY;
|
dec->status_ = VP8_STATUS_OUT_OF_MEMORY;
|
||||||
@ -1666,7 +1666,6 @@ int VP8LDecodeImage(VP8LDecoder* const dec) {
|
|||||||
VP8Io* io = NULL;
|
VP8Io* io = NULL;
|
||||||
WebPDecParams* params = NULL;
|
WebPDecParams* params = NULL;
|
||||||
|
|
||||||
// Sanity checks.
|
|
||||||
if (dec == NULL) return 0;
|
if (dec == NULL) return 0;
|
||||||
|
|
||||||
assert(dec->hdr_.huffman_tables_ != NULL);
|
assert(dec->hdr_.huffman_tables_ != NULL);
|
||||||
|
@ -303,7 +303,7 @@ static int EncodeAlpha(VP8Encoder* const enc,
|
|||||||
int ok = 1;
|
int ok = 1;
|
||||||
const int reduce_levels = (quality < 100);
|
const int reduce_levels = (quality < 100);
|
||||||
|
|
||||||
// quick sanity checks
|
// quick correctness checks
|
||||||
assert((uint64_t)data_size == (uint64_t)width * height); // as per spec
|
assert((uint64_t)data_size == (uint64_t)width * height); // as per spec
|
||||||
assert(enc != NULL && pic != NULL && pic->a != NULL);
|
assert(enc != NULL && pic != NULL && pic->a != NULL);
|
||||||
assert(output != NULL && output_size != NULL);
|
assert(output != NULL && output_size != NULL);
|
||||||
@ -375,7 +375,7 @@ static int CompressAlphaJob(void* arg1, void* unused) {
|
|||||||
filter, effort_level, &alpha_data, &alpha_size)) {
|
filter, effort_level, &alpha_data, &alpha_size)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (alpha_size != (uint32_t)alpha_size) { // Sanity check.
|
if (alpha_size != (uint32_t)alpha_size) { // Soundness check.
|
||||||
WebPSafeFree(alpha_data);
|
WebPSafeFree(alpha_data);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -349,7 +349,7 @@ int VP8EncWrite(VP8Encoder* const enc) {
|
|||||||
(enc->alpha_data_size_ & 1);
|
(enc->alpha_data_size_ & 1);
|
||||||
riff_size += CHUNK_HEADER_SIZE + padded_alpha_size;
|
riff_size += CHUNK_HEADER_SIZE + padded_alpha_size;
|
||||||
}
|
}
|
||||||
// Sanity check.
|
// RIFF size should fit in 32-bits.
|
||||||
if (riff_size > 0xfffffffeU) {
|
if (riff_size > 0xfffffffeU) {
|
||||||
return WebPEncodingSetError(pic, VP8_ENC_ERROR_FILE_TOO_BIG);
|
return WebPEncodingSetError(pic, VP8_ENC_ERROR_FILE_TOO_BIG);
|
||||||
}
|
}
|
||||||
|
@ -418,7 +418,7 @@ static void MinimizeChangeRectangle(const WebPPicture* const src,
|
|||||||
const int max_allowed_diff_lossy = QualityToMaxDiff(quality);
|
const int max_allowed_diff_lossy = QualityToMaxDiff(quality);
|
||||||
const int max_allowed_diff = is_lossless ? 0 : max_allowed_diff_lossy;
|
const int max_allowed_diff = is_lossless ? 0 : max_allowed_diff_lossy;
|
||||||
|
|
||||||
// Sanity checks.
|
// Assumption/correctness checks.
|
||||||
assert(src->width == dst->width && src->height == dst->height);
|
assert(src->width == dst->width && src->height == dst->height);
|
||||||
assert(rect->x_offset_ + rect->width_ <= dst->width);
|
assert(rect->x_offset_ + rect->width_ <= dst->width);
|
||||||
assert(rect->y_offset_ + rect->height_ <= dst->height);
|
assert(rect->y_offset_ + rect->height_ <= dst->height);
|
||||||
|
@ -235,7 +235,6 @@ WebPMuxError WebPMuxSetImage(WebPMux* mux, const WebPData* bitstream,
|
|||||||
WebPMuxImage wpi;
|
WebPMuxImage wpi;
|
||||||
WebPMuxError err;
|
WebPMuxError err;
|
||||||
|
|
||||||
// Sanity checks.
|
|
||||||
if (mux == NULL || bitstream == NULL || bitstream->bytes == NULL ||
|
if (mux == NULL || bitstream == NULL || bitstream->bytes == NULL ||
|
||||||
bitstream->size > MAX_CHUNK_PAYLOAD) {
|
bitstream->size > MAX_CHUNK_PAYLOAD) {
|
||||||
return WEBP_MUX_INVALID_ARGUMENT;
|
return WEBP_MUX_INVALID_ARGUMENT;
|
||||||
@ -267,7 +266,6 @@ WebPMuxError WebPMuxPushFrame(WebPMux* mux, const WebPMuxFrameInfo* info,
|
|||||||
WebPMuxImage wpi;
|
WebPMuxImage wpi;
|
||||||
WebPMuxError err;
|
WebPMuxError err;
|
||||||
|
|
||||||
// Sanity checks.
|
|
||||||
if (mux == NULL || info == NULL) return WEBP_MUX_INVALID_ARGUMENT;
|
if (mux == NULL || info == NULL) return WEBP_MUX_INVALID_ARGUMENT;
|
||||||
|
|
||||||
if (info->id != WEBP_CHUNK_ANMF) return WEBP_MUX_INVALID_ARGUMENT;
|
if (info->id != WEBP_CHUNK_ANMF) return WEBP_MUX_INVALID_ARGUMENT;
|
||||||
|
@ -56,7 +56,7 @@ static WebPMuxError ChunkVerifyAndAssign(WebPChunk* chunk,
|
|||||||
uint32_t chunk_size;
|
uint32_t chunk_size;
|
||||||
WebPData chunk_data;
|
WebPData chunk_data;
|
||||||
|
|
||||||
// Sanity checks.
|
// Correctness checks.
|
||||||
if (data_size < CHUNK_HEADER_SIZE) return WEBP_MUX_NOT_ENOUGH_DATA;
|
if (data_size < CHUNK_HEADER_SIZE) return WEBP_MUX_NOT_ENOUGH_DATA;
|
||||||
chunk_size = GetLE32(data + TAG_SIZE);
|
chunk_size = GetLE32(data + TAG_SIZE);
|
||||||
if (chunk_size > MAX_CHUNK_PAYLOAD) return WEBP_MUX_BAD_DATA;
|
if (chunk_size > MAX_CHUNK_PAYLOAD) return WEBP_MUX_BAD_DATA;
|
||||||
@ -186,7 +186,6 @@ WebPMux* WebPMuxCreateInternal(const WebPData* bitstream, int copy_data,
|
|||||||
WebPChunk** chunk_list_ends[WEBP_CHUNK_NIL + 1] = { NULL };
|
WebPChunk** chunk_list_ends[WEBP_CHUNK_NIL + 1] = { NULL };
|
||||||
ChunkInit(&chunk);
|
ChunkInit(&chunk);
|
||||||
|
|
||||||
// Sanity checks.
|
|
||||||
if (WEBP_ABI_IS_INCOMPATIBLE(version, WEBP_MUX_ABI_VERSION)) {
|
if (WEBP_ABI_IS_INCOMPATIBLE(version, WEBP_MUX_ABI_VERSION)) {
|
||||||
return NULL; // version mismatch
|
return NULL; // version mismatch
|
||||||
}
|
}
|
||||||
@ -481,7 +480,6 @@ WebPMuxError WebPMuxGetFrame(
|
|||||||
WebPMuxError err;
|
WebPMuxError err;
|
||||||
WebPMuxImage* wpi;
|
WebPMuxImage* wpi;
|
||||||
|
|
||||||
// Sanity checks.
|
|
||||||
if (mux == NULL || frame == NULL) {
|
if (mux == NULL || frame == NULL) {
|
||||||
return WEBP_MUX_INVALID_ARGUMENT;
|
return WEBP_MUX_INVALID_ARGUMENT;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user