Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Put explicit byte-narrowing in the write pipeline of -encoding binary channels. This makes tests pass again. I don't much like it. It makes "-encoding binary" something different from "-encoding iso8859-1 -eofchar {} -translation lf" without a known good reason. Seems it would fit in better with other encodings if chars outside the supported set transformed in "?" instead. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | dgp-properbytearray |
Files: | files | file ages | folders |
SHA1: |
236f5e4f11800a089846f9a8809a04a3 |
User & Date: | dgp 2016-12-07 19:52:37 |
Context
2016-12-07
| ||
20:01 | Enable the no-copy path through narrowing that was overlooked. check-in: 617acf8eb6 user: dgp tags: dgp-properbytearray | |
19:52 | Put explicit byte-narrowing in the write pipeline of -encoding binary channels. This makes tests pas... check-in: 236f5e4f11 user: dgp tags: dgp-properbytearray | |
19:22 | Make explicit the implicit byte-narrowing function of [binary format]. check-in: 56ac0f8998 user: dgp tags: dgp-properbytearray | |
Changes
Changes to generic/tclIO.c.
︙ | ︙ | |||
4074 4075 4076 4077 4078 4079 4080 | * buffer. */ int len) /* Length of string in bytes, or < 0 for * strlen(). */ { Channel *chanPtr = (Channel *) chan; ChannelState *statePtr = chanPtr->state; /* State info for channel */ int result; | | | 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 | * buffer. */ int len) /* Length of string in bytes, or < 0 for * strlen(). */ { Channel *chanPtr = (Channel *) chan; ChannelState *statePtr = chanPtr->state; /* State info for channel */ int result; Tcl_Obj *objPtr, *copy; if (CheckChannelErrors(statePtr, TCL_WRITABLE) != 0) { return -1; } chanPtr = statePtr->topChanPtr; |
︙ | ︙ | |||
4101 4102 4103 4104 4105 4106 4107 | */ if ((len == 1) && (UCHAR(*src) < 0xC0)) { return WriteBytes(chanPtr, src, len); } objPtr = Tcl_NewStringObj(src, len); | > | > | | 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 | */ if ((len == 1) && (UCHAR(*src) < 0xC0)) { return WriteBytes(chanPtr, src, len); } objPtr = Tcl_NewStringObj(src, len); copy = TclNarrowToBytes(objPtr); src = (char *) Tcl_GetByteArrayFromObj(copy, &len); TclDecrRefCount(objPtr); result = WriteBytes(chanPtr, src, len); TclDecrRefCount(copy); return result; } /* *--------------------------------------------------------------------------- * * Tcl_WriteObj -- |
︙ | ︙ | |||
4153 4154 4155 4156 4157 4158 4159 | statePtr = ((Channel *) chan)->state; chanPtr = statePtr->topChanPtr; if (CheckChannelErrors(statePtr, TCL_WRITABLE) != 0) { return -1; } if (statePtr->encoding == NULL) { | > > > | | > > | 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 | statePtr = ((Channel *) chan)->state; chanPtr = statePtr->topChanPtr; if (CheckChannelErrors(statePtr, TCL_WRITABLE) != 0) { return -1; } if (statePtr->encoding == NULL) { int result; Tcl_Obj *copy = TclNarrowToBytes(objPtr); src = (char *) Tcl_GetByteArrayFromObj(copy, &srcLen); result = WriteBytes(chanPtr, src, srcLen); Tcl_DecrRefCount(copy); return result; } else { src = TclGetStringFromObj(objPtr, &srcLen); return WriteChars(chanPtr, src, srcLen); } } static void |
︙ | ︙ |