Tk Library Source Code

Artifact [9f72ebf441]
Login

Artifact 9f72ebf44186665eb53203e1ef3c5717eb1dd5ac:

Attachment "asn_oid.patch" to ticket [1391776fff] added by nobody 2005-12-28 14:31:44.
--- asn.tcl.orig	2005-12-28 10:19:54.000000000 +0300
+++ asn.tcl	2005-12-26 18:35:35.000000000 +0300
@@ -528,20 +528,24 @@
               set octets [binary format c [expr {[lindex $oid 0]*40+[lindex $oid 1]}]]
               foreach identifier [lrange $oid 2 end] {
                   set d 128
-                  set subidentifier [list]
-                  # find the largest divisor
-                  while {($identifier / $d) >= 128} { set d [expr {$d * 128}] }
-                  # and construct the subidentifiers
-                  set remainder $identifier
-                  while {$d >= 128} {
-                       set coefficient [expr {($remainder / $d) | 0x80}]
-                       set remainder [expr {$remainder % $d}]
-                       set d [expr {$d / 128}]
-                       lappend subidentifier $coefficient
-                  }
-                  lappend subidentifier $remainder
+                  if {$identifier < 128} {
+				  	set subidentifier [list $identifier]
+				  } else {	
+					set subidentifier [list]
+					# find the largest divisor
+					
+					while {($identifier / $d) >= 128} { set d [expr {$d * 128}] }
+					# and construct the subidentifiers
+					set remainder $identifier
+					while {$d >= 128} {
+						set coefficient [expr {($remainder / $d) | 0x80}]
+						set remainder [expr {$remainder % $d}]
+						set d [expr {$d / 128}]
+						lappend subidentifier $coefficient
+					}
+					lappend subidentifier $remainder
+				  }
                   append octets [binary format c* $subidentifier]
-                  puts [string length $octets]
               }
               return [binary format H2a*a* 06 [asnLength [string length $octets]] $octets]
         }