Differences From Artifact [b94d48eb9c]:
- File
src/OFStdIOStream_Win32Console.m
— part of check-in
[6b77a5dd8b]
at
2017-05-21 21:28:57
on branch trunk
— Prefix private methods with of_ instead of OF_
This matches Apple's style. (user: js, size: 8011) [annotate] [blame] [check-ins using]
To Artifact [e75a0d88c9]:
- File
src/OFStdIOStream_Win32Console.m
— part of check-in
[4f36894ce7]
at
2017-06-05 17:36:28
on branch trunk
— Clean up exceptions a little
This removes several initializers that omitted the errNo. Removing those
forces to think about whether there is a meaningful errNo to set instead
of just omitting it. (user: js, size: 8084) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
39 40 41 42 43 44 45 46 47 48 49 50 51 52 | */ #define OF_STDIO_STREAM_WIN32_CONSOLE_M #include "config.h" #include <assert.h> #import "OFStdIOStream_Win32Console.h" #import "OFStdIOStream+Private.h" #import "OFString.h" #import "OFDataArray.h" #import "OFInvalidArgumentException.h" | > | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | */ #define OF_STDIO_STREAM_WIN32_CONSOLE_M #include "config.h" #include <assert.h> #include <errno.h> #import "OFStdIOStream_Win32Console.h" #import "OFStdIOStream+Private.h" #import "OFString.h" #import "OFDataArray.h" #import "OFInvalidArgumentException.h" |
︙ | ︙ | |||
118 119 120 121 122 123 124 | OFDataArray *rest = nil; size_t i = 0; if (!ReadConsoleW(_handle, UTF16, (DWORD)length, &UTF16Len, NULL)) @throw [OFReadFailedException exceptionWithObject: self | | > | 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | OFDataArray *rest = nil; size_t i = 0; if (!ReadConsoleW(_handle, UTF16, (DWORD)length, &UTF16Len, NULL)) @throw [OFReadFailedException exceptionWithObject: self requestedLength: length * 2 errNo: EIO]; if (UTF16Len > 0 && _incompleteUTF16Surrogate != 0) { of_unichar_t c = (((_incompleteUTF16Surrogate & 0x3FF) << 10) | (UTF16[0] & 0x3FF)) + 0x10000; char UTF8[4]; size_t UTF8Len; |
︙ | ︙ | |||
269 270 271 272 273 274 275 | } } if (!WriteConsoleW(_handle, UTF16, UTF16Len, &written, NULL) || written != UTF16Len) @throw [OFWriteFailedException exceptionWithObject: self | | > | 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 | } } if (!WriteConsoleW(_handle, UTF16, UTF16Len, &written, NULL) || written != UTF16Len) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: UTF16Len * 2 errNo: EIO]; _incompleteUTF8SurrogateLen = 0; i += toCopy; } tmp = [self allocMemoryWithSize: sizeof(char16_t) count: length * 2]; |
︙ | ︙ | |||
320 321 322 323 324 325 326 | if (j > UINT32_MAX) @throw [OFOutOfRangeException exception]; if (!WriteConsoleW(_handle, tmp, (DWORD)j, &written, NULL) || written != j) @throw [OFWriteFailedException exceptionWithObject: self | | > | 323 324 325 326 327 328 329 330 331 332 333 334 335 336 | if (j > UINT32_MAX) @throw [OFOutOfRangeException exception]; if (!WriteConsoleW(_handle, tmp, (DWORD)j, &written, NULL) || written != j) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: j * 2 errNo: EIO]; } @finally { [self freeMemory: tmp]; } } @end |