Differences From Artifact [959c780c29]:
- File src/OFWin32ConsoleStdIOStream.m — part of check-in [d5eb0384c5] at 2020-05-28 00:15:05 on branch trunk — OFStdIOStream: Add -[hasTerminal] (user: js, size: 15008) [annotate] [blame] [check-ins using] [more...]
To Artifact [7dd85d6178]:
- File
src/OFWin32ConsoleStdIOStream.m
— part of check-in
[0ddaac3f5b]
at
2020-11-05 00:24:29
on branch trunk
— Avoid -[allocMemoryWithSize:] for temporary memory
-[allocMemoryWithSize:] has book keeping overhead that is unnecessary
for temporary memory. (user: js, size: 14922) [annotate] [blame] [check-ins using] [more...]
︙ | ︙ | |||
133 134 135 136 137 138 139 | char *buffer = buffer_; of_char16_t *UTF16; size_t j = 0; if (length > UINT32_MAX) @throw [OFOutOfRangeException exception]; | | < | 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | char *buffer = buffer_; of_char16_t *UTF16; size_t j = 0; if (length > UINT32_MAX) @throw [OFOutOfRangeException exception]; UTF16 = of_malloc(length, sizeof(of_char16_t)); @try { DWORD UTF16Len; OFMutableData *rest = nil; size_t i = 0; if ([OFSystemInfo isWindowsNT]) { if (!ReadConsoleW(_handle, UTF16, (DWORD)length, |
︙ | ︙ | |||
256 257 258 259 260 261 262 | } } if (rest != nil) [self unreadFromBuffer: rest.items length: rest.count]; } @finally { | | | 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | } } if (rest != nil) [self unreadFromBuffer: rest.items length: rest.count]; } @finally { free(UTF16); } objc_autoreleasePoolPop(pool); return j; } |
︙ | ︙ | |||
361 362 363 364 365 366 367 | bytesWritten: bytesWritten * 2 errNo: 0]; _incompleteUTF8SurrogateLen = 0; i += toCopy; } | | < | 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 | bytesWritten: bytesWritten * 2 errNo: 0]; _incompleteUTF8SurrogateLen = 0; i += toCopy; } tmp = of_malloc(length * 2, sizeof(of_char16_t)); @try { DWORD bytesWritten; while (i < length) { of_unichar_t c; ssize_t UTF8Len; |
︙ | ︙ | |||
441 442 443 444 445 446 447 | if (bytesWritten != j) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: j * 2 bytesWritten: bytesWritten * 2 errNo: 0]; } @finally { | | | 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 | if (bytesWritten != j) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: j * 2 bytesWritten: bytesWritten * 2 errNo: 0]; } @finally { free(tmp); } /* * We do not count in bytes when writing to the Win32 console. But * since any incomplete write is an exception here anyway, we can just * return length. */ |
︙ | ︙ |