Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch tip633-tcl9-fconfigure-strictencoding Excluding Merge-Ins
This is equivalent to a diff from 20347a792f to 74abec9977
2022-10-09
| ||
16:16 | Merge 8.7 check-in: e37e9b9a2b user: jan.nijtmans tags: trunk, main | |
2022-10-08
| ||
17:17 | Merge 9.0 Closed-Leaf check-in: 74abec9977 user: jan.nijtmans tags: tip633-tcl9-fconfigure-strictencoding | |
17:02 | Merge 8.7 check-in: 20347a792f user: jan.nijtmans tags: trunk, main | |
17:01 | TIP #346 bugfix: -strictencoding should be resetable too check-in: 1b80921f3b user: jan.nijtmans tags: core-8-branch | |
16:44 | Merge 9.0 check-in: f34a14695a user: jan.nijtmans tags: tip633-tcl9-fconfigure-strictencoding | |
15:43 | Merge 8.7 check-in: 58f6cbaca1 user: jan.nijtmans tags: trunk, main | |
Changes to generic/tclIO.c.
︙ | |||
4356 4357 4358 4359 4360 4361 4362 | 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 | - + + + + + | int encodingError = 0; if (srcLen) { WillWrite(chanPtr); } /* |
︙ | |||
4403 4404 4405 4406 4407 4408 4409 | 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 | - + | memcpy(InsertPoint(bufPtr), safe, saved); bufPtr->nextAdded += saved; saved = 0; } dst = InsertPoint(bufPtr); dstLen = SpaceLeft(bufPtr); |
︙ | |||
4683 4684 4685 4686 4687 4688 4689 | 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 | - + + + + | */ if (encoding == NULL) { encoding = GetBinaryEncoding(); } /* |
︙ | |||
5451 5452 5453 5454 5455 5456 5457 | 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 | - + + + + | spaceLeft = length - offset; dst = objPtr->bytes + offset; *gsPtr->dstPtr = dst; } gsPtr->state = statePtr->inputEncodingState; /* |
︙ | |||
6234 6235 6236 6237 6238 6239 6240 | 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 | - + + + + | dst = TclGetStringStorage(objPtr, &size) + numBytes; dstLimit = size - numBytes; } else { dst = TclGetString(objPtr) + numBytes; } /* |
︙ | |||
7972 7973 7974 7975 7976 7977 7978 7979 7980 7981 7982 7983 7984 7985 | 7985 7986 7987 7988 7989 7990 7991 7992 7993 7994 7995 7996 7997 7998 7999 8000 8001 8002 8003 8004 8005 8006 8007 8008 | + + + + + + + + + + | if (((flags & (TCL_READABLE|TCL_WRITABLE)) == (TCL_READABLE|TCL_WRITABLE)) && (len == 0)) { Tcl_DStringEndSublist(dsPtr); } if (len > 0) { return TCL_OK; } } if (len == 0 || HaveOpt(1, "-nocomplainencoding")) { if (len == 0) { Tcl_DStringAppendElement(dsPtr, "-nocomplainencoding"); } Tcl_DStringAppendElement(dsPtr, (flags & CHANNEL_ENCODING_NOCOMPLAIN) ? "1" : "0"); if (len > 0) { return TCL_OK; } } if (len == 0 || HaveOpt(1, "-strictencoding")) { if (len == 0) { Tcl_DStringAppendElement(dsPtr, "-strictencoding"); } Tcl_DStringAppendElement(dsPtr, (flags & CHANNEL_ENCODING_STRICT) ? "1" : "0"); |
︙ | |||
8245 8246 8247 8248 8249 8250 8251 8252 8253 8254 8255 8256 8257 8258 8259 8260 8261 8262 8263 8264 8265 8266 | 8268 8269 8270 8271 8272 8273 8274 8275 8276 8277 8278 8279 8280 8281 8282 8283 8284 8285 8286 8287 8288 8289 8290 8291 8292 8293 8294 8295 8296 8297 8298 8299 8300 8301 8302 8303 8304 8305 8306 8307 8308 8309 8310 8311 8312 8313 8314 8315 8316 8317 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + | */ if (GotFlag(statePtr, CHANNEL_EOF)) { statePtr->inputEncodingFlags |= TCL_ENCODING_START; } ResetFlag(statePtr, CHANNEL_EOF|CHANNEL_STICKY_EOF|CHANNEL_BLOCKED); statePtr->inputEncodingFlags &= ~TCL_ENCODING_END; return TCL_OK; } else if (HaveOpt(1, "-nocomplainencoding")) { int newMode; if (Tcl_GetBoolean(interp, newValue, &newMode) == TCL_ERROR) { return TCL_ERROR; } if (newMode) { if (GotFlag(statePtr, CHANNEL_ENCODING_STRICT)) { if (interp) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "-nocomplainencoding cannot be used with -strictencoding", -1)); } return TCL_ERROR; } SetFlag(statePtr, CHANNEL_ENCODING_NOCOMPLAIN); } else { ResetFlag(statePtr, CHANNEL_ENCODING_NOCOMPLAIN); } return TCL_OK; } else if (HaveOpt(1, "-strictencoding")) { int newMode; if (Tcl_GetBoolean(interp, newValue, &newMode) == TCL_ERROR) { return TCL_ERROR; } if (newMode) { if (GotFlag(statePtr, CHANNEL_ENCODING_NOCOMPLAIN)) { if (interp) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "-strictencoding cannot be used with -nocomplainencoding", -1)); } return TCL_ERROR; } SetFlag(statePtr, CHANNEL_ENCODING_STRICT); } else { ResetFlag(statePtr, CHANNEL_ENCODING_STRICT); } return TCL_OK; } else if (HaveOpt(1, "-translation")) { const char *readMode, *writeMode; |
︙ |
Changes to generic/tclIO.h.
︙ | |||
269 270 271 272 273 274 275 276 277 278 279 280 281 282 | 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 | + + | * to get a complete character. When * set, file events will not be * delivered for buffered data until * the state of the channel * changes. */ #define CHANNEL_RAW_MODE (1<<16) /* When set, notes that the Raw API is * being used. */ #define CHANNEL_ENCODING_NOCOMPLAIN (1<<17) /* set if option * -nocomplainencoding is set to 1 */ #define CHANNEL_ENCODING_STRICT (1<<18) /* set if option * -strictencoding is set to 1 */ #define CHANNEL_INCLOSE (1<<19) /* Channel is currently being closed. * Its structures are still live and * usable, but it may not be closed * again from within the close * handler. */ |
︙ |
Changes to tests/io.test.
︙ | |||
8948 8949 8950 8951 8952 8953 8954 | 8948 8949 8950 8951 8952 8953 8954 8955 8956 8957 8958 8959 8960 8961 8962 8963 8964 8965 8966 8967 8968 8969 8970 8971 8972 8973 8974 8975 8976 8977 8978 8979 8980 8981 8982 8983 8984 8985 8986 8987 8988 8989 8990 8991 8992 8993 8994 8995 8996 8997 8998 8999 9000 9001 9002 9003 9004 9005 9006 9007 9008 9009 9010 9011 9012 9013 9014 9015 9016 9017 9018 9019 9020 9021 9022 9023 9024 9025 9026 9027 9028 9029 9030 9031 9032 9033 9034 9035 9036 9037 9038 9039 9040 9041 9042 9043 9044 9045 9046 9047 9048 9049 9050 9051 9052 9053 | + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | read [teststringobj get 2] } -cleanup { interp delete child testobj freeallvars removeFile io-74.1 } -returnCodes error -match glob -result {can not find channel named "*"} test io-75.1 {multibyte encoding error read results in raw bytes (-nocomplainencoding 1)} -setup { set fn [makeFile {} io-75.1] set f [open $fn w+] fconfigure $f -encoding binary # In UTF-8, a byte 0xCx starts a multibyte sequence and must be followed # by a byte > 0x7F. This is violated to get an invalid sequence. puts -nonewline $f "A\xC0\x40" flush $f seek $f 0 fconfigure $f -encoding utf-8 -nocomplainencoding 1 -buffering none } -body { set d [read $f] binary scan $d H* hd set hd } -cleanup { close $f removeFile io-75.1 } -result "41c040" |
︙ |
Changes to tests/ioCmd.test.
︙ | |||
241 242 243 244 245 246 247 | 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | - + - + - + | file delete $path(test1) } -body { set f1 [open $path(test1) w] fconfigure $f1 -translation lf -eofchar {} -encoding utf-16 fconfigure $f1 } -cleanup { catch {close $f1} |
︙ | |||
1359 1360 1361 1362 1363 1364 1365 | 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 | - + - + - + | set res {} proc foo {args} {oninit; onfinal; track; note MUST_NOT_HAPPEN; return} set c [chan create {r w} foo] note [fconfigure $c] close $c rename foo {} set res |
︙ |
Changes to tests/socket.test.
︙ | |||
1067 1068 1069 1070 1071 1072 1073 | 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 | - + | } -result {3 1 0} test socket_$af-7.3 {testing socket specific options} -constraints [list socket supported_$af] -body { set s [socket -server accept -myaddr $localhost 0] set l [fconfigure $s] close $s update llength $l |
︙ |
Changes to tests/zlib.test.
︙ | |||
288 289 290 291 292 293 294 | 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 | - + - + | set fd [open $file wb] } -constraints zlib -body { list [fconfigure $fd] [zlib push compress $fd; fconfigure $fd] \ [chan pop $fd; fconfigure $fd] } -cleanup { catch {close $fd} removeFile $file |
︙ |