]> git.sesse.net Git - ffmpeg/blobdiff - libavutil/crc.c
intfloat_readwrite: fix signed addition overflows
[ffmpeg] / libavutil / crc.c
index 4cad9816325318d1ec23de51a4744cc2a3c38485..44719ffaee3554263184c90710dd726bae9adcd1 100644 (file)
@@ -1,20 +1,20 @@
 /*
  * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -49,7 +49,7 @@ static AVCRC av_crc_table[AV_CRC_MAX][257];
  *           If 0, you must swap the CRC parameter and the result of av_crc
  *           if you need the standard representation (can be simplified in
  *           most cases to e.g. bswap16):
- *           bswap_32(crc << (32-bits))
+ *           av_bswap32(crc << (32-bits))
  * @param bits number of bits for the CRC
  * @param poly generator polynomial without the x**bits coefficient, in the
  *             representation as specified by le
@@ -57,7 +57,7 @@ static AVCRC av_crc_table[AV_CRC_MAX][257];
  * @return <0 on failure
  */
 int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size){
-    int i, j;
+    unsigned i, j;
     uint32_t c;
 
     if (bits < 8 || bits > 32 || poly >= (1LL<<bits))
@@ -73,7 +73,7 @@ int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size){
         } else {
             for (c = i << 24, j = 0; j < 8; j++)
                 c = (c<<1) ^ ((poly<<(32-bits)) & (((int32_t)c)>>31) );
-            ctx[i] = bswap_32(c);
+            ctx[i] = av_bswap32(c);
         }
     }
     ctx[256]=1;
@@ -121,7 +121,7 @@ uint32_t av_crc(const AVCRC *ctx, uint32_t crc, const uint8_t *buffer, size_t le
             crc = ctx[((uint8_t)crc) ^ *buffer++] ^ (crc >> 8);
 
         while(buffer<end-3){
-            crc ^= le2ne_32(*(const uint32_t*)buffer); buffer+=4;
+            crc ^= av_le2ne32(*(const uint32_t*)buffer); buffer+=4;
             crc =  ctx[3*256 + ( crc     &0xFF)]
                   ^ctx[2*256 + ((crc>>8 )&0xFF)]
                   ^ctx[1*256 + ((crc>>16)&0xFF)]