Revision: 64366
http://sourceforge.net/p/brlcad/code/64366
Author: n_reed
Date: 2015-03-11 04:58:48 +0000 (Wed, 11 Mar 2015)
Log Message:
-----------
fix build warning about index out of bounds
Modified Paths:
--------------
brlcad/trunk/src/libbn/tests/bn_polygon_triangulate.c
Modified: brlcad/trunk/src/libbn/tests/bn_polygon_triangulate.c
===================================================================
--- brlcad/trunk/src/libbn/tests/bn_polygon_triangulate.c 2015-03-11
04:44:34 UTC (rev 64365)
+++ brlcad/trunk/src/libbn/tests/bn_polygon_triangulate.c 2015-03-11
04:58:48 UTC (rev 64366)
@@ -40,6 +40,7 @@
main(int UNUSED(argc), const char **UNUSED(argv))
{
{
+ size_t num_points = 0;
int num_faces = 0;
int *faces = NULL;
@@ -90,16 +91,18 @@
V2SET(points[42], 2807.83, 2022.83);
V2SET(points[43], 2807.83, 2372.83);
- if (bn_polygon_triangulate(&faces, &num_faces, (const point2d_t
*)points, 44)) {
+ num_points = sizeof(points) / sizeof(point2d_t);
+ if (bn_polygon_triangulate(&faces, &num_faces, (const point2d_t
*)points, num_points)) {
return 1;
}
}
{
+ size_t num_points = 0;
int num_faces = 0;
int *faces = NULL;
- /* 13 point polygon derived from NIST MBE PMI sample 3 shape */
- point2d_t points[13] = {{0}};
+ /* 14 point polygon derived from NIST MBE PMI sample 3 shape */
+ point2d_t points[14] = {{0}};
V2SET(points[0], 801.392008, 748.924528);
V2SET(points[1], 801.392008, 729.874528);
V2SET(points[2], 1164.916808, 729.874528);
@@ -115,7 +118,8 @@
V2SET(points[12], 840.914408, 761.624528);
V2SET(points[13], 814.092008, 761.624528);
- if (bn_polygon_triangulate(&faces, &num_faces, (const point2d_t
*)points, 13)) {
+ num_points = sizeof(points) / sizeof(point2d_t);
+ if (bn_polygon_triangulate(&faces, &num_faces, (const point2d_t
*)points, num_points)) {
return 1;
}
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits