[FFmpeg-devel] [PATCH 4/4] targa: cosmetics - add some whitespace
Clément Bœsch
ubitux at gmail.com
Mon Oct 8 07:53:44 CEST 2012
On Mon, Oct 08, 2012 at 12:41:21AM -0500, Bobby Bingham wrote:
> Signed-off-by: Bobby Bingham <uhmmmm at gmail.com>
> ---
> libavcodec/targa.c | 25 ++++++++++++++-----------
> 1 file changed, 14 insertions(+), 11 deletions(-)
>
> diff --git a/libavcodec/targa.c b/libavcodec/targa.c
> index dd30a41..0dc4203 100644
> --- a/libavcodec/targa.c
> +++ b/libavcodec/targa.c
> @@ -150,7 +150,7 @@ static int decode_frame(AVCodecContext *avctx,
> // skip identifier if any
> bytestream2_skip(&s->gb, idlen);
>
> - switch(bpp){
> + switch(bpp) {
The coding style likes even more spaces (just after the switch).
> case 8:
> avctx->pix_fmt = ((compr & (~TGA_RLE)) == TGA_BW) ? PIX_FMT_GRAY8 : PIX_FMT_PAL8;
> break;
> @@ -180,10 +180,11 @@ static int decode_frame(AVCodecContext *avctx,
> av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
> return -1;
> }
> +
> if(flags & TGA_TOPTOBOTTOM) {
You're adding a \n but no space after the if
Same a lot below.
> dst = p->data[0];
> stride = p->linesize[0];
> - }else{ //image is upside-down
> + } else { //image is upside-down
> dst = p->data[0] + p->linesize[0] * (h - 1);
> stride = -p->linesize[0];
> }
> @@ -191,7 +192,7 @@ static int decode_frame(AVCodecContext *avctx,
> interleave = flags & TGA_INTERLEAVE2 ? 2 :
> flags & TGA_INTERLEAVE4 ? 4 : 1;
>
> - if(colors){
> + if(colors) {
why an incomplete change here
> int pal_size, pal_sample_size;
> if((colors + first_clr) > 256){
but not here?
> av_log(avctx, AV_LOG_ERROR, "Incorrect palette: %i colors with offset %i\n", colors, first_clr);
> @@ -206,9 +207,9 @@ static int decode_frame(AVCodecContext *avctx,
> return -1;
> }
> pal_size = colors * pal_sample_size;
> - if(avctx->pix_fmt != PIX_FMT_PAL8)//should not occur but skip palette anyway
> + if(avctx->pix_fmt != PIX_FMT_PAL8) //should not occur but skip palette anyway
> bytestream2_skip(&s->gb, pal_size);
> - else{
> + else {
> int t;
> uint32_t *pal = ((uint32_t *)p->data[1]) + first_clr;
>
> @@ -239,10 +240,11 @@ static int decode_frame(AVCodecContext *avctx,
> p->palette_has_changed = 1;
> }
> }
> +
> if ((compr & (~TGA_RLE)) == TGA_NODATA) {
> memset(p->data[0], 0, p->linesize[0] * h);
> } else {
> - if(compr & TGA_RLE){
> + if(compr & TGA_RLE) {
> int res = targa_decode_rle(avctx, s, dst, w, h, stride, bpp, interleave);
> if (res < 0)
> return res;
> @@ -263,12 +265,13 @@ static int decode_frame(AVCodecContext *avctx,
> } while (line);
> }
> }
> +
> if(flags & TGA_RIGHTTOLEFT) { // right-to-left, needs horizontal flip
> int x;
> - for(y = 0; y < h; y++){
> + for(y = 0; y < h; y++) {
> void *line = &p->data[0][y * p->linesize[0]];
> - for(x = 0; x < w >> 1; x++){
> - switch(bpp){
> + for(x = 0; x < w >> 1; x++) {
> + switch(bpp) {
Missing more spaces
> case 32:
> FFSWAP(uint32_t, ((uint32_t *)line)[x], ((uint32_t *)line)[w - x - 1]);
> break;
> @@ -293,7 +296,7 @@ static int decode_frame(AVCodecContext *avctx,
> return avpkt->size;
> }
>
> -static av_cold int targa_init(AVCodecContext *avctx){
> +static av_cold int targa_init(AVCodecContext *avctx) {
> TargaContext *s = avctx->priv_data;
>
> avcodec_get_frame_defaults(&s->picture);
> @@ -302,7 +305,7 @@ static av_cold int targa_init(AVCodecContext *avctx){
> return 0;
> }
>
> -static av_cold int targa_end(AVCodecContext *avctx){
> +static av_cold int targa_end(AVCodecContext *avctx) {
We generally put a \n instead in case of function
[...]
If you're going to "fix" the style of the file, please don't add
inconsistencies, just do all the file in one row, or don't do it at all.
--
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20121008/84f88027/attachment.asc>
More information about the ffmpeg-devel
mailing list