Differences From Artifact [451d779be8]:
- File
src/OFStdIOStream_Win32Console.m
— part of check-in
[2ae01218ef]
at
2017-06-12 22:29:41
on branch trunk
— OFWriteFailedException: Add -[bytesWritten]
This allows retrieving the number of bytes already written before the
write failed, allowing to retry without writing data that has already
been written. (user: js, size: 8471) [annotate] [blame] [check-ins using]
To Artifact [2cf46b37b4]:
- File src/OFStdIOStream_Win32Console.m — part of check-in [c8f7b90082] at 2017-07-22 20:50:27 on branch trunk — Split OFDataArray into OFData and OFMutableData (user: js, size: 8462) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
44 45 46 47 48 49 50 | #include <assert.h> #include <errno.h> #import "OFStdIOStream_Win32Console.h" #import "OFStdIOStream+Private.h" #import "OFString.h" | | | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | #include <assert.h> #include <errno.h> #import "OFStdIOStream_Win32Console.h" #import "OFStdIOStream+Private.h" #import "OFString.h" #import "OFData.h" #import "OFInvalidArgumentException.h" #import "OFInvalidEncodingException.h" #import "OFOutOfRangeException.h" #import "OFReadFailedException.h" #import "OFWriteFailedException.h" |
︙ | ︙ | |||
112 113 114 115 116 117 118 | if (length > sizeof(UINT32_MAX)) @throw [OFOutOfRangeException exception]; UTF16 = [self allocMemoryWithSize: sizeof(char16_t) count: length]; @try { DWORD UTF16Len; | | | 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | if (length > sizeof(UINT32_MAX)) @throw [OFOutOfRangeException exception]; UTF16 = [self allocMemoryWithSize: sizeof(char16_t) count: length]; @try { DWORD UTF16Len; OFMutableData *rest = nil; size_t i = 0; if (!ReadConsoleW(_handle, UTF16, (DWORD)length, &UTF16Len, NULL)) @throw [OFReadFailedException exceptionWithObject: self requestedLength: length * 2 |
︙ | ︙ | |||
137 138 139 140 141 142 143 | @throw [OFInvalidEncodingException exception]; if (UTF8Len <= length) { memcpy(buffer, UTF8, UTF8Len); j += UTF8Len; } else { if (rest == nil) | | | 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | @throw [OFInvalidEncodingException exception]; if (UTF8Len <= length) { memcpy(buffer, UTF8, UTF8Len); j += UTF8Len; } else { if (rest == nil) rest = [OFMutableData data]; [rest addItems: UTF8 count: UTF8Len]; } _incompleteUTF16Surrogate = 0; i++; |
︙ | ︙ | |||
195 196 197 198 199 200 201 | @throw [OFInvalidEncodingException exception]; if (j + UTF8Len <= length) { memcpy(buffer + j, UTF8, UTF8Len); j += UTF8Len; } else { if (rest == nil) | | | 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | @throw [OFInvalidEncodingException exception]; if (j + UTF8Len <= length) { memcpy(buffer + j, UTF8, UTF8Len); j += UTF8Len; } else { if (rest == nil) rest = [OFMutableData data]; [rest addItems: UTF8 count: UTF8Len]; } } if (rest != nil) |
︙ | ︙ |