[Ffmpeg-cvslog] r5492 - in trunk/libavformat: aiff.c asf-enc.c avformat.h dv.c gif.c matroska.c movenc.c png.c utils.c yuv4mpeg.c

diego subversion
Sat Jun 17 17:53:24 CEST 2006


Author: diego
Date: Sat Jun 17 17:53:23 2006
New Revision: 5492

Modified:
   trunk/libavformat/aiff.c
   trunk/libavformat/asf-enc.c
   trunk/libavformat/avformat.h
   trunk/libavformat/dv.c
   trunk/libavformat/gif.c
   trunk/libavformat/matroska.c
   trunk/libavformat/movenc.c
   trunk/libavformat/png.c
   trunk/libavformat/utils.c
   trunk/libavformat/yuv4mpeg.c

Log:
Add (mostly) const to variable and parameter declaration, where a char* was
used and 'const char*' should be, plus make some function declarations
static if they aren't used outside their declaring source file.
patch by Stefan Huehner stefan%%at%%huehner%%dot%%org


Modified: trunk/libavformat/aiff.c
==============================================================================
--- trunk/libavformat/aiff.c	(original)
+++ trunk/libavformat/aiff.c	Sat Jun 17 17:53:23 2006
@@ -220,10 +220,10 @@
     put_le32(pb, enc->codec_tag);
     if (coder_len & 1) {
         put_byte(pb, coder_len);
-        put_buffer(pb, (uint8_t*)enc->codec->name, coder_len);
+        put_buffer(pb, (const uint8_t*)enc->codec->name, coder_len);
     } else {
         put_byte(pb, coder_len+1);
-        put_buffer(pb, (uint8_t*)enc->codec->name, coder_len);
+        put_buffer(pb, (const uint8_t*)enc->codec->name, coder_len);
         put_byte(pb, 0);
     }
 

Modified: trunk/libavformat/asf-enc.c
==============================================================================
--- trunk/libavformat/asf-enc.c	(original)
+++ trunk/libavformat/asf-enc.c	Sat Jun 17 17:53:23 2006
@@ -349,7 +349,7 @@
     /* stream headers */
     for(n=0;n<s->nb_streams;n++) {
         int64_t es_pos;
-        uint8_t *er_spr = NULL;
+        const uint8_t *er_spr = NULL;
         int er_spr_len = 0;
         //        ASFStream *stream = &asf->streams[n];
 
@@ -360,7 +360,7 @@
 
         if (enc->codec_type == CODEC_TYPE_AUDIO) {
             if (enc->codec_id == CODEC_ID_ADPCM_G726) {
-                er_spr     = (uint8_t *)error_spread_ADPCM_G726;
+                er_spr     = error_spread_ADPCM_G726;
                 er_spr_len = sizeof(error_spread_ADPCM_G726);
             }
         }

Modified: trunk/libavformat/avformat.h
==============================================================================
--- trunk/libavformat/avformat.h	(original)
+++ trunk/libavformat/avformat.h	Sat Jun 17 17:53:23 2006
@@ -604,7 +604,7 @@
 void fifo_free(FifoBuffer *f);
 int fifo_size(FifoBuffer *f, uint8_t *rptr);
 int fifo_read(FifoBuffer *f, uint8_t *buf, int buf_size, uint8_t **rptr_ptr);
-void fifo_write(FifoBuffer *f, uint8_t *buf, int size, uint8_t **wptr_ptr);
+void fifo_write(FifoBuffer *f, const uint8_t *buf, int size, uint8_t **wptr_ptr);
 int put_fifo(ByteIOContext *pb, FifoBuffer *f, int buf_size, uint8_t **rptr_ptr);
 void fifo_realloc(FifoBuffer *f, unsigned int size);
 

Modified: trunk/libavformat/dv.c
==============================================================================
--- trunk/libavformat/dv.c	(original)
+++ trunk/libavformat/dv.c	Sat Jun 17 17:53:23 2006
@@ -692,7 +692,7 @@
             /* FIXME: we have to have more sensible approach than this one */
             if (fifo_size(&c->audio_data[i], c->audio_data[i].rptr) + data_size >= 100*AVCODEC_MAX_AUDIO_FRAME_SIZE)
                 av_log(st->codec, AV_LOG_ERROR, "Can't process DV frame #%d. Insufficient video data or severe sync problem.\n", c->frames);
-            fifo_write(&c->audio_data[i], (uint8_t *)data, data_size, &c->audio_data[i].wptr);
+            fifo_write(&c->audio_data[i], data, data_size, &c->audio_data[i].wptr);
         }
     }
 out:

Modified: trunk/libavformat/gif.c
==============================================================================
--- trunk/libavformat/gif.c	(original)
+++ trunk/libavformat/gif.c	Sat Jun 17 17:53:23 2006
@@ -187,7 +187,7 @@
 
     /* the global palette */
     if (!palette) {
-        put_buffer(pb, (unsigned char *)gif_clut, 216*3);
+        put_buffer(pb, (const unsigned char *)gif_clut, 216*3);
         for(i=0;i<((256-216)*3);i++)
             put_byte(pb, 0);
     } else {

Modified: trunk/libavformat/matroska.c
==============================================================================
--- trunk/libavformat/matroska.c	(original)
+++ trunk/libavformat/matroska.c	Sat Jun 17 17:53:23 2006
@@ -183,14 +183,14 @@
  */
 
 typedef struct CodecTags{
-    char *str;
+    const char *str;
     enum CodecID id;
 }CodecTags;
 
 #define MATROSKA_CODEC_ID_VIDEO_VFW_FOURCC   "V_MS/VFW/FOURCC"
 #define MATROSKA_CODEC_ID_AUDIO_ACM          "A_MS/ACM"
 
-CodecTags codec_tags[]={
+static CodecTags codec_tags[]={
 //    {"V_MS/VFW/FOURCC"  , CODEC_ID_NONE},
     {"V_UNCOMPRESSED"   , CODEC_ID_RAWVIDEO},
     {"V_MPEG4/ISO/SP"   , CODEC_ID_MPEG4},

Modified: trunk/libavformat/movenc.c
==============================================================================
--- trunk/libavformat/movenc.c	(original)
+++ trunk/libavformat/movenc.c	Sat Jun 17 17:53:23 2006
@@ -788,7 +788,7 @@
 
 static int mov_write_hdlr_tag(ByteIOContext *pb, MOVTrack* track)
 {
-    char *descr, *hdlr, *hdlr_type;
+    const char *descr, *hdlr, *hdlr_type;
     offset_t pos = url_ftell(pb);
 
     if (!track) { /* no media --> data handler */
@@ -1085,7 +1085,7 @@
     }
 }
 
-static int mov_write_string_tag(ByteIOContext *pb, char *name, char *value, int long_style){
+static int mov_write_string_tag(ByteIOContext *pb, const char *name, const char *value, int long_style){
     int size = 0;
     if ( value && value[0] ) {
         offset_t pos = url_ftell(pb);
@@ -1225,7 +1225,7 @@
     return 2*n;
 }
 
-static uint16_t language_code (char *str)
+static uint16_t language_code (const char *str)
 {
     return ((((str[0]-0x60) & 0x1F)<<10) + (((str[1]-0x60) & 0x1F)<<5) + ((str[2]-0x60) & 0x1F));
 }

Modified: trunk/libavformat/png.c
==============================================================================
--- trunk/libavformat/png.c	(original)
+++ trunk/libavformat/png.c	Sat Jun 17 17:53:23 2006
@@ -326,7 +326,7 @@
 
     d = dst;
     for(j = 0; j < width; j++) {
-        v = ((uint32_t *)src)[j];
+        v = ((const uint32_t *)src)[j];
         d[0] = v >> 16;
         d[1] = v >> 8;
         d[2] = v;

Modified: trunk/libavformat/utils.c
==============================================================================
--- trunk/libavformat/utils.c	(original)
+++ trunk/libavformat/utils.c	Sat Jun 17 17:53:23 2006
@@ -342,7 +342,7 @@
     }
 }
 
-void fifo_write(FifoBuffer *f, uint8_t *buf, int size, uint8_t **wptr_ptr)
+void fifo_write(FifoBuffer *f, const uint8_t *buf, int size, uint8_t **wptr_ptr)
 {
     int len;
     uint8_t *wptr;

Modified: trunk/libavformat/yuv4mpeg.c
==============================================================================
--- trunk/libavformat/yuv4mpeg.c	(original)
+++ trunk/libavformat/yuv4mpeg.c	Sat Jun 17 17:53:23 2006
@@ -35,7 +35,7 @@
     int width, height;
     int raten, rated, aspectn, aspectd, n;
     char inter;
-    char *colorspace = "";
+    const char *colorspace = "";
 
     st = s->streams[0];
     width = st->codec->width;




More information about the ffmpeg-cvslog mailing list