fix erroneous assertion
authorJosh Coalson <jcoalson@users.sourceforce.net>
Sat, 24 Jul 2004 00:02:46 +0000 (00:02 +0000)
committerJosh Coalson <jcoalson@users.sourceforce.net>
Sat, 24 Jul 2004 00:02:46 +0000 (00:02 +0000)
src/flac/decode.c
src/libFLAC/stream_encoder_framing.c

index 41b17ba..f3ae2e1 100644 (file)
@@ -1020,13 +1020,14 @@ FLAC__StreamDecoderWriteStatus write_callback(const void *decoder, const FLAC__F
                        }
                }
        }
-       FLAC__ASSERT(bytes_to_write > 0);
-       if(flac__utils_fwrite(u8buffer, 1, bytes_to_write, fout) != bytes_to_write) {
-               /* if a pipe closed when writing to stdout, we let it go without an error message */
-               if(errno == EPIPE && decoder_session->fout == stdout)
-                       decoder_session->aborting_due_to_until = true;
-               decoder_session->abort_flag = true;
-               return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
+       if(bytes_to_write > 0) {
+               if(flac__utils_fwrite(u8buffer, 1, bytes_to_write, fout) != bytes_to_write) {
+                       /* if a pipe closed when writing to stdout, we let it go without an error message */
+                       if(errno == EPIPE && decoder_session->fout == stdout)
+                               decoder_session->aborting_due_to_until = true;
+                       decoder_session->abort_flag = true;
+                       return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
+               }
        }
        return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
 }
index c537a1e..5eb4a0c 100644 (file)
@@ -197,7 +197,7 @@ FLAC__bool FLAC__frame_add_header(const FLAC__FrameHeader *header, FLAC__bool st
 
        FLAC__ASSERT(header->blocksize > 0 && header->blocksize <= FLAC__MAX_BLOCK_SIZE);
        /* when this assertion holds true, any legal blocksize can be expressed in the frame header */
-       FLAC__ASSERT(FLAC__MAX_BLOCK_SIZE <= (1u << FLAC__FRAME_HEADER_BLOCK_SIZE_LEN));
+       FLAC__ASSERT(FLAC__MAX_BLOCK_SIZE <= 65535u);
        blocksize_hint = 0;
        switch(header->blocksize) {
                case   192: u = 1; break;