[MPlayer-cvslog] r31932 - in trunk: Makefile libass/ass.c libass/ass.h libass/ass_bitmap.c libass/ass_bitmap.h libass/ass_cache.c libass/ass_drawing.c libass/ass_drawing.h libass/ass_font.c libass/ass_font.h libass...
Reimar Döffinger
Reimar.Doeffinger at gmx.de
Sun Aug 8 12:16:27 CEST 2010
Hello,
Do you care to take comments on libass code here?
> +#define ass_atof(STR) (ass_strtod((STR),NULL))
Those extra () actually should not be necessary.
Also I am in general in favour of static inline
functions, avoids even having to think about these
things
> Modified: trunk/libass/ass_bitmap.c
> ==============================================================================
> --- trunk/libass/ass_bitmap.c Fri Aug 6 12:48:16 2010 (r31931)
> +++ trunk/libass/ass_bitmap.c Fri Aug 6 23:13:41 2010 (r31932)
> @@ -139,8 +139,8 @@ void ass_synth_done(ASS_SynthPriv *priv)
> static Bitmap *alloc_bitmap(int w, int h)
> {
> Bitmap *bm;
> - bm = calloc(1, sizeof(Bitmap));
> - bm->buffer = malloc(w * h);
> + bm = malloc(sizeof(Bitmap));
> + bm->buffer = calloc(w, h);
Isn't it more maintainable to use calloc for both?
Then there's no risk of some par of Bitmap staying
uninitialized after extending it.
> @@ -224,7 +226,7 @@ ass_strtod(string, endPtr)
> errno = ERANGE;
> }
> dblExp = 1.0;
> - for (d = powersOf10; exp != 0; exp >>= 1, d += 1) {
> + for (d = (double *) powersOf10; exp != 0; exp >>= 1, d += 1) {
Why not just fix the type of d?
Also the increment syntax in for loops is rather inconsistent,
sometimes it is in the style of d++, sometimes it is ++d
or like here d += 1.
And maybe a comment why this doesn't just use pow() would
be a good idea?
> if (exp & 01) {
Is this using octal intentionally?
More information about the MPlayer-cvslog
mailing list