History

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

Originally committed as revision 5492 to svn://svn.ffmpeg.org/ffmpeg/trunk

Stefan Huehner committed 20 years ago

Commit a97c1e91 parent c8e9f8010 files · +15 −15Browse files

Unified · Split

10 files
  1. libavformat/aiff.c +2 −2
  2. libavformat/asf-enc.c +2 −2
  3. libavformat/avformat.h +1 −1
  4. libavformat/dv.c +1 −1
  5. libavformat/gif.c +1 −1
  6. libavformat/matroska.c +2 −2
  7. libavformat/movenc.c +3 −3
  8. libavformat/png.c +1 −1
  9. libavformat/utils.c +1 −1
  10. libavformat/yuv4mpeg.c +1 −1
libavformat/aiff.c+2−2
@@ -220,10 +220,10 @@ static int aiff_write_header(AVFormatContext *s) · 219 unmodified lines
220220 put_le32(pb, enc->codec_tag);
221221 if (coder_len & 1) {
222222 put_byte(pb, coder_len);
223− put_buffer(pb, (uint8_t*)enc->codec->name, coder_len);
223+ put_buffer(pb, (const uint8_t*)enc->codec->name, coder_len);
224224 } else {
225225 put_byte(pb, coder_len+1);
226− put_buffer(pb, (uint8_t*)enc->codec->name, coder_len);
226+ put_buffer(pb, (const uint8_t*)enc->codec->name, coder_len);
227227 put_byte(pb, 0);
228228 }
229229
libavformat/asf-enc.c+2−2
@@ -349,7 +349,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data · 348 unmodified lines
349349 /* stream headers */
350350 for(n=0;n<s->nb_streams;n++) {
351351 int64_t es_pos;
352− uint8_t *er_spr = NULL;
352+ const uint8_t *er_spr = NULL;
353353 int er_spr_len = 0;
354354 // ASFStream *stream = &asf->streams[n];
355355
@@ -360,7 +360,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data · 4 unmodified lines
360360
361361 if (enc->codec_type == CODEC_TYPE_AUDIO) {
362362 if (enc->codec_id == CODEC_ID_ADPCM_G726) {
363− er_spr = (uint8_t *)error_spread_ADPCM_G726;
363+ er_spr = error_spread_ADPCM_G726;
364364 er_spr_len = sizeof(error_spread_ADPCM_G726);
365365 }
366366 }
libavformat/avformat.h+1−1
@@ -604,7 +604,7 @@ int fifo_init(FifoBuffer *f, int size); · 603 unmodified lines
604604 void fifo_free(FifoBuffer *f);
605605 int fifo_size(FifoBuffer *f, uint8_t *rptr);
606606 int fifo_read(FifoBuffer *f, uint8_t *buf, int buf_size, uint8_t **rptr_ptr);
607−void fifo_write(FifoBuffer *f, uint8_t *buf, int size, uint8_t **wptr_ptr);
607+void fifo_write(FifoBuffer *f, const uint8_t *buf, int size, uint8_t **wptr_ptr);
608608 int put_fifo(ByteIOContext *pb, FifoBuffer *f, int buf_size, uint8_t **rptr_ptr);
609609 void fifo_realloc(FifoBuffer *f, unsigned int size);
610610
libavformat/dv.c+1−1
@@ -692,7 +692,7 @@ int dv_assemble_frame(DVMuxContext *c, AVStream* st, · 691 unmodified lines
692692 /* FIXME: we have to have more sensible approach than this one */
693693 if (fifo_size(&c->audio_data[i], c->audio_data[i].rptr) + data_size >= 100*AVCODEC_MAX_AUDIO_FRAME_SIZE)
694694 av_log(st->codec, AV_LOG_ERROR, "Can't process DV frame #%d. Insufficient video data or severe sync problem.\n", c->frames);
695− fifo_write(&c->audio_data[i], (uint8_t *)data, data_size, &c->audio_data[i].wptr);
695+ fifo_write(&c->audio_data[i], data, data_size, &c->audio_data[i].wptr);
696696 }
697697 }
698698 out:
libavformat/gif.c+1−1
@@ -187,7 +187,7 @@ static int gif_image_write_header(ByteIOContext *pb, · 186 unmodified lines
187187
188188 /* the global palette */
189189 if (!palette) {
190− put_buffer(pb, (unsigned char *)gif_clut, 216*3);
190+ put_buffer(pb, (const unsigned char *)gif_clut, 216*3);
191191 for(i=0;i<((256-216)*3);i++)
192192 put_byte(pb, 0);
193193 } else {
libavformat/matroska.c+2−2
@@ -183,14 +183,14 @@ typedef enum { · 182 unmodified lines
183183 */
184184
185185 typedef struct CodecTags{
186− char *str;
186+ const char *str;
187187 enum CodecID id;
188188 }CodecTags;
189189
190190 #define MATROSKA_CODEC_ID_VIDEO_VFW_FOURCC "V_MS/VFW/FOURCC"
191191 #define MATROSKA_CODEC_ID_AUDIO_ACM "A_MS/ACM"
192192
193−CodecTags codec_tags[]={
193+static CodecTags codec_tags[]={
194194 // {"V_MS/VFW/FOURCC" , CODEC_ID_NONE},
195195 {"V_UNCOMPRESSED" , CODEC_ID_RAWVIDEO},
196196 {"V_MPEG4/ISO/SP" , CODEC_ID_MPEG4},
libavformat/movenc.c+3−3
@@ -788,7 +788,7 @@ static int mov_write_vmhd_tag(ByteIOContext *pb) · 787 unmodified lines
788788
789789 static int mov_write_hdlr_tag(ByteIOContext *pb, MOVTrack* track)
790790 {
791− char *descr, *hdlr, *hdlr_type;
791+ const char *descr, *hdlr, *hdlr_type;
792792 offset_t pos = url_ftell(pb);
793793
794794 if (!track) { /* no media --> data handler */
@@ -1085,7 +1085,7 @@ static int mov_write_string_data_tag(ByteIOContext *pb, const char *data, int lo · 290 unmodified lines
10851085 }
10861086 }
10871087
1088−static int mov_write_string_tag(ByteIOContext *pb, char *name, char *value, int long_style){
1088+static int mov_write_string_tag(ByteIOContext *pb, const char *name, const char *value, int long_style){
10891089 int size = 0;
10901090 if ( value && value[0] ) {
10911091 offset_t pos = url_ftell(pb);
@@ -1225,7 +1225,7 @@ static size_t ascii_to_wc (ByteIOContext *pb, char *b, size_t n) · 133 unmodified lines
12251225 return 2*n;
12261226 }
12271227
1228−static uint16_t language_code (char *str)
1228+static uint16_t language_code (const char *str)
12291229 {
12301230 return ((((str[0]-0x60) & 0x1F)<<10) + (((str[1]-0x60) & 0x1F)<<5) + ((str[2]-0x60) & 0x1F));
12311231 }
libavformat/png.c+1−1
@@ -326,7 +326,7 @@ static void convert_from_rgba32(uint8_t *dst, const uint8_t *src, int width) · 325 unmodified lines
326326
327327 d = dst;
328328 for(j = 0; j < width; j++) {
329− v = ((uint32_t *)src)[j];
329+ v = ((const uint32_t *)src)[j];
330330 d[0] = v >> 16;
331331 d[1] = v >> 8;
332332 d[2] = v;
libavformat/utils.c+1−1
@@ -342,7 +342,7 @@ void fifo_realloc(FifoBuffer *f, unsigned int new_size){ · 341 unmodified lines
342342 }
343343 }
344344
345−void fifo_write(FifoBuffer *f, uint8_t *buf, int size, uint8_t **wptr_ptr)
345+void fifo_write(FifoBuffer *f, const uint8_t *buf, int size, uint8_t **wptr_ptr)
346346 {
347347 int len;
348348 uint8_t *wptr;
libavformat/yuv4mpeg.c+1−1
@@ -35,7 +35,7 @@ static int yuv4_generate_header(AVFormatContext *s, char* buf) · 34 unmodified lines
3535 int width, height;
3636 int raten, rated, aspectn, aspectd, n;
3737 char inter;
38− char *colorspace = "";
38+ const char *colorspace = "";
3939
4040 st = s->streams[0];
4141 width = st->codec->width;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t