diff options
author | Oneric <oneric@oneric.stub> | 2022-01-19 22:49:52 +0100 |
---|---|---|
committer | Oneric <oneric@oneric.stub> | 2022-01-20 00:29:23 +0100 |
commit | bfa1dbe8680f5b709828a4b317992a793cf26856 (patch) | |
tree | 1f4be312a03939d058ee13957b69ea15d56a6778 | |
parent | 06e48f1828bae0ffaa9021327bf040ab3fd69d46 (diff) | |
download | libass-bfa1dbe8680f5b709828a4b317992a793cf26856.tar.bz2 libass-bfa1dbe8680f5b709828a4b317992a793cf26856.tar.xz |
refactor: do not cast allocations
-rw-r--r-- | libass/ass_directwrite.c | 10 | ||||
-rw-r--r-- | libass/ass_directwrite_info_template.h | 4 | ||||
-rw-r--r-- | test/test.c | 4 |
3 files changed, 9 insertions, 9 deletions
diff --git a/libass/ass_directwrite.c b/libass/ass_directwrite.c index ccb82c3..f8c2a27 100644 --- a/libass/ass_directwrite.c +++ b/libass/ass_directwrite.c @@ -482,7 +482,7 @@ static char *get_utf8_name(IDWriteLocalizedStrings *names, int k) if (length >= (UINT32) -1 || length + (size_t) 1 > SIZE_MAX / sizeof(wchar_t)) goto cleanup; - temp_name = (wchar_t *) malloc((length + 1) * sizeof(wchar_t)); + temp_name = malloc((length + 1) * sizeof(wchar_t)); if (!temp_name) goto cleanup; @@ -495,7 +495,7 @@ static char *get_utf8_name(IDWriteLocalizedStrings *names, int k) if (!size_needed) goto cleanup; - mbName = (char *) malloc(size_needed); + mbName = malloc(size_needed); if (!mbName) goto cleanup; @@ -616,7 +616,7 @@ static void add_font_face(IDWriteFontFace *face, ASS_FontProvider *provider, goto cleanup; } - FontPrivate *font_priv = (FontPrivate *) calloc(1, sizeof(*font_priv)); + FontPrivate *font_priv = calloc(1, sizeof(*font_priv)); if (!font_priv) goto cleanup; @@ -815,7 +815,7 @@ static void add_font(IDWriteFont *font, IDWriteFontFamily *fontFamily, if (!get_font_info_IDWriteFont(font, fontFamily, &meta)) goto cleanup; - FontPrivate *font_priv = (FontPrivate *) calloc(1, sizeof(*font_priv)); + FontPrivate *font_priv = calloc(1, sizeof(*font_priv)); if (!font_priv) goto cleanup; font_priv->font = font; @@ -1086,7 +1086,7 @@ ASS_FontProvider *ass_directwrite_add_provider(ASS_Library *lib, goto cleanup; } - priv = (ProviderPrivate *)calloc(sizeof(*priv), 1); + priv = calloc(sizeof(*priv), 1); if (!priv) goto cleanup; diff --git a/libass/ass_directwrite_info_template.h b/libass/ass_directwrite_info_template.h index 7c545d1..b627124 100644 --- a/libass/ass_directwrite_info_template.h +++ b/libass/ass_directwrite_info_template.h @@ -40,7 +40,7 @@ static bool NAME(FONT_TYPE)(FONT_TYPE *font, if (exists) { meta->n_fullname = IDWriteLocalizedStrings_GetCount(fontNames); - meta->fullnames = (char **) calloc(meta->n_fullname, sizeof(char *)); + meta->fullnames = calloc(meta->n_fullname, sizeof(char *)); if (!meta->fullnames) { IDWriteLocalizedStrings_Release(fontNames); return false; @@ -69,7 +69,7 @@ static bool NAME(FONT_TYPE)(FONT_TYPE *font, return false; meta->n_family = IDWriteLocalizedStrings_GetCount(familyNames); - meta->families = (char **) calloc(meta->n_family, sizeof(char *)); + meta->families = calloc(meta->n_family, sizeof(char *)); if (!meta->families) { IDWriteLocalizedStrings_Release(familyNames); return false; diff --git a/test/test.c b/test/test.c index c378e48..b099a9a 100644 --- a/test/test.c +++ b/test/test.c @@ -77,7 +77,7 @@ static void write_png(char *fname, image_t *img) png_set_bgr(png_ptr); - row_pointers = (png_byte **) malloc(img->height * sizeof(png_byte *)); + row_pointers = malloc(img->height * sizeof(png_byte *)); for (k = 0; k < img->height; k++) row_pointers[k] = img->buffer + img->stride * k; @@ -118,7 +118,7 @@ static image_t *gen_image(int width, int height) img->width = width; img->height = height; img->stride = width * 3; - img->buffer = (unsigned char *) calloc(1, height * width * 3); + img->buffer = calloc(1, height * width * 3); memset(img->buffer, 63, img->stride * img->height); //for (int i = 0; i < height * width * 3; ++i) // img->buffer[i] = (i/3/50) % 100; |