Don't flush the last buffered symbol if it is zero.
authorTimothy B. Terriberry <tterribe@xiph.org>
Tue, 19 Feb 2008 09:39:00 +0000 (04:39 -0500)
committerJean-Marc Valin <jean-marc.valin@usherbrooke.ca>
Tue, 19 Feb 2008 09:54:55 +0000 (20:54 +1100)
When rng starts out 0x80000000, this can cause an extra zero byte to be written
 to the stream.

libcelt/rangeenc.c

index 374ea16..f8ff3e3 100644 (file)
@@ -138,7 +138,7 @@ void ec_enc_done(ec_enc *_this){
     }
   }
   /*If we have a buffered byte flush it into the output buffer.*/
-  if(_this->rem>=0||_this->ext>0){
+  if(_this->rem>0||_this->ext>0){
     ec_enc_carry_out(_this,0);
     _this->rem=-1;
   }