Index: openacs-4/packages/acs-tcl/tcl/text-html-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/text-html-procs.tcl,v
diff -u -r1.65.6.3 -r1.65.6.4
--- openacs-4/packages/acs-tcl/tcl/text-html-procs.tcl 5 Sep 2013 11:51:00 -0000 1.65.6.3
+++ openacs-4/packages/acs-tcl/tcl/text-html-procs.tcl 14 Sep 2013 09:35:47 -0000 1.65.6.4
@@ -646,7 +646,7 @@
# We maintain counter is so that we don't accidentally enter an infinite loop
set count 0
while { $i < [string length $html] && ![string equal [string index $html $i] {>}] } {
- if { [incr count] > 1000 } {
+ if { [incr count] > 3000 } {
error "There appears to be a programming bug in ad_parse_html_attributes_upvar: We've entered an infinite loop. We are here: \noffset $i: [string range $html $i [expr {$i + 60}]]"
}
if { [string range $html $i $i+1] eq "/>" } {
@@ -684,7 +684,7 @@
}
if { ![regexp -indices -start $i $exp $html match attr_value_idx] } {
# No end quote.
- set attr_value [string range $html [expr {$i+1}] end]
+ set attr_value [string range $html $i+1 end]
set i [string length $html]
} else {
set attr_value [string range $html [lindex $attr_value_idx 0] [lindex $attr_value_idx 1]]
@@ -849,7 +849,7 @@
for { set i [string first < $html] } { $i != -1 } { set i [string first < $html $i] } {
# append everything up to and not including the tag-opening <
- ad_html_to_text_put_text output [string range $html $last_tag_end [expr {$i - 1}]]
+ ad_html_to_text_put_text output [string range $html $last_tag_end $i-1]
# Check that:
# - we're not past the end of the string
@@ -891,7 +891,7 @@
set count 0
while 1 {
- if {[incr count] > 1000 } {
+ if {[incr count] > 3000 } {
# JCD: the programming bug is that an unmatched < in the input runs off forever looking for
# it's closing > and in some long text like program listings you can have lots of quotes
# before you find that >
@@ -941,7 +941,7 @@
incr i
}
- set full_tag [string range $html $tag_start [expr { $i - 1 }]]
+ set full_tag [string range $html $tag_start $i-1]
if { ![regexp {^(/?)([^\s]+)[\s]*(\s.*)?$} $full_tag match slash tagname attributes] } {
# A malformed tag -- just delete it
@@ -1283,9 +1283,9 @@
for { set i [string first & $html] } { $i != -1 } { set i [string first & $html $i] } {
set match_p 0
- switch -regexp -- [string index $html [expr {$i+1}]] {
+ switch -regexp -- [string index $html $i+1]] {
# {
- switch -regexp -- [string index $html [expr {$i+2}]] {
+ switch -regexp -- [string index $html $i+2] {
[xX] {
regexp -indices -start [expr {$i+3}] {[0-9a-fA-F]*} $html hex_idx
set hex [string range $html [lindex $hex_idx 0] [lindex $hex_idx 1]]
@@ -1307,7 +1307,7 @@
}
}
[a-zA-Z] {
- if { [regexp -indices -start [expr {$i}] {\A&([^\s;]+)} $html match entity_idx] } {
+ if { [regexp -indices -start $i {\A&([^\s;]+)} $html match entity_idx] } {
set entity [string tolower [string range $html [lindex $entity_idx 0] [lindex $entity_idx 1]]]
if { [info exists entities($entity)] } {
set html [string replace $html $i [lindex $match 1] $entities($entity)]
@@ -1378,7 +1378,7 @@
}
# OK, we have a last space pos of some sort
set real_index_of_space [expr {$start_of_line_index + $last_space_pos}]
- lappend result_rows [string range $input $start_of_line_index [expr {$real_index_of_space - 1}]]
+ lappend result_rows [string range $input $start_of_line_index $real_index_of_space-1]
set start_of_line_index [expr {$start_of_line_index + $last_space_pos + 1}]
}
}
@@ -1403,8 +1403,7 @@
# Validate procedure input
set from [ad_decode $from "html" "text/html" "text" "text/plain" "plain" "text/plain" $from]
set to [ad_decode $to "html" "text/html" "text" "text/plain" "plain" "text/plain" $to]
- return [expr {[lsearch $valid_froms $from] != -1 &&
- [lsearch $valid_tos $to] != -1}]
+ return [expr {$from in $valid_froms && $to in $valid_tos}]
}
ad_proc -public ad_html_text_convert {
@@ -1689,7 +1688,7 @@
} {
if { $len > 0 } {
if { [string length $string] > $len } {
- set end_index [expr $len-[string length $ellipsis]-1]
+ set end_index [expr {$len-[string length $ellipsis]-1}]
# Back up to the nearest whitespace
if { ![string is space [string index $string $end_index+1]] } {
@@ -1700,7 +1699,7 @@
# If that laves us with an empty string, then ignore whitespace and just truncate mid-word
if { $end_index == -1 } {
- set end_index [expr $len-[string length $ellipsis]-1]
+ set end_index [expr {$len-[string length $ellipsis]-1}]
}
# Chop off extra whitespace at the end