ObjFW  Check-in [976162aa79]

Overview
Comment:OFStdIOStream_Win32Console: Small read fix
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 976162aa793eb67ef8357836a4db7ad1a15989216b7fcef2244da2113904b120
User & Date: js on 2016-03-13 20:29:46
Other Links: manifest | tags
Context
2016-03-19
21:21
Add XML file for Nintendo 3DS check-in: b750e84c5e user: js tags: trunk
2016-03-13
20:29
OFStdIOStream_Win32Console: Small read fix check-in: 976162aa79 user: js tags: trunk
20:04
OFStdIOStream_Win32Console: Use U+FFFD, not U+FFFE check-in: 9d70e660ea user: js tags: trunk
Changes

Modified src/OFStdIOStream_Win32Console.m from [c7b07d3dc1] to [856da3e285].

109
110
111
112
113
114
115

116
117
118
119
120
121
122
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123







+







	size_t j = 0;

	UTF16 = [self allocMemoryWithSize: sizeof(of_char16_t)
				    count: length];
	@try {
		DWORD UTF16Len;
		OFDataArray *rest = nil;
		size_t i = 0;

		if (!ReadConsoleW(_handle, UTF16, length, &UTF16Len, NULL))
			@throw [OFReadFailedException
			    exceptionWithObject: self
				requestedLength: length * 2];

		if (UTF16Len > 0 && _incompleteUTF16Surrogate != 0) {
137
138
139
140
141
142
143

144
145
146

147
148
149
150
151
152
153
138
139
140
141
142
143
144
145
146
147

148
149
150
151
152
153
154
155







+


-
+







					rest = [OFDataArray dataArray];

				[rest addItems: UTF8
					 count: UTF8Len];
			}

			_incompleteUTF16Surrogate = 0;
			i++;
		}

		for (size_t i = 0; i < UTF16Len; i++) {
		for (; i < UTF16Len; i++) {
			of_unichar_t c = UTF16[i];
			char UTF8[4];
			size_t UTF8Len;

			/* Missing high surrogate */
			if ((c & 0xFC00) == 0xDC00)
				@throw [OFInvalidEncodingException exception];