Tk Library Source Code

Artifact [367219ff56]
Login

Artifact 367219ff56c6572e06e48b08fc91ad8c6f531656:

Attachment "units.tcl.patch" to ticket [3141584fff] added by yyamasak 2010-12-22 16:13:33.
--- C:/Tcl/lib/tcllib1.12/units/units.tcl	Wed Dec 22 17:33:59 2010
+++ C:/Tcl/lib/tcllib1.12/units/units.20101222.tcl	Wed Dec 22 17:50:53 2010
@@ -99,10 +99,19 @@
     #  Check number of arguments
     switch [llength $args] {
 	2 {
-	    set value [lindex $args 0]
+	    foreach {value targetUnits} $args break
 	    # make sure it isn't octal (bug 758702)
-	    set value [string trimleft $value "0"]
-	    set targetUnits [lindex $args 1]
+	    switch [scan $value %f%s srcValue srcUnits] {
+	    1 {
+		    set value $srcValue
+		}
+		2 {
+			set value [list $srcValue $srcUnits]
+		}
+		default {
+			error "Wrong value. units::convert value targetUnits"
+		}
+		}
 	}
 	default {
 	    #  issue same error as C extension