Differences From Artifact [7f3fc13f71]:
- File
src/OFStdIOStream_Win32Console.m
— part of check-in
[4af49a13c3]
at
2017-05-07 20:10:13
on branch trunk
— Small code style change
Casts are now written like types in variable declarations. (user: js, size: 8029) [annotate] [blame] [check-ins using]
To Artifact [877aa024e4]:
- File src/OFStdIOStream_Win32Console.m — part of check-in [37d2a81754] at 2017-05-07 21:25:56 on branch trunk — Use char{16,32}_t instead of of_char{16,32}_t (user: js, size: 8011) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
101 102 103 104 105 106 107 | } - (size_t)lowlevelReadIntoBuffer: (void *)buffer_ length: (size_t)length { void *pool = objc_autoreleasePoolPush(); char *buffer = buffer_; | | | | 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | } - (size_t)lowlevelReadIntoBuffer: (void *)buffer_ length: (size_t)length { void *pool = objc_autoreleasePoolPush(); char *buffer = buffer_; char16_t *UTF16; size_t j = 0; if (length > sizeof(UINT32_MAX)) @throw [OFOutOfRangeException exception]; UTF16 = [self allocMemoryWithSize: sizeof(char16_t) count: length]; @try { DWORD UTF16Len; OFDataArray *rest = nil; size_t i = 0; if (!ReadConsoleW(_handle, UTF16, (DWORD)length, &UTF16Len, |
︙ | ︙ | |||
155 156 157 158 159 160 161 | size_t UTF8Len; /* Missing high surrogate */ if ((c & 0xFC00) == 0xDC00) @throw [OFInvalidEncodingException exception]; if ((c & 0xFC00) == 0xD800) { | | | 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | size_t UTF8Len; /* Missing high surrogate */ if ((c & 0xFC00) == 0xDC00) @throw [OFInvalidEncodingException exception]; if ((c & 0xFC00) == 0xD800) { char16_t next; if (UTF16Len <= i + 1) { _incompleteUTF16Surrogate = c; if (rest != nil) { char *items = [rest items]; size_t count = [rest count]; |
︙ | ︙ | |||
216 217 218 219 220 221 222 | return j; } - (void)lowlevelWriteBuffer: (const void *)buffer_ length: (size_t)length { const char *buffer = buffer_; | | | | 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | return j; } - (void)lowlevelWriteBuffer: (const void *)buffer_ length: (size_t)length { const char *buffer = buffer_; char16_t *tmp; size_t i = 0, j = 0; if (length > SIZE_MAX / 2) @throw [OFOutOfRangeException exception]; if (_incompleteUTF8SurrogateLen > 0) { of_unichar_t c; char16_t UTF16[2]; ssize_t UTF8Len; size_t toCopy; DWORD UTF16Len, written; UTF8Len = -of_string_utf8_decode( _incompleteUTF8Surrogate, _incompleteUTF8SurrogateLen, &c); |
︙ | ︙ | |||
275 276 277 278 279 280 281 | exceptionWithObject: self requestedLength: UTF16Len * 2]; _incompleteUTF8SurrogateLen = 0; i += toCopy; } | | | 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 | exceptionWithObject: self requestedLength: UTF16Len * 2]; _incompleteUTF8SurrogateLen = 0; i += toCopy; } tmp = [self allocMemoryWithSize: sizeof(char16_t) count: length * 2]; @try { DWORD written; while (i < length) { of_unichar_t c; ssize_t UTF8Len; |
︙ | ︙ |