]> granicus.if.org Git - libvpx/commitdiff
vp8: move error check earlier
authorJohann <johannkoenig@google.com>
Tue, 17 Dec 2019 19:44:26 +0000 (11:44 -0800)
committerJohann <johannkoenig@google.com>
Tue, 17 Dec 2019 19:44:29 +0000 (11:44 -0800)
This avoids assigning variables which will not be used. A
similar change was made to vpx_dsp/bitreader.c a long time
ago.

Change-Id: Ia5012091b8d85ca9bfefc7735a2aa69c5c2bf516

vp8/decoder/dboolhuff.c

index 4cfaef05cb5291370a47a713087c4a6028147a5e..11099c453c074bc126e9a153d962aa7529be2f66 100644 (file)
@@ -15,6 +15,8 @@
 int vp8dx_start_decode(BOOL_DECODER *br, const unsigned char *source,
                        unsigned int source_sz, vpx_decrypt_cb decrypt_cb,
                        void *decrypt_state) {
+  if (source_sz && !source) return 1;
+
   // To simplify calling code this fuction can be called with |source| == null
   // and |source_sz| == 0. This and vp8dx_bool_decoder_fill() are essentially
   // no-ops in this case.
@@ -27,8 +29,6 @@ int vp8dx_start_decode(BOOL_DECODER *br, const unsigned char *source,
   br->decrypt_cb = decrypt_cb;
   br->decrypt_state = decrypt_state;
 
-  if (source_sz && !source) return 1;
-
   /* Populate the buffer */
   vp8dx_bool_decoder_fill(br);