Skip to content
Tcl Source Code Artifact [d32acb3766]
Login

Artifact [d32acb3766]

Artifact d32acb376657a5523f15f59b950a7c2586a5302e:

Ticket change [d32acb3766] - Ticket [219210ffffffffff|219210ffff] <i>fcopy does not respect encodings</i> status still Open with 4 other changes by andreas_kupries on 2001-03-31 20:22:45.
D 2001-03-31T20:22:45
J icomment Logged\sIn:\sYES\s\nuser_id=75003\n\nThe\sfix\sfor\sthis\sreport\shas\sto\sbe\sdone\sin\s"tclIO.c",\n"CopyData",\swhich\ncurrently\suses\s"DoRead"\sand\s"DoWrite"\sfor\sreading\sfrom\sand\nwriting\sto\nthe\schannels\sinvolved\sin\sthe\scopying.\sExchanging\sthese\stwo\ncalls\nagainst\sstripped\sdown\sversions\sof\s"Tcl_ReadChars"\sand\n"Tcl_WriteChars"\nshould\sdo\sthe\strick.\s"Stripped\sdown"\smeans\shere\sthat\swe\shave\navoid\sthe\ncall\sto\s"CheckChannelErrors"\sin\sthese\stwo\sroutines\sas\sthis\nroutine\nflags\stheir\susage\sfor\sa\schannel\sused\sin\san\s"fcopy"\sas\san\nerror.\sI\nwould\spropose\sto\smove\sthe\smeat\sof\sthese\stwo\sroutines\sinto\ntwo\sinternal\nprocedures\s"DoReadChars"\sand\s"DoWriteChars"\swhich\sare\sthen\ncalled\sfrom\nthe\soriginal\sroutines.\sThe\soriginals\swould\sretain\sthe\serror\nchecking.\sAnd\s"CopyData"\scan\suse\sthe\sinternal\sprocedures\sto\nget\sits\nown\swork\sdone.\n\nNote\sthe\sfollowing\sconsequences\sof\sthe\schange:\n\n-\sThe\ssystem\swill\suse\sUTF-8\sinternally\swhen\scopying\sdata,\nmeaning\sthat\sit\swill\sconsume\smore\smemory,\sor\scopy\sless\sdata\nper\sbuffer.\n\n-\sPerformance\swill\sbe\saffected\snegatively\sbecause\sof\sthe\nadditional\sconversions\sto\sand\sfrom\sUTF-8.\s(Side\snote:\sDo\swe\nhave\sperformance\stests\sfor\s"fcopy"\sin\s"tclbench"\s?).\n\nThe\scode\sof\sthe\schannel\ssystem\suses\s'statePtr->encoding\s==\nNULL'\sas\nsignal\sthat\sthe\sencoding\sis\sbinary,\sand\sthe\stwo\s"Tcl_*Chars"\nprocedures\shave\sspecial\sprovisions\sfor\sthat\scase.\nUnfortunately\snot\nvery\sefficient\sas\sit\sinvolves\sByteArray\sobjects.\n\nI\swould\spropose\sthat\s"CopyData"\sshould\scheck\sfor\sbinary\ntranslation\son\n_both_\schannels\sand\sfall\sback\sto\sthe\sold\scode\sin\ssuch\sa\ncase.\sThis\nwould\savoid\squite\sa\slot\sof\sconversions\sand\scopying.\sWe\nshouldn't\sdo\nthis\sfor\sa\smixture\sof\sbinary\sand\snon-binary\sencodings\sas\swe\nstill\sneed\nan\sintermediate\sByteArray\sto\sget\sthe\sconversion\sright\sfor\nthese\scases,\ncausing\sadditional\scomplexity\sin\sthe\snew\scode.\sBetter\sto\nstay\swith\sthe\ntried\sand\strue\scode\sfor\sthat\sfor\snow.\n\n
J login andreas_kupries
J mimetype text/plain
J username andreas_kupries
K 219210ffffffffffffffffffffffffffffffffff
U andreas_kupries
Z 52b6f6b5f9b30d80406ad77fe42b63a4