Merge pull request #474 from dragos-oancea/mod_cv-nullptr-passed

[mod_cv] scan-build: Null pointer passed as an argument to a 'nonnull' parameter.
This commit is contained in:
Andrey Volk 2020-05-15 20:28:51 +04:00 committed by GitHub
commit eba009868e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 12 deletions

View File

@ -181,7 +181,6 @@ static void context_render_text(cv_context_t *context, struct overlay *overlay,
if (!(context->w && context->h)) return; if (!(context->w && context->h)) return;
w = context->w;
h = context->h; h = context->h;
if (overlay->fontsz) { if (overlay->fontsz) {
@ -198,10 +197,6 @@ static void context_render_text(cv_context_t *context, struct overlay *overlay,
if (!text) text = overlay->text; if (!text) text = overlay->text;
int len = strlen(text);
if (len < 5) len = 5;
//width = (int) (float)(font_size * .95f * len); //width = (int) (float)(font_size * .95f * len);
switch_color_set_rgb(&bgcolor, overlay->bg); switch_color_set_rgb(&bgcolor, overlay->bg);
@ -897,7 +892,6 @@ static switch_status_t video_thread_callback(switch_core_session_t *session, swi
} }
shape_w = context->shape[0].w; shape_w = context->shape[0].w;
shape_h = context->shape[0].h;
cx = context->shape[0].cx; cx = context->shape[0].cx;
cy = context->shape[0].cy; cy = context->shape[0].cy;
@ -1095,11 +1089,13 @@ static void parse_params(cv_context_t *context, int start, int argc, char **argv
} else if (!strcasecmp(name, "allclear")) { } else if (!strcasecmp(name, "allclear")) {
for (int x = context->overlay_count - 1; x >= 0; x--) { for (int x = context->overlay_count - 1; x >= 0; x--) {
png_idx = clear_overlay(context, x); png_idx = clear_overlay(context, x);
if (context->overlay[x]) {
context->overlay[x]->xo = context->overlay[x]->yo = context->overlay[x]->shape_scale = 0.0f; context->overlay[x]->xo = context->overlay[x]->yo = context->overlay[x]->shape_scale = 0.0f;
context->overlay[x]->zidx = 0; context->overlay[x]->zidx = 0;
context->overlay[x]->scale_w = context->overlay[x]->scale_h = 0; context->overlay[x]->scale_w = context->overlay[x]->scale_h = 0;
context->overlay[x]->shape_scale = 1; context->overlay[x]->shape_scale = 1;
} }
}
} else if (!strcasecmp(name, "home")) { } else if (!strcasecmp(name, "home")) {
context->overlay[png_idx]->xo = context->overlay[png_idx]->yo = context->overlay[png_idx]->shape_scale = 0.0f; context->overlay[png_idx]->xo = context->overlay[png_idx]->yo = context->overlay[png_idx]->shape_scale = 0.0f;
context->overlay[png_idx]->zidx = 0; context->overlay[png_idx]->zidx = 0;
@ -1200,7 +1196,7 @@ static switch_bool_t cv_bug_callback(switch_media_bug_t *bug, void *user_data, s
{ {
cv_context_t *context = (cv_context_t *) user_data; cv_context_t *context = (cv_context_t *) user_data;
switch_channel_t *channel = switch_core_session_get_channel(context->session); switch_channel_t *channel;
switch (type) { switch (type) {
case SWITCH_ABC_TYPE_INIT: case SWITCH_ABC_TYPE_INIT:
@ -1263,7 +1259,7 @@ SWITCH_STANDARD_APP(cv_bug_start_function)
parse_params(context, 1, argc, argv); parse_params(context, 1, argc, argv);
} }
if (!strcasecmp(argv[0], "patch") || !strcasecmp(argv[1], "patch")) { if ((argv[0] && !strcasecmp(argv[0], "patch")) ||(argv[1] && !strcasecmp(argv[1], "patch"))) {
function = "patch:video"; function = "patch:video";
flags = SMBF_VIDEO_PATCH; flags = SMBF_VIDEO_PATCH;
} }