1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178
|
Patch by Sergei Golovan (initially by Victor Wagner taken from
http://sourceforge.net/tracker/index.php?func=detail&aid=1011498&group_id=32692&atid=406308)
fixes -encoding and -eofchar of files opened on VFS.
Probably, the patch is incomplete for mk4fs with ::mk4vfs::zstreamed set to 1.
--- a/library/ftpvfs.tcl
+++ b/library/ftpvfs.tcl
@@ -133,10 +133,13 @@
ftp::Get $fd $name -variable tmp
set filed [vfs::memchan]
+ set encoding [fconfigure $filed -encoding]
+ set eofchar [fconfigure $filed -eofchar]
+ set translation [fconfigure $filed -translation]
fconfigure $filed -translation binary
puts -nonewline $filed $tmp
- fconfigure $filed -translation auto
+ fconfigure $filed -translation $translation -encoding $encoding -eofchar $eofchar
seek $filed 0
return [list $filed]
}
--- a/library/httpvfs.tcl
+++ b/library/httpvfs.tcl
@@ -357,11 +357,14 @@
"r" {
set token [geturl "$dirurl$urlname" -headers $headers]
set filed [vfs::memchan]
+ set encoding [fconfigure $filed -encoding]
+ set eofchar [fconfigure $filed -eofchar]
+ set translation [fconfigure $filed -translation]
fconfigure $filed -translation binary
puts -nonewline $filed [::http::data $token]
http::cleanup $token
- fconfigure $filed -translation auto
+ fconfigure $filed -translation $translation -encoding $encoding -eofchar $eofchar
seek $filed 0
# XXX: the close command should free vfs::memchan somehow??
return [list $filed]
--- a/library/tclprocvfs.tcl
+++ b/library/tclprocvfs.tcl
@@ -84,9 +84,12 @@
"" -
"r" {
set nfd [vfs::memchan]
+ set encoding [fconfigure $nfd -encoding]
+ set eofchar [fconfigure $nfd -eofchar]
+ set translation [fconfigure $nfd -translation]
fconfigure $nfd -translation binary
puts -nonewline $nfd [_generate ::${ns}::${name}]
- fconfigure $nfd -translation auto
+ fconfigure $nfd -translation $translation -encoding $encoding -eofchar $eofchar
seek $nfd 0
return [list $nfd]
}
--- a/library/webdavvfs.tcl
+++ b/library/webdavvfs.tcl
@@ -153,8 +153,12 @@
upvar #0 $token state
set filed [vfs::memchan]
+ set encoding [fconfigure $filed -encoding]
+ set eofchar [fconfigure $filed -eofchar]
+ set translation [fconfigure $filed -translation]
fconfigure $filed -encoding binary -translation binary
puts -nonewline $filed [::http::data $token]
+ fconfigure $filed -translation $translation -encoding $encoding -eofchar $eofchar
seek $filed 0
::http::cleanup $token
return [list $filed]
--- a/library/tkvfs.tcl
+++ b/library/tkvfs.tcl
@@ -72,9 +72,12 @@
"" -
"r" {
set nfd [vfs::memchan]
+ set encoding [fconfigure $nfd -encoding]
+ set eofchar [fconfigure $nfd -eofchar]
+ set translation [fconfigure $nfd -translation]
fconfigure $nfd -translation binary
puts -nonewline $nfd [_generate ${widg}.${name}]
- fconfigure $nfd -translation auto
+ fconfigure $nfd -translation $translation -encoding $encoding -eofchar $eofchar
seek $nfd 0
return [list $nfd]
}
--- a/library/tarvfs.tcl
+++ b/library/tarvfs.tcl
@@ -106,6 +106,9 @@
vfs::tar::_stat $tarfd $name sb
set nfd [vfs::memchan]
+ set encoding [fconfigure $nfd -encoding]
+ set eofchar [fconfigure $nfd -eofchar]
+ set translation [fconfigure $nfd -translation]
fconfigure $nfd -translation binary
# get the starting point from structure
@@ -114,7 +117,7 @@
puts -nonewline $nfd $data
- fconfigure $nfd -translation auto
+ fconfigure $nfd -translation $translation -encoding $encoding -eofchar $eofchar
seek $nfd 0
return [list $nfd]
}
--- a/library/zipvfs.tcl
+++ b/library/zipvfs.tcl
@@ -154,13 +154,16 @@
return [list $nfd]
} else {
set nfd [vfs::memchan]
+ set encoding [fconfigure $nfd -encoding]
+ set eofchar [fconfigure $nfd -eofchar]
+ set translation [fconfigure $nfd -translation]
fconfigure $nfd -translation binary
set data [zip::Data $zipfd sb 0]
puts -nonewline $nfd $data
- fconfigure $nfd -translation auto
+ fconfigure $nfd -translation $translation -encoding $encoding -eofchar $eofchar
seek $nfd 0
return [list $nfd]
}
--- a/library/mk4vfs.tcl
+++ b/library/mk4vfs.tcl
@@ -171,19 +171,25 @@
set fd [vfs::zstream decompress $fd $sb(csize) $sb(size)]
} else {
set fd [vfs::memchan]
+ set encoding [fconfigure $fd -encoding]
+ set eofchar [fconfigure $fd -eofchar]
+ set translation [fconfigure $fd -translation]
fconfigure $fd -translation binary
set s [mk::get $sb(ino) contents]
puts -nonewline $fd [vfs::zip -mode decompress $s]
- fconfigure $fd -translation auto
+ fconfigure $fd -translation $translation -encoding $encoding -eofchar $eofchar
seek $fd 0
}
} elseif { $::mk4vfs::direct } {
set fd [vfs::memchan]
+ set encoding [fconfigure $fd -encoding]
+ set eofchar [fconfigure $fd -eofchar]
+ set translation [fconfigure $fd -translation]
fconfigure $fd -translation binary
puts -nonewline $fd [mk::get $sb(ino) contents]
- fconfigure $fd -translation auto
+ fconfigure $fd -translation $translation -encoding $encoding -eofchar $eofchar
seek $fd 0
} else {
set fd [mk::channel $sb(ino) contents r]
@@ -214,6 +220,9 @@
}
set fd [vfs::memchan]
+ set encoding [fconfigure $fd -encoding]
+ set eofchar [fconfigure $fd -eofchar]
+ set translation [fconfigure $fd -translation]
fconfigure $fd -translation binary
set s [mk::get $sb(ino) contents]
@@ -225,7 +234,7 @@
puts -nonewline $fd $s
#set fd [mk::channel $sb(ino) contents a]
}
- fconfigure $fd -translation auto
+ fconfigure $fd -translation $translation -encoding $encoding -eofchar $eofchar
seek $fd 0 end
return [list $fd [list mk4vfs::do_close $db $fd $mode $sb(ino)]]
}
|