about summary refs log tree commit
path: root/src/libOggFLAC/ogg_helper.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libOggFLAC/ogg_helper.c')
-rw-r--r--src/libOggFLAC/ogg_helper.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/libOggFLAC/ogg_helper.c b/src/libOggFLAC/ogg_helper.c
index bebd7f06..3441ee60 100644
--- a/src/libOggFLAC/ogg_helper.c
+++ b/src/libOggFLAC/ogg_helper.c
@@ -92,7 +92,6 @@ FLAC__bool simple_ogg_page__get_at(OggFLAC__SeekableStreamEncoder *encoder, FLAC
 {
         static const unsigned OGG_HEADER_FIXED_PORTION_LEN = 27;
         static const unsigned OGG_MAX_HEADER_LEN = 27/*OGG_HEADER_FIXED_PORTION_LEN*/ + 255;
-        FLAC__byte crc[4];
 
         FLAC__ASSERT(page->header == 0);
         FLAC__ASSERT(page->header_len == 0);
@@ -158,12 +157,17 @@ FLAC__bool simple_ogg_page__get_at(OggFLAC__SeekableStreamEncoder *encoder, FLAC
                 return false;
 
         /* check the CRC */
-        memcpy(crc, page->header+22, 4);
-        ogg_page_checksum_set(page);
-        if(memcmp(crc, page->header+22, 4)) {
-                encoder->protected_->state = OggFLAC__SEEKABLE_STREAM_ENCODER_OGG_ERROR;
-                return false;
+#ifdef OGGFLAC_CRC_CHECKING
+        {
+                FLAC__byte crc[4];
+                memcpy(crc, page->header+22, 4);
+                ogg_page_checksum_set(page);
+                if(memcmp(crc, page->header+22, 4)) {
+                        encoder->protected_->state = OggFLAC__SEEKABLE_STREAM_ENCODER_OGG_ERROR;
+                        return false;
+                }
         }
+#endif
 
         return true;
 }