diff options
Diffstat (limited to 'sub')
-rw-r--r-- | sub/spudec.c | 5 | ||||
-rw-r--r-- | sub/subreader.c | 4 | ||||
-rw-r--r-- | sub/vobsub.c | 12 |
3 files changed, 8 insertions, 13 deletions
diff --git a/sub/spudec.c b/sub/spudec.c index 8f05724fab..22f121e92c 100644 --- a/sub/spudec.c +++ b/sub/spudec.c @@ -455,11 +455,6 @@ static void spudec_process_control(spudec_handle_t *this, int pts100) current_nibble[0] / 2, current_nibble[1] / 2); off+=4; break; - case 0xff: - /* All done, bye-bye */ - mp_msg(MSGT_SPUDEC,MSGL_DBG2,"Done!\n"); - return; -// break; default: mp_msg(MSGT_SPUDEC,MSGL_WARN,"spudec: Error determining control type 0x%02x. Skipping %d bytes.\n", type, next_off - off); diff --git a/sub/subreader.c b/sub/subreader.c index 99b2c6849c..adb12724c4 100644 --- a/sub/subreader.c +++ b/sub/subreader.c @@ -165,7 +165,7 @@ static subtitle *sub_read_line_sami(stream_t* st, subtitle *current, s++; if (*s == 'P' || *s == 'p') { s++; state = 2; continue; } /* found '<P' */ for (; *s != '>' && *s != '\0'; s++); /* skip remains of non-<P> TAG */ - if (s == '\0') + if (*s == '\0') break; s++; continue; @@ -276,7 +276,7 @@ static const char *sub_readtext(const char *source, char **dest) { } *dest= malloc (len+1); - if (!dest) {return ERR;} + if (!*dest) {return ERR;} strncpy(*dest, source, len); (*dest)[len]=0; diff --git a/sub/vobsub.c b/sub/vobsub.c index 1643f249f0..5ae7e6cf1a 100644 --- a/sub/vobsub.c +++ b/sub/vobsub.c @@ -38,6 +38,7 @@ #include "core/mp_msg.h" #include "core/path.h" #include "libavutil/common.h" +#include "libavutil/intreadwrite.h" extern int vobsub_id; // Record the original -vobsubid set by commandline, since vobsub_id will be @@ -660,8 +661,7 @@ int vobsub_parse_ifo(void* this, const char *const name, unsigned int *palette, } else if (memcmp(block, ifo_magic, strlen(ifo_magic) + 1)) mp_msg(MSGT_VOBSUB, MSGL_ERR, "VobSub: Bad magic in IFO header\n"); else { - unsigned long pgci_sector = block[0xcc] << 24 | block[0xcd] << 16 - | block[0xce] << 8 | block[0xcf]; + unsigned pgci_sector = AV_RB32(block + 0xcc); int standard = (block[0x200] & 0x30) >> 4; int resolution = (block[0x201] & 0x0c) >> 2; *height = standard ? 576 : 480; @@ -693,12 +693,12 @@ int vobsub_parse_ifo(void* this, const char *const name, unsigned int *palette, || rar_read(block, sizeof(block), 1, fd) != 1) mp_msg(MSGT_VOBSUB, MSGL_ERR, "VobSub: Can't read IFO PGCI\n"); else { - unsigned long idx; - unsigned long pgc_offset = block[0xc] << 24 | block[0xd] << 16 - | block[0xe] << 8 | block[0xf]; + unsigned idx; + unsigned pgc_offset = AV_RB32(block + 0xc); + pgc_offset = FFMIN(pgc_offset, sizeof(block) - 0xa4 - 4*16); for (idx = 0; idx < 16; ++idx) { unsigned char *p = block + pgc_offset + 0xa4 + 4 * idx; - palette[idx] = p[0] << 24 | p[1] << 16 | p[2] << 8 | p[3]; + palette[idx] = AV_RB32(p); } if (vob) vob->have_palette = 1; |