Merge changes I87544e92,I0bb6cda5

* changes:
  VP8LEncodeStream: add an assert
  VP8LColorCacheCopy: promote an int before shifting
This commit is contained in:
pascal massimino 2015-01-17 08:54:30 -08:00 committed by Gerrit Code Review
commit 4a82aab569
2 changed files with 2 additions and 1 deletions

View File

@ -1257,6 +1257,7 @@ WebPEncodingError VP8LEncodeStream(const WebPConfig* const config,
int y; int y;
err = AllocateTransformBuffer(enc, width, height); err = AllocateTransformBuffer(enc, width, height);
if (err != VP8_ENC_OK) goto Error; if (err != VP8_ENC_OK) goto Error;
assert(enc->argb_ != NULL);
for (y = 0; y < height; ++y) { for (y = 0; y < height; ++y) {
memcpy(enc->argb_ + y * width, memcpy(enc->argb_ + y * width,
picture->argb + y * picture->argb_stride, picture->argb + y * picture->argb_stride,

View File

@ -45,5 +45,5 @@ void VP8LColorCacheCopy(const VP8LColorCache* const src,
assert(dst != NULL); assert(dst != NULL);
assert(src->hash_bits_ == dst->hash_bits_); assert(src->hash_bits_ == dst->hash_bits_);
memcpy(dst->colors_, src->colors_, memcpy(dst->colors_, src->colors_,
(size_t)(1 << dst->hash_bits_) * sizeof(*dst->colors_)); ((size_t)1u << dst->hash_bits_) * sizeof(*dst->colors_));
} }