This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Mplayer(cvs09.10.03) compilation fails with gcc3.4(cvs08.10.03) onsubreader.c
- From: Sebastian Stammler <linuxcld at hrz dot tu-darmstadt dot de>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 09 Oct 2003 17:07:13 +0200
- Subject: Mplayer(cvs09.10.03) compilation fails with gcc3.4(cvs08.10.03) onsubreader.c
- Reply-to: linuxchild at users dot sourceforge dot com
hi,
version=3.4(cvs fom 8.10.03)
system type= i686 athlon-xp
built with= ../gcc/configure --with-cpu=athlon-xp --with-arch=athlon-xp
--disable-werror
commandline that triggers the bug + errors:
[linuxcld@yuna1 main]$ gcc -v -c -O4 -march=athlon-xp -pipe -ffast-math
-fomit-frame-pointer -D_REENTRANT -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 -Ilibmpdemux -Iloader -Ilibvo
-I/usr/include/freetype2 -I/usr/include/gtk-1.2 -I/usr/include/glib-1.2
-I/usr/lib/glib/include -I/usr/X11R6/include -I/usr/X11R6/include
-o subreader.o subreader.c
Reading specs from /usr/local/lib/gcc/i686-pc-linux-gnu/3.4/specs
Konfiguriert mit: ../gcc/configure --with-cpu=athlon-xp
--with-arch=athlon-xp : (reconfigured) ../gcc/configure
--with-cpu=athlon-xp --with-arch=athlon-xp --disable-werror
Thread model: posix
gcc-Version 3.4 20031007 (experimental)
/usr/local/libexec/gcc/i686-pc-linux-gnu/3.4/cc1 -quiet -v
-Ilibmpdemux -Iloader -Ilibvo -I/usr/include/freetype2
-I/usr/include/gtk-1.2 -I/usr/include/glib-1.2 -I/usr/lib/glib/include
-I/usr/X11R6/include -I/usr/X11R6/include -D_REENTRANT
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 subreader.c -quiet -dumpbase
subreader.c -march=athlon-xp -auxbase-strip subreader.o -O4 -version
-ffast-math -fomit-frame-pointer -o - |
as -V -Qy -o subreader.o -
nicht vorhandenes Verzeichnis »NONE/include« wird ignoriert
nicht vorhandenes Verzeichnis
»/usr/local/lib/gcc/i686-pc-linux-gnu/3.4/../../../../i686-pc-linux-gnu/include«
wird ignoriert
doppeltes Verzeichnis »/usr/X11R6/include« wird ignoriert
#include "..." search starts here:
#include <...> search starts here:
libmpdemux
loader
libvo
/usr/include/freetype2
/usr/include/gtk-1.2
/usr/include/glib-1.2
/usr/lib/glib/include
/usr/X11R6/include
/usr/local/include
/usr/local/lib/gcc/i686-pc-linux-gnu/3.4/include
/usr/include
End of search list.
GNU C version 3.4 20031007 (experimental) (i686-pc-linux-gnu)
compiled by GNU C version 3.4 20031007 (experimental).
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
GNU assembler version 2.13.90.0.2 (i386-redhat-linux) using BFD version
2.13.90.0.2 20020802
subreader.c: In function `subcp_recode':
subreader.c:1024: internal compiler error: output_operand: invalid
expression as operand
Bitte senden Sie einen vollständigen Fehlerbericht auf Englisch ein;
bearbeiten Sie die Quellen zunächst mit eine Präprozessor, wenn es
dienlich ist.
Fehler in der deutschen Übersetzung sind an de@li.org zu melden.
Gehen Sie gemäß den Hinweisen in <URL:http://gcc.gnu.org/bugs.html> vor.
{standard input}: Assembler messages:
{standard input}:2039: Warning: end of file not at end of a line;
newline inserted
{standard input}:2311: Error: missing or invalid immediate expression `'
taken as 0
{standard input}:2311: Error: suffix or operands invalid for `add'
--------------------------
i hope that's it!
thank you!
cu linuxchild
# 1 "<built-in>"
# 1 "<command line>"
# 1 "subreader.c"
# 10 "subreader.c"
# 1 "/usr/include/stdio.h" 1 3 4
# 28 "/usr/include/stdio.h" 3 4
# 1 "/usr/include/features.h" 1 3 4
# 291 "/usr/include/features.h" 3 4
# 1 "/usr/include/sys/cdefs.h" 1 3 4
# 292 "/usr/include/features.h" 2 3 4
# 320 "/usr/include/features.h" 3 4
# 1 "/usr/include/gnu/stubs.h" 1 3 4
# 321 "/usr/include/features.h" 2 3 4
# 29 "/usr/include/stdio.h" 2 3 4
# 1 "/usr/local/lib/gcc/i686-pc-linux-gnu/3.4/include/stddef.h" 1 3 4
# 213 "/usr/local/lib/gcc/i686-pc-linux-gnu/3.4/include/stddef.h" 3 4
typedef unsigned int size_t;
# 35 "/usr/include/stdio.h" 2 3 4
# 1 "/usr/include/bits/types.h" 1 3 4
# 29 "/usr/include/bits/types.h" 3 4
# 1 "/usr/local/lib/gcc/i686-pc-linux-gnu/3.4/include/stddef.h" 1 3 4
# 30 "/usr/include/bits/types.h" 2 3 4
typedef unsigned char __u_char;
typedef unsigned short __u_short;
typedef unsigned int __u_int;
typedef unsigned long __u_long;
__extension__ typedef unsigned long long int __u_quad_t;
__extension__ typedef long long int __quad_t;
# 49 "/usr/include/bits/types.h" 3 4
typedef signed char __int8_t;
typedef unsigned char __uint8_t;
typedef signed short int __int16_t;
typedef unsigned short int __uint16_t;
typedef signed int __int32_t;
typedef unsigned int __uint32_t;
__extension__ typedef signed long long int __int64_t;
__extension__ typedef unsigned long long int __uint64_t;
typedef __quad_t *__qaddr_t;
typedef __u_quad_t __dev_t;
typedef __u_int __uid_t;
typedef __u_int __gid_t;
typedef __u_long __ino_t;
typedef __u_int __mode_t;
typedef __u_int __nlink_t;
typedef long int __off_t;
typedef __quad_t __loff_t;
typedef int __pid_t;
typedef int __ssize_t;
typedef __u_long __rlim_t;
typedef __u_quad_t __rlim64_t;
typedef __u_int __id_t;
typedef struct
{
int __val[2];
} __fsid_t;
typedef int __daddr_t;
typedef char *__caddr_t;
typedef long int __time_t;
typedef unsigned int __useconds_t;
typedef long int __suseconds_t;
typedef long int __swblk_t;
typedef long int __clock_t;
typedef int __clockid_t;
typedef int __timer_t;
typedef int __key_t;
typedef unsigned short int __ipc_pid_t;
typedef long int __blksize_t;
typedef long int __blkcnt_t;
typedef __quad_t __blkcnt64_t;
typedef __u_long __fsblkcnt_t;
typedef __u_quad_t __fsblkcnt64_t;
typedef __u_long __fsfilcnt_t;
typedef __u_quad_t __fsfilcnt64_t;
typedef __u_quad_t __ino64_t;
typedef __loff_t __off64_t;
typedef long int __t_scalar_t;
typedef unsigned long int __t_uscalar_t;
typedef int __intptr_t;
typedef unsigned int __socklen_t;
# 1 "/usr/include/bits/pthreadtypes.h" 1 3 4
# 23 "/usr/include/bits/pthreadtypes.h" 3 4
# 1 "/usr/include/bits/sched.h" 1 3 4
# 68 "/usr/include/bits/sched.h" 3 4
struct __sched_param
{
int __sched_priority;
};
# 24 "/usr/include/bits/pthreadtypes.h" 2 3 4
struct _pthread_fastlock
{
long int __status;
int __spinlock;
};
typedef struct _pthread_descr_struct *_pthread_descr;
typedef struct __pthread_attr_s
{
int __detachstate;
int __schedpolicy;
struct __sched_param __schedparam;
int __inheritsched;
int __scope;
size_t __guardsize;
int __stackaddr_set;
void *__stackaddr;
size_t __stacksize;
} pthread_attr_t;
typedef struct
{
struct _pthread_fastlock __c_lock;
_pthread_descr __c_waiting;
} pthread_cond_t;
typedef struct
{
int __dummy;
} pthread_condattr_t;
typedef unsigned int pthread_key_t;
typedef struct
{
int __m_reserved;
int __m_count;
_pthread_descr __m_owner;
int __m_kind;
struct _pthread_fastlock __m_lock;
} pthread_mutex_t;
typedef struct
{
int __mutexkind;
} pthread_mutexattr_t;
typedef int pthread_once_t;
# 140 "/usr/include/bits/pthreadtypes.h" 3 4
typedef unsigned long int pthread_t;
# 144 "/usr/include/bits/types.h" 2 3 4
# 37 "/usr/include/stdio.h" 2 3 4
typedef struct _IO_FILE FILE;
# 62 "/usr/include/stdio.h" 3 4
typedef struct _IO_FILE __FILE;
# 72 "/usr/include/stdio.h" 3 4
# 1 "/usr/include/libio.h" 1 3 4
# 32 "/usr/include/libio.h" 3 4
# 1 "/usr/include/_G_config.h" 1 3 4
# 14 "/usr/include/_G_config.h" 3 4
# 1 "/usr/local/lib/gcc/i686-pc-linux-gnu/3.4/include/stddef.h" 1 3 4
# 325 "/usr/local/lib/gcc/i686-pc-linux-gnu/3.4/include/stddef.h" 3 4
typedef long int wchar_t;
# 354 "/usr/local/lib/gcc/i686-pc-linux-gnu/3.4/include/stddef.h" 3 4
typedef unsigned int wint_t;
# 15 "/usr/include/_G_config.h" 2 3 4
# 24 "/usr/include/_G_config.h" 3 4
# 1 "/usr/include/wchar.h" 1 3 4
# 48 "/usr/include/wchar.h" 3 4
# 1 "/usr/local/lib/gcc/i686-pc-linux-gnu/3.4/include/stddef.h" 1 3 4
# 49 "/usr/include/wchar.h" 2 3 4
# 1 "/usr/include/bits/wchar.h" 1 3 4
# 51 "/usr/include/wchar.h" 2 3 4
# 71 "/usr/include/wchar.h" 3 4
typedef struct
{
int __count;
union
{
wint_t __wch;
char __wchb[4];
} __value;
} __mbstate_t;
# 25 "/usr/include/_G_config.h" 2 3 4
typedef struct
{
__off_t __pos;
__mbstate_t __state;
} _G_fpos_t;
typedef struct
{
__off64_t __pos;
__mbstate_t __state;
} _G_fpos64_t;
# 44 "/usr/include/_G_config.h" 3 4
# 1 "/usr/include/gconv.h" 1 3 4
# 28 "/usr/include/gconv.h" 3 4
# 1 "/usr/include/wchar.h" 1 3 4
# 48 "/usr/include/wchar.h" 3 4
# 1 "/usr/local/lib/gcc/i686-pc-linux-gnu/3.4/include/stddef.h" 1 3 4
# 49 "/usr/include/wchar.h" 2 3 4
# 29 "/usr/include/gconv.h" 2 3 4
# 1 "/usr/local/lib/gcc/i686-pc-linux-gnu/3.4/include/stddef.h" 1 3 4
# 32 "/usr/include/gconv.h" 2 3 4
enum
{
__GCONV_OK = 0,
__GCONV_NOCONV,
__GCONV_NODB,
__GCONV_NOMEM,
__GCONV_EMPTY_INPUT,
__GCONV_FULL_OUTPUT,
__GCONV_ILLEGAL_INPUT,
__GCONV_INCOMPLETE_INPUT,
__GCONV_ILLEGAL_DESCRIPTOR,
__GCONV_INTERNAL_ERROR
};
enum
{
__GCONV_IS_LAST = 0x0001,
__GCONV_IGNORE_ERRORS = 0x0002
};
struct __gconv_step;
struct __gconv_step_data;
struct __gconv_loaded_object;
struct __gconv_trans_data;
typedef int (*__gconv_fct) (struct __gconv_step *, struct __gconv_step_data *,
__const unsigned char **, __const unsigned char *,
unsigned char **, size_t *, int, int);
typedef int (*__gconv_init_fct) (struct __gconv_step *);
typedef void (*__gconv_end_fct) (struct __gconv_step *);
typedef int (*__gconv_trans_fct) (struct __gconv_step *,
struct __gconv_step_data *, void *,
__const unsigned char *,
__const unsigned char **,
__const unsigned char *, unsigned char **,
size_t *);
typedef int (*__gconv_trans_context_fct) (void *, __const unsigned char *,
__const unsigned char *,
unsigned char *, unsigned char *);
typedef int (*__gconv_trans_query_fct) (__const char *, __const char ***,
size_t *);
typedef int (*__gconv_trans_init_fct) (void **, const char *);
typedef void (*__gconv_trans_end_fct) (void *);
struct __gconv_trans_data
{
__gconv_trans_fct __trans_fct;
__gconv_trans_context_fct __trans_context_fct;
__gconv_trans_end_fct __trans_end_fct;
void *__data;
struct __gconv_trans_data *__next;
};
struct __gconv_step
{
struct __gconv_loaded_object *__shlib_handle;
__const char *__modname;
int __counter;
char *__from_name;
char *__to_name;
__gconv_fct __fct;
__gconv_init_fct __init_fct;
__gconv_end_fct __end_fct;
int __min_needed_from;
int __max_needed_from;
int __min_needed_to;
int __max_needed_to;
int __stateful;
void *__data;
};
struct __gconv_step_data
{
unsigned char *__outbuf;
unsigned char *__outbufend;
int __flags;
int __invocation_counter;
int __internal_use;
__mbstate_t *__statep;
__mbstate_t __state;
struct __gconv_trans_data *__trans;
};
typedef struct __gconv_info
{
size_t __nsteps;
struct __gconv_step *__steps;
__extension__ struct __gconv_step_data __data [];
} *__gconv_t;
# 45 "/usr/include/_G_config.h" 2 3 4
typedef union
{
struct __gconv_info __cd;
struct
{
struct __gconv_info __cd;
struct __gconv_step_data __data;
} __combined;
} _G_iconv_t;
typedef int _G_int16_t __attribute__ ((__mode__ (__HI__)));
typedef int _G_int32_t __attribute__ ((__mode__ (__SI__)));
typedef unsigned int _G_uint16_t __attribute__ ((__mode__ (__HI__)));
typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));
# 33 "/usr/include/libio.h" 2 3 4
# 53 "/usr/include/libio.h" 3 4
# 1 "/usr/local/lib/gcc/i686-pc-linux-gnu/3.4/include/stdarg.h" 1 3 4
# 43 "/usr/local/lib/gcc/i686-pc-linux-gnu/3.4/include/stdarg.h" 3 4
typedef __builtin_va_list __gnuc_va_list;
# 54 "/usr/include/libio.h" 2 3 4
# 162 "/usr/include/libio.h" 3 4
struct _IO_jump_t; struct _IO_FILE;
# 172 "/usr/include/libio.h" 3 4
typedef void _IO_lock_t;
struct _IO_marker {
struct _IO_marker *_next;
struct _IO_FILE *_sbuf;
int _pos;
# 195 "/usr/include/libio.h" 3 4
};
enum __codecvt_result
{
__codecvt_ok,
__codecvt_partial,
__codecvt_error,
__codecvt_noconv
};
# 263 "/usr/include/libio.h" 3 4
struct _IO_FILE {
int _flags;
char* _IO_read_ptr;
char* _IO_read_end;
char* _IO_read_base;
char* _IO_write_base;
char* _IO_write_ptr;
char* _IO_write_end;
char* _IO_buf_base;
char* _IO_buf_end;
char *_IO_save_base;
char *_IO_backup_base;
char *_IO_save_end;
struct _IO_marker *_markers;
struct _IO_FILE *_chain;
int _fileno;
int _flags2;
__off_t _old_offset;
unsigned short _cur_column;
signed char _vtable_offset;
char _shortbuf[1];
_IO_lock_t *_lock;
# 311 "/usr/include/libio.h" 3 4
__off64_t _offset;
void *__pad1;
void *__pad2;
int _mode;
char _unused2[15 * sizeof (int) - 2 * sizeof (void *)];
};
typedef struct _IO_FILE _IO_FILE;
struct _IO_FILE_plus;
extern struct _IO_FILE_plus _IO_2_1_stdin_;
extern struct _IO_FILE_plus _IO_2_1_stdout_;
extern struct _IO_FILE_plus _IO_2_1_stderr_;
# 350 "/usr/include/libio.h" 3 4
typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes);
typedef __ssize_t __io_write_fn (void *__cookie, __const char *__buf,
size_t __n);
typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w);
typedef int __io_close_fn (void *__cookie);
# 402 "/usr/include/libio.h" 3 4
extern int __underflow (_IO_FILE *) ;
extern int __uflow (_IO_FILE *) ;
extern int __overflow (_IO_FILE *, int) ;
extern wint_t __wunderflow (_IO_FILE *) ;
extern wint_t __wuflow (_IO_FILE *) ;
extern wint_t __woverflow (_IO_FILE *, wint_t) ;
# 432 "/usr/include/libio.h" 3 4
extern int _IO_getc (_IO_FILE *__fp) ;
extern int _IO_putc (int __c, _IO_FILE *__fp) ;
extern int _IO_feof (_IO_FILE *__fp) ;
extern int _IO_ferror (_IO_FILE *__fp) ;
extern int _IO_peekc_locked (_IO_FILE *__fp) ;
extern void _IO_flockfile (_IO_FILE *) ;
extern void _IO_funlockfile (_IO_FILE *) ;
extern int _IO_ftrylockfile (_IO_FILE *) ;
# 462 "/usr/include/libio.h" 3 4
extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict,
__gnuc_va_list, int *__restrict) ;
extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict,
__gnuc_va_list) ;
extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t) ;
extern size_t _IO_sgetn (_IO_FILE *, void *, size_t) ;
extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int) ;
extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int) ;
extern void _IO_free_backup_area (_IO_FILE *) ;
# 73 "/usr/include/stdio.h" 2 3 4
# 86 "/usr/include/stdio.h" 3 4
typedef _G_fpos64_t fpos_t;
# 138 "/usr/include/stdio.h" 3 4
# 1 "/usr/include/bits/stdio_lim.h" 1 3 4
# 139 "/usr/include/stdio.h" 2 3 4
extern struct _IO_FILE *stdin;
extern struct _IO_FILE *stdout;
extern struct _IO_FILE *stderr;
extern int remove (__const char *__filename) ;
extern int rename (__const char *__old, __const char *__new) ;
extern FILE *tmpfile (void) __asm__ ("" "tmpfile64");
extern char *tmpnam (char *__s) ;
# 183 "/usr/include/stdio.h" 3 4
extern char *tmpnam_r (char *__s) ;
# 195 "/usr/include/stdio.h" 3 4
extern char *tempnam (__const char *__dir, __const char *__pfx)
__attribute__ ((__malloc__));
extern int fclose (FILE *__stream) ;
extern int fflush (FILE *__stream) ;
extern int fflush_unlocked (FILE *__stream) ;
# 218 "/usr/include/stdio.h" 3 4
# 229 "/usr/include/stdio.h" 3 4
extern FILE *fopen (__const char *__restrict __filename, __const char *__restrict __modes) __asm__ ("" "fopen64");
extern FILE *freopen (__const char *__restrict __filename, __const char *__restrict __modes, FILE *__restrict __stream) __asm__ ("" "freopen64");
# 241 "/usr/include/stdio.h" 3 4
# 252 "/usr/include/stdio.h" 3 4
extern FILE *fdopen (int __fd, __const char *__modes) ;
# 273 "/usr/include/stdio.h" 3 4
extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) ;
extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf,
int __modes, size_t __n) ;
extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
size_t __size) ;
extern void setlinebuf (FILE *__stream) ;
extern int fprintf (FILE *__restrict __stream,
__const char *__restrict __format, ...) ;
extern int printf (__const char *__restrict __format, ...) ;
extern int sprintf (char *__restrict __s,
__const char *__restrict __format, ...) ;
extern int vfprintf (FILE *__restrict __s, __const char *__restrict __format,
__gnuc_va_list __arg) ;
extern int vprintf (__const char *__restrict __format, __gnuc_va_list __arg)
;
extern int vsprintf (char *__restrict __s, __const char *__restrict __format,
__gnuc_va_list __arg) ;
extern int snprintf (char *__restrict __s, size_t __maxlen,
__const char *__restrict __format, ...)
__attribute__ ((__format__ (__printf__, 3, 4)));
extern int vsnprintf (char *__restrict __s, size_t __maxlen,
__const char *__restrict __format, __gnuc_va_list __arg)
__attribute__ ((__format__ (__printf__, 3, 0)));
# 351 "/usr/include/stdio.h" 3 4
extern int fscanf (FILE *__restrict __stream,
__const char *__restrict __format, ...) ;
extern int scanf (__const char *__restrict __format, ...) ;
extern int sscanf (__const char *__restrict __s,
__const char *__restrict __format, ...) ;
# 381 "/usr/include/stdio.h" 3 4
extern int fgetc (FILE *__stream) ;
extern int getc (FILE *__stream) ;
extern int getchar (void) ;
extern int getc_unlocked (FILE *__stream) ;
extern int getchar_unlocked (void) ;
extern int fgetc_unlocked (FILE *__stream) ;
extern int fputc (int __c, FILE *__stream) ;
extern int putc (int __c, FILE *__stream) ;
extern int putchar (int __c) ;
extern int fputc_unlocked (int __c, FILE *__stream) ;
extern int putc_unlocked (int __c, FILE *__stream) ;
extern int putchar_unlocked (int __c) ;
extern int getw (FILE *__stream) ;
extern int putw (int __w, FILE *__stream) ;
extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
;
extern char *gets (char *__s) ;
# 477 "/usr/include/stdio.h" 3 4
extern int fputs (__const char *__restrict __s, FILE *__restrict __stream)
;
extern int puts (__const char *__s) ;
extern int ungetc (int __c, FILE *__stream) ;
extern size_t fread (void *__restrict __ptr, size_t __size,
size_t __n, FILE *__restrict __stream) ;
extern size_t fwrite (__const void *__restrict __ptr, size_t __size,
size_t __n, FILE *__restrict __s) ;
# 506 "/usr/include/stdio.h" 3 4
extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
size_t __n, FILE *__restrict __stream) ;
extern size_t fwrite_unlocked (__const void *__restrict __ptr, size_t __size,
size_t __n, FILE *__restrict __stream) ;
extern int fseek (FILE *__stream, long int __off, int __whence) ;
extern long int ftell (FILE *__stream) ;
extern void rewind (FILE *__stream) ;
# 535 "/usr/include/stdio.h" 3 4
extern int fseeko (FILE *__stream, __off64_t __off, int __whence) __asm__ ("" "fseeko64");
extern __off64_t ftello (FILE *__stream) __asm__ ("" "ftello64");
# 555 "/usr/include/stdio.h" 3 4
extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos) __asm__ ("" "fgetpos64");
extern int fsetpos (FILE *__stream, __const fpos_t *__pos) __asm__ ("" "fsetpos64");
# 575 "/usr/include/stdio.h" 3 4
extern void clearerr (FILE *__stream) ;
extern int feof (FILE *__stream) ;
extern int ferror (FILE *__stream) ;
extern void clearerr_unlocked (FILE *__stream) ;
extern int feof_unlocked (FILE *__stream) ;
extern int ferror_unlocked (FILE *__stream) ;
extern void perror (__const char *__s) ;
# 1 "/usr/include/bits/sys_errlist.h" 1 3 4
# 27 "/usr/include/bits/sys_errlist.h" 3 4
extern int sys_nerr;
extern __const char *__const sys_errlist[];
# 602 "/usr/include/stdio.h" 2 3 4
extern int fileno (FILE *__stream) ;
extern int fileno_unlocked (FILE *__stream) ;
extern FILE *popen (__const char *__command, __const char *__modes) ;
extern int pclose (FILE *__stream) ;
extern char *ctermid (char *__s) ;
# 655 "/usr/include/stdio.h" 3 4
extern void flockfile (FILE *__stream) ;
extern int ftrylockfile (FILE *__stream) ;
extern void funlockfile (FILE *__stream) ;
# 676 "/usr/include/stdio.h" 3 4
# 1 "/usr/include/bits/stdio.h" 1 3 4
# 33 "/usr/include/bits/stdio.h" 3 4
extern __inline int
vprintf (__const char *__restrict __fmt, __gnuc_va_list __arg)
{
return vfprintf (stdout, __fmt, __arg);
}
extern __inline int
getchar (void)
{
return _IO_getc (stdin);
}
extern __inline int
getc_unlocked (FILE *__fp)
{
return ((__fp)->_IO_read_ptr >= (__fp)->_IO_read_end ? __uflow (__fp) : *(unsigned char *) (__fp)->_IO_read_ptr++);
}
extern __inline int
getchar_unlocked (void)
{
return ((stdin)->_IO_read_ptr >= (stdin)->_IO_read_end ? __uflow (stdin) : *(unsigned char *) (stdin)->_IO_read_ptr++);
}
extern __inline int
putchar (int __c)
{
return _IO_putc (__c, stdout);
}
extern __inline int
fputc_unlocked (int __c, FILE *__stream)
{
return (((__stream)->_IO_write_ptr >= (__stream)->_IO_write_end) ? __overflow (__stream, (unsigned char) (__c)) : (unsigned char) (*(__stream)->_IO_write_ptr++ = (__c)));
}
extern __inline int
putc_unlocked (int __c, FILE *__stream)
{
return (((__stream)->_IO_write_ptr >= (__stream)->_IO_write_end) ? __overflow (__stream, (unsigned char) (__c)) : (unsigned char) (*(__stream)->_IO_write_ptr++ = (__c)));
}
extern __inline int
putchar_unlocked (int __c)
{
return (((stdout)->_IO_write_ptr >= (stdout)->_IO_write_end) ? __overflow (stdout, (unsigned char) (__c)) : (unsigned char) (*(stdout)->_IO_write_ptr++ = (__c)));
}
# 111 "/usr/include/bits/stdio.h" 3 4
extern __inline int
feof_unlocked (FILE *__stream)
{
return (((__stream)->_flags & 0x10) != 0);
}
extern __inline int
ferror_unlocked (FILE *__stream)
{
return (((__stream)->_flags & 0x20) != 0);
}
# 677 "/usr/include/stdio.h" 2 3 4
# 11 "subreader.c" 2
# 1 "/usr/include/stdlib.h" 1 3 4
# 33 "/usr/include/stdlib.h" 3 4
# 1 "/usr/local/lib/gcc/i686-pc-linux-gnu/3.4/include/stddef.h" 1 3 4
# 34 "/usr/include/stdlib.h" 2 3 4
# 93 "/usr/include/stdlib.h" 3 4
typedef struct
{
int quot;
int rem;
} div_t;
typedef struct
{
long int quot;
long int rem;
} ldiv_t;
# 137 "/usr/include/stdlib.h" 3 4
extern size_t __ctype_get_mb_cur_max (void) ;
extern double atof (__const char *__nptr) __attribute__ ((__pure__));
extern int atoi (__const char *__nptr) __attribute__ ((__pure__));
extern long int atol (__const char *__nptr) __attribute__ ((__pure__));
__extension__ extern long long int atoll (__const char *__nptr)
__attribute__ ((__pure__));
extern double strtod (__const char *__restrict __nptr,
char **__restrict __endptr) ;
# 174 "/usr/include/stdlib.h" 3 4
extern long int strtol (__const char *__restrict __nptr,
char **__restrict __endptr, int __base) ;
extern unsigned long int strtoul (__const char *__restrict __nptr,
char **__restrict __endptr, int __base)
;
__extension__
extern long long int strtoq (__const char *__restrict __nptr,
char **__restrict __endptr, int __base) ;
__extension__
extern unsigned long long int strtouq (__const char *__restrict __nptr,
char **__restrict __endptr, int __base)
;
__extension__
extern long long int strtoll (__const char *__restrict __nptr,
char **__restrict __endptr, int __base) ;
__extension__
extern unsigned long long int strtoull (__const char *__restrict __nptr,
char **__restrict __endptr, int __base)
;
# 264 "/usr/include/stdlib.h" 3 4
extern double __strtod_internal (__const char *__restrict __nptr,
char **__restrict __endptr, int __group)
;
extern float __strtof_internal (__const char *__restrict __nptr,
char **__restrict __endptr, int __group)
;
extern long double __strtold_internal (__const char *__restrict __nptr,
char **__restrict __endptr,
int __group) ;
extern long int __strtol_internal (__const char *__restrict __nptr,
char **__restrict __endptr,
int __base, int __group) ;
extern unsigned long int __strtoul_internal (__const char *__restrict __nptr,
char **__restrict __endptr,
int __base, int __group) ;
__extension__
extern long long int __strtoll_internal (__const char *__restrict __nptr,
char **__restrict __endptr,
int __base, int __group) ;
__extension__
extern unsigned long long int __strtoull_internal (__const char *
__restrict __nptr,
char **__restrict __endptr,
int __base, int __group)
;
extern __inline double
strtod (__const char *__restrict __nptr, char **__restrict __endptr)
{
return __strtod_internal (__nptr, __endptr, 0);
}
extern __inline long int
strtol (__const char *__restrict __nptr, char **__restrict __endptr,
int __base)
{
return __strtol_internal (__nptr, __endptr, __base, 0);
}
extern __inline unsigned long int
strtoul (__const char *__restrict __nptr, char **__restrict __endptr,
int __base)
{
return __strtoul_internal (__nptr, __endptr, __base, 0);
}
# 343 "/usr/include/stdlib.h" 3 4
__extension__ extern __inline long long int
strtoq (__const char *__restrict __nptr, char **__restrict __endptr,
int __base)
{
return __strtoll_internal (__nptr, __endptr, __base, 0);
}
__extension__ extern __inline unsigned long long int
strtouq (__const char *__restrict __nptr, char **__restrict __endptr,
int __base)
{
return __strtoull_internal (__nptr, __endptr, __base, 0);
}
__extension__ extern __inline long long int
strtoll (__const char *__restrict __nptr, char **__restrict __endptr,
int __base)
{
return __strtoll_internal (__nptr, __endptr, __base, 0);
}
__extension__ extern __inline unsigned long long int
strtoull (__const char * __restrict __nptr, char **__restrict __endptr,
int __base)
{
return __strtoull_internal (__nptr, __endptr, __base, 0);
}
extern __inline double
atof (__const char *__nptr)
{
return strtod (__nptr, (char **) ((void *)0));
}
extern __inline int
atoi (__const char *__nptr)
{
return (int) strtol (__nptr, (char **) ((void *)0), 10);
}
extern __inline long int
atol (__const char *__nptr)
{
return strtol (__nptr, (char **) ((void *)0), 10);
}
__extension__ extern __inline long long int
atoll (__const char *__nptr)
{
return strtoll (__nptr, (char **) ((void *)0), 10);
}
# 408 "/usr/include/stdlib.h" 3 4
extern char *l64a (long int __n) ;
extern long int a64l (__const char *__s) __attribute__ ((__pure__));
# 1 "/usr/include/sys/types.h" 1 3 4
# 28 "/usr/include/sys/types.h" 3 4
typedef __u_char u_char;
typedef __u_short u_short;
typedef __u_int u_int;
typedef __u_long u_long;
typedef __quad_t quad_t;
typedef __u_quad_t u_quad_t;
typedef __fsid_t fsid_t;
typedef __loff_t loff_t;
typedef __ino64_t ino_t;
# 61 "/usr/include/sys/types.h" 3 4
typedef __dev_t dev_t;
typedef __gid_t gid_t;
typedef __mode_t mode_t;
typedef __nlink_t nlink_t;
typedef __uid_t uid_t;
typedef __off64_t off_t;
# 99 "/usr/include/sys/types.h" 3 4
typedef __pid_t pid_t;
typedef __id_t id_t;
typedef __ssize_t ssize_t;
typedef __daddr_t daddr_t;
typedef __caddr_t caddr_t;
typedef __key_t key_t;
# 132 "/usr/include/sys/types.h" 3 4
# 1 "/usr/include/time.h" 1 3 4
# 74 "/usr/include/time.h" 3 4
typedef __time_t time_t;
# 92 "/usr/include/time.h" 3 4
typedef __clockid_t clockid_t;
# 104 "/usr/include/time.h" 3 4
typedef __timer_t timer_t;
# 133 "/usr/include/sys/types.h" 2 3 4
# 146 "/usr/include/sys/types.h" 3 4
# 1 "/usr/local/lib/gcc/i686-pc-linux-gnu/3.4/include/stddef.h" 1 3 4
# 147 "/usr/include/sys/types.h" 2 3 4
typedef unsigned long int ulong;
typedef unsigned short int ushort;
typedef unsigned int uint;
# 190 "/usr/include/sys/types.h" 3 4
typedef int int8_t __attribute__ ((__mode__ (__QI__)));
typedef int int16_t __attribute__ ((__mode__ (__HI__)));
typedef int int32_t __attribute__ ((__mode__ (__SI__)));
typedef int int64_t __attribute__ ((__mode__ (__DI__)));
typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__)));
typedef unsigned int u_int16_t __attribute__ ((__mode__ (__HI__)));
typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__)));
typedef unsigned int u_int64_t __attribute__ ((__mode__ (__DI__)));
typedef int register_t __attribute__ ((__mode__ (__word__)));
# 212 "/usr/include/sys/types.h" 3 4
# 1 "/usr/include/endian.h" 1 3 4
# 37 "/usr/include/endian.h" 3 4
# 1 "/usr/include/bits/endian.h" 1 3 4
# 38 "/usr/include/endian.h" 2 3 4
# 213 "/usr/include/sys/types.h" 2 3 4
# 1 "/usr/include/sys/select.h" 1 3 4
# 31 "/usr/include/sys/select.h" 3 4
# 1 "/usr/include/bits/select.h" 1 3 4
# 32 "/usr/include/sys/select.h" 2 3 4
# 1 "/usr/include/bits/sigset.h" 1 3 4
# 23 "/usr/include/bits/sigset.h" 3 4
typedef int __sig_atomic_t;
typedef struct
{
unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))];
} __sigset_t;
# 35 "/usr/include/sys/select.h" 2 3 4
typedef __sigset_t sigset_t;
# 1 "/usr/include/time.h" 1 3 4
# 116 "/usr/include/time.h" 3 4
struct timespec
{
__time_t tv_sec;
long int tv_nsec;
};
# 45 "/usr/include/sys/select.h" 2 3 4
# 1 "/usr/include/bits/time.h" 1 3 4
# 67 "/usr/include/bits/time.h" 3 4
struct timeval
{
__time_t tv_sec;
__suseconds_t tv_usec;
};
# 47 "/usr/include/sys/select.h" 2 3 4
typedef __suseconds_t suseconds_t;
typedef long int __fd_mask;
# 67 "/usr/include/sys/select.h" 3 4
typedef struct
{
__fd_mask __fds_bits[1024 / (8 * sizeof (__fd_mask))];
} fd_set;
typedef __fd_mask fd_mask;
# 99 "/usr/include/sys/select.h" 3 4
extern int select (int __nfds, fd_set *__restrict __readfds,
fd_set *__restrict __writefds,
fd_set *__restrict __exceptfds,
struct timeval *__restrict __timeout) ;
# 122 "/usr/include/sys/select.h" 3 4
# 216 "/usr/include/sys/types.h" 2 3 4
# 1 "/usr/include/sys/sysmacros.h" 1 3 4
# 219 "/usr/include/sys/types.h" 2 3 4
# 243 "/usr/include/sys/types.h" 3 4
typedef __blkcnt64_t blkcnt_t;
typedef __fsblkcnt64_t fsblkcnt_t;
typedef __fsfilcnt64_t fsfilcnt_t;
# 262 "/usr/include/sys/types.h" 3 4
# 415 "/usr/include/stdlib.h" 2 3 4
extern long int random (void) ;
extern void srandom (unsigned int __seed) ;
extern char *initstate (unsigned int __seed, char *__statebuf,
size_t __statelen) ;
extern char *setstate (char *__statebuf) ;
struct random_data
{
int32_t *fptr;
int32_t *rptr;
int32_t *state;
int rand_type;
int rand_deg;
int rand_sep;
int32_t *end_ptr;
};
extern int random_r (struct random_data *__restrict __buf,
int32_t *__restrict __result) ;
extern int srandom_r (unsigned int __seed, struct random_data *__buf) ;
extern int initstate_r (unsigned int __seed, char *__restrict __statebuf,
size_t __statelen,
struct random_data *__restrict __buf) ;
extern int setstate_r (char *__restrict __statebuf,
struct random_data *__restrict __buf) ;
extern int rand (void) ;
extern void srand (unsigned int __seed) ;
extern int rand_r (unsigned int *__seed) ;
extern double drand48 (void) ;
extern double erand48 (unsigned short int __xsubi[3]) ;
extern long int lrand48 (void) ;
extern long int nrand48 (unsigned short int __xsubi[3]) ;
extern long int mrand48 (void) ;
extern long int jrand48 (unsigned short int __xsubi[3]) ;
extern void srand48 (long int __seedval) ;
extern unsigned short int *seed48 (unsigned short int __seed16v[3]) ;
extern void lcong48 (unsigned short int __param[7]) ;
struct drand48_data
{
unsigned short int __x[3];
unsigned short int __old_x[3];
unsigned short int __c;
unsigned short int __init;
unsigned long long int __a;
};
extern int drand48_r (struct drand48_data *__restrict __buffer,
double *__restrict __result) ;
extern int erand48_r (unsigned short int __xsubi[3],
struct drand48_data *__restrict __buffer,
double *__restrict __result) ;
extern int lrand48_r (struct drand48_data *__restrict __buffer,
long int *__restrict __result) ;
extern int nrand48_r (unsigned short int __xsubi[3],
struct drand48_data *__restrict __buffer,
long int *__restrict __result) ;
extern int mrand48_r (struct drand48_data *__restrict __buffer,
long int *__restrict __result) ;
extern int jrand48_r (unsigned short int __xsubi[3],
struct drand48_data *__restrict __buffer,
long int *__restrict __result) ;
extern int srand48_r (long int __seedval, struct drand48_data *__buffer)
;
extern int seed48_r (unsigned short int __seed16v[3],
struct drand48_data *__buffer) ;
extern int lcong48_r (unsigned short int __param[7],
struct drand48_data *__buffer) ;
extern void *malloc (size_t __size) __attribute__ ((__malloc__));
extern void *calloc (size_t __nmemb, size_t __size)
__attribute__ ((__malloc__));
extern void *realloc (void *__ptr, size_t __size) __attribute__ ((__malloc__));
extern void free (void *__ptr) ;
extern void cfree (void *__ptr) ;
# 1 "/usr/include/alloca.h" 1 3 4
# 25 "/usr/include/alloca.h" 3 4
# 1 "/usr/local/lib/gcc/i686-pc-linux-gnu/3.4/include/stddef.h" 1 3 4
# 26 "/usr/include/alloca.h" 2 3 4
extern void *alloca (size_t __size) ;
# 577 "/usr/include/stdlib.h" 2 3 4
extern void *valloc (size_t __size) __attribute__ ((__malloc__));
# 590 "/usr/include/stdlib.h" 3 4
extern void abort (void) __attribute__ ((__noreturn__));
extern int atexit (void (*__func) (void)) ;
extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg)
;
extern void exit (int __status) __attribute__ ((__noreturn__));
# 622 "/usr/include/stdlib.h" 3 4
extern char *getenv (__const char *__name) ;
extern char *__secure_getenv (__const char *__name) ;
extern int putenv (char *__string) ;
extern int setenv (__const char *__name, __const char *__value, int __replace)
;
extern int unsetenv (__const char *__name) ;
extern int clearenv (void) ;
# 661 "/usr/include/stdlib.h" 3 4
extern char *mktemp (char *__template) ;
# 672 "/usr/include/stdlib.h" 3 4
extern int mkstemp (char *__template) __asm__ ("" "mkstemp64");
# 688 "/usr/include/stdlib.h" 3 4
extern char *mkdtemp (char *__template) ;
extern int system (__const char *__command) ;
# 712 "/usr/include/stdlib.h" 3 4
extern char *realpath (__const char *__restrict __name,
char *__restrict __resolved) ;
typedef int (*__compar_fn_t) (__const void *, __const void *);
extern void *bsearch (__const void *__key, __const void *__base,
size_t __nmemb, size_t __size, __compar_fn_t __compar);
extern void qsort (void *__base, size_t __nmemb, size_t __size,
__compar_fn_t __compar);
extern int abs (int __x) __attribute__ ((__const__));
extern long int labs (long int __x) __attribute__ ((__const__));
extern div_t div (int __numer, int __denom)
__attribute__ ((__const__));
extern ldiv_t ldiv (long int __numer, long int __denom)
__attribute__ ((__const__));
# 776 "/usr/include/stdlib.h" 3 4
extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt,
int *__restrict __sign) ;
extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt,
int *__restrict __sign) ;
extern char *gcvt (double __value, int __ndigit, char *__buf) ;
extern char *qecvt (long double __value, int __ndigit,
int *__restrict __decpt, int *__restrict __sign) ;
extern char *qfcvt (long double __value, int __ndigit,
int *__restrict __decpt, int *__restrict __sign) ;
extern char *qgcvt (long double __value, int __ndigit, char *__buf) ;
extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt,
int *__restrict __sign, char *__restrict __buf,
size_t __len) ;
extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt,
int *__restrict __sign, char *__restrict __buf,
size_t __len) ;
extern int qecvt_r (long double __value, int __ndigit,
int *__restrict __decpt, int *__restrict __sign,
char *__restrict __buf, size_t __len) ;
extern int qfcvt_r (long double __value, int __ndigit,
int *__restrict __decpt, int *__restrict __sign,
char *__restrict __buf, size_t __len) ;
extern int mblen (__const char *__s, size_t __n) ;
extern int mbtowc (wchar_t *__restrict __pwc,
__const char *__restrict __s, size_t __n) ;
extern int wctomb (char *__s, wchar_t __wchar) ;
extern size_t mbstowcs (wchar_t *__restrict __pwcs,
__const char *__restrict __s, size_t __n) ;
extern size_t wcstombs (char *__restrict __s,
__const wchar_t *__restrict __pwcs, size_t __n)
;
extern int rpmatch (__const char *__response) ;
# 908 "/usr/include/stdlib.h" 3 4
extern int getloadavg (double __loadavg[], int __nelem) ;
# 12 "subreader.c" 2
# 1 "/usr/include/string.h" 1 3 4
# 28 "/usr/include/string.h" 3 4
# 1 "/usr/local/lib/gcc/i686-pc-linux-gnu/3.4/include/stddef.h" 1 3 4
# 34 "/usr/include/string.h" 2 3 4
extern void *memcpy (void *__restrict __dest,
__const void *__restrict __src, size_t __n) ;
extern void *memmove (void *__dest, __const void *__src, size_t __n)
;
extern void *memccpy (void *__restrict __dest, __const void *__restrict __src,
int __c, size_t __n)
;
extern void *memset (void *__s, int __c, size_t __n) ;
extern int memcmp (__const void *__s1, __const void *__s2, size_t __n)
__attribute__ ((__pure__));
extern void *memchr (__const void *__s, int __c, size_t __n)
__attribute__ ((__pure__));
# 80 "/usr/include/string.h" 3 4
extern char *strcpy (char *__restrict __dest, __const char *__restrict __src)
;
extern char *strncpy (char *__restrict __dest,
__const char *__restrict __src, size_t __n) ;
extern char *strcat (char *__restrict __dest, __const char *__restrict __src)
;
extern char *strncat (char *__restrict __dest, __const char *__restrict __src,
size_t __n) ;
extern int strcmp (__const char *__s1, __const char *__s2)
__attribute__ ((__pure__));
extern int strncmp (__const char *__s1, __const char *__s2, size_t __n)
__attribute__ ((__pure__));
extern int strcoll (__const char *__s1, __const char *__s2)
__attribute__ ((__pure__));
extern size_t strxfrm (char *__restrict __dest,
__const char *__restrict __src, size_t __n) ;
# 126 "/usr/include/string.h" 3 4
extern char *strdup (__const char *__s) __attribute__ ((__malloc__));
# 160 "/usr/include/string.h" 3 4
extern char *strchr (__const char *__s, int __c) __attribute__ ((__pure__));
extern char *strrchr (__const char *__s, int __c) __attribute__ ((__pure__));
extern size_t strcspn (__const char *__s, __const char *__reject)
__attribute__ ((__pure__));
extern size_t strspn (__const char *__s, __const char *__accept)
__attribute__ ((__pure__));
extern char *strpbrk (__const char *__s, __const char *__accept)
__attribute__ ((__pure__));
extern char *strstr (__const char *__haystack, __const char *__needle)
__attribute__ ((__pure__));
extern char *strtok (char *__restrict __s, __const char *__restrict __delim)
;
extern char *__strtok_r (char *__restrict __s,
__const char *__restrict __delim,
char **__restrict __save_ptr) ;
extern char *strtok_r (char *__restrict __s, __const char *__restrict __delim,
char **__restrict __save_ptr) ;
# 228 "/usr/include/string.h" 3 4
extern size_t strlen (__const char *__s) __attribute__ ((__pure__));
# 241 "/usr/include/string.h" 3 4
extern char *strerror (int __errnum) ;
extern char *strerror_r (int __errnum, char *__buf, size_t __buflen) ;
extern void __bzero (void *__s, size_t __n) ;
extern void bcopy (__const void *__src, void *__dest, size_t __n) ;
extern void bzero (void *__s, size_t __n) ;
extern int bcmp (__const void *__s1, __const void *__s2, size_t __n)
__attribute__ ((__pure__));
extern char *index (__const char *__s, int __c) __attribute__ ((__pure__));
extern char *rindex (__const char *__s, int __c) __attribute__ ((__pure__));
extern int ffs (int __i) __attribute__ ((__const__));
# 287 "/usr/include/string.h" 3 4
extern int strcasecmp (__const char *__s1, __const char *__s2)
__attribute__ ((__pure__));
extern int strncasecmp (__const char *__s1, __const char *__s2, size_t __n)
__attribute__ ((__pure__));
# 309 "/usr/include/string.h" 3 4
extern char *strsep (char **__restrict __stringp,
__const char *__restrict __delim) ;
# 372 "/usr/include/string.h" 3 4
# 1 "/usr/include/bits/string.h" 1 3 4
# 373 "/usr/include/string.h" 2 3 4
# 1 "/usr/include/bits/string2.h" 1 3 4
# 389 "/usr/include/bits/string2.h" 3 4
extern void *__rawmemchr (const void *__s, int __c);
# 919 "/usr/include/bits/string2.h" 3 4
extern __inline size_t __strcspn_c1 (__const char *__s, int __reject);
extern __inline size_t
__strcspn_c1 (__const char *__s, int __reject)
{
register size_t __result = 0;
while (__s[__result] != '\0' && __s[__result] != __reject)
++__result;
return __result;
}
extern __inline size_t __strcspn_c2 (__const char *__s, int __reject1,
int __reject2);
extern __inline size_t
__strcspn_c2 (__const char *__s, int __reject1, int __reject2)
{
register size_t __result = 0;
while (__s[__result] != '\0' && __s[__result] != __reject1
&& __s[__result] != __reject2)
++__result;
return __result;
}
extern __inline size_t __strcspn_c3 (__const char *__s, int __reject1,
int __reject2, int __reject3);
extern __inline size_t
__strcspn_c3 (__const char *__s, int __reject1, int __reject2,
int __reject3)
{
register size_t __result = 0;
while (__s[__result] != '\0' && __s[__result] != __reject1
&& __s[__result] != __reject2 && __s[__result] != __reject3)
++__result;
return __result;
}
# 976 "/usr/include/bits/string2.h" 3 4
extern __inline size_t __strspn_c1 (__const char *__s, int __accept);
extern __inline size_t
__strspn_c1 (__const char *__s, int __accept)
{
register size_t __result = 0;
while (__s[__result] == __accept)
++__result;
return __result;
}
extern __inline size_t __strspn_c2 (__const char *__s, int __accept1,
int __accept2);
extern __inline size_t
__strspn_c2 (__const char *__s, int __accept1, int __accept2)
{
register size_t __result = 0;
while (__s[__result] == __accept1 || __s[__result] == __accept2)
++__result;
return __result;
}
extern __inline size_t __strspn_c3 (__const char *__s, int __accept1,
int __accept2, int __accept3);
extern __inline size_t
__strspn_c3 (__const char *__s, int __accept1, int __accept2, int __accept3)
{
register size_t __result = 0;
while (__s[__result] == __accept1 || __s[__result] == __accept2
|| __s[__result] == __accept3)
++__result;
return __result;
}
# 1033 "/usr/include/bits/string2.h" 3 4
extern __inline char *__strpbrk_c2 (__const char *__s, int __accept1,
int __accept2);
extern __inline char *
__strpbrk_c2 (__const char *__s, int __accept1, int __accept2)
{
while (*__s != '\0' && *__s != __accept1 && *__s != __accept2)
++__s;
return *__s == '\0' ? ((void *)0) : (char *) (size_t) __s;
}
extern __inline char *__strpbrk_c3 (__const char *__s, int __accept1,
int __accept2, int __accept3);
extern __inline char *
__strpbrk_c3 (__const char *__s, int __accept1, int __accept2,
int __accept3)
{
while (*__s != '\0' && *__s != __accept1 && *__s != __accept2
&& *__s != __accept3)
++__s;
return *__s == '\0' ? ((void *)0) : (char *) (size_t) __s;
}
# 1085 "/usr/include/bits/string2.h" 3 4
extern __inline char *__strtok_r_1c (char *__s, char __sep, char **__nextp);
extern __inline char *
__strtok_r_1c (char *__s, char __sep, char **__nextp)
{
char *__result;
if (__s == ((void *)0))
__s = *__nextp;
while (*__s == __sep)
++__s;
__result = ((void *)0);
if (*__s != '\0')
{
__result = __s++;
while (*__s != '\0')
if (*__s++ == __sep)
{
__s[-1] = '\0';
break;
}
*__nextp = __s;
}
return __result;
}
# 1117 "/usr/include/bits/string2.h" 3 4
extern char *__strsep_g (char **__stringp, __const char *__delim);
# 1135 "/usr/include/bits/string2.h" 3 4
extern __inline char *__strsep_1c (char **__s, char __reject);
extern __inline char *
__strsep_1c (char **__s, char __reject)
{
register char *__retval = *__s;
if (__retval != ((void *)0) && (*__s = (__extension__ (__builtin_constant_p (__reject) && (__reject) == '\0' ? (char *) __rawmemchr (__retval, __reject) : strchr (__retval, __reject)))) != ((void *)0))
*(*__s)++ = '\0';
return __retval;
}
extern __inline char *__strsep_2c (char **__s, char __reject1, char __reject2);
extern __inline char *
__strsep_2c (char **__s, char __reject1, char __reject2)
{
register char *__retval = *__s;
if (__retval != ((void *)0))
{
register char *__cp = __retval;
while (1)
{
if (*__cp == '\0')
{
__cp = ((void *)0);
break;
}
if (*__cp == __reject1 || *__cp == __reject2)
{
*__cp++ = '\0';
break;
}
++__cp;
}
*__s = __cp;
}
return __retval;
}
extern __inline char *__strsep_3c (char **__s, char __reject1, char __reject2,
char __reject3);
extern __inline char *
__strsep_3c (char **__s, char __reject1, char __reject2, char __reject3)
{
register char *__retval = *__s;
if (__retval != ((void *)0))
{
register char *__cp = __retval;
while (1)
{
if (*__cp == '\0')
{
__cp = ((void *)0);
break;
}
if (*__cp == __reject1 || *__cp == __reject2 || *__cp == __reject3)
{
*__cp++ = '\0';
break;
}
++__cp;
}
*__s = __cp;
}
return __retval;
}
# 1216 "/usr/include/bits/string2.h" 3 4
extern char *__strdup (__const char *__string) __attribute__ ((__malloc__));
# 1235 "/usr/include/bits/string2.h" 3 4
extern char *__strndup (__const char *__string, size_t __n)
__attribute__ ((__malloc__));
# 376 "/usr/include/string.h" 2 3 4
# 13 "subreader.c" 2
# 1 "/usr/include/ctype.h" 1 3 4
# 30 "/usr/include/ctype.h" 3 4
# 48 "/usr/include/ctype.h" 3 4
enum
{
_ISupper = ((0) < 8 ? ((1 << (0)) << 8) : ((1 << (0)) >> 8)),
_ISlower = ((1) < 8 ? ((1 << (1)) << 8) : ((1 << (1)) >> 8)),
_ISalpha = ((2) < 8 ? ((1 << (2)) << 8) : ((1 << (2)) >> 8)),
_ISdigit = ((3) < 8 ? ((1 << (3)) << 8) : ((1 << (3)) >> 8)),
_ISxdigit = ((4) < 8 ? ((1 << (4)) << 8) : ((1 << (4)) >> 8)),
_ISspace = ((5) < 8 ? ((1 << (5)) << 8) : ((1 << (5)) >> 8)),
_ISprint = ((6) < 8 ? ((1 << (6)) << 8) : ((1 << (6)) >> 8)),
_ISgraph = ((7) < 8 ? ((1 << (7)) << 8) : ((1 << (7)) >> 8)),
_ISblank = ((8) < 8 ? ((1 << (8)) << 8) : ((1 << (8)) >> 8)),
_IScntrl = ((9) < 8 ? ((1 << (9)) << 8) : ((1 << (9)) >> 8)),
_ISpunct = ((10) < 8 ? ((1 << (10)) << 8) : ((1 << (10)) >> 8)),
_ISalnum = ((11) < 8 ? ((1 << (11)) << 8) : ((1 << (11)) >> 8))
};
# 81 "/usr/include/ctype.h" 3 4
extern __const unsigned short int **__ctype_b_loc (void)
__attribute__ ((__const));
extern __const __int32_t **__ctype_tolower_loc (void)
__attribute__ ((__const));
extern __const __int32_t **__ctype_toupper_loc (void)
__attribute__ ((__const));
# 96 "/usr/include/ctype.h" 3 4
extern int isalnum (int) ;
extern int isalpha (int) ;
extern int iscntrl (int) ;
extern int isdigit (int) ;
extern int islower (int) ;
extern int isgraph (int) ;
extern int isprint (int) ;
extern int ispunct (int) ;
extern int isspace (int) ;
extern int isupper (int) ;
extern int isxdigit (int) ;
extern int tolower (int __c) ;
extern int toupper (int __c) ;
# 142 "/usr/include/ctype.h" 3 4
extern int isascii (int __c) ;
extern int toascii (int __c) ;
extern int _toupper (int) ;
extern int _tolower (int) ;
# 190 "/usr/include/ctype.h" 3 4
extern __inline int
tolower (int __c)
{
return __c >= -128 && __c < 256 ? (*__ctype_tolower_loc ())[__c] : __c;
}
extern __inline int
toupper (int __c)
{
return __c >= -128 && __c < 256 ? (*__ctype_toupper_loc ())[__c] : __c;
}
# 323 "/usr/include/ctype.h" 3 4
# 14 "subreader.c" 2
# 1 "/usr/include/dirent.h" 1 3 4
# 28 "/usr/include/dirent.h" 3 4
# 62 "/usr/include/dirent.h" 3 4
# 1 "/usr/include/bits/dirent.h" 1 3 4
# 23 "/usr/include/bits/dirent.h" 3 4
struct dirent
{
__ino64_t d_ino;
__off64_t d_off;
unsigned short int d_reclen;
unsigned char d_type;
char d_name[256];
};
# 63 "/usr/include/dirent.h" 2 3 4
# 98 "/usr/include/dirent.h" 3 4
enum
{
DT_UNKNOWN = 0,
DT_FIFO = 1,
DT_CHR = 2,
DT_DIR = 4,
DT_BLK = 6,
DT_REG = 8,
DT_LNK = 10,
DT_SOCK = 12,
DT_WHT = 14
};
# 128 "/usr/include/dirent.h" 3 4
typedef struct __dirstream DIR;
extern DIR *opendir (__const char *__name) ;
extern int closedir (DIR *__dirp) ;
# 149 "/usr/include/dirent.h" 3 4
extern struct dirent *readdir (DIR *__dirp) __asm__ ("" "readdir64");
# 168 "/usr/include/dirent.h" 3 4
extern int readdir_r (DIR *__restrict __dirp, struct dirent *__restrict __entry, struct dirent **__restrict __result) __asm__ ("" "readdir64_r");
# 186 "/usr/include/dirent.h" 3 4
extern void rewinddir (DIR *__dirp) ;
extern void seekdir (DIR *__dirp, long int __pos) ;
extern long int telldir (DIR *__dirp) ;
extern int dirfd (DIR *__dirp) ;
# 1 "/usr/include/bits/posix1_lim.h" 1 3 4
# 126 "/usr/include/bits/posix1_lim.h" 3 4
# 1 "/usr/include/bits/local_lim.h" 1 3 4
# 36 "/usr/include/bits/local_lim.h" 3 4
# 1 "/usr/include/linux/limits.h" 1 3 4
# 37 "/usr/include/bits/local_lim.h" 2 3 4
# 127 "/usr/include/bits/posix1_lim.h" 2 3 4
# 210 "/usr/include/dirent.h" 2 3 4
# 220 "/usr/include/dirent.h" 3 4
# 1 "/usr/local/lib/gcc/i686-pc-linux-gnu/3.4/include/stddef.h" 1 3 4
# 221 "/usr/include/dirent.h" 2 3 4
# 233 "/usr/include/dirent.h" 3 4
extern int scandir (__const char *__restrict __dir, struct dirent ***__restrict __namelist, int (*__selector) (__const struct dirent *), int (*__cmp) (__const void *, __const void *)) __asm__ ("" "scandir64");
# 259 "/usr/include/dirent.h" 3 4
extern int alphasort (__const void *__e1, __const void *__e2) __asm__ ("" "alphasort64") __attribute__ ((__pure__));
# 305 "/usr/include/dirent.h" 3 4
extern __ssize_t getdirentries (int __fd, char *__restrict __buf, size_t __nbytes, __off64_t *__restrict __basep) __asm__ ("" "getdirentries64");
# 323 "/usr/include/dirent.h" 3 4
# 17 "subreader.c" 2
# 1 "config.h" 1
# 19 "subreader.c" 2
# 1 "mp_msg.h" 1
extern int verbose;
# 90 "mp_msg.h"
void mp_msg_init();
void mp_msg_set_level(int verbose);
int mp_msg_test(int mod, int lev);
# 1 "config.h" 1
# 95 "mp_msg.h" 2
# 103 "mp_msg.h"
# 1 "/usr/include/libintl.h" 1 3 4
# 35 "/usr/include/libintl.h" 3 4
extern char *gettext (__const char *__msgid) ;
extern char *dgettext (__const char *__domainname, __const char *__msgid)
;
extern char *__dgettext (__const char *__domainname, __const char *__msgid)
__attribute__ ((__format_arg__ (2)));
extern char *dcgettext (__const char *__domainname,
__const char *__msgid, int __category) ;
extern char *__dcgettext (__const char *__domainname,
__const char *__msgid, int __category)
__attribute__ ((__format_arg__ (2)));
extern char *ngettext (__const char *__msgid1, __const char *__msgid2,
unsigned long int __n)
__attribute__ ((__format_arg__ (1))) __attribute__ ((__format_arg__ (2)));
extern char *dngettext (__const char *__domainname, __const char *__msgid1,
__const char *__msgid2, unsigned long int __n)
__attribute__ ((__format_arg__ (2))) __attribute__ ((__format_arg__ (3)));
extern char *dcngettext (__const char *__domainname, __const char *__msgid1,
__const char *__msgid2, unsigned long int __n,
int __category)
__attribute__ ((__format_arg__ (2))) __attribute__ ((__format_arg__ (3)));
extern char *textdomain (__const char *__domainname) ;
extern char *bindtextdomain (__const char *__domainname,
__const char *__dirname) ;
extern char *bind_textdomain_codeset (__const char *__domainname,
__const char *__codeset) ;
# 1 "/usr/local/lib/gcc/i686-pc-linux-gnu/3.4/include/stddef.h" 1 3 4
# 100 "/usr/include/libintl.h" 2 3 4
# 1 "/usr/include/locale.h" 1 3 4
# 29 "/usr/include/locale.h" 3 4
# 1 "/usr/local/lib/gcc/i686-pc-linux-gnu/3.4/include/stddef.h" 1 3 4
# 30 "/usr/include/locale.h" 2 3 4
# 1 "/usr/include/bits/locale.h" 1 3 4
# 27 "/usr/include/bits/locale.h" 3 4
enum
{
__LC_CTYPE = 0,
__LC_NUMERIC = 1,
__LC_TIME = 2,
__LC_COLLATE = 3,
__LC_MONETARY = 4,
__LC_MESSAGES = 5,
__LC_ALL = 6,
__LC_PAPER = 7,
__LC_NAME = 8,
__LC_ADDRESS = 9,
__LC_TELEPHONE = 10,
__LC_MEASUREMENT = 11,
__LC_IDENTIFICATION = 12
};
# 31 "/usr/include/locale.h" 2 3 4
# 52 "/usr/include/locale.h" 3 4
struct lconv
{
char *decimal_point;
char *thousands_sep;
char *grouping;
char *int_curr_symbol;
char *currency_symbol;
char *mon_decimal_point;
char *mon_thousands_sep;
char *mon_grouping;
char *positive_sign;
char *negative_sign;
char int_frac_digits;
char frac_digits;
char p_cs_precedes;
char p_sep_by_space;
char n_cs_precedes;
char n_sep_by_space;
char p_sign_posn;
char n_sign_posn;
# 112 "/usr/include/locale.h" 3 4
char __int_p_cs_precedes;
char __int_p_sep_by_space;
char __int_n_cs_precedes;
char __int_n_sep_by_space;
char __int_p_sign_posn;
char __int_n_sign_posn;
};
extern char *setlocale (int __category, __const char *__locale) ;
extern struct lconv *localeconv (void) ;
# 208 "/usr/include/locale.h" 3 4
# 103 "/usr/include/libintl.h" 2 3 4
# 120 "/usr/include/libintl.h" 3 4
# 104 "mp_msg.h" 2
void mp_msg_c( int x, const char *format, ... ) __attribute__ ((format (printf, 2, 3)));
# 20 "subreader.c" 2
# 1 "subreader.h" 1
extern int suboverlap_enabled;
extern int sub_no_text_pp;
extern int sub_match_fuzziness;
# 25 "subreader.h"
extern int sub_format;
# 34 "subreader.h"
typedef struct {
int lines;
unsigned long start;
unsigned long end;
char *text[10];
unsigned char alignment;
} subtitle;
typedef struct {
subtitle *subtitles;
char *filename;
int sub_uses_time;
int sub_num;
int sub_errs;
} sub_data;
sub_data* sub_read_file (char *filename, float pts);
subtitle* subcp_recode1 (subtitle *sub);
void subcp_open (void);
void subcp_close (void);
char ** sub_filenames(char *path, char *fname);
void list_sub_file(sub_data* subd);
void dump_srt(sub_data* subd, float fps);
void dump_mpsub(sub_data* subd, float fps);
void dump_microdvd(sub_data* subd, float fps);
void dump_jacosub(sub_data* subd, float fps);
void dump_sami(sub_data* subd, float fps);
void sub_free( sub_data * subd );
void find_sub(sub_data* subd,int key);
void step_sub(sub_data *subd, float pts, int movement);
# 21 "subreader.c" 2
# 1 "/usr/include/iconv.h" 1 3 4
# 24 "/usr/include/iconv.h" 3 4
# 1 "/usr/local/lib/gcc/i686-pc-linux-gnu/3.4/include/stddef.h" 1 3 4
# 25 "/usr/include/iconv.h" 2 3 4
typedef void *iconv_t;
extern iconv_t iconv_open (__const char *__tocode, __const char *__fromcode)
;
extern size_t iconv (iconv_t __cd, char **__restrict __inbuf,
size_t *__restrict __inbytesleft,
char **__restrict __outbuf,
size_t *__restrict __outbytesleft);
extern int iconv_close (iconv_t __cd) ;
# 26 "subreader.c" 2
char *sub_cp=((void *)0);
extern char* dvdsub_lang;
static float mpsub_position=0;
static float mpsub_multiplier=1.;
static int sub_slacktime = 20000;
int sub_no_text_pp=0;
int sub_match_fuzziness=0;
int sub_format=-1;
# 61 "subreader.c"
unsigned long previous_sub_end;
static int eol(char p) {
return (p=='\r' || p=='\n' || p=='\0');
}
static void trail_space(char *s) {
int i = 0;
while (((*__ctype_b_loc ())[(int) ((s[i]))] & (unsigned short int) _ISspace)) ++i;
if (i) strcpy(s, s + i);
i = strlen(s) - 1;
while (i > 0 && ((*__ctype_b_loc ())[(int) ((s[i]))] & (unsigned short int) _ISspace)) s[i--] = '\0';
}
static char *stristr(const char *haystack, const char *needle) {
int len = 0;
const char *p = haystack;
if (!(haystack && needle)) return ((void *)0);
len=strlen(needle);
while (*p != '\0') {
if (strncasecmp(p, needle, len) == 0) return (char*)p;
p++;
}
return ((void *)0);
}
subtitle *sub_read_line_sami(FILE *fd, subtitle *current) {
static char line[1000 +1];
static char *s = ((void *)0), *slacktime_s;
char text[1000 +1], *p=((void *)0), *q;
int state;
current->lines = current->start = current->end = 0;
state = 0;
if (!s)
if (!(s = fgets(line, 1000, fd))) return 0;
do {
switch (state) {
case 0:
slacktime_s = stristr (s, "Slacktime:");
if (slacktime_s)
sub_slacktime = strtol (slacktime_s+10, ((void *)0), 0) / 10;
s = stristr (s, "Start=");
if (s) {
current->start = strtol (s + 6, &s, 0) / 10;
state = 1; continue;
}
break;
case 1:
if ((s = stristr (s, "<P"))) { s += 2; state = 2; continue; }
break;
case 2:
if ((s = (__extension__ (__builtin_constant_p ('>') && ('>') == '\0' ? (char *) __rawmemchr (s, '>') : strchr (s, '>'))))) { s++; state = 3; p = text; continue; }
break;
case 3:
if (*s == '\0') break;
else if (!strncasecmp (s, "<br>", 4)) {
*p = '\0'; p = text; trail_space (text);
if (text[0] != '\0')
current->text[current->lines++] = (__extension__ (__builtin_constant_p (text) && ((size_t)(const void *)((text) + 1) - (size_t)(const void *)(text) == 1) ? (((__const char *) (text))[0] == '\0' ? (char *) calloc (1, 1) : ({ size_t __len = strlen (text) + 1; char *__retval = (char *) malloc (__len); if (__retval != ((void *)0)) __retval = (char *) memcpy (__retval, text, __len); __retval; })) : __strdup (text)));
s += 4;
}
else if (*s == '<') { state = 4; }
else if (!strncasecmp (s, " ", 6)) { *p++ = ' '; s += 6; }
else if (*s == '\t') { *p++ = ' '; s++; }
else if (*s == '\r' || *s == '\n') { s++; }
else *p++ = *s++;
if (p > text + 2) if (*(p-1) == ' ' && *(p-2) == ' ') p--;
continue;
case 4:
q = stristr (s, "Start=");
if (q) {
current->end = strtol (q + 6, &q, 0) / 10 - 1;
*p = '\0'; trail_space (text);
if (text[0] != '\0')
current->text[current->lines++] = (__extension__ (__builtin_constant_p (text) && ((size_t)(const void *)((text) + 1) - (size_t)(const void *)(text) == 1) ? (((__const char *) (text))[0] == '\0' ? (char *) calloc (1, 1) : ({ size_t __len = strlen (text) + 1; char *__retval = (char *) malloc (__len); if (__retval != ((void *)0)) __retval = (char *) memcpy (__retval, text, __len); __retval; })) : __strdup (text)));
if (current->lines > 0) { state = 99; break; }
state = 0; continue;
}
s = (__extension__ (__builtin_constant_p ('>') && ('>') == '\0' ? (char *) __rawmemchr (s, '>') : strchr (s, '>')));
if (s) { s++; state = 3; continue; }
break;
}
if (state != 99 && !(s = fgets (line, 1000, fd))) {
if (current->start > 0) {
break;
} else {
return 0;
}
}
} while (state != 99);
if (current->end <= 0) {
current->end = current->start + sub_slacktime;
*p = '\0'; trail_space (text);
if (text[0] != '\0')
current->text[current->lines++] = (__extension__ (__builtin_constant_p (text) && ((size_t)(const void *)((text) + 1) - (size_t)(const void *)(text) == 1) ? (((__const char *) (text))[0] == '\0' ? (char *) calloc (1, 1) : ({ size_t __len = strlen (text) + 1; char *__retval = (char *) malloc (__len); if (__retval != ((void *)0)) __retval = (char *) memcpy (__retval, text, __len); __retval; })) : __strdup (text)));
}
return current;
}
char *sub_readtext(char *source, char **dest) {
int len=0;
char *p=source;
while ( !eol(*p) && *p!= '|' ) {
p++,len++;
}
*dest= (char *)malloc (len+1);
if (!dest) {return ((void *) -1);}
(__extension__ (__builtin_constant_p (source) && __builtin_constant_p (len) ? (strlen (source) + 1 >= ((size_t) (len)) ? (char *) memcpy (*dest, source, len) : strncpy (*dest, source, len)) : strncpy (*dest, source, len)));
(*dest)[len]=0;
while (*p=='\r' || *p=='\n' || *p=='|') p++;
if (*p) return p;
else return ((void *)0);
}
subtitle *sub_read_line_microdvd(FILE *fd,subtitle *current) {
char line[1000 +1];
char line2[1000 +1];
char *p, *next;
int i;
do {
if (!fgets (line, 1000, fd)) return ((void *)0);
} while ((sscanf (line,
"{%ld}{}%[^\r\n]",
&(current->start), line2) < 2) &&
(sscanf (line,
"{%ld}{%ld}%[^\r\n]",
&(current->start), &(current->end), line2) < 3));
p=line2;
next=p, i=0;
while ((next =sub_readtext (next, &(current->text[i])))) {
if (current->text[i]==((void *) -1)) {return ((void *) -1);}
i++;
if (i>=10) { mp_msg_c(((36)<<8)|(2),"Too many lines in a subtitle\n" );current->lines=i;return current;}
}
current->lines= ++i;
return current;
}
subtitle *sub_read_line_subrip(FILE *fd, subtitle *current) {
char line[1000 +1];
int a1,a2,a3,a4,b1,b2,b3,b4;
char *p=((void *)0), *q=((void *)0);
int len;
while (1) {
if (!fgets (line, 1000, fd)) return ((void *)0);
if (sscanf (line, "%d:%d:%d.%d,%d:%d:%d.%d",&a1,&a2,&a3,&a4,&b1,&b2,&b3,&b4) < 8) continue;
current->start = a1*360000+a2*6000+a3*100+a4;
current->end = b1*360000+b2*6000+b3*100+b4;
if (!fgets (line, 1000, fd)) return ((void *)0);
p=q=line;
for (current->lines=1; current->lines < 10; current->lines++) {
for (q=p,len=0; *p && *p!='\r' && *p!='\n' && *p!='|' && (__extension__ (__builtin_constant_p (4) && ((__builtin_constant_p (p) && strlen (p) < ((size_t) (4))) || (__builtin_constant_p ("[br]") && strlen ("[br]") < ((size_t) (4)))) ? __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (p) && __builtin_constant_p ("[br]") && (__s1_len = strlen (p), __s2_len = strlen ("[br]"), (!((size_t)(const void *)((p) + 1) - (size_t)(const void *)(p) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("[br]") + 1) - (size_t)(const void *)("[br]") == 1) || __s2_len >= 4)) ? memcmp ((__const char *) (p), (__const char *) ("[br]"), (__s1_len < __s2_len ? __s1_len : __s2_len) + 1) : (__builtin_constant_p (p) && ((size_t)(const void *)((p) + 1) - (size_t)(const void *)(p) == 1) && (__s1_len = strlen (p), __s1_len < 4) ? (__builtin_constant_p ("[br]") && ((size_t)(const void *)(("[br]") + 1) - (size_t)(const void *)("[br]") == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (p))[0] - ((__const unsigned char *) (__const char *)("[br]"))[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (p))[1] - ((__const unsigned char *) (__const char *) ("[br]"))[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (p))[2] - ((__const unsigned char *) (__const char *) ("[br]"))[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (p))[3] - ((__const unsigned char *) (__const char *) ("[br]"))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s2 = (__const unsigned char *) (__const char *) ("[br]"); register int __result = (((__const unsigned char *) (__const char *) (p))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (p))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (p))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (p))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("[br]") && ((size_t)(const void *)(("[br]") + 1) - (size_t)(const void *)("[br]") == 1) && (__s2_len = strlen ("[br]"), __s2_len < 4) ? (__builtin_constant_p (p) && ((size_t)(const void *)((p) + 1) - (size_t)(const void *)(p) == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (p))[0] - ((__const unsigned char *) (__const char *)("[br]"))[0]); if (__s2_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (p))[1] - ((__const unsigned char *) (__const char *) ("[br]"))[1]); if (__s2_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (p))[2] - ((__const unsigned char *) (__const char *) ("[br]"))[2]); if (__s2_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (p))[3] - ((__const unsigned char *) (__const char *) ("[br]"))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s1 = (__const unsigned char *) (__const char *) (p); register int __result = __s1[0] - ((__const unsigned char *) (__const char *) ("[br]"))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((__const unsigned char *) (__const char *) ("[br]"))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((__const unsigned char *) (__const char *) ("[br]"))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((__const unsigned char *) (__const char *) ("[br]"))[3]); } } __result; }))) : strcmp (p, "[br]")))); }) : strncmp (p, "[br]", 4))); p++,len++);
current->text[current->lines-1]=(char *)malloc (len+1);
if (!current->text[current->lines-1]) return ((void *) -1);
(__extension__ (__builtin_constant_p (q) && __builtin_constant_p (len) ? (strlen (q) + 1 >= ((size_t) (len)) ? (char *) memcpy (current->text[current->lines-1], q, len) : strncpy (current->text[current->lines-1], q, len)) : strncpy (current->text[current->lines-1], q, len)));
current->text[current->lines-1][len]='\0';
if (!*p || *p=='\r' || *p=='\n') break;
if (*p=='|') p++;
else while (*p++!=']');
}
break;
}
return current;
}
subtitle *sub_read_line_subviewer(FILE *fd,subtitle *current) {
char line[1000 +1];
int a1,a2,a3,a4,b1,b2,b3,b4;
char *p=((void *)0);
int i,len;
while (!current->text[0]) {
if (!fgets (line, 1000, fd)) return ((void *)0);
if ((len=sscanf (line, "%d:%d:%d%[,.:]%d --> %d:%d:%d%[,.:]%d",&a1,&a2,&a3,(char *)&i,&a4,&b1,&b2,&b3,(char *)&i,&b4)) < 10)
continue;
current->start = a1*360000+a2*6000+a3*100+a4/10;
current->end = b1*360000+b2*6000+b3*100+b4/10;
for (i=0; i<10;) {
if (!fgets (line, 1000, fd)) break;
len=0;
for (p=line; *p!='\n' && *p!='\r' && *p; p++,len++);
if (len) {
int j=0,skip=0;
char *curptr=current->text[i]=(char *)malloc (len+1);
if (!current->text[i]) return ((void *) -1);
for(; j<len; j++) {
if(line[j]=='>') {
skip=0;
continue;
}
if(line[j]=='<') {
skip=1;
continue;
}
if(skip) {
continue;
}
*curptr=line[j];
curptr++;
}
*curptr='\0';
i++;
} else {
break;
}
}
current->lines=i;
}
return current;
}
subtitle *sub_read_line_subviewer2(FILE *fd,subtitle *current) {
char line[1000 +1];
int a1,a2,a3,a4;
char *p=((void *)0);
int i,len;
while (!current->text[0]) {
if (!fgets (line, 1000, fd)) return ((void *)0);
if (line[0]!='{')
continue;
if ((len=sscanf (line, "{T %d:%d:%d:%d",&a1,&a2,&a3,&a4)) < 4)
continue;
current->start = a1*360000+a2*6000+a3*100+a4/10;
for (i=0; i<10;) {
if (!fgets (line, 1000, fd)) break;
if (line[0]=='}') break;
len=0;
for (p=line; *p!='\n' && *p!='\r' && *p; ++p,++len);
if (len) {
current->text[i]=(char *)malloc (len+1);
if (!current->text[i]) return ((void *) -1);
(__extension__ (__builtin_constant_p (line) && __builtin_constant_p (len) ? (strlen (line) + 1 >= ((size_t) (len)) ? (char *) memcpy (current->text[i], line, len) : strncpy (current->text[i], line, len)) : strncpy (current->text[i], line, len))); current->text[i][len]='\0';
++i;
} else {
break;
}
}
current->lines=i;
}
return current;
}
subtitle *sub_read_line_vplayer(FILE *fd,subtitle *current) {
char line[1000 +1];
int a1,a2,a3;
char *p=((void *)0), *next,separator;
int i,len,plen;
while (!current->text[0]) {
if (!fgets (line, 1000, fd)) return ((void *)0);
if ((len=sscanf (line, "%d:%d:%d%c%n",&a1,&a2,&a3,&separator,&plen)) < 4)
continue;
if (!(current->start = a1*360000+a2*6000+a3*100))
continue;
# 376 "subreader.c"
p = &line[ plen ];
i=0;
if (*p!='|') {
next = p,i=0;
while ((next =sub_readtext (next, &(current->text[i])))) {
if (current->text[i]==((void *) -1)) {return ((void *) -1);}
i++;
if (i>=10) { mp_msg_c(((36)<<8)|(2),"Too many lines in a subtitle\n" );current->lines=i;return current;}
}
current->lines=i+1;
}
}
return current;
}
subtitle *sub_read_line_rt(FILE *fd,subtitle *current) {
char line[1000 +1];
int a1,a2,a3,a4,b1,b2,b3,b4;
char *p=((void *)0),*next=((void *)0);
int i,len,plen;
while (!current->text[0]) {
if (!fgets (line, 1000, fd)) return ((void *)0);
plen=a1=a2=a3=a4=b1=b2=b3=b4=0;
if (
((len=sscanf (line, "<%*[tT]ime %*[bB]egin=\"%d.%d\" %*[Ee]nd=\"%d.%d\"%*[^<]<clear/>%n",&a3,&a4,&b3,&b4,&plen)) < 4) &&
((len=sscanf (line, "<%*[tT]ime %*[bB]egin=\"%d.%d\" %*[Ee]nd=\"%d:%d.%d\"%*[^<]<clear/>%n",&a3,&a4,&b2,&b3,&b4,&plen)) < 5) &&
((len=sscanf (line, "<%*[tT]ime %*[bB]egin=\"%d:%d\" %*[Ee]nd=\"%d:%d\"%*[^<]<clear/>%n",&a2,&a3,&b2,&b3,&plen)) < 4) &&
((len=sscanf (line, "<%*[tT]ime %*[bB]egin=\"%d:%d\" %*[Ee]nd=\"%d:%d.%d\"%*[^<]<clear/>%n",&a2,&a3,&b2,&b3,&b4,&plen)) < 5) &&
((len=sscanf (line, "<%*[tT]ime %*[bB]egin=\"%d:%d.%d\" %*[Ee]nd=\"%d:%d.%d\"%*[^<]<clear/>%n",&a2,&a3,&a4,&b2,&b3,&b4,&plen)) < 6) &&
((len=sscanf (line, "<%*[tT]ime %*[bB]egin=\"%d:%d:%d.%d\" %*[Ee]nd=\"%d:%d:%d.%d\"%*[^<]<clear/>%n",&a1,&a2,&a3,&a4,&b1,&b2,&b3,&b4,&plen)) < 8) &&
((len=sscanf (line, "<%*[tT]ime %*[bB]egin=\"%d.%d\"%*[^<]<clear/>%n",&a3,&a4,&plen)) < 2) &&
((len=sscanf (line, "<%*[tT]ime %*[bB]egin=\"%d:%d\"%*[^<]<clear/>%n",&a2,&a3,&plen)) < 2) &&
((len=sscanf (line, "<%*[tT]ime %*[bB]egin=\"%d:%d.%d\"%*[^<]<clear/>%n",&a2,&a3,&a4,&plen)) < 3) &&
((len=sscanf (line, "<%*[tT]ime %*[bB]egin=\"%d:%d:%d.%d\"%*[^<]<clear/>%n",&a1,&a2,&a3,&a4,&plen)) < 4)
)
continue;
current->start = a1*360000+a2*6000+a3*100+a4/10;
current->end = b1*360000+b2*6000+b3*100+b4/10;
if (b1 == 0 && b2 == 0 && b3 == 0 && b4 == 0)
current->end = current->start+200;
p=line; p+=plen;i=0;
next = strstr(line,"<clear/>");
if(next && strlen(next)>8){
next+=8;i=0;
while ((next =sub_readtext (next, &(current->text[i])))) {
if (current->text[i]==((void *) -1)) {return ((void *) -1);}
i++;
if (i>=10) { mp_msg_c(((36)<<8)|(2),"Too many lines in a subtitle\n" );current->lines=i;return current;}
}
}
current->lines=i+1;
}
return current;
}
subtitle *sub_read_line_ssa(FILE *fd,subtitle *current) {
# 453 "subreader.c"
int comma;
static int max_comma = 32;
int hour1, min1, sec1, hunsec1,
hour2, min2, sec2, hunsec2, nothing;
int num;
char line[1000 +1],
line3[1000 +1],
*line2;
char *tmp;
do {
if (!fgets (line, 1000, fd)) return ((void *)0);
} while (sscanf (line, "Dialogue: Marked=%d,%d:%d:%d.%d,%d:%d:%d.%d,"
"%[^\n\r]", ¬hing,
&hour1, &min1, &sec1, &hunsec1,
&hour2, &min2, &sec2, &hunsec2,
line3) < 9
&&
sscanf (line, "Dialogue: %d,%d:%d:%d.%d,%d:%d:%d.%d,"
"%[^\n\r]", ¬hing,
&hour1, &min1, &sec1, &hunsec1,
&hour2, &min2, &sec2, &hunsec2,
line3) < 9 );
line2=(__extension__ (__builtin_constant_p (',') && (',') == '\0' ? (char *) __rawmemchr (line3, ',') : strchr (line3, ',')));
for (comma = 4; comma < max_comma; comma ++)
{
tmp = line2;
if(!(tmp=(__extension__ (__builtin_constant_p (',') && (',') == '\0' ? (char *) __rawmemchr (++tmp, ',') : strchr (++tmp, ','))))) break;
if(*(++tmp) == ' ') break;
line2 = tmp;
}
if(comma < max_comma)max_comma = comma;
if(*line2 == ',') line2++;
current->lines=0;num=0;
current->start = 360000*hour1 + 6000*min1 + 100*sec1 + hunsec1;
current->end = 360000*hour2 + 6000*min2 + 100*sec2 + hunsec2;
while (((tmp=strstr(line2, "\\n")) != ((void *)0)) || ((tmp=strstr(line2, "\\N")) != ((void *)0)) ){
current->text[num]=(char *)malloc(tmp-line2+1);
(__extension__ (__builtin_constant_p (line2) && __builtin_constant_p (tmp-line2) ? (strlen (line2) + 1 >= ((size_t) (tmp-line2)) ? (char *) memcpy (current->text[num], line2, tmp-line2) : strncpy (current->text[num], line2, tmp-line2)) : strncpy (current->text[num], line2, tmp-line2)));
current->text[num][tmp-line2]='\0';
line2=tmp+2;
num++;
current->lines++;
if (current->lines >= 10) return current;
}
current->text[num]=(__extension__ (__builtin_constant_p (line2) && ((size_t)(const void *)((line2) + 1) - (size_t)(const void *)(line2) == 1) ? (((__const char *) (line2))[0] == '\0' ? (char *) calloc (1, 1) : ({ size_t __len = strlen (line2) + 1; char *__retval = (char *) malloc (__len); if (__retval != ((void *)0)) __retval = (char *) memcpy (__retval, line2, __len); __retval; })) : __strdup (line2)));
current->lines++;
return current;
}
void sub_pp_ssa(subtitle *sub) {
int l=sub->lines;
char *so,*de,*start;
while (l){
so=de=sub->text[--l];
while (*so) {
if(*so == '{' && so[1]=='\\') {
for (start=so; *so && *so!='}'; so++);
if(*so) so++; else so=start;
}
if(*so) {
*de=*so;
so++; de++;
}
}
*de=*so;
}
}
subtitle *sub_read_line_dunnowhat(FILE *fd,subtitle *current) {
char line[1000 +1];
char text[1000 +1];
if (!fgets (line, 1000, fd))
return ((void *)0);
if (sscanf (line, "%ld,%ld,\"%[^\"]", &(current->start),
&(current->end), text) <3)
return ((void *) -1);
current->text[0] = (__extension__ (__builtin_constant_p (text) && ((size_t)(const void *)((text) + 1) - (size_t)(const void *)(text) == 1) ? (((__const char *) (text))[0] == '\0' ? (char *) calloc (1, 1) : ({ size_t __len = strlen (text) + 1; char *__retval = (char *) malloc (__len); if (__retval != ((void *)0)) __retval = (char *) memcpy (__retval, text, __len); __retval; })) : __strdup (text)));
current->lines = 1;
return current;
}
subtitle *sub_read_line_mpsub(FILE *fd, subtitle *current) {
char line[1000 +1];
float a,b;
int num=0;
char *p, *q;
do
{
if (!fgets(line, 1000, fd)) return ((void *)0);
} while (sscanf (line, "%f %f", &a, &b) !=2);
mpsub_position += a*mpsub_multiplier;
current->start=(int) mpsub_position;
mpsub_position += b*mpsub_multiplier;
current->end=(int) mpsub_position;
while (num < 10) {
if (!fgets (line, 1000, fd)) {
if (num == 0) return ((void *)0);
else return current;
}
p=line;
while (((*__ctype_b_loc ())[(int) ((*p))] & (unsigned short int) _ISspace)) p++;
if (eol(*p) && num > 0) return current;
if (eol(*p)) return ((void *)0);
for (q=p; !eol(*q); q++);
*q='\0';
if (strlen(p)) {
current->text[num]=(__extension__ (__builtin_constant_p (p) && ((size_t)(const void *)((p) + 1) - (size_t)(const void *)(p) == 1) ? (((__const char *) (p))[0] == '\0' ? (char *) calloc (1, 1) : ({ size_t __len = strlen (p) + 1; char *__retval = (char *) malloc (__len); if (__retval != ((void *)0)) __retval = (char *) memcpy (__retval, p, __len); __retval; })) : __strdup (p)));
current->lines = ++num;
} else {
if (num) return current;
else return ((void *)0);
}
}
return ((void *)0);
}
subtitle *sub_read_line_aqt(FILE *fd,subtitle *current) {
char line[1000 +1];
char *next;
int i;
while (1) {
if (!fgets (line, 1000, fd))
return ((void *)0);
if (!(sscanf (line, "-->> %ld", &(current->start)) <1))
break;
}
previous_sub_end = (current->start) ? current->start - 1 : 0;
if (!fgets (line, 1000, fd))
return ((void *)0);
sub_readtext((char *) &line,¤t->text[0]);
current->lines = 1;
current->end = current->start;
if (!fgets (line, 1000, fd))
return current;
next = line,i=1;
while ((next =sub_readtext (next, &(current->text[i])))) {
if (current->text[i]==((void *) -1)) {return ((void *) -1);}
i++;
if (i>=10) { mp_msg_c(((36)<<8)|(2),"Too many lines in a subtitle\n" );current->lines=i;return current;}
}
current->lines=i+1;
if ((current->text[0]=="") && (current->text[1]=="")) {
previous_sub_end = 0;
return ((void *)0);
}
return current;
}
subtitle *sub_read_line_subrip09(FILE *fd,subtitle *current) {
char line[1000 +1];
int a1,a2,a3;
char * next=((void *)0);
int i,len;
while (1) {
if (!fgets (line, 1000, fd))
return ((void *)0);
if (!((len=sscanf (line, "[%d:%d:%d]",&a1,&a2,&a3)) < 3))
break;
}
current->start = a1*360000+a2*6000+a3*100;
previous_sub_end = (current->start) ? current->start - 1 : 0;
if (!fgets (line, 1000, fd))
return ((void *)0);
next = line,i=0;
current->text[0]="";
while ((next =sub_readtext (next, &(current->text[i])))) {
if (current->text[i]==((void *) -1)) {return ((void *) -1);}
i++;
if (i>=10) { mp_msg_c(((36)<<8)|(2),"Too many lines in a subtitle\n" );current->lines=i;return current;}
}
current->lines=i+1;
if ((current->text[0]=="") && (i==0)) {
previous_sub_end = 0;
return ((void *)0);
}
return current;
}
subtitle *sub_read_line_jacosub(FILE * fd, subtitle * current)
{
char line1[1000], line2[1000], directive[1000], *p, *q;
unsigned a1, a2, a3, a4, b1, b2, b3, b4, comment = 0;
static unsigned jacoTimeres = 30;
static int jacoShift = 0;
bzero(current, sizeof(subtitle));
bzero(line1, 1000);
bzero(line2, 1000);
bzero(directive, 1000);
while (!current->text[0]) {
if (!fgets(line1, 1000, fd)) {
return ((void *)0);
}
if (sscanf
(line1, "%u:%u:%u.%u %u:%u:%u.%u %[^\n\r]", &a1, &a2, &a3, &a4,
&b1, &b2, &b3, &b4, line2) < 9) {
if (sscanf(line1, "@%u @%u %[^\n\r]", &a4, &b4, line2) < 3) {
if (line1[0] == '#') {
int hours = 0, minutes = 0, seconds, delta, inverter =
1;
unsigned units = jacoShift;
switch ((__extension__ ({ int __res; if (sizeof (line1[1]) > 1) { if (__builtin_constant_p (line1[1])) { int __c = (line1[1]); __res = __c < -128 || __c > 255 ? __c : (*__ctype_toupper_loc ())[__c]; } else __res = toupper (line1[1]); } else __res = (*__ctype_toupper_loc ())[(int) (line1[1])]; __res; }))) {
case 'S':
if (((*__ctype_b_loc ())[(int) ((line1[2]))] & (unsigned short int) _ISalpha)) {
delta = 6;
} else {
delta = 2;
}
if (sscanf(&line1[delta], "%d", &hours)) {
if (hours < 0) {
hours *= -1;
inverter = -1;
}
if (sscanf(&line1[delta], "%*d:%d", &minutes)) {
if (sscanf
(&line1[delta], "%*d:%*d:%d",
&seconds)) {
sscanf(&line1[delta], "%*d:%*d:%*d.%d",
&units);
} else {
hours = 0;
sscanf(&line1[delta], "%d:%d.%d",
&minutes, &seconds, &units);
minutes *= inverter;
}
} else {
hours = minutes = 0;
sscanf(&line1[delta], "%d.%d", &seconds,
&units);
seconds *= inverter;
}
jacoShift =
((hours * 3600 + minutes * 60 +
seconds) * jacoTimeres +
units) * inverter;
}
break;
case 'T':
if (((*__ctype_b_loc ())[(int) ((line1[2]))] & (unsigned short int) _ISalpha)) {
delta = 8;
} else {
delta = 2;
}
sscanf(&line1[delta], "%u", &jacoTimeres);
break;
}
}
continue;
} else {
current->start =
(unsigned long) ((a4 + jacoShift) * 100.0 /
jacoTimeres);
current->end =
(unsigned long) ((b4 + jacoShift) * 100.0 /
jacoTimeres);
}
} else {
current->start =
(unsigned
long) (((a1 * 3600 + a2 * 60 + a3) * jacoTimeres + a4 +
jacoShift) * 100.0 / jacoTimeres);
current->end =
(unsigned
long) (((b1 * 3600 + b2 * 60 + b3) * jacoTimeres + b4 +
jacoShift) * 100.0 / jacoTimeres);
}
current->lines = 0;
p = line2;
while ((*p == ' ') || (*p == '\t')) {
++p;
}
if (((*__ctype_b_loc ())[(int) ((*p))] & (unsigned short int) _ISalpha)||*p == '[') {
int cont, jLength;
if (sscanf(p, "%s %[^\n\r]", directive, line1) < 2)
return (subtitle *) ((void *) -1);
jLength = strlen(directive);
for (cont = 0; cont < jLength; ++cont) {
if (((*__ctype_b_loc ())[(int) ((*(directive + cont)))] & (unsigned short int) _ISalpha))
*(directive + cont) = (__extension__ ({ int __res; if (sizeof (*(directive + cont)) > 1) { if (__builtin_constant_p (*(directive + cont))) { int __c = (*(directive + cont)); __res = __c < -128 || __c > 255 ? __c : (*__ctype_toupper_loc ())[__c]; } else __res = toupper (*(directive + cont)); } else __res = (*__ctype_toupper_loc ())[(int) (*(directive + cont))]; __res; }));
}
if ((strstr(directive, "RDB") != ((void *)0))
|| (strstr(directive, "RDC") != ((void *)0))
|| (strstr(directive, "RLB") != ((void *)0))
|| (strstr(directive, "RLG") != ((void *)0))) {
continue;
}
if (strstr(directive, "JL") != ((void *)0)) {
current->alignment = 1;
} else if (strstr(directive, "JR") != ((void *)0)) {
current->alignment = 2;
} else {
current->alignment = 0;
}
strcpy(line2, line1);
p = line2;
}
for (q = line1; (!eol(*p)) && (current->lines < 10); ++p) {
switch (*p) {
case '{':
comment++;
break;
case '}':
if (comment) {
--comment;
if ((*(p + 1)) == ' ')
p++;
}
break;
case '~':
if (!comment) {
*q = ' ';
++q;
}
break;
case ' ':
case '\t':
if ((*(p + 1) == ' ') || (*(p + 1) == '\t'))
break;
if (!comment) {
*q = ' ';
++q;
}
break;
case '\\':
if (*(p + 1) == 'n') {
*q = '\0';
q = line1;
current->text[current->lines++] = (__extension__ (__builtin_constant_p (line1) && ((size_t)(const void *)((line1) + 1) - (size_t)(const void *)(line1) == 1) ? (((__const char *) (line1))[0] == '\0' ? (char *) calloc (1, 1) : ({ size_t __len = strlen (line1) + 1; char *__retval = (char *) malloc (__len); if (__retval != ((void *)0)) __retval = (char *) memcpy (__retval, line1, __len); __retval; })) : __strdup (line1)));
++p;
break;
}
if (((__extension__ ({ int __res; if (sizeof (*(p + 1)) > 1) { if (__builtin_constant_p (*(p + 1))) { int __c = (*(p + 1)); __res = __c < -128 || __c > 255 ? __c : (*__ctype_toupper_loc ())[__c]; } else __res = toupper (*(p + 1)); } else __res = (*__ctype_toupper_loc ())[(int) (*(p + 1))]; __res; })) == 'C')
|| ((__extension__ ({ int __res; if (sizeof (*(p + 1)) > 1) { if (__builtin_constant_p (*(p + 1))) { int __c = (*(p + 1)); __res = __c < -128 || __c > 255 ? __c : (*__ctype_toupper_loc ())[__c]; } else __res = toupper (*(p + 1)); } else __res = (*__ctype_toupper_loc ())[(int) (*(p + 1))]; __res; })) == 'F')) {
++p,++p;
break;
}
if ((*(p + 1) == 'B') || (*(p + 1) == 'b') || (*(p + 1) == 'D') ||
(*(p + 1) == 'I') || (*(p + 1) == 'i') || (*(p + 1) == 'N') || (*(p + 1) == 'T') ||
(*(p + 1) == 'U') || (*(p + 1) == 'u')) {
++p;
break;
}
if ((*(p + 1) == '\\') ||
(*(p + 1) == '~') || (*(p + 1) == '{')) {
++p;
} else if (eol(*(p + 1))) {
if (!fgets(directive, 1000, fd))
return ((void *)0);
trail_space(directive);
(__extension__ (__builtin_constant_p (directive) && __builtin_constant_p ((1000 > 511) ? 1000 : 511) ? (strlen (directive) < ((size_t) ((1000 > 511) ? 1000 : 511)) ? strcat (line2, directive) : strncat (line2, directive, (1000 > 511) ? 1000 : 511)) : strncat (line2, directive, (1000 > 511) ? 1000 : 511)));
break;
}
default:
if (!comment) {
*q = *p;
++q;
}
}
}
*q = '\0';
current->text[current->lines] = (__extension__ (__builtin_constant_p (line1) && ((size_t)(const void *)((line1) + 1) - (size_t)(const void *)(line1) == 1) ? (((__const char *) (line1))[0] == '\0' ? (char *) calloc (1, 1) : ({ size_t __len = strlen (line1) + 1; char *__retval = (char *) malloc (__len); if (__retval != ((void *)0)) __retval = (char *) memcpy (__retval, line1, __len); __retval; })) : __strdup (line1)));
}
current->lines++;
return current;
}
int sub_autodetect (FILE *fd, int *uses_time) {
char line[1000 +1];
int i,j=0;
char p;
while (j < 100) {
j++;
if (!fgets (line, 1000, fd))
return -1;
if (sscanf (line, "{%d}{%d}", &i, &i)==2)
{*uses_time=0;return 0;}
if (sscanf (line, "{%d}{}", &i)==1)
{*uses_time=0;return 0;}
if (sscanf (line, "%d:%d:%d.%d,%d:%d:%d.%d", &i, &i, &i, &i, &i, &i, &i, &i)==8)
{*uses_time=1;return 1;}
if (sscanf (line, "%d:%d:%d%[,.:]%d --> %d:%d:%d%[,.:]%d", &i, &i, &i, (char *)&i, &i, &i, &i, &i, (char *)&i, &i)==10)
{*uses_time=1;return 2;}
if (sscanf (line, "{T %d:%d:%d:%d",&i, &i, &i, &i))
{*uses_time=1;return 10;}
if (strstr (line, "<SAMI>"))
{*uses_time=1; return 3;}
if (sscanf(line, "%d:%d:%d.%d %d:%d:%d.%d", &i, &i, &i, &i, &i, &i, &i, &i) == 8)
{*uses_time = 1; return 12;}
if (sscanf(line, "@%d @%d", &i, &i) == 2)
{*uses_time = 1; return 12;}
if (sscanf (line, "%d:%d:%d:", &i, &i, &i )==3)
{*uses_time=1;return 4;}
if (sscanf (line, "%d:%d:%d ", &i, &i, &i )==3)
{*uses_time=1;return 4;}
if ( *line == '<' )
{*uses_time=1;return 5;}
if (!memcmp(line, "Dialogue: Marked", 16))
{*uses_time=1; return 6;}
if (!memcmp(line, "Dialogue: ", 10))
{*uses_time=1; return 6;}
if (sscanf (line, "%d,%d,\"%c", &i, &i, (char *) &i) == 3)
{*uses_time=0;return 7;}
if (sscanf (line, "FORMAT=%d", &i) == 1)
{*uses_time=0; return 8;}
if (sscanf (line, "FORMAT=TIM%c", &p)==1 && p=='E')
{*uses_time=1; return 8;}
if (strstr (line, "-->>"))
{*uses_time=0; return 9;}
if (sscanf (line, "[%d:%d:%d]", &i, &i, &i)==3)
{*uses_time=1;return 11;}
}
return -1;
}
extern int sub_utf8;
int sub_utf8_prev=0;
extern float sub_delay;
extern float sub_fps;
static iconv_t icdsc = (iconv_t)(-1);
void subcp_open (void)
{
char *tocp = "UTF-8";
if (sub_cp){
if ((icdsc = iconv_open (tocp, sub_cp)) != (iconv_t)(-1)){
mp_msg_c(((36)<<8)|(6),"SUB: opened iconv descriptor.\n" );
sub_utf8 = 2;
} else
mp_msg_c(((36)<<8)|(1),"SUB: error opening iconv descriptor.\n" );
}
}
void subcp_close (void)
{
if (icdsc != (iconv_t)(-1)){
(void) iconv_close (icdsc);
icdsc = (iconv_t)(-1);
mp_msg_c(((36)<<8)|(6),"SUB: closed iconv descriptor.\n" );
}
}
static char icbuffer[512];
subtitle* subcp_recode (subtitle *sub)
{
int l=sub->lines;
size_t ileft, oleft;
char *op, *ip, *ot;
while (l){
op = icbuffer;
ip = sub->text[--l];
ileft = strlen(ip);
oleft = 512 - 1;
if (iconv(icdsc, &ip, &ileft,
&op, &oleft) == (size_t)(-1)) {
mp_msg_c(((36)<<8)|(2),"SUB: error recoding line (1).\n" );
l++;
break;
}
if (!(ot = (char *)malloc(op - icbuffer + 1))){
mp_msg_c(((36)<<8)|(2),"SUB: error allocating mem.\n" );
l++;
break;
}
*op='\0' ;
strcpy (ot, icbuffer);
free (sub->text[l]);
sub->text[l] = ot;
}
if (l){
for (l = sub->lines; l;)
free (sub->text[--l]);
return ((void *) -1);
}
return sub;
}
subtitle* subcp_recode1 (subtitle *sub)
{
int l=sub->lines;
size_t ileft, oleft;
if(icdsc == (iconv_t)(-1)) return sub;
while (l){
char *ip = icbuffer;
char *op = sub->text[--l];
strcpy(ip, op);
ileft = strlen(ip);
oleft = 512 - 1;
if (iconv(icdsc, &ip, &ileft,
&op, &oleft) == (size_t)(-1)) {
mp_msg_c(((36)<<8)|(6),"SUB: error recoding line (2).\n" );
return sub;
}
*op='\0' ;
}
return sub;
}
# 1111 "subreader.c"
static void adjust_subs_time(subtitle* sub, float subtime, float fps, int block,
int sub_num, int sub_uses_time) {
int n,m;
subtitle* nextsub;
int i = sub_num;
unsigned long subfms = (sub_uses_time ? 100 : fps) * subtime;
unsigned long overlap = (sub_uses_time ? 100 : fps) / 5;
n=m=0;
if (i) for (;;){
if (sub->end <= sub->start){
sub->end = sub->start + subfms;
m++;
n++;
}
if (!--i) break;
nextsub = sub + 1;
if(block){
if ((sub->end > nextsub->start) && (sub->end <= nextsub->start + overlap)) {
unsigned delta = sub->end - nextsub->start, half = delta / 2;
sub->end -= half + 1;
nextsub->start += delta - half;
}
if (sub->end >= nextsub->start){
sub->end = nextsub->start - 1;
if (sub->end - sub->start > subfms)
sub->end = sub->start + subfms;
if (!m)
n++;
}
}
# 1157 "subreader.c"
if(sub_uses_time && sub_fps) {
sub->start *= sub_fps/fps;
sub->end *= sub_fps/fps;
}
sub = nextsub;
m = 0;
}
if (n) mp_msg_c(((36)<<8)|(4),"SUB: Adjusted %d subtitle(s).\n", n );
}
struct subreader {
subtitle * (*read)(FILE *fd,subtitle *dest);
void (*post)(subtitle *dest);
const char *name;
};
sub_data* sub_read_file (char *filename, float fps) {
FILE *fd;
int n_max, n_first, i, j, sub_first, sub_orig;
subtitle *first, *second, *sub, *return_sub;
sub_data *subt_data;
int uses_time = 0, sub_num = 0, sub_errs = 0;
struct subreader sr[]=
{
{ sub_read_line_microdvd, ((void *)0), "microdvd" },
{ sub_read_line_subrip, ((void *)0), "subrip" },
{ sub_read_line_subviewer, ((void *)0), "subviewer" },
{ sub_read_line_sami, ((void *)0), "sami" },
{ sub_read_line_vplayer, ((void *)0), "vplayer" },
{ sub_read_line_rt, ((void *)0), "rt" },
{ sub_read_line_ssa, sub_pp_ssa, "ssa" },
{ sub_read_line_dunnowhat, ((void *)0), "dunnowhat" },
{ sub_read_line_mpsub, ((void *)0), "mpsub" },
{ sub_read_line_aqt, ((void *)0), "aqt" },
{ sub_read_line_subviewer2, ((void *)0), "subviewer 2.0" },
{ sub_read_line_subrip09, ((void *)0), "subrip 0.9" },
{ sub_read_line_jacosub, ((void *)0), "jacosub" }
};
struct subreader *srp;
if(filename==((void *)0)) return ((void *)0);
fd=fopen (filename, "r"); if (!fd) return ((void *)0);
sub_format=sub_autodetect (fd, &uses_time);
mpsub_multiplier = (uses_time ? 100.0 : 1.0);
if (sub_format==-1) {mp_msg_c(((36)<<8)|(2),"SUB: Could not determine file format\n" );return ((void *)0);}
srp=sr+sub_format;
mp_msg_c(((36)<<8)|(4),"SUB: Detected subtitle file format: %s\n", srp->name );
rewind (fd);
sub_utf8_prev=sub_utf8;
{
int l,k;
k = -1;
if ((l=strlen(filename))>4){
char *exts[] = {".utf", ".utf8", ".utf-8" };
for (k=3;--k>=0;)
if (!strcasecmp(filename+(l - strlen(exts[k])), exts[k])){
sub_utf8 = 1;
break;
}
}
if (k<0) subcp_open();
}
sub_num=0;n_max=32;
first=(subtitle *)malloc(n_max*sizeof(subtitle));
if(!first){
subcp_close();
sub_utf8=sub_utf8_prev;
return ((void *)0);
}
sub = (subtitle *)malloc(sizeof(subtitle));
previous_sub_end = 0;
while(1){
if(sub_num>=n_max){
n_max+=16;
first=realloc(first,n_max*sizeof(subtitle));
}
(__extension__ (__builtin_constant_p (sizeof(subtitle)) && (sizeof(subtitle)) <= 16 ? ((sizeof(subtitle)) == 1 ? ({ void *__s = (sub); *((__uint8_t *) __s) = (__uint8_t) '\0'; __s; }) : ({ void *__s = (sub); union { unsigned int __ui; unsigned short int __usi; unsigned char __uc; } *__u = __s; __uint8_t __c = (__uint8_t) ('\0'); switch ((unsigned int) (sizeof(subtitle))) { case 15: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 11: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 7: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 3: __u->__usi = (unsigned short int) __c * 0x0101; __u = __extension__ ((void *) __u + 2); __u->__uc = (unsigned char) __c; break; case 14: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 10: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 6: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 2: __u->__usi = (unsigned short int) __c * 0x0101; break; case 13: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 9: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 5: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 1: __u->__uc = (unsigned char) __c; break; case 16: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 12: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 8: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 4: __u->__ui = __c * 0x01010101; case 0: break; } __s; })) : (__builtin_constant_p ('\0') && ('\0') == '\0' ? ({ void *__s = (sub); __builtin_memset (__s, '\0', sizeof(subtitle)); __s; }) : memset (sub, '\0', sizeof(subtitle)))));
sub=srp->read(fd,sub);
if(!sub) break;
if ((sub!=((void *) -1)) && (sub_utf8 & 2)) sub=subcp_recode(sub);
if ( sub == ((void *) -1) )
{
subcp_close();
if ( first ) free(first);
return ((void *)0);
}
if ((sub!=((void *) -1)) && !sub_no_text_pp && srp->post) srp->post(sub);
if(!sub_num || (first[sub_num - 1].start <= sub->start)){
first[sub_num].start = sub->start;
first[sub_num].end = sub->end;
first[sub_num].lines = sub->lines;
first[sub_num].alignment = sub->alignment;
for(i = 0; i < sub->lines; ++i){
first[sub_num].text[i] = sub->text[i];
}
if (previous_sub_end){
first[sub_num - 1].end = previous_sub_end;
previous_sub_end = 0;
}
} else {
for(j = sub_num - 1; j >= 0; --j){
first[j + 1].start = first[j].start;
first[j + 1].end = first[j].end;
first[j + 1].lines = first[j].lines;
first[j + 1].alignment = first[j].alignment;
for(i = 0; i < first[j].lines; ++i){
first[j + 1].text[i] = first[j].text[i];
}
if(!j || (first[j - 1].start <= sub->start)){
first[j].start = sub->start;
first[j].end = sub->end;
first[j].lines = sub->lines;
first[j].alignment = sub->alignment;
for(i = 0; i < 10; ++i){
first[j].text[i] = sub->text[i];
}
if (previous_sub_end){
first[j].end = first[j - 1].end;
first[j - 1].end = previous_sub_end;
previous_sub_end = 0;
}
break;
}
}
}
if(sub==((void *) -1)) ++sub_errs; else ++sub_num;
}
fclose(fd);
subcp_close();
mp_msg_c(((36)<<8)|(4),"SUB: Read %i subtitles", sub_num );
if (sub_errs) mp_msg_c(((36)<<8)|(4),", %i bad line(s).\n", sub_errs );
else mp_msg_c(((36)<<8)|(4),".\n" );
if(sub_num<=0){
free(first);
return ((void *)0);
}
if ((suboverlap_enabled == 2) ||
((suboverlap_enabled) && ((sub_format == 12) || (sub_format == 6)))) {
adjust_subs_time(first, 6.0, fps, 0, sub_num, uses_time);
sub_orig = sub_num;
n_first = sub_num;
sub_num = 0;
second = ((void *)0);
for (sub_first = 0; sub_first < n_first; ++sub_first) {
unsigned long global_start = first[sub_first].start,
global_end = first[sub_first].end, local_start, local_end;
int lines_to_add = first[sub_first].lines, sub_to_add = 0,
**placeholder = ((void *)0), higher_line = 0, counter, start_block_sub = sub_num;
char real_block = 1;
while ((sub_first + sub_to_add + 1 < n_first) && (first[sub_first + sub_to_add + 1].start < global_end)) {
++sub_to_add;
lines_to_add += first[sub_first + sub_to_add].lines;
if (first[sub_first + sub_to_add].start < global_start) {
global_start = first[sub_first + sub_to_add].start;
}
if (first[sub_first + sub_to_add].end > global_end) {
global_end = first[sub_first + sub_to_add].end;
}
}
counter = 2 * sub_to_add + 1;
placeholder = (int **) malloc(sizeof(int *) * counter);
for (i = 0; i < counter; ++i) {
placeholder[i] = (int *) malloc(sizeof(int) * lines_to_add);
for (j = 0; j < lines_to_add; ++j) {
placeholder[i][j] = -1;
}
}
counter = 0;
local_end = global_start - 1;
do {
int ls;
local_start = local_end + 1;
local_end = global_end;
for (j = 0; j <= sub_to_add; ++j) {
if ((first[sub_first + j].start - 1 > local_start) && (first[sub_first + j].start - 1 < local_end)) {
local_end = first[sub_first + j].start - 1;
} else if ((first[sub_first + j].end > local_start) && (first[sub_first + j].end < local_end)) {
local_end = first[sub_first + j].end;
}
}
for (j = 0; j <= sub_to_add; ++j) {
if ((first[sub_first + j].start <= local_end) && (first[sub_first + j].end > local_start)) {
unsigned long sub_lines = first[sub_first + j].lines, fragment_length = lines_to_add + 1,
tmp = 0;
char boolean = 0;
int fragment_position = -1;
if (counter)
for (i = 0; i < lines_to_add; ++i) {
if (placeholder[counter - 1][i] == sub_first + j) {
placeholder[counter][i] = sub_first + j;
boolean = 1;
}
}
if (boolean)
continue;
for (i = 0; i < lines_to_add; ++i) {
if (placeholder[counter][i] == -1) {
++tmp;
} else {
if (tmp == sub_lines) {
fragment_position = i - tmp;
tmp = 0;
break;
}
if ((tmp) && (tmp > sub_lines) && (tmp < fragment_length)) {
fragment_length = tmp;
fragment_position = i - tmp;
tmp = 0;
} else {
tmp = 0;
}
}
}
if (tmp) {
if ((tmp >= sub_lines) && (tmp < fragment_length)) {
fragment_position = i - tmp;
}
}
if (fragment_position == -1) {
mp_msg_c(((36)<<8)|(2), "SUB: we could not find a suitable position for an overlapping subtitle\n" );
higher_line = 10 + 1;
break;
} else {
for (tmp = 0; tmp < sub_lines; ++tmp) {
placeholder[counter][fragment_position + tmp] = sub_first + j;
}
}
}
}
for (j = higher_line + 1; j < lines_to_add; ++j) {
if (placeholder[counter][j] != -1)
higher_line = j;
else
break;
}
if (higher_line >= 10) {
second = (subtitle *) realloc(second, (sub_num + sub_to_add + 1) * sizeof(subtitle));
for (j = 0; j <= sub_to_add; ++j) {
int ls;
(__extension__ (__builtin_constant_p (sizeof(subtitle)) && (sizeof(subtitle)) <= 16 ? ((sizeof(subtitle)) == 1 ? ({ void *__s = (&second[sub_num + j]); *((__uint8_t *) __s) = (__uint8_t) '\0'; __s; }) : ({ void *__s = (&second[sub_num + j]); union { unsigned int __ui; unsigned short int __usi; unsigned char __uc; } *__u = __s; __uint8_t __c = (__uint8_t) ('\0'); switch ((unsigned int) (sizeof(subtitle))) { case 15: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 11: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 7: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 3: __u->__usi = (unsigned short int) __c * 0x0101; __u = __extension__ ((void *) __u + 2); __u->__uc = (unsigned char) __c; break; case 14: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 10: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 6: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 2: __u->__usi = (unsigned short int) __c * 0x0101; break; case 13: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 9: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 5: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 1: __u->__uc = (unsigned char) __c; break; case 16: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 12: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 8: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 4: __u->__ui = __c * 0x01010101; case 0: break; } __s; })) : (__builtin_constant_p ('\0') && ('\0') == '\0' ? ({ void *__s = (&second[sub_num + j]); __builtin_memset (__s, '\0', sizeof(subtitle)); __s; }) : memset (&second[sub_num + j], '\0', sizeof(subtitle)))));
second[sub_num + j].start = first[sub_first + j].start;
second[sub_num + j].end = first[sub_first + j].end;
second[sub_num + j].lines = first[sub_first + j].lines;
second[sub_num + j].alignment = first[sub_first + j].alignment;
for (ls = 0; ls < second[sub_num + j].lines; ls++) {
second[sub_num + j].text[ls] = (__extension__ (__builtin_constant_p (first[sub_first + j].text[ls]) && ((size_t)(const void *)((first[sub_first + j].text[ls]) + 1) - (size_t)(const void *)(first[sub_first + j].text[ls]) == 1) ? (((__const char *) (first[sub_first + j].text[ls]))[0] == '\0' ? (char *) calloc (1, 1) : ({ size_t __len = strlen (first[sub_first + j].text[ls]) + 1; char *__retval = (char *) malloc (__len); if (__retval != ((void *)0)) __retval = (char *) memcpy (__retval, first[sub_first + j].text[ls], __len); __retval; })) : __strdup (first[sub_first + j].text[ls])));
}
}
sub_num += sub_to_add + 1;
sub_first += sub_to_add;
real_block = 0;
break;
}
second = (subtitle *) realloc(second, (sub_num + 1) * sizeof(subtitle));
(__extension__ (__builtin_constant_p (sizeof(subtitle)) && (sizeof(subtitle)) <= 16 ? ((sizeof(subtitle)) == 1 ? ({ void *__s = (&second[sub_num]); *((__uint8_t *) __s) = (__uint8_t) '\0'; __s; }) : ({ void *__s = (&second[sub_num]); union { unsigned int __ui; unsigned short int __usi; unsigned char __uc; } *__u = __s; __uint8_t __c = (__uint8_t) ('\0'); switch ((unsigned int) (sizeof(subtitle))) { case 15: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 11: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 7: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 3: __u->__usi = (unsigned short int) __c * 0x0101; __u = __extension__ ((void *) __u + 2); __u->__uc = (unsigned char) __c; break; case 14: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 10: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 6: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 2: __u->__usi = (unsigned short int) __c * 0x0101; break; case 13: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 9: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 5: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 1: __u->__uc = (unsigned char) __c; break; case 16: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 12: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 8: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 4: __u->__ui = __c * 0x01010101; case 0: break; } __s; })) : (__builtin_constant_p ('\0') && ('\0') == '\0' ? ({ void *__s = (&second[sub_num]); __builtin_memset (__s, '\0', sizeof(subtitle)); __s; }) : memset (&second[sub_num], '\0', sizeof(subtitle)))));
second[sub_num].start = local_start;
second[sub_num].end = local_end;
second[sub_num].alignment = 0;
n_max = (lines_to_add < 10) ? lines_to_add : 10;
for (i = 0, j = 0; j < n_max; ++j) {
if (placeholder[counter][j] != -1) {
int lines = first[placeholder[counter][j]].lines;
for (ls = 0; ls < lines; ++ls) {
second[sub_num].text[i++] = (__extension__ (__builtin_constant_p (first[placeholder[counter][j]].text[ls]) && ((size_t)(const void *)((first[placeholder[counter][j]].text[ls]) + 1) - (size_t)(const void *)(first[placeholder[counter][j]].text[ls]) == 1) ? (((__const char *) (first[placeholder[counter][j]].text[ls]))[0] == '\0' ? (char *) calloc (1, 1) : ({ size_t __len = strlen (first[placeholder[counter][j]].text[ls]) + 1; char *__retval = (char *) malloc (__len); if (__retval != ((void *)0)) __retval = (char *) memcpy (__retval, first[placeholder[counter][j]].text[ls], __len); __retval; })) : __strdup (first[placeholder[counter][j]].text[ls])));
}
j += lines - 1;
} else {
second[sub_num].text[i++] = (__extension__ (__builtin_constant_p (" ") && ((size_t)(const void *)((" ") + 1) - (size_t)(const void *)(" ") == 1) ? (((__const char *) (" "))[0] == '\0' ? (char *) calloc (1, 1) : ({ size_t __len = strlen (" ") + 1; char *__retval = (char *) malloc (__len); if (__retval != ((void *)0)) __retval = (char *) memcpy (__retval, " ", __len); __retval; })) : __strdup (" ")));
}
}
++sub_num;
++counter;
} while (local_end < global_end);
if (real_block)
for (i = 0; i < counter; ++i)
second[start_block_sub + i].lines = higher_line + 1;
counter = 2 * sub_to_add + 1;
for (i = 0; i < counter; ++i) {
free(placeholder[i]);
}
free(placeholder);
sub_first += sub_to_add;
}
for (j = sub_orig - 1; j >= 0; --j) {
for (i = first[j].lines - 1; i >= 0; --i) {
free(first[j].text[i]);
}
}
free(first);
return_sub = second;
} else {
adjust_subs_time(first, 6.0, fps, 1, sub_num, uses_time);
return_sub = first;
}
if (return_sub == ((void *)0)) return ((void *)0);
subt_data = (sub_data *)malloc(sizeof(sub_data));
subt_data->filename = filename;
subt_data->sub_uses_time = uses_time;
subt_data->sub_num = sub_num;
subt_data->sub_errs = sub_errs;
subt_data->subtitles = return_sub;
return subt_data;
}
# 1564 "subreader.c"
static void strcpy_trim(char *d, char *s)
{
while (*s && !((*__ctype_b_loc ())[(int) ((*s))] & (unsigned short int) _ISalnum)) {
s++;
}
for (;;) {
while (*s && ((*__ctype_b_loc ())[(int) ((*s))] & (unsigned short int) _ISalnum)) {
*d = (__extension__ ({ int __res; if (sizeof (*s) > 1) { if (__builtin_constant_p (*s)) { int __c = (*s); __res = __c < -128 || __c > 255 ? __c : (*__ctype_tolower_loc ())[__c]; } else __res = tolower (*s); } else __res = (*__ctype_tolower_loc ())[(int) (*s)]; __res; }));
s++; d++;
}
if (*s == 0) break;
while (*s && !((*__ctype_b_loc ())[(int) ((*s))] & (unsigned short int) _ISalnum)) {
s++;
}
if (*s == 0) break;
*d++ = ' ';
}
*d = 0;
}
static void strcpy_strip_ext(char *d, char *s)
{
char *tmp = strrchr(s,'.');
if (!tmp) {
strcpy(d, s);
return;
} else {
(__extension__ (__builtin_constant_p (s) && __builtin_constant_p (tmp-s) ? (strlen (s) + 1 >= ((size_t) (tmp-s)) ? (char *) memcpy (d, s, tmp-s) : strncpy (d, s, tmp-s)) : strncpy (d, s, tmp-s)));
d[tmp-s] = 0;
}
while (*d) {
*d = (__extension__ ({ int __res; if (sizeof (*d) > 1) { if (__builtin_constant_p (*d)) { int __c = (*d); __res = __c < -128 || __c > 255 ? __c : (*__ctype_tolower_loc ())[__c]; } else __res = tolower (*d); } else __res = (*__ctype_tolower_loc ())[(int) (*d)]; __res; }));
d++;
}
}
static void strcpy_get_ext(char *d, char *s)
{
char *tmp = strrchr(s,'.');
if (!tmp) {
strcpy(d, "");
return;
} else {
strcpy(d, tmp+1);
}
}
static int whiteonly(char *s)
{
while (*s) {
if (((*__ctype_b_loc ())[(int) ((*s))] & (unsigned short int) _ISalnum)) return 0;
s++;
}
return 1;
}
typedef struct _subfn
{
int priority;
char *fname;
} subfn;
static int compare_sub_priority(const void *a, const void *b)
{
if (((subfn*)a)->priority > ((subfn*)b)->priority) {
return -1;
} else if (((subfn*)a)->priority < ((subfn*)b)->priority) {
return 1;
} else {
return strcoll(((subfn*)a)->fname, ((subfn*)b)->fname);
}
}
char** sub_filenames(char* path, char *fname)
{
char *f_dir, *f_fname, *f_fname_noext, *f_fname_trim, *tmp, *tmp_sub_id;
char *tmp_fname_noext, *tmp_fname_trim, *tmp_fname_ext, *tmpresult;
int len, pos, found, i, j;
char * sub_exts[] = { "utf", "utf8", "utf-8", "sub", "srt", "smi", "rt", "txt", "ssa", "aqt", "jss", "js", "ass", ((void *)0)};
subfn *result;
char **result2;
int subcnt;
FILE *f;
DIR *d;
struct dirent *de;
len = (strlen(fname) > 256 ? strlen(fname) : 256)
+(strlen(path) > 256 ? strlen(path) : 256)+2;
f_dir = (char*)malloc(len);
f_fname = (char*)malloc(len);
f_fname_noext = (char*)malloc(len);
f_fname_trim = (char*)malloc(len);
tmp_fname_noext = (char*)malloc(len);
tmp_fname_trim = (char*)malloc(len);
tmp_fname_ext = (char*)malloc(len);
tmpresult = (char*)malloc(len);
result = (subfn*)malloc(sizeof(subfn)*128);
(__extension__ (__builtin_constant_p (sizeof(subfn)*128) && (sizeof(subfn)*128) <= 16 ? ((sizeof(subfn)*128) == 1 ? ({ void *__s = (result); *((__uint8_t *) __s) = (__uint8_t) 0; __s; }) : ({ void *__s = (result); union { unsigned int __ui; unsigned short int __usi; unsigned char __uc; } *__u = __s; __uint8_t __c = (__uint8_t) (0); switch ((unsigned int) (sizeof(subfn)*128)) { case 15: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 11: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 7: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 3: __u->__usi = (unsigned short int) __c * 0x0101; __u = __extension__ ((void *) __u + 2); __u->__uc = (unsigned char) __c; break; case 14: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 10: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 6: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 2: __u->__usi = (unsigned short int) __c * 0x0101; break; case 13: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 9: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 5: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 1: __u->__uc = (unsigned char) __c; break; case 16: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 12: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 8: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 4: __u->__ui = __c * 0x01010101; case 0: break; } __s; })) : (__builtin_constant_p (0) && (0) == '\0' ? ({ void *__s = (result); __builtin_memset (__s, '\0', sizeof(subfn)*128); __s; }) : memset (result, 0, sizeof(subfn)*128))));
subcnt = 0;
tmp = strrchr(fname,'/');
if (tmp) {
strcpy(f_fname, tmp+1);
pos = tmp - fname;
(__extension__ (__builtin_constant_p (fname) && __builtin_constant_p (pos+1) ? (strlen (fname) + 1 >= ((size_t) (pos+1)) ? (char *) memcpy (f_dir, fname, pos+1) : strncpy (f_dir, fname, pos+1)) : strncpy (f_dir, fname, pos+1)));
f_dir[pos+1] = 0;
} else {
strcpy(f_fname, fname);
strcpy(f_dir, "./");
}
strcpy_strip_ext(f_fname_noext, f_fname);
strcpy_trim(f_fname_trim, f_fname_noext);
tmp_sub_id = ((void *)0);
if (dvdsub_lang && !whiteonly(dvdsub_lang)) {
tmp_sub_id = (char*)malloc(strlen(dvdsub_lang)+1);
strcpy_trim(tmp_sub_id, dvdsub_lang);
}
for (j = 0; j <= 1; j++) {
d = opendir(j == 0 ? f_dir : path);
if (d) {
while ((de = readdir(d))) {
strcpy_strip_ext(tmp_fname_noext, de->d_name);
strcpy_get_ext(tmp_fname_ext, de->d_name);
strcpy_trim(tmp_fname_trim, tmp_fname_noext);
found = 0;
for (i = (sub_cp ? 3 : 0); sub_exts[i]; i++) {
if (__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (sub_exts[i]) && __builtin_constant_p (tmp_fname_ext) && (__s1_len = strlen (sub_exts[i]), __s2_len = strlen (tmp_fname_ext), (!((size_t)(const void *)((sub_exts[i]) + 1) - (size_t)(const void *)(sub_exts[i]) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((tmp_fname_ext) + 1) - (size_t)(const void *)(tmp_fname_ext) == 1) || __s2_len >= 4)) ? memcmp ((__const char *) (sub_exts[i]), (__const char *) (tmp_fname_ext), (__s1_len < __s2_len ? __s1_len : __s2_len) + 1) : (__builtin_constant_p (sub_exts[i]) && ((size_t)(const void *)((sub_exts[i]) + 1) - (size_t)(const void *)(sub_exts[i]) == 1) && (__s1_len = strlen (sub_exts[i]), __s1_len < 4) ? (__builtin_constant_p (tmp_fname_ext) && ((size_t)(const void *)((tmp_fname_ext) + 1) - (size_t)(const void *)(tmp_fname_ext) == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (sub_exts[i]))[0] - ((__const unsigned char *) (__const char *)(tmp_fname_ext))[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (sub_exts[i]))[1] - ((__const unsigned char *) (__const char *) (tmp_fname_ext))[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (sub_exts[i]))[2] - ((__const unsigned char *) (__const char *) (tmp_fname_ext))[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (sub_exts[i]))[3] - ((__const unsigned char *) (__const char *) (tmp_fname_ext))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s2 = (__const unsigned char *) (__const char *) (tmp_fname_ext); register int __result = (((__const unsigned char *) (__const char *) (sub_exts[i]))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (sub_exts[i]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (sub_exts[i]))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (sub_exts[i]))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (tmp_fname_ext) && ((size_t)(const void *)((tmp_fname_ext) + 1) - (size_t)(const void *)(tmp_fname_ext) == 1) && (__s2_len = strlen (tmp_fname_ext), __s2_len < 4) ? (__builtin_constant_p (sub_exts[i]) && ((size_t)(const void *)((sub_exts[i]) + 1) - (size_t)(const void *)(sub_exts[i]) == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (sub_exts[i]))[0] - ((__const unsigned char *) (__const char *)(tmp_fname_ext))[0]); if (__s2_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (sub_exts[i]))[1] - ((__const unsigned char *) (__const char *) (tmp_fname_ext))[1]); if (__s2_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (sub_exts[i]))[2] - ((__const unsigned char *) (__const char *) (tmp_fname_ext))[2]); if (__s2_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (sub_exts[i]))[3] - ((__const unsigned char *) (__const char *) (tmp_fname_ext))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s1 = (__const unsigned char *) (__const char *) (sub_exts[i]); register int __result = __s1[0] - ((__const unsigned char *) (__const char *) (tmp_fname_ext))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((__const unsigned char *) (__const char *) (tmp_fname_ext))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((__const unsigned char *) (__const char *) (tmp_fname_ext))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((__const unsigned char *) (__const char *) (tmp_fname_ext))[3]); } } __result; }))) : strcmp (sub_exts[i], tmp_fname_ext)))); }) == 0) {
found = 1;
break;
}
}
if (found) {
int prio = 0;
if (!prio && tmp_sub_id)
{
sprintf(tmpresult, "%s %s", f_fname_trim, tmp_sub_id);
printf("dvdsublang...%s\n", tmpresult);
if (__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (tmp_fname_trim) && __builtin_constant_p (tmpresult) && (__s1_len = strlen (tmp_fname_trim), __s2_len = strlen (tmpresult), (!((size_t)(const void *)((tmp_fname_trim) + 1) - (size_t)(const void *)(tmp_fname_trim) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((tmpresult) + 1) - (size_t)(const void *)(tmpresult) == 1) || __s2_len >= 4)) ? memcmp ((__const char *) (tmp_fname_trim), (__const char *) (tmpresult), (__s1_len < __s2_len ? __s1_len : __s2_len) + 1) : (__builtin_constant_p (tmp_fname_trim) && ((size_t)(const void *)((tmp_fname_trim) + 1) - (size_t)(const void *)(tmp_fname_trim) == 1) && (__s1_len = strlen (tmp_fname_trim), __s1_len < 4) ? (__builtin_constant_p (tmpresult) && ((size_t)(const void *)((tmpresult) + 1) - (size_t)(const void *)(tmpresult) == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (tmp_fname_trim))[0] - ((__const unsigned char *) (__const char *)(tmpresult))[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (tmp_fname_trim))[1] - ((__const unsigned char *) (__const char *) (tmpresult))[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (tmp_fname_trim))[2] - ((__const unsigned char *) (__const char *) (tmpresult))[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (tmp_fname_trim))[3] - ((__const unsigned char *) (__const char *) (tmpresult))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s2 = (__const unsigned char *) (__const char *) (tmpresult); register int __result = (((__const unsigned char *) (__const char *) (tmp_fname_trim))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (tmp_fname_trim))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (tmp_fname_trim))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (tmp_fname_trim))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (tmpresult) && ((size_t)(const void *)((tmpresult) + 1) - (size_t)(const void *)(tmpresult) == 1) && (__s2_len = strlen (tmpresult), __s2_len < 4) ? (__builtin_constant_p (tmp_fname_trim) && ((size_t)(const void *)((tmp_fname_trim) + 1) - (size_t)(const void *)(tmp_fname_trim) == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (tmp_fname_trim))[0] - ((__const unsigned char *) (__const char *)(tmpresult))[0]); if (__s2_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (tmp_fname_trim))[1] - ((__const unsigned char *) (__const char *) (tmpresult))[1]); if (__s2_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (tmp_fname_trim))[2] - ((__const unsigned char *) (__const char *) (tmpresult))[2]); if (__s2_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (tmp_fname_trim))[3] - ((__const unsigned char *) (__const char *) (tmpresult))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s1 = (__const unsigned char *) (__const char *) (tmp_fname_trim); register int __result = __s1[0] - ((__const unsigned char *) (__const char *) (tmpresult))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((__const unsigned char *) (__const char *) (tmpresult))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((__const unsigned char *) (__const char *) (tmpresult))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((__const unsigned char *) (__const char *) (tmpresult))[3]); } } __result; }))) : strcmp (tmp_fname_trim, tmpresult)))); }) == 0 && sub_match_fuzziness >= 1) {
prio = 5;
}
}
if (!prio && __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (tmp_fname_trim) && __builtin_constant_p (f_fname_trim) && (__s1_len = strlen (tmp_fname_trim), __s2_len = strlen (f_fname_trim), (!((size_t)(const void *)((tmp_fname_trim) + 1) - (size_t)(const void *)(tmp_fname_trim) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((f_fname_trim) + 1) - (size_t)(const void *)(f_fname_trim) == 1) || __s2_len >= 4)) ? memcmp ((__const char *) (tmp_fname_trim), (__const char *) (f_fname_trim), (__s1_len < __s2_len ? __s1_len : __s2_len) + 1) : (__builtin_constant_p (tmp_fname_trim) && ((size_t)(const void *)((tmp_fname_trim) + 1) - (size_t)(const void *)(tmp_fname_trim) == 1) && (__s1_len = strlen (tmp_fname_trim), __s1_len < 4) ? (__builtin_constant_p (f_fname_trim) && ((size_t)(const void *)((f_fname_trim) + 1) - (size_t)(const void *)(f_fname_trim) == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (tmp_fname_trim))[0] - ((__const unsigned char *) (__const char *)(f_fname_trim))[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (tmp_fname_trim))[1] - ((__const unsigned char *) (__const char *) (f_fname_trim))[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (tmp_fname_trim))[2] - ((__const unsigned char *) (__const char *) (f_fname_trim))[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (tmp_fname_trim))[3] - ((__const unsigned char *) (__const char *) (f_fname_trim))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s2 = (__const unsigned char *) (__const char *) (f_fname_trim); register int __result = (((__const unsigned char *) (__const char *) (tmp_fname_trim))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (tmp_fname_trim))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (tmp_fname_trim))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (tmp_fname_trim))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (f_fname_trim) && ((size_t)(const void *)((f_fname_trim) + 1) - (size_t)(const void *)(f_fname_trim) == 1) && (__s2_len = strlen (f_fname_trim), __s2_len < 4) ? (__builtin_constant_p (tmp_fname_trim) && ((size_t)(const void *)((tmp_fname_trim) + 1) - (size_t)(const void *)(tmp_fname_trim) == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (tmp_fname_trim))[0] - ((__const unsigned char *) (__const char *)(f_fname_trim))[0]); if (__s2_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (tmp_fname_trim))[1] - ((__const unsigned char *) (__const char *) (f_fname_trim))[1]); if (__s2_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (tmp_fname_trim))[2] - ((__const unsigned char *) (__const char *) (f_fname_trim))[2]); if (__s2_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (tmp_fname_trim))[3] - ((__const unsigned char *) (__const char *) (f_fname_trim))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s1 = (__const unsigned char *) (__const char *) (tmp_fname_trim); register int __result = __s1[0] - ((__const unsigned char *) (__const char *) (f_fname_trim))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((__const unsigned char *) (__const char *) (f_fname_trim))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((__const unsigned char *) (__const char *) (f_fname_trim))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((__const unsigned char *) (__const char *) (f_fname_trim))[3]); } } __result; }))) : strcmp (tmp_fname_trim, f_fname_trim)))); }) == 0) {
prio = 4;
}
if (!prio && (tmp = strstr(tmp_fname_trim, f_fname_trim)) && (sub_match_fuzziness >= 1)) {
tmp += strlen(f_fname_trim);
if (tmp_sub_id && strstr(tmp, tmp_sub_id)) {
prio = 3;
} else if ((tmp_sub_id == ((void *)0)) && whiteonly(tmp)) {
prio = 3;
} else {
prio = 2;
}
}
if (!prio) {
if ((j == 0) && (sub_match_fuzziness >= 2)) {
prio = 1;
}
}
if (prio) {
prio += prio;
if (i<3){
prio++;
}
sprintf(tmpresult, "%s%s", j == 0 ? f_dir : path, de->d_name);
if ((f = fopen(tmpresult, "rt"))) {
fclose(f);
result[subcnt].priority = prio;
result[subcnt].fname = (__extension__ (__builtin_constant_p (tmpresult) && ((size_t)(const void *)((tmpresult) + 1) - (size_t)(const void *)(tmpresult) == 1) ? (((__const char *) (tmpresult))[0] == '\0' ? (char *) calloc (1, 1) : ({ size_t __len = strlen (tmpresult) + 1; char *__retval = (char *) malloc (__len); if (__retval != ((void *)0)) __retval = (char *) memcpy (__retval, tmpresult, __len); __retval; })) : __strdup (tmpresult)));
subcnt++;
}
}
}
if (subcnt >= 128) break;
}
closedir(d);
}
}
if (tmp_sub_id) free(tmp_sub_id);
free(f_dir);
free(f_fname);
free(f_fname_noext);
free(f_fname_trim);
free(tmp_fname_noext);
free(tmp_fname_trim);
free(tmp_fname_ext);
free(tmpresult);
qsort(result, subcnt, sizeof(subfn), compare_sub_priority);
result2 = (char**)malloc(sizeof(char*)*(subcnt+1));
(__extension__ (__builtin_constant_p (sizeof(char*)*(subcnt+1)) && (sizeof(char*)*(subcnt+1)) <= 16 ? ((sizeof(char*)*(subcnt+1)) == 1 ? ({ void *__s = (result2); *((__uint8_t *) __s) = (__uint8_t) 0; __s; }) : ({ void *__s = (result2); union { unsigned int __ui; unsigned short int __usi; unsigned char __uc; } *__u = __s; __uint8_t __c = (__uint8_t) (0); switch ((unsigned int) (sizeof(char*)*(subcnt+1))) { case 15: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 11: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 7: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 3: __u->__usi = (unsigned short int) __c * 0x0101; __u = __extension__ ((void *) __u + 2); __u->__uc = (unsigned char) __c; break; case 14: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 10: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 6: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 2: __u->__usi = (unsigned short int) __c * 0x0101; break; case 13: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 9: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 5: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 1: __u->__uc = (unsigned char) __c; break; case 16: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 12: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 8: __u->__ui = __c * 0x01010101; __u = __extension__ ((void *) __u + 4); case 4: __u->__ui = __c * 0x01010101; case 0: break; } __s; })) : (__builtin_constant_p (0) && (0) == '\0' ? ({ void *__s = (result2); __builtin_memset (__s, '\0', sizeof(char*)*(subcnt+1)); __s; }) : memset (result2, 0, sizeof(char*)*(subcnt+1)))));
for (i = 0; i < subcnt; i++) {
result2[i] = result[i].fname;
}
result2[subcnt] = ((void *)0);
free(result);
return result2;
}
void list_sub_file(sub_data* subd){
int i,j;
subtitle *subs = subd->subtitles;
for(j=0; j < subd->sub_num; j++){
subtitle* egysub=&subs[j];
printf ("%i line%c (%li-%li)\n",
egysub->lines,
(1==egysub->lines)?' ':'s',
egysub->start,
egysub->end);
for (i=0; i<egysub->lines; i++) {
printf ("\t\t%d: %s%s", i,egysub->text[i], i==egysub->lines-1?"":" \n ");
}
printf ("\n");
}
printf ("Subtitle format %s time.\n",
subd->sub_uses_time ? "uses":"doesn't use");
printf ("Read %i subtitles, %i errors.\n", subd->sub_num, subd->sub_errs);
}
void dump_srt(sub_data* subd, float fps){
int i,j;
int h,m,s,ms;
FILE * fd;
subtitle * onesub;
unsigned long temp;
subtitle *subs = subd->subtitles;
if (!subd->sub_uses_time && sub_fps == 0)
sub_fps = fps;
fd=fopen("dumpsub.srt","w");
if(!fd)
{
perror("dump_srt: fopen");
return;
}
for(i=0; i < subd->sub_num; i++)
{
onesub=subs+i;
fprintf(fd,"%d\n",i+1);
temp=onesub->start;
if (!subd->sub_uses_time)
temp = temp * 100 / sub_fps;
temp -= sub_delay * 100;
h=temp/360000;temp%=360000;
m=temp/6000; temp%=6000;
s=temp/100; temp%=100;
ms=temp*10;
fprintf(fd,"%02d:%02d:%02d,%03d --> ",h,m,s,ms);
temp=onesub->end;
if (!subd->sub_uses_time)
temp = temp * 100 / sub_fps;
temp -= sub_delay * 100;
h=temp/360000;temp%=360000;
m=temp/6000; temp%=6000;
s=temp/100; temp%=100;
ms=temp*10;
fprintf(fd,"%02d:%02d:%02d,%03d\n",h,m,s,ms);
for(j=0;j<onesub->lines;j++)
fprintf(fd,"%s\n",onesub->text[j]);
fprintf(fd,"\n");
}
fclose(fd);
mp_msg_c(((36)<<8)|(4),"SUB: Subtitles dumped in \'dumpsub.srt\'.\n" );
}
void dump_mpsub(sub_data* subd, float fps){
int i,j;
FILE *fd;
float a,b;
subtitle *subs = subd->subtitles;
mpsub_position = subd->sub_uses_time? (sub_delay*100) : (sub_delay*fps);
if (sub_fps==0) sub_fps=fps;
fd=fopen ("dump.mpsub", "w");
if (!fd) {
perror ("dump_mpsub: fopen");
return;
}
if (subd->sub_uses_time) fprintf (fd,"FORMAT=TIME\n\n");
else fprintf (fd, "FORMAT=%5.2f\n\n", fps);
for(j=0; j < subd->sub_num; j++){
subtitle* egysub=&subs[j];
if (subd->sub_uses_time) {
a=((egysub->start-mpsub_position)/100.0);
b=((egysub->end-egysub->start)/100.0);
if ( (float)((int)a) == a)
fprintf (fd, "%.0f",a);
else
fprintf (fd, "%.2f",a);
if ( (float)((int)b) == b)
fprintf (fd, " %.0f\n",b);
else
fprintf (fd, " %.2f\n",b);
} else {
fprintf (fd, "%ld %ld\n", (long)((egysub->start*(fps/sub_fps))-((mpsub_position*(fps/sub_fps)))),
(long)(((egysub->end)-(egysub->start))*(fps/sub_fps)));
}
mpsub_position = egysub->end;
for (i=0; i<egysub->lines; i++) {
fprintf (fd, "%s\n",egysub->text[i]);
}
fprintf (fd, "\n");
}
fclose (fd);
mp_msg_c(((36)<<8)|(4),"SUB: Subtitles dumped in \'dump.mpsub\'.\n" );
}
void dump_microdvd(sub_data* subd, float fps) {
int i, delay;
FILE *fd;
subtitle *subs = subd->subtitles;
if (sub_fps == 0)
sub_fps = fps;
fd = fopen("dumpsub.txt", "w");
if (!fd) {
perror("dumpsub.txt: fopen");
return;
}
delay = sub_delay * sub_fps;
for (i = 0; i < subd->sub_num; ++i) {
int j, start, end;
start = subs[i].start;
end = subs[i].end;
if (subd->sub_uses_time) {
start = start * sub_fps / 100 ;
end = end * sub_fps / 100;
}
else {
start = start * sub_fps / fps;
end = end * sub_fps / fps;
}
start -= delay;
end -= delay;
fprintf(fd, "{%d}{%d}", start, end);
for (j = 0; j < subs[i].lines; ++j)
fprintf(fd, "%s%s", j ? "|" : "", subs[i].text[j]);
fprintf(fd, "\n");
}
fclose(fd);
mp_msg_c(((36)<<8)|(4),"SUB: Subtitles dumped in \'dumpsub.txt\'.\n" );
}
void dump_jacosub(sub_data* subd, float fps) {
int i,j;
int h,m,s,cs;
FILE * fd;
subtitle * onesub;
unsigned long temp;
subtitle *subs = subd->subtitles;
if (!subd->sub_uses_time && sub_fps == 0)
sub_fps = fps;
fd=fopen("dumpsub.jss","w");
if(!fd)
{
perror("dump_jacosub: fopen");
return;
}
fprintf(fd, "#TIMERES %d\n", (subd->sub_uses_time) ? 100 : (int)sub_fps);
for(i=0; i < subd->sub_num; i++)
{
onesub=subs+i;
temp=onesub->start;
if (!subd->sub_uses_time)
temp = temp * 100 / sub_fps;
temp -= sub_delay * 100;
h=temp/360000;temp%=360000;
m=temp/6000; temp%=6000;
s=temp/100; temp%=100;
cs=temp;
fprintf(fd,"%02d:%02d:%02d.%02d ",h,m,s,cs);
temp=onesub->end;
if (!subd->sub_uses_time)
temp = temp * 100 / sub_fps;
temp -= sub_delay * 100;
h=temp/360000;temp%=360000;
m=temp/6000; temp%=6000;
s=temp/100; temp%=100;
cs=temp;
fprintf(fd,"%02d:%02d:%02d.%02d {~} ",h,m,s,cs);
for(j=0;j<onesub->lines;j++)
fprintf(fd,"%s%s",j ? "\\n" : "", onesub->text[j]);
fprintf(fd,"\n");
}
fclose(fd);
mp_msg_c(((36)<<8)|(4),"SUB: Subtitles dumped in \'dumpsub.js\'.\n" );
}
void dump_sami(sub_data* subd, float fps) {
int i,j;
FILE * fd;
subtitle * onesub;
unsigned long temp;
subtitle *subs = subd->subtitles;
if (!subd->sub_uses_time && sub_fps == 0)
sub_fps = fps;
fd=fopen("dumpsub.smi","w");
if(!fd)
{
perror("dump_jacosub: fopen");
return;
}
fprintf(fd, "<SAMI>\n"
"<HEAD>\n"
" <STYLE TYPE=\"Text/css\">\n"
" <!--\n"
" P {margin-left: 29pt; margin-right: 29pt; font-size: 24pt; text-align: center; font-family: Tahoma; font-weight: bold; color: #FCDD03; background-color: #000000;}\n"
" .SUBTTL {Name: 'Subtitles'; Lang: en-US; SAMIType: CC;}\n"
" -->\n"
" </STYLE>\n"
"</HEAD>\n"
"<BODY>\n");
for(i=0; i < subd->sub_num; i++)
{
onesub=subs+i;
temp=onesub->start;
if (!subd->sub_uses_time)
temp = temp * 100 / sub_fps;
temp -= sub_delay * 100;
fprintf(fd,"\t<SYNC Start=%lu>\n"
"\t <P>", temp * 10);
for(j=0;j<onesub->lines;j++)
fprintf(fd,"%s%s",j ? "<br>" : "", onesub->text[j]);
fprintf(fd,"\n");
temp=onesub->end;
if (!subd->sub_uses_time)
temp = temp * 100 / sub_fps;
temp -= sub_delay * 100;
fprintf(fd,"\t<SYNC Start=%lu>\n"
"\t <P> \n", temp * 10);
}
fprintf(fd, "</BODY>\n"
"</SAMI>\n");
fclose(fd);
mp_msg_c(((36)<<8)|(4),"SUB: Subtitles dumped in \'dumpsub.smi\'.\n" );
}
void sub_free( sub_data * subd )
{
int i;
if ( !subd ) return;
if (subd->subtitles) {
for (i=0; i < subd->subtitles->lines; i++) free( subd->subtitles->text[i] );
free( subd->subtitles );
}
if (subd->filename) free( subd->filename );
free( subd );
}