mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
tests:audioconvert: Fix integer overflow build error
value of 32768L << 16 and 1L << 31 is 2147483648 but it exceeds the positive range of int which is 2147483647 resulting in integer overflow error. Use G_GINT64_CONSTANT instead of L. https://bugzilla.gnome.org/show_bug.cgi?id=760769
This commit is contained in:
parent
91084f49c0
commit
2aabbc2163
1 changed files with 4 additions and 3 deletions
|
@ -812,7 +812,7 @@ GST_START_TEST (test_int_float_conversion)
|
||||||
{
|
{
|
||||||
gint16 in[] = { 0, -32768, 16384, -16384 };
|
gint16 in[] = { 0, -32768, 16384, -16384 };
|
||||||
gdouble out[] = { 0.0,
|
gdouble out[] = { 0.0,
|
||||||
(gdouble) (-(32768L << 16)) / 2147483648.0, /* ~ -1.0 */
|
(gdouble) (-(G_GINT64_CONSTANT (32768) << 16)) / 2147483648.0, /* ~ -1.0 */
|
||||||
(gdouble) (16384L << 16) / 2147483648.0, /* ~ 0.5 */
|
(gdouble) (16384L << 16) / 2147483648.0, /* ~ 0.5 */
|
||||||
(gdouble) (-(16384L << 16)) / 2147483648.0, /* ~ -0.5 */
|
(gdouble) (-(16384L << 16)) / 2147483648.0, /* ~ -0.5 */
|
||||||
};
|
};
|
||||||
|
@ -822,9 +822,10 @@ GST_START_TEST (test_int_float_conversion)
|
||||||
out, get_float_caps (1, G_BYTE_ORDER, 64));
|
out, get_float_caps (1, G_BYTE_ORDER, 64));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
gint32 in[] = { 0, (-(1L << 31)), (1L << 30), (-(1L << 30)) };
|
gint32 in[] =
|
||||||
|
{ 0, (-(G_GINT64_CONSTANT (1) << 31)), (1L << 30), (-(1L << 30)) };
|
||||||
gdouble out[] = { 0.0,
|
gdouble out[] = { 0.0,
|
||||||
(gdouble) (-(1L << 31)) / 2147483648.0, /* ~ -1.0 */
|
(gdouble) (-(G_GINT64_CONSTANT (1) << 31)) / 2147483648.0, /* ~ -1.0 */
|
||||||
(gdouble) (1L << 30) / 2147483648.0, /* ~ 0.5 */
|
(gdouble) (1L << 30) / 2147483648.0, /* ~ 0.5 */
|
||||||
(gdouble) (-(1L << 30)) / 2147483648.0, /* ~ -0.5 */
|
(gdouble) (-(1L << 30)) / 2147483648.0, /* ~ -0.5 */
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue