Revision: 68976
http://sourceforge.net/p/brlcad/code/68976
Author: brlcad
Date: 2016-10-04 06:30:12 +0000 (Tue, 04 Oct 2016)
Log Message:
-----------
restore booleanize back to r68707 with slight modification that was causing the
spdi/shaders/solids regression tests to fail. the problem was simply that
errno needed to be reset before calling strtol(). now all regress tests are
passing again.
Revision Links:
--------------
http://sourceforge.net/p/brlcad/code/68707
Modified Paths:
--------------
brlcad/trunk/src/libbu/booleanize.c
Modified: brlcad/trunk/src/libbu/booleanize.c
===================================================================
--- brlcad/trunk/src/libbu/booleanize.c 2016-10-03 23:51:18 UTC (rev 68975)
+++ brlcad/trunk/src/libbu/booleanize.c 2016-10-04 06:30:12 UTC (rev 68976)
@@ -52,71 +52,62 @@
return 0;
}
- /* starts with 'n', [nN]* looks like 'no' */
- if (newstr[0] == 'n' || newstr[0] == 'N') {
+ /* case-insensitive "no" */
+ if (BU_STR_EQUIV(newstr, "n") || BU_STR_EQUIV(newstr, "no")) {
bu_vls_free(&vls);
return 0;
}
- /* exactly "f" or "F" (for false) */
- if (BU_STR_EQUIV(newstr, "f")) {
+ /* case-insensitive "false" */
+ if (BU_STR_EQUIV(newstr, "false")) {
bu_vls_free(&vls);
return 0;
}
- /* exact case insensitive match for "false" */
- if (BU_STR_EQUIV(newstr, "false")) {
+ /* case-insensitive "off" */
+ if (BU_STR_EQUIV(newstr, "off")) {
bu_vls_free(&vls);
return 0;
}
- /* exactly "0" */
- if (BU_STR_EQUAL(newstr, "0")) {
- bu_vls_free(&vls);
- return 0;
- }
- /* variant of "0" (e.g., 000) */
+ /* any variant of "0" (e.g., 000) */
+ errno = 0;
val = strtol(newstr, &endptr, 10);
- if (val == 0 && errno != EINVAL && *endptr == '\0') {
+ if (val == 0 && !errno && *endptr == '\0') {
bu_vls_free(&vls);
return 0;
}
- /* exactly "(null)" */
- if (BU_STR_EQUAL(newstr, "(null)")) {
+ /* case-insensitive "(null)" */
+ if (BU_STR_EQUIV(newstr, "(null)")) {
bu_vls_free(&vls);
return 0;
}
/* true value from here on out */
- /* starts with 'y', [yY]* looks like 'yes' */
- if (newstr[0] == 'y' || newstr[0] == 'Y') {
+ /* case-insensitive "yes" */
+ if (BU_STR_EQUIV(newstr, "y") || BU_STR_EQUIV(newstr, "yes")) {
bu_vls_free(&vls);
return 1;
}
- /* exactly "t" or "T" (for true) */
- if (BU_STR_EQUIV(newstr, "t")) {
- bu_vls_free(&vls);
- return 1;
- }
-
- /* exact case insensitive match for "true" */
+ /* case-insensitive "true" */
if (BU_STR_EQUIV(newstr, "true")) {
bu_vls_free(&vls);
return 1;
}
- /* exactly "1" */
- if (BU_STR_EQUAL(newstr, "1")) {
+ /* case-insensitive "on" */
+ if (BU_STR_EQUIV(newstr, "on")) {
bu_vls_free(&vls);
return 1;
}
/* variant of "1" (e.g., 001) */
+ errno = 0;
val = strtol(newstr, &endptr, 10);
- if (val == 1 && errno != EINVAL && *endptr == '\0') {
+ if (val == 1 && !errno && *endptr == '\0') {
bu_vls_free(&vls);
return 1;
}
@@ -126,9 +117,7 @@
bu_vls_free(&vls);
/* anything else */
- if ((int)val > 1)
- return (int)val;
- return 2;
+ return (int)val;
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits