[m-rev.] diff: fix string__to_float("") for .NET

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Oct 24 00:43:39 AEST 2002


This fixes a bug that Peter Moulder spotted in my earlier change.

Estimated hours taken: 4
Branches: main

library/string.m:
	Fix a bug in my previous change to the MC++ version of
	string__to_float: check for the case when the string is empty.

Workspace: /c/fjh/ws/2/mercury
Index: library/string.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/string.m,v
retrieving revision 1.180
diff -u -d -r1.180 string.m
--- library/string.m	22 Oct 2002 06:15:41 -0000	1.180
+++ library/string.m	23 Oct 2002 14:45:35 -0000
@@ -1863,7 +1863,8 @@
 	string__to_float(FloatString::in, FloatVal::out),
 		[will_not_call_mercury, promise_pure, thread_safe], "{
 	// leading or trailing whitespace is not allowed
-	if (System::Char::IsWhiteSpace(FloatString, 0) ||
+	if (FloatString->Length == 0 ||
+	    System::Char::IsWhiteSpace(FloatString, 0) ||
 	    System::Char::IsWhiteSpace(FloatString, FloatString->Length - 1))
 	{
 	    SUCCESS_INDICATOR = MR_FALSE;
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list