Commit dd6533e1 authored by diego's avatar diego

whitespace cosmetics: K&R coding style, prettyprinting


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@20381 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent bba01e2d
......@@ -18,6 +18,7 @@
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "avcodec.h"
#include "pnm.h"
......@@ -32,7 +33,7 @@ static void pnm_get(PNMContext *sc, char *str, int buf_size)
int c;
/* skip spaces and comments */
for(;;) {
for (;;) {
c = *sc->bytestream++;
if (c == '#') {
do {
......@@ -52,7 +53,8 @@ static void pnm_get(PNMContext *sc, char *str, int buf_size)
*s = '\0';
}
int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s){
int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s)
{
char buf1[32], tuple_type[32];
int h, w, depth, maxval;
......@@ -72,7 +74,7 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s){
maxval = -1;
depth = -1;
tuple_type[0] = '\0';
for(;;) {
for (;;) {
pnm_get(s, buf1, sizeof(buf1));
if (!strcmp(buf1, "WIDTH")) {
pnm_get(s, buf1, sizeof(buf1));
......
......@@ -23,8 +23,7 @@
#include "pnm.h"
static int pnm_parse(AVCodecParserContext *s,
AVCodecContext *avctx,
static int pnm_parse(AVCodecParserContext *s, AVCodecContext *avctx,
const uint8_t **poutbuf, int *poutbuf_size,
const uint8_t *buf, int buf_size)
{
......@@ -32,31 +31,31 @@ static int pnm_parse(AVCodecParserContext *s,
PNMContext pnmctx;
int next;
for(; pc->overread>0; pc->overread--){
for (; pc->overread > 0; pc->overread--) {
pc->buffer[pc->index++]= pc->buffer[pc->overread_index++];
}
retry:
if(pc->index){
pnmctx.bytestream_start=
pnmctx.bytestream= pc->buffer;
pnmctx.bytestream_end= pc->buffer + pc->index;
}else{
pnmctx.bytestream_start=
pnmctx.bytestream= (uint8_t *) buf; /* casts avoid warnings */
pnmctx.bytestream_end= (uint8_t *) buf + buf_size;
if (pc->index) {
pnmctx.bytestream_start =
pnmctx.bytestream = pc->buffer;
pnmctx.bytestream_end = pc->buffer + pc->index;
} else {
pnmctx.bytestream_start =
pnmctx.bytestream = (uint8_t *) buf; /* casts avoid warnings */
pnmctx.bytestream_end = (uint8_t *) buf + buf_size;
}
if(ff_pnm_decode_header(avctx, &pnmctx) < 0){
if(pnmctx.bytestream < pnmctx.bytestream_end){
if(pc->index){
pc->index=0;
}else{
if (ff_pnm_decode_header(avctx, &pnmctx) < 0) {
if (pnmctx.bytestream < pnmctx.bytestream_end) {
if (pc->index) {
pc->index = 0;
} else {
buf++;
buf_size--;
}
goto retry;
}
#if 0
if(pc->index && pc->index*2 + FF_INPUT_BUFFER_PADDING_SIZE < pc->buffer_size && buf_size > pc->index){
if (pc->index && pc->index * 2 + FF_INPUT_BUFFER_PADDING_SIZE < pc->buffer_size && buf_size > pc->index) {
memcpy(pc->buffer + pc->index, buf, pc->index);
pc->index += pc->index;
buf += pc->index;
......@@ -64,17 +63,17 @@ retry:
goto retry;
}
#endif
next= END_NOT_FOUND;
}else{
next= pnmctx.bytestream - pnmctx.bytestream_start
next = END_NOT_FOUND;
} else {
next = pnmctx.bytestream - pnmctx.bytestream_start
+ avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height);
if(pnmctx.bytestream_start!=buf)
next-= pc->index;
if(next > buf_size)
next= END_NOT_FOUND;
if (pnmctx.bytestream_start != buf)
next -= pc->index;
if (next > buf_size)
next = END_NOT_FOUND;
}
if(ff_combine_frame(pc, next, &buf, &buf_size)<0){
if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
*poutbuf = NULL;
*poutbuf_size = 0;
return buf_size;
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment