Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch tip-657 Through [da536b9803] Excluding Merge-Ins
This is equivalent to a diff from cbdec07524 to da536b9803
|
2024-08-16
| ||
| 21:13 | Fix dulicate test name. check-in: a146dfa1b9 user: pooryorick tags: unchained, INCOMPATIBLE_LICENSE | |
|
2023-07-19
| ||
| 08:59 | Merge 9.0 check-in: 331a94f0b8 user: jan.nijtmans tags: tip-657 | |
|
2023-07-14
| ||
| 14:51 | First attempt to mix TIP's #657 and #671 check-in: 77d9664918 user: jan.nijtmans tags: tip-671 | |
| 14:18 | dup test name check-in: 5225dfe40c user: dgp tags: trunk, main | |
| 13:36 | merge trunk check-in: 1514cf37c0 user: dgp tags: dgp-refactor | |
| 13:29 | merge trunk check-in: 16bb98397c user: dgp tags: core-9-0-b1-rc | |
| 13:28 | merge trunk check-in: e20451ce48 user: dgp tags: novem | |
| 11:13 | Use "strict" in almost all commands. Only "glob" and environment variables are left out. (Experiment... check-in: da536b9803 user: jan.nijtmans tags: tip-657 | |
| 06:31 | Rebase to 9.0 check-in: 0a52caf686 user: jan.nijtmans tags: tip-657 | |
| 06:28 | Merge 8.7 check-in: cbdec07524 user: jan.nijtmans tags: trunk, main | |
|
2023-07-13
| ||
| 17:19 | Correct wording in Comment check-in: 7136462c76 user: oehhar tags: core-8-branch | |
| 16:23 | Merge 8.7 check-in: 528716921f user: jan.nijtmans tags: trunk, main | |
Changes to doc/Encoding.3.
| ︙ | |||
101 102 103 104 105 106 107 | 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | - - - + + + | converted. \fBTCL_ENCODING_END\fR signifies that the source buffer is the last block in a (potentially multi-block) input stream, telling the conversion routine to perform any finalization that needs to occur after the last byte is converted and then to reset to an initial state. The \fBTCL_PROFILE_*\fR bits defined in the \fBPROFILES\fR section below control the encoding profile to be used for dealing with invalid data or other errors in the encoding transform. |
| ︙ | |||
586 587 588 589 590 591 592 | 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 | - + | Encoding profiles define the manner in which errors in the encoding transforms are handled by the encoding functions. An application can specify the profile to be used by OR-ing the \fBflags\fR parameter passed to the function with at most one of \fBTCL_ENCODING_PROFILE_TCL8\fR, \fBTCL_ENCODING_PROFILE_STRICT\fR or \fBTCL_ENCODING_PROFILE_REPLACE\fR. These correspond to the \fBtcl8\fR, \fBstrict\fR and \fBreplace\fR profiles respectively. If none are specified, a version-dependent default profile is used. |
Changes to doc/chan.n.
| ︙ | |||
196 197 198 199 200 201 202 | 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | - - - + + + - | platform-specific representation: For all Unix variants it is \fBlf\fR, and for all Windows variants it is \fBcrlf\fR, except that for sockets on all platforms it is \fBcrlf\fR for both input and output. .TP \fBbinary\fR . Like \fBlf\fR, no end-of-line translation is performed, but in addition, sets |
| ︙ |
Changes to doc/encoding.n.
| ︙ | |||
107 108 109 110 111 112 113 114 115 | 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 | + + + + + - + - - - - | .VS "TCL8.7 TIP656" Each \fIprofile\fR is a distinct strategy for dealing with invalid data for an encoding. .PP The following profiles are currently implemented. .VS "TCL8.7 TIP656" .TP \fBstrict\fR . The default profile. The operation fails when invalid data for the encoding are encountered. .TP \fBtcl8\fR . |
| ︙ | |||
176 177 178 179 180 181 182 | 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | - + - + | % codepoints [encoding convertfrom -profile strict ascii A\ex80] unexpected byte sequence starting at index 1: '\ex80' .CE .PP Example 3: Get partial data and the error location: .PP .CS |
Changes to generic/tcl.h.
| ︙ | |||
2011 2012 2013 2014 2015 2016 2017 | 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 | - - - + + + - - - - - | /* Internal use bits, do not define bits in this space. See above comment */ #define TCL_ENCODING_INTERNAL_USE_MASK 0xFF00 /* * Reserve top byte for profile values (disjoint, not a mask). In case of * changes, ensure ENCODING_PROFILE_* macros in tclInt.h are modified if * necessary. */ |
| ︙ |
Changes to generic/tclCmdAH.c.
| ︙ | |||
430 431 432 433 434 435 436 | 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 | - + |
)
{
static const char *const options[] = {"-profile", "-failindex", NULL};
enum convertfromOptions { PROFILE, FAILINDEX } optIndex;
Tcl_Encoding encoding;
Tcl_Obj *dataObj;
Tcl_Obj *failVarObj;
|
| ︙ |
Changes to generic/tclEncoding.c.
| ︙ | |||
196 197 198 199 200 201 202 | 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | - - + + - - - + + - - + - - |
int value;
} encodingProfiles[] = {
{"replace", TCL_ENCODING_PROFILE_REPLACE},
{"strict", TCL_ENCODING_PROFILE_STRICT},
{"tcl8", TCL_ENCODING_PROFILE_TCL8},
};
#define PROFILE_TCL8(flags_) \
|
| ︙ | |||
1167 1168 1169 1170 1171 1172 1173 | 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 | - - - - |
*
* Convert a source buffer from the specified encoding into UTF-8.
* "flags" controls the behavior if any of the bytes in
* the source buffer are invalid or cannot be represented in utf-8.
* Possible flags values:
* target encoding. It should be composed by OR-ing the following:
* - *At most one* of TCL_ENCODING_PROFILE{DEFAULT,TCL8,STRICT}
|
| ︙ | |||
1497 1498 1499 1500 1501 1502 1503 | 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 | - - |
* Tcl_UtfToExternalDStringEx --
*
* Convert a source buffer from UTF-8 to the specified encoding.
* The parameter flags controls the behavior, if any of the bytes in
* the source buffer are invalid or cannot be represented in the
* target encoding. It should be composed by OR-ing the following:
* - *At most one* of TCL_ENCODING_PROFILE{DEFAULT,TCL8,STRICT}
|
| ︙ | |||
2448 2449 2450 2451 2452 2453 2454 | 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 | - |
int result;
result = TCL_OK;
dstLen -= TCL_UTF_MAX - 1;
if (dstLen < 0) {
dstLen = 0;
}
|
| ︙ | |||
2516 2517 2518 2519 2520 2521 2522 | 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 | - |
int profile;
result = TCL_OK;
srcStart = src;
srcEnd = src + srcLen;
srcClose = srcEnd;
|
| ︙ | |||
2745 2746 2747 2748 2749 2750 2751 | 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 | - |
* output buffer. */
{
const char *srcStart, *srcEnd;
const char *dstEnd, *dstStart;
int result, numChars, charLimit = INT_MAX;
int ch = 0, bytesLeft = srcLen % 4;
|
| ︙ | |||
2925 2926 2927 2928 2929 2930 2931 | 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 | - |
const char *srcStart, *srcEnd, *srcClose, *dstStart, *dstEnd;
int result, numChars;
int ch, len;
srcStart = src;
srcEnd = src + srcLen;
srcClose = srcEnd;
|
| ︙ | |||
3023 3024 3025 3026 3027 3028 3029 | 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 | - |
* output buffer. */
{
const char *srcStart, *srcEnd;
const char *dstEnd, *dstStart;
int result, numChars, charLimit = INT_MAX;
unsigned short ch = 0;
|
| ︙ | |||
3213 3214 3215 3216 3217 3218 3219 | 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 | - |
const char *srcStart, *srcEnd, *srcClose, *dstStart, *dstEnd;
int result, numChars;
int ch, len;
srcStart = src;
srcEnd = src + srcLen;
srcClose = srcEnd;
|
| ︙ | |||
3319 3320 3321 3322 3323 3324 3325 | 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 | - |
* correspond to the bytes stored in the
* output buffer. */
{
const char *srcStart, *srcEnd, *srcClose, *dstStart, *dstEnd;
int result, numChars, len;
Tcl_UniChar ch = 0;
|
| ︙ | |||
3442 3443 3444 3445 3446 3447 3448 | 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 | - |
const char *dstEnd, *dstStart, *prefixBytes;
int result, byte, numChars, charLimit = INT_MAX;
Tcl_UniChar ch = 0;
const unsigned short *const *toUnicode;
const unsigned short *pageZero;
TableEncodingData *dataPtr = (TableEncodingData *)clientData;
|
| ︙ | |||
3584 3585 3586 3587 3588 3589 3590 | 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 | - |
prefixBytes = dataPtr->prefixBytes;
fromUnicode = (const unsigned short *const *) dataPtr->fromUnicode;
srcStart = src;
srcEnd = src + srcLen;
srcClose = srcEnd;
|
| ︙ | |||
3691 3692 3693 3694 3695 3696 3697 | 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 | - |
* correspond to the bytes stored in the
* output buffer. */
{
const char *srcStart, *srcEnd;
const char *dstEnd, *dstStart;
int result, numChars, charLimit = INT_MAX;
|
| ︙ | |||
3785 3786 3787 3788 3789 3790 3791 | 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 | - |
const char *dstStart, *dstEnd;
int result = TCL_OK, numChars;
Tcl_UniChar ch = 0;
srcStart = src;
srcEnd = src + srcLen;
srcClose = srcEnd;
|
| ︙ | |||
3933 3934 3935 3936 3937 3938 3939 | 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 | - |
EscapeEncodingData *dataPtr = (EscapeEncodingData *)clientData;
const char *prefixBytes, *tablePrefixBytes, *srcStart, *srcEnd;
const unsigned short *const *tableToUnicode;
const Encoding *encodingPtr;
int state, result, numChars, charLimit = INT_MAX;
const char *dstStart, *dstEnd;
|
| ︙ | |||
4163 4164 4165 4166 4167 4168 4169 | 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 | - |
Tcl_UniChar ch = 0;
result = TCL_OK;
srcStart = src;
srcEnd = src + srcLen;
srcClose = srcEnd;
|
| ︙ | |||
4608 4609 4610 4611 4612 4613 4614 | 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
"Internal error. Bad profile id \"%d\".",
profileValue));
Tcl_SetErrorCode(
interp, "TCL", "ENCODING", "PROFILEID", NULL);
}
return NULL;
}
|
| ︙ |
Changes to generic/tclIO.c.
| ︙ | |||
1676 1677 1678 1679 1680 1681 1682 | 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 | - - - - |
* interpretation that Tcl_Channels give to the "-encoding binary" option.
*/
name = Tcl_GetEncodingName(NULL);
statePtr->encoding = Tcl_GetEncoding(NULL, name);
statePtr->inputEncodingState = NULL;
statePtr->inputEncodingFlags = TCL_ENCODING_START;
|
| ︙ | |||
8163 8164 8165 8166 8167 8168 8169 | 8159 8160 8161 8162 8163 8164 8165 8166 8167 8168 8169 8170 8171 8172 | - - - - - - |
return TCL_OK;
} else if (HaveOpt(2, "-encoding")) {
Tcl_Encoding encoding;
int profile;
if ((newValue[0] == '\0') || (strcmp(newValue, "binary") == 0)) {
encoding = Tcl_GetEncoding(NULL, "iso8859-1");
|
| ︙ | |||
8277 8278 8279 8280 8281 8282 8283 | 8267 8268 8269 8270 8271 8272 8273 8274 8275 8276 8277 8278 8279 8280 | - - - - - - |
} else if (strcmp(readMode, "auto") == 0) {
translation = TCL_TRANSLATE_AUTO;
} else if (strcmp(readMode, "binary") == 0) {
translation = TCL_TRANSLATE_LF;
statePtr->inEofChar = 0;
Tcl_FreeEncoding(statePtr->encoding);
statePtr->encoding = Tcl_GetEncoding(NULL, "iso8859-1");
|
| ︙ | |||
8332 8333 8334 8335 8336 8337 8338 | 8316 8317 8318 8319 8320 8321 8322 8323 8324 8325 8326 8327 8328 8329 | - - - - - - |
} else {
statePtr->outputTranslation = TCL_PLATFORM_TRANSLATION;
}
} else if (strcmp(writeMode, "binary") == 0) {
statePtr->outputTranslation = TCL_TRANSLATE_LF;
Tcl_FreeEncoding(statePtr->encoding);
statePtr->encoding = Tcl_GetEncoding(NULL, "iso8859-1");
|
| ︙ |
Changes to generic/tclIOSock.c.
| ︙ | |||
71 72 73 74 75 76 77 | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | - + + + + + |
const char *native;
if (Tcl_GetInt(NULL, string, portPtr) != TCL_OK) {
/*
* Don't bother translating 'proto' to native.
*/
|
| ︙ | |||
180 181 182 183 184 185 186 | 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | - + + + + + |
struct addrinfo *v6head = NULL, *v6ptr = NULL;
char *native = NULL, portbuf[TCL_INTEGER_SPACE], *portstring;
const char *family = NULL;
Tcl_DString ds;
int result;
if (host != NULL) {
|
| ︙ |
Changes to generic/tclInt.h.
| ︙ | |||
3031 3032 3033 3034 3035 3036 3037 | 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 | - | MODULE_SCOPE Tcl_Encoding tclIdentityEncoding; MODULE_SCOPE int TclEncodingProfileNameToId(Tcl_Interp *interp, const char *profileName, int *profilePtr); MODULE_SCOPE const char *TclEncodingProfileIdToName(Tcl_Interp *interp, int profileId); |
| ︙ |
Changes to generic/tclZipfs.c.
| ︙ | |||
2537 2538 2539 2540 2541 2542 2543 | 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 | - + + + + + |
}
/*
* Convert to encoded form. Note that we use strlen() here; if someone's
* crazy enough to embed NULs in filenames, they deserve what they get!
*/
|
| ︙ | |||
3206 3207 3208 3209 3210 3211 3212 | 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 | - + + + + + |
hPtr = Tcl_FindHashEntry(&fileHash, name);
if (!hPtr) {
continue;
}
z = (ZipEntry *) Tcl_GetHashValue(hPtr);
|
| ︙ |
Changes to library/http/http.tcl.
| ︙ | |||
1743 1744 1745 1746 1747 1748 1749 | 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 | - + |
set delay [expr {[clock milliseconds] - $pre}]
if {$delay > 3000} {
Log socket delay $delay - token $token
}
fconfigure $sock -translation {auto crlf} \
-buffersize $state(-blocksize)
if {[package vsatisfies [package provide Tcl] 9.0-]} {
|
| ︙ | |||
2164 2165 2166 2167 2168 2169 2170 | 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 | - + |
# Send data in cr-lf format, but accept any line terminators.
# Initialisation to {auto *} now done in geturl, KeepSocket and DoneRequest.
# We are concerned here with the request (write) not the response (read).
lassign [fconfigure $sock -translation] trRead trWrite
fconfigure $sock -translation [list $trRead crlf] \
-buffersize $state(-blocksize)
if {[package vsatisfies [package provide Tcl] 9.0-]} {
|
| ︙ | |||
2557 2558 2559 2560 2561 2562 2563 | 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 | - + |
set sock $state(sock)
#Log ---- $state(socketinfo) >> conn to $token for HTTP response
lassign [fconfigure $sock -translation] trRead trWrite
fconfigure $sock -translation [list auto $trWrite] \
-buffersize $state(-blocksize)
if {[package vsatisfies [package provide Tcl] 9.0-]} {
|
| ︙ | |||
4551 4552 4553 4554 4555 4556 4557 | 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 | - + |
# correctly. iso8859-1 is the RFC default, but this could be any
# IANA charset. However, we only know how to convert what we have
# encodings for.
set enc [CharsetToEncoding $state(charset)]
if {$enc ne "binary"} {
if {[package vsatisfies [package provide Tcl] 9.0-]} {
|
| ︙ | |||
4638 4639 4640 4641 4642 4643 4644 | 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 | - + |
}
}
set enc [CharsetToEncoding $res]
if {$enc eq "binary"} {
return 0
}
if {[package vsatisfies [package provide Tcl] 9.0-]} {
|
| ︙ | |||
4723 4724 4725 4726 4727 4728 4729 | 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 | - + |
variable formMap
# The spec says: "non-alphanumeric characters are replaced by '%HH'". Use
# a pre-computed map and [string map] to do the conversion (much faster
# than [regsub]/[subst]). [Bug 1020491]
if {[package vsatisfies [package provide Tcl] 9.0-]} {
|
| ︙ |
Changes to tests/encoding.test.
| ︙ | |||
573 574 575 576 577 578 579 | 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 | - + |
test encoding-16.22 {Utf16ToUtfProc, strict, bug [db7a085bd9]} -body {
encoding convertfrom -profile strict utf-16le \x00\xD8
} -returnCodes 1 -result {unexpected byte sequence starting at index 0: '\x00'}
test encoding-16.23 {Utf16ToUtfProc, strict, bug [db7a085bd9]} -body {
encoding convertfrom -profile strict utf-16le \x00\xDC
} -returnCodes 1 -result {unexpected byte sequence starting at index 0: '\x00'}
test encoding-16.24 {Utf32ToUtfProc} -body {
|
| ︙ |
Changes to tests/encodingVectors.tcl.
1 2 3 4 5 6 7 8 9 10 11 12 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | - + |
# This file contains test vectors for verifying various encodings. They are
# stored in a common file so that they can be sourced into the various test
# modules that are dependent on encodings. This file contains statically defined
# test vectors. In addition, it sources the ICU-generated test vectors from
# icuUcmTests.tcl.
#
# Note that sourcing the file will reinitialize any existing encoding test
# vectors.
#
# List of defined encoding profiles
set encProfiles {tcl8 strict replace}
|
| ︙ |
Changes to tests/ioCmd.test.
| ︙ | |||
236 237 238 239 240 241 242 | 236 237 238 239 240 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 | - + - + - + - + |
test iocmd-8.6 {fconfigure command} -returnCodes error -body {
fconfigure stdin -translation froboz
} -result {bad value for -translation: must be one of auto, binary, cr, lf, crlf, or platform}
test iocmd-8.7 {fconfigure command} -setup {
file delete $path(test1)
} -body {
set f1 [open $path(test1) w]
|
| ︙ |
Changes to tests/utfext.test.
| ︙ | |||
72 73 74 75 76 77 78 | 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | - - - + + + |
# Another bug - char limit not obeyed
# % set cv 2
# % testencoding Tcl_ExternalToUtf utf-8 abcdefgh {start end noterminate charlimit} {} 20 rv wv cv
# nospace {} abcÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
test TableToUtf-bug-5be203d6ca {Bug 5be203d6ca - truncated prefix in table encoding} -body {
set src \x82\x4F\x82\x50\x82
|
| ︙ |
Changes to unix/tclLoadDl.c.
| ︙ | |||
104 105 106 107 108 109 110 | 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | - + + + + + | * string the user gave us which hopefully refers to a file on the * binary path. */ Tcl_DString ds; const char *fileName = TclGetString(pathPtr); |
| ︙ | |||
175 176 177 178 179 180 181 | 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | - + + + + + |
/*
* Some platforms still add an underscore to the beginning of symbol
* names. If we can't find a name without an underscore, try again with
* the underscore.
*/
|
| ︙ |
Changes to unix/tclUnixFCmd.c.
| ︙ | |||
758 759 760 761 762 763 764 | 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 | - + - + + + + - - + + - - - - - - - - - + + + + + + + + + + + + + + + - - |
{
Tcl_DString ds;
Tcl_DString srcString, dstString;
int ret;
Tcl_Obj *transPtr;
transPtr = Tcl_FSGetTranslatedPath(NULL,srcPathPtr);
|
| ︙ | |||
822 823 824 825 826 827 828 | 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 | - + + + + - - - + + + + + + + + - - |
Tcl_Obj **errorPtr)
{
Tcl_DString ds;
Tcl_DString pathString;
int ret;
Tcl_Obj *transPtr = Tcl_FSGetTranslatedPath(NULL, pathPtr);
|
| ︙ | |||
882 883 884 885 886 887 888 | 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 | - + |
if (errno == ENOTEMPTY) {
errno = EEXIST;
}
result = TCL_OK;
if ((errno != EEXIST) || (recursive == 0)) {
if (errorPtr != NULL) {
|
| ︙ | |||
1131 1132 1133 1134 1135 1136 1137 | 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 | - + |
}
}
#endif /* !HAVE_FTS */
end:
if (errfile != NULL) {
if (errorPtr != NULL) {
|
| ︙ | |||
1202 1203 1204 1205 1206 1207 1208 | 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 | - + |
/*
* There shouldn't be a problem with src, because we already checked it to
* get here.
*/
if (errorPtr != NULL) {
Tcl_ExternalToUtfDStringEx(NULL, NULL, Tcl_DStringValue(dstPtr),
|
| ︙ | |||
1253 1254 1255 1256 1257 1258 1259 | 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 | - + |
if (DoRemoveDirectory(srcPtr, 0, NULL) == 0) {
return TCL_OK;
}
break;
}
if (errorPtr != NULL) {
Tcl_ExternalToUtfDStringEx(NULL, NULL, Tcl_DStringValue(srcPtr),
|
| ︙ | |||
1420 1421 1422 1423 1424 1425 1426 | 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 | - + |
pwPtr = TclpGetPwUid(statBuf.st_uid);
if (pwPtr == NULL) {
TclNewIntObj(*attributePtrPtr, statBuf.st_uid);
} else {
Tcl_DString ds;
|
| ︙ | |||
1504 1505 1506 1507 1508 1509 1510 | 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 | - + + + + + | Tcl_DString ds; struct group *groupPtr = NULL; const char *string; Tcl_Size length; string = Tcl_GetStringFromObj(attributePtr, &length); |
| ︙ | |||
1571 1572 1573 1574 1575 1576 1577 | 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 | - + + + + + | Tcl_DString ds; struct passwd *pwPtr = NULL; const char *string; Tcl_Size length; string = Tcl_GetStringFromObj(attributePtr, &length); |
| ︙ | |||
1931 1932 1933 1934 1935 1936 1937 | 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 | - + | * Side effects: * *--------------------------------------------------------------------------- */ int TclpObjNormalizePath( |
| ︙ | |||
1965 1966 1967 1968 1969 1970 1971 | 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 | - - + + + + + + |
/*
* Try to get the entire path in one go
*/
const char *lastDir = strrchr(currentPathEndPosition, '/');
if (lastDir != NULL) {
|
| ︙ | |||
2001 2002 2003 2004 2005 2006 2007 | 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 | - - + + + + + + |
if ((cur == '/') && (path != currentPathEndPosition)) {
/*
* Reached directory separator.
*/
int accessOk;
|
| ︙ | |||
2046 2047 2048 2049 2050 2051 2052 | 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 | - + + + + + | * 'Realpath' transforms an empty string into the normalized pwd, * which is the wrong answer. */ return 0; } |
| ︙ | |||
2082 2083 2084 2085 2086 2087 2088 | 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 | - + | } /* * Free the original path and replace it with the normalized path. */ Tcl_DStringFree(&ds); |
| ︙ | |||
2170 2171 2172 2173 2174 2175 2176 | 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 | - + - + + + - + + + + - + + + + - - + + + + + |
{
Tcl_DString templ, tmp;
const char *string;
int fd;
Tcl_Size length;
/*
|
| ︙ | |||
2300 2301 2302 2303 2304 2305 2306 | 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 | - + + + - + + + + |
/*
* Build the template in writable memory from the user-supplied pieces and
* some defaults.
*/
if (dirObj) {
string = TclGetString(dirObj);
|
| ︙ | |||
2338 2339 2340 2341 2342 2343 2344 | 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 | - - + + + + + |
return NULL;
}
/*
* The template has been updated. Tell the caller what it was.
*/
|
| ︙ |
Changes to unix/tclUnixFile.c.
| ︙ | |||
304 305 306 307 308 309 310 | 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 | - + + + + + + + | } } /* * Now open the directory for reading and iterate over the contents. */ |
| ︙ | |||
368 369 370 371 372 373 374 | 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 | - - + + + + + + | } /* * Now check to see if the file matches, according to both type * and pattern. If so, add the file to the result. */ |
| ︙ | |||
595 596 597 598 599 600 601 | 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 | - + + + + + + + - + + + + + |
TclpGetUserHome(
const char *name, /* User name for desired home directory. */
Tcl_DString *bufferPtr) /* Uninitialized or free DString filled with
* name of user's home directory. */
{
struct passwd *pwPtr;
Tcl_DString ds;
|
| ︙ | |||
781 782 783 784 785 786 787 | 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 | - + + + + |
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"error getting working directory name: %s",
Tcl_PosixError(interp)));
}
return NULL;
}
|
| ︙ | |||
812 813 814 815 816 817 818 | 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 | - + - + + + + + - - - + + + + + - |
TclpReadlink(
const char *path, /* Path of file to readlink (UTF-8). */
Tcl_DString *linkPtr) /* Uninitialized or free DString filled with
* contents of link (UTF-8). */
{
#ifndef DJGPP
char link[MAXPATHLEN];
|
| ︙ | |||
958 959 960 961 962 963 964 | 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 | - + + + + + |
*/
transPtr = Tcl_FSGetTranslatedPath(NULL, toPtr);
if (transPtr == NULL) {
return NULL;
}
target = Tcl_GetStringFromObj(transPtr, &length);
|
| ︙ | |||
993 994 995 996 997 998 999 | 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 | - + + + |
Tcl_DecrRefCount(transPtr);
length = readlink((const char *)Tcl_FSGetNativePath(pathPtr), link, sizeof(link));
if (length < 0) {
return NULL;
}
|
| ︙ | |||
1058 1059 1060 1061 1062 1063 1064 | 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 | - + |
Tcl_Obj *
TclpNativeToNormalized(
void *clientData)
{
Tcl_DString ds;
|
| ︙ | |||
1112 1113 1114 1115 1116 1117 1118 | 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 | - + + + + + |
if (validPathPtr == NULL) {
return NULL;
}
Tcl_IncrRefCount(validPathPtr);
}
str = Tcl_GetStringFromObj(validPathPtr, &len);
|
| ︙ |
Changes to unix/tclUnixPipe.c.
| ︙ | |||
137 138 139 140 141 142 143 | 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | - + + + + + |
const char *fname, /* The name of the file to open. */
int mode) /* In what mode to open the file? */
{
int fd;
const char *native;
Tcl_DString ds;
|
| ︙ | |||
194 195 196 197 198 199 200 | 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 | - + + + + + + |
return NULL;
}
fcntl(fd, F_SETFD, FD_CLOEXEC);
if (contents != NULL) {
Tcl_DString dstring;
char *native;
|
| ︙ | |||
433 434 435 436 437 438 439 | 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 | - + + + + + + + + + |
* deallocated later
*/
dsArray = (Tcl_DString *)TclStackAlloc(interp, argc * sizeof(Tcl_DString));
newArgv = (char **)TclStackAlloc(interp, (argc+1) * sizeof(char *));
newArgv[argc] = NULL;
for (i = 0; i < argc; i++) {
|
| ︙ |
Changes to win/tclWinPipe.c.
| ︙ | |||
647 648 649 650 651 652 653 | 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 | - + |
*/
TclFile
TclpCreateTempFile(
const char *contents) /* String to write into temp file, or NULL. */
{
WCHAR name[MAX_PATH];
|
| ︙ | |||
675 676 677 678 679 680 681 | 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 | - + + + + | const char *p; int toCopy; /* * Convert the contents from UTF to native encoding */ |
| ︙ | |||
715 716 717 718 719 720 721 | 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 | + - + + |
* Free the native representation of the contents if necessary.
*/
if (contents != NULL) {
Tcl_DStringFree(&dstring);
}
if (native != NULL) {
|
| ︙ |