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
220 put_le32(pb, enc->codec_tag);220 put_le32(pb, enc->codec_tag);
221 if (coder_len & 1) {221 if (coder_len & 1) {
222 put_byte(pb, coder_len);222 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);
224 } else {224 } else {
225 put_byte(pb, coder_len+1);225 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);
227 put_byte(pb, 0);227 put_byte(pb, 0);
228 }228 }
229 229
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
349 /* stream headers */349 /* stream headers */
350 for(n=0;n<s->nb_streams;n++) {350 for(n=0;n<s->nb_streams;n++) {
351 int64_t es_pos;351 int64_t es_pos;
352 uint8_t *er_spr = NULL;352 const uint8_t *er_spr = NULL;
353 int er_spr_len = 0;353 int er_spr_len = 0;
354 // ASFStream *stream = &asf->streams[n];354 // ASFStream *stream = &asf->streams[n];
355 355
@@ -360,7 +360,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data · 4 unmodified lines
360 360
361 if (enc->codec_type == CODEC_TYPE_AUDIO) {361 if (enc->codec_type == CODEC_TYPE_AUDIO) {
362 if (enc->codec_id == CODEC_ID_ADPCM_G726) {362 if (enc->codec_id == CODEC_ID_ADPCM_G726) {
363 er_spr = (uint8_t *)error_spread_ADPCM_G726;363 er_spr = error_spread_ADPCM_G726;
364 er_spr_len = sizeof(error_spread_ADPCM_G726);364 er_spr_len = sizeof(error_spread_ADPCM_G726);
365 }365 }
366 }366 }
libavformat/avformat.h+1−1
@@ -604,7 +604,7 @@ int fifo_init(FifoBuffer *f, int size); · 603 unmodified lines
604void fifo_free(FifoBuffer *f);604void fifo_free(FifoBuffer *f);
605int fifo_size(FifoBuffer *f, uint8_t *rptr);605int fifo_size(FifoBuffer *f, uint8_t *rptr);
606int fifo_read(FifoBuffer *f, uint8_t *buf, int buf_size, uint8_t **rptr_ptr);606int fifo_read(FifoBuffer *f, uint8_t *buf, int buf_size, uint8_t **rptr_ptr);
607void fifo_write(FifoBuffer *f, uint8_t *buf, int size, uint8_t **wptr_ptr);607void fifo_write(FifoBuffer *f, const uint8_t *buf, int size, uint8_t **wptr_ptr);
608int put_fifo(ByteIOContext *pb, FifoBuffer *f, int buf_size, uint8_t **rptr_ptr);608int put_fifo(ByteIOContext *pb, FifoBuffer *f, int buf_size, uint8_t **rptr_ptr);
609void fifo_realloc(FifoBuffer *f, unsigned int size);609void fifo_realloc(FifoBuffer *f, unsigned int size);
610 610
libavformat/dv.c+1−1
@@ -692,7 +692,7 @@ int dv_assemble_frame(DVMuxContext *c, AVStream* st, · 691 unmodified lines
692 /* FIXME: we have to have more sensible approach than this one */692 /* FIXME: we have to have more sensible approach than this one */
693 if (fifo_size(&c->audio_data[i], c->audio_data[i].rptr) + data_size >= 100*AVCODEC_MAX_AUDIO_FRAME_SIZE)693 if (fifo_size(&c->audio_data[i], c->audio_data[i].rptr) + data_size >= 100*AVCODEC_MAX_AUDIO_FRAME_SIZE)
694 av_log(st->codec, AV_LOG_ERROR, "Can't process DV frame #%d. Insufficient video data or severe sync problem.\n", c->frames);694 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);
696 }696 }
697 }697 }
698out:698out:
libavformat/gif.c+1−1
@@ -187,7 +187,7 @@ static int gif_image_write_header(ByteIOContext *pb, · 186 unmodified lines
187 187
188 /* the global palette */188 /* the global palette */
189 if (!palette) {189 if (!palette) {
190 put_buffer(pb, (unsigned char *)gif_clut, 216*3);190 put_buffer(pb, (const unsigned char *)gif_clut, 216*3);
191 for(i=0;i<((256-216)*3);i++)191 for(i=0;i<((256-216)*3);i++)
192 put_byte(pb, 0);192 put_byte(pb, 0);
193 } else {193 } else {
libavformat/matroska.c+2−2
@@ -183,14 +183,14 @@ typedef enum { · 182 unmodified lines
183 */183 */
184 184
185typedef struct CodecTags{185typedef struct CodecTags{
186 char *str;186 const char *str;
187 enum CodecID id;187 enum CodecID id;
188}CodecTags;188}CodecTags;
189 189
190#define MATROSKA_CODEC_ID_VIDEO_VFW_FOURCC "V_MS/VFW/FOURCC"190#define MATROSKA_CODEC_ID_VIDEO_VFW_FOURCC "V_MS/VFW/FOURCC"
191#define MATROSKA_CODEC_ID_AUDIO_ACM "A_MS/ACM"191#define MATROSKA_CODEC_ID_AUDIO_ACM "A_MS/ACM"
192 192
193CodecTags codec_tags[]={193static CodecTags codec_tags[]={
194// {"V_MS/VFW/FOURCC" , CODEC_ID_NONE},194// {"V_MS/VFW/FOURCC" , CODEC_ID_NONE},
195 {"V_UNCOMPRESSED" , CODEC_ID_RAWVIDEO},195 {"V_UNCOMPRESSED" , CODEC_ID_RAWVIDEO},
196 {"V_MPEG4/ISO/SP" , CODEC_ID_MPEG4},196 {"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
788 788
789static int mov_write_hdlr_tag(ByteIOContext *pb, MOVTrack* track)789static int mov_write_hdlr_tag(ByteIOContext *pb, MOVTrack* track)
790{790{
791 char *descr, *hdlr, *hdlr_type;791 const char *descr, *hdlr, *hdlr_type;
792 offset_t pos = url_ftell(pb);792 offset_t pos = url_ftell(pb);
793 793
794 if (!track) { /* no media --> data handler */794 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
1085 }1085 }
1086}1086}
1087 1087
1088static int mov_write_string_tag(ByteIOContext *pb, char *name, char *value, int long_style){1088static int mov_write_string_tag(ByteIOContext *pb, const char *name, const char *value, int long_style){
1089 int size = 0;1089 int size = 0;
1090 if ( value && value[0] ) {1090 if ( value && value[0] ) {
1091 offset_t pos = url_ftell(pb);1091 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
1225 return 2*n;1225 return 2*n;
1226}1226}
1227 1227
1228static uint16_t language_code (char *str)1228static uint16_t language_code (const char *str)
1229{1229{
1230 return ((((str[0]-0x60) & 0x1F)<<10) + (((str[1]-0x60) & 0x1F)<<5) + ((str[2]-0x60) & 0x1F));1230 return ((((str[0]-0x60) & 0x1F)<<10) + (((str[1]-0x60) & 0x1F)<<5) + ((str[2]-0x60) & 0x1F));
1231}1231}
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
326 326
327 d = dst;327 d = dst;
328 for(j = 0; j < width; j++) {328 for(j = 0; j < width; j++) {
329 v = ((uint32_t *)src)[j];329 v = ((const uint32_t *)src)[j];
330 d[0] = v >> 16;330 d[0] = v >> 16;
331 d[1] = v >> 8;331 d[1] = v >> 8;
332 d[2] = v;332 d[2] = v;
libavformat/utils.c+1−1
@@ -342,7 +342,7 @@ void fifo_realloc(FifoBuffer *f, unsigned int new_size){ · 341 unmodified lines
342 }342 }
343}343}
344 344
345void fifo_write(FifoBuffer *f, uint8_t *buf, int size, uint8_t **wptr_ptr)345void fifo_write(FifoBuffer *f, const uint8_t *buf, int size, uint8_t **wptr_ptr)
346{346{
347 int len;347 int len;
348 uint8_t *wptr;348 uint8_t *wptr;
libavformat/yuv4mpeg.c+1−1
@@ -35,7 +35,7 @@ static int yuv4_generate_header(AVFormatContext *s, char* buf) · 34 unmodified lines
35 int width, height;35 int width, height;
36 int raten, rated, aspectn, aspectd, n;36 int raten, rated, aspectn, aspectd, n;
37 char inter;37 char inter;
38 char *colorspace = "";38 const char *colorspace = "";
39 39
40 st = s->streams[0];40 st = s->streams[0];
41 width = st->codec->width;41 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