Skip to content

Commit

Permalink
Fix compiler warnings
Browse files Browse the repository at this point in the history
Add some casts to shut up MSVC in 32-bit mode.
  • Loading branch information
ifb committed Jan 5, 2023
1 parent 73a8b40 commit 8d316ee
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions colorbars.c
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ static const VSFrame *VS_CC colorbarsGetFrame (int n, int activationReason, void
uint16_t rampheight = hdr_p4_gray[hdr - 1][depth][2] - hdr_p4_gray[hdr - 1][depth][1];
float slope = (float)rampheight / (float)rampwidth;
for (int i = 0; i < rampwidth; i++, edge_y++, edge_u++, edge_v++)
*edge_y = *edge_u = *edge_v = (hdr_p4_gray[hdr - 1][depth][1] + i * slope);
*edge_y = *edge_u = *edge_v = (int)(hdr_p4_gray[hdr - 1][depth][1] + i * slope);
for (int i = 0; i < hdr_p4_widths[depth][hdr - 1][resolution - 3][3]; i++, edge_y++, edge_u++, edge_v++)
*edge_y = *edge_u = *edge_v = hdr_p4_gray[hdr - 1][depth][2];
y += stride;
Expand Down Expand Up @@ -707,7 +707,7 @@ static const VSFrame *VS_CC colorbarsGetFrame (int n, int activationReason, void
float slope = (float)rampheight / (float)rampwidth;
for (int i = 0; i < rampwidth; i++, edge_y++, edge_u++, edge_v++)
{
*edge_y = p3_y[wcg][depth][2] + i * slope;
*edge_y = (int)(p3_y[wcg][depth][2] + i * slope);
*edge_u = p3_u[wcg][depth][2];
*edge_v = p3_v[wcg][depth][2];
}
Expand Down Expand Up @@ -758,13 +758,13 @@ static const VSFrame *VS_CC colorbarsGetFrame (int n, int activationReason, void
float slope = (float)subblack * (float)rampheight / (float)rampwidth;
for (int i = 0; i < rampwidth; i++, edge_y++, edge_u++, edge_v++)
{
*edge_y = p4_y[depth][1] - i * slope;
*edge_y = (int)(p4_y[depth][1] - i * slope);
*edge_u = p4_u[depth][1];
*edge_v = p4_v[depth][1];
}
for (int i = 0; i < rampwidth; i++, edge_y++, edge_u++, edge_v++)
{
*edge_y = p4_y[depth][1 + subblack * 10] + i * slope;
*edge_y = (int)(p4_y[depth][1 + subblack * 10] + i * slope);
*edge_u = p4_u[depth][1];
*edge_v = p4_v[depth][1];
}
Expand All @@ -775,13 +775,13 @@ static const VSFrame *VS_CC colorbarsGetFrame (int n, int activationReason, void
slope = (float)superwhite * (float)rampheight / (float)rampwidth;
for (int i = 0; i < rampwidth; i++, edge_y++, edge_u++, edge_v++)
{
*edge_y = p4_y[depth][2] + i * slope;
*edge_y = (int)(p4_y[depth][2] + i * slope);
*edge_u = p4_u[depth][2];
*edge_v = p4_v[depth][2];
}
for (int i = 0; i < rampwidth; i++, edge_y++, edge_u++, edge_v++)
{
*edge_y = p4_y[depth][2 + superwhite * 10] - i * slope;
*edge_y = (int)(p4_y[depth][2 + superwhite * 10] - i * slope);
*edge_u = p4_u[depth][2];
*edge_v = p4_v[depth][2];
}
Expand Down Expand Up @@ -831,7 +831,7 @@ static void VS_CC colorbarsCreate(const VSMap *in, VSMap *out, void *userData, V
ColorBarsData *data;

int err = 0;
d.compatability = vsapi->mapGetInt(in, "compatability", 0, &err);
d.compatability = (int)vsapi->mapGetInt(in, "compatability", 0, &err);
if (err)
d.compatability = 2;
if (d.compatability < 0 || d.compatability > 2)
Expand All @@ -857,13 +857,13 @@ static void VS_CC colorbarsCreate(const VSMap *in, VSMap *out, void *userData, V
d.vi.height = resolutions[d.resolution][1];
if (d.compatability == 2 && (d.resolution == NTSC || d.resolution == NTSC_4FSC))
d.vi.height = 480;
d.hdr = vsapi->mapGetInt(in, "hdr", 0, &err);
d.hdr = (int)vsapi->mapGetInt(in, "hdr", 0, &err);
if (err)
d.hdr = 0;
if (d.hdr < 0 || d.hdr > 3)
RETERROR("ColorBars: invalid HDR mode");

int pixformat = vsapi->mapGetInt(in, "format", 0, &err);
int pixformat = (int)vsapi->mapGetInt(in, "format", 0, &err);
if (err)
RETERROR("ColorBars: invalid format");

Expand All @@ -873,11 +873,11 @@ static void VS_CC colorbarsCreate(const VSMap *in, VSMap *out, void *userData, V
if (d.hdr && pixformat != pfRGB30 && pixformat != pfRGB36)
RETERROR( "ColorBars: invalid format, only RGB30 and RGB36 for HDR formats");

d.subblack = vsapi->mapGetInt(in, "subblack", 0, &err);
d.subblack = (int)vsapi->mapGetInt(in, "subblack", 0, &err);
if (err)
d.subblack = 1;
d.subblack = !!d.subblack;
d.superwhite = vsapi->mapGetInt(in, "superwhite", 0, &err);
d.superwhite = (int)vsapi->mapGetInt(in, "superwhite", 0, &err);
if (err)
d.superwhite = 1;
d.superwhite = !!d.superwhite;
Expand All @@ -886,7 +886,7 @@ static void VS_CC colorbarsCreate(const VSMap *in, VSMap *out, void *userData, V
d.iq = d.hdr ? IQ_NONE : d.resolution < UHDTV1 ? IQ_BOTH : IQ_NONE;
if (d.iq < 0 || d.iq > 3)
RETERROR("ColorBars: invalid I/Q mode");
d.wcg = vsapi->mapGetInt(in, "wcg", 0, &err);
d.wcg = (int)vsapi->mapGetInt(in, "wcg", 0, &err);
if (err)
d.wcg = 0;
d.wcg = !!d.wcg;
Expand Down Expand Up @@ -914,14 +914,14 @@ static void VS_CC colorbarsCreate(const VSMap *in, VSMap *out, void *userData, V
vsapi->logMessage(mtWarning, "ColorBars: I/Q is not valid option with HDR", core);
}

d.halfline = vsapi->mapGetInt(in, "halfline", 0, &err);
d.halfline = (int)vsapi->mapGetInt(in, "halfline", 0, &err);
if (err)
d.halfline = 0;
d.halfline = !!d.halfline;
if (d.halfline && (d.resolution > PAL && d.resolution < NTSC_4FSC))
RETERROR("ColorBars: Half line blanking only valid with NTSC/PAL");

d.filter = vsapi->mapGetInt(in, "filter", 0, &err);
d.filter = (int)vsapi->mapGetInt(in, "filter", 0, &err);
if (err)
d.filter = 1;
d.filter = !!d.filter;
Expand Down

2 comments on commit 8d316ee

@dnjulek
Copy link

@dnjulek dnjulek commented on 8d316ee Jan 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ifb
Copy link
Owner Author

@ifb ifb commented on 8d316ee Jan 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Making the release is the first time I've compiled the 32-bit version in forever. I thought it was odd the API returned an int64_t, but didn't even notice mapGetIntSaturated() in the header.

Please sign in to comment.