Commit 52831460 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

We only have to reduce unsigned fractions in VLC

(someone show me a screen with a negative pixel resolution)
parent 856bb692
......@@ -998,7 +998,7 @@ typedef __int64 off_t;
# include <tchar.h>
#endif
VLC_EXPORT( vlc_bool_t, vlc_reduce, ( int *, int *, int64_t, int64_t, int64_t ) );
VLC_EXPORT( vlc_bool_t, vlc_reduce, ( unsigned *, unsigned *, uint64_t, uint64_t, uint64_t ) );
VLC_EXPORT( char **, vlc_parse_cmdline, ( const char *, int * ) );
/* vlc_wraptext (defined in src/extras/libc.c) */
......
......@@ -181,7 +181,7 @@ struct module_symbols_t
void * (*vlc_opendir_inner) (const char *);
void * (*vlc_readdir_inner) (void *);
int (*vlc_closedir_inner) (void *);
vlc_bool_t (*vlc_reduce_inner) (int *, int *, int64_t, int64_t, int64_t);
vlc_bool_t (*vlc_reduce_inner) (unsigned *, unsigned *, uint64_t, uint64_t, uint64_t);
char ** (*vlc_parse_cmdline_inner) (const char *, int *);
char * (*vlc_wraptext_inner) (const char *, int, vlc_bool_t);
vlc_iconv_t (*vlc_iconv_open_inner) (const char *, const char *);
......
......@@ -463,11 +463,11 @@ int vlc_iconv_close( vlc_iconv_t cd )
* reduce a fraction
* (adapted from libavcodec, author Michael Niedermayer <michaelni@gmx.at>)
*****************************************************************************/
vlc_bool_t vlc_reduce( int *pi_dst_nom, int *pi_dst_den,
int64_t i_nom, int64_t i_den, int64_t i_max )
vlc_bool_t vlc_reduce( unsigned *pi_dst_nom, unsigned *pi_dst_den,
uint64_t i_nom, uint64_t i_den, uint64_t i_max )
{
vlc_bool_t b_exact = 1, b_sign = 0;
int64_t i_gcd;
vlc_bool_t b_exact = 1;
uint64_t u_gcd;
if( i_den == 0 )
{
......@@ -476,18 +476,6 @@ vlc_bool_t vlc_reduce( int *pi_dst_nom, int *pi_dst_den,
return 1;
}
if( i_den < 0 )
{
i_den = - i_den;
i_nom = - i_nom;
}
if( i_nom < 0 )
{
i_nom = - i_nom;
b_sign = 1;
}
i_gcd = GCD( i_nom, i_den );
i_nom /= i_gcd;
i_den /= i_gcd;
......@@ -518,8 +506,6 @@ vlc_bool_t vlc_reduce( int *pi_dst_nom, int *pi_dst_den,
i_den = i_a1_den;
}
if( b_sign ) i_nom = - i_nom;
*pi_dst_nom = i_nom;
*pi_dst_den = i_den;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment