ObjFW  Check-in [3912669d91]

Overview
Comment:Add codepage 437.

This is required for ZIP files, which can use either codepage 437 or
Unicode.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 3912669d917dfe73fe3e2cc13ec7d2a151d71b0dc6da68df8afcc9d3d8e39483
User & Date: js on 2013-08-12 10:09:07
Other Links: manifest | tags
Context
2013-08-12
13:26
Fix OFSeekableStream. check-in: d101b6f8b4 user: js tags: trunk
10:09
Add codepage 437. check-in: 3912669d91 user: js tags: trunk
10:00
Don't store the first 128 chars of an encoding. check-in: d36cf257fe user: js tags: trunk
Changes

Modified ObjFW.xcodeproj/project.pbxproj from [db5b5a8b49] to [ded6ae00ad].

349
350
351
352
353
354
355

356
357
358
359
360
361
362
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363







+







		4BB4B54416775FF4002A2DCE /* OFHTTPClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BB4B53F16775FF4002A2DCE /* OFHTTPClient.h */; settings = {ATTRIBUTES = (Public, ); }; };
		4BB4B54516775FF4002A2DCE /* OFHTTPClient.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BB4B54016775FF4002A2DCE /* OFHTTPClient.m */; };
		4BB4B54616775FF4002A2DCE /* OFHTTPServer.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BB4B54116775FF4002A2DCE /* OFHTTPServer.h */; settings = {ATTRIBUTES = (Public, ); }; };
		4BB4B54716775FF4002A2DCE /* OFHTTPServer.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BB4B54216775FF4002A2DCE /* OFHTTPServer.m */; };
		4BB4B54A16776094002A2DCE /* OFHTTPClientTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BB4B54916776094002A2DCE /* OFHTTPClientTests.m */; };
		4BB524C1143D1E4E0085FBCC /* OFProcess.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BB524BF143D1E4E0085FBCC /* OFProcess.h */; settings = {ATTRIBUTES = (Public, ); }; };
		4BB524C2143D1E4E0085FBCC /* OFProcess.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BB524C0143D1E4E0085FBCC /* OFProcess.m */; settings = {ATTRIBUTES = (Public, ); }; };
		4BB52CC717B8EA7F00B7EBF5 /* codepage_437.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BB52CC617B8EA7F00B7EBF5 /* codepage_437.m */; };
		4BC090441584F6760040640F /* OFInvalidJSONException.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BC090421584F6760040640F /* OFInvalidJSONException.h */; settings = {ATTRIBUTES = (Public, ); }; };
		4BC090451584F6760040640F /* OFInvalidJSONException.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BC090431584F6760040640F /* OFInvalidJSONException.m */; };
		4BCAA9AF1772432F003EF859 /* OFMessagePackExtension.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BCAA9AD1772432E003EF859 /* OFMessagePackExtension.h */; settings = {ATTRIBUTES = (Public, ); }; };
		4BCAA9B01772432F003EF859 /* OFMessagePackExtension.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BCAA9AE1772432E003EF859 /* OFMessagePackExtension.m */; };
		4BD653C5143B8489006182F0 /* OFTCPSocket+SOCKS5.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BD653C3143B8489006182F0 /* OFTCPSocket+SOCKS5.h */; settings = {ATTRIBUTES = (); }; };
		4BD653C6143B8489006182F0 /* OFTCPSocket+SOCKS5.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BD653C4143B8489006182F0 /* OFTCPSocket+SOCKS5.m */; };
		4BD77FDE176E4BC40031C497 /* OFUnboundPrefixException.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BD77FDC176E4BC40031C497 /* OFUnboundPrefixException.h */; settings = {ATTRIBUTES = (Public, ); }; };
773
774
775
776
777
778
779





780
781
782
783
784
785
786
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792







+
+
+
+
+







		4BB4B54116775FF4002A2DCE /* OFHTTPServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFHTTPServer.h; path = src/OFHTTPServer.h; sourceTree = "<group>"; };
		4BB4B54216775FF4002A2DCE /* OFHTTPServer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFHTTPServer.m; path = src/OFHTTPServer.m; sourceTree = "<group>"; };
		4BB4B54916776094002A2DCE /* OFHTTPClientTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFHTTPClientTests.m; path = tests/OFHTTPClientTests.m; sourceTree = "<group>"; };
		4BB50DCF12F863C700C9393F /* of_asprintf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = of_asprintf.h; path = src/of_asprintf.h; sourceTree = SOURCE_ROOT; };
		4BB50DD012F863C700C9393F /* of_asprintf.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = of_asprintf.m; path = src/of_asprintf.m; sourceTree = SOURCE_ROOT; };
		4BB524BF143D1E4E0085FBCC /* OFProcess.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFProcess.h; path = src/OFProcess.h; sourceTree = "<group>"; };
		4BB524C0143D1E4E0085FBCC /* OFProcess.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFProcess.m; path = src/OFProcess.m; sourceTree = "<group>"; };
		4BB52CC617B8EA7F00B7EBF5 /* codepage_437.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = codepage_437.m; path = src/codepage_437.m; sourceTree = "<group>"; };
		4BB52CC817B8EA8E00B7EBF5 /* apple-forwarding-arm.S */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; name = "apple-forwarding-arm.S"; path = "src/apple-forwarding-arm.S"; sourceTree = "<group>"; };
		4BB52CC917B8EA8E00B7EBF5 /* apple-forwarding-i386.S */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; name = "apple-forwarding-i386.S"; path = "src/apple-forwarding-i386.S"; sourceTree = "<group>"; };
		4BB52CCA17B8EA8E00B7EBF5 /* apple-forwarding-ppc.S */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; name = "apple-forwarding-ppc.S"; path = "src/apple-forwarding-ppc.S"; sourceTree = "<group>"; };
		4BB52CCB17B8EA8E00B7EBF5 /* apple-forwarding-x86_64.S */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; name = "apple-forwarding-x86_64.S"; path = "src/apple-forwarding-x86_64.S"; sourceTree = "<group>"; };
		4BBA36C411406AB700CBA3AC /* atomic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = atomic.h; path = src/atomic.h; sourceTree = "<group>"; };
		4BBA36C511406AB700CBA3AC /* macros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = macros.h; path = src/macros.h; sourceTree = "<group>"; };
		4BC090421584F6760040640F /* OFInvalidJSONException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFInvalidJSONException.h; path = src/exceptions/OFInvalidJSONException.h; sourceTree = "<group>"; };
		4BC090431584F6760040640F /* OFInvalidJSONException.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFInvalidJSONException.m; path = src/exceptions/OFInvalidJSONException.m; sourceTree = "<group>"; };
		4BCAA9AD1772432E003EF859 /* OFMessagePackExtension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFMessagePackExtension.h; path = src/OFMessagePackExtension.h; sourceTree = "<group>"; };
		4BCAA9AE1772432E003EF859 /* OFMessagePackExtension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFMessagePackExtension.m; path = src/OFMessagePackExtension.m; sourceTree = "<group>"; };
		4BD653C3143B8489006182F0 /* OFTCPSocket+SOCKS5.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "OFTCPSocket+SOCKS5.h"; path = "src/OFTCPSocket+SOCKS5.h"; sourceTree = "<group>"; };
1235
1236
1237
1238
1239
1240
1241




1242
1243
1244
1245
1246
1247
1248

1249
1250
1251
1252
1253
1254
1255
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266







+
+
+
+







+







				4B11005A14329B9A003A45D8 /* OFXMLNode.h */,
				4B11005B14329B9A003A45D8 /* OFXMLNode.m */,
				4B6799891099E7C50041064A /* OFXMLParser.h */,
				4B67998A1099E7C50041064A /* OFXMLParser.m */,
				4B48B95214DC23B100546D39 /* OFXMLProcessingInstructions.h */,
				4B48B95314DC23B100546D39 /* OFXMLProcessingInstructions.m */,
				4B6AF97310A8D4450003FB0A /* ObjFW.h */,
				4BB52CC817B8EA8E00B7EBF5 /* apple-forwarding-arm.S */,
				4BB52CC917B8EA8E00B7EBF5 /* apple-forwarding-i386.S */,
				4BB52CCA17B8EA8E00B7EBF5 /* apple-forwarding-ppc.S */,
				4BB52CCB17B8EA8E00B7EBF5 /* apple-forwarding-x86_64.S */,
				4B6799561099E7C50041064A /* asprintf.h */,
				4B6AF96C10A8D3E40003FB0A /* asprintf.m */,
				4BBA36C411406AB700CBA3AC /* atomic.h */,
				4BA9CFA315E129D30076DC74 /* autorelease.h */,
				4B3D236D1337FB5800DD29B8 /* base64.h */,
				4B3D236E1337FB5800DD29B8 /* base64.m */,
				4B837D7716829C5F007A3E83 /* block.h */,
				4BB52CC617B8EA7F00B7EBF5 /* codepage_437.m */,
				4B837D7816829C5F007A3E83 /* instance.h */,
				4B6AF96F10A8D40E0003FB0A /* iso_8859_15.m */,
				4BEF2D3017A5BF5200BB8BA3 /* forwarding.S */,
				4BE17AD812FD744C002CEB0B /* foundation-compat.m */,
				4BBA36C511406AB700CBA3AC /* macros.h */,
				4BF1BCBF11C9663F0025511F /* objfw-defs.h.in */,
				4BB50DCF12F863C700C9393F /* of_asprintf.h */,
1800
1801
1802
1803
1804
1805
1806

1807
1808
1809
1810
1811
1812
1813
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825







+







				4B3D23AF1337FC0D00DD29B8 /* OFXMLElement.m in Sources */,
				4BB25E8D139C388A00F574EA /* OFXMLElement+Serialization.m in Sources */,
				4B3D23B01337FC0D00DD29B8 /* OFXMLElementBuilder.m in Sources */,
				4B11005D14329B9A003A45D8 /* OFXMLNode.m in Sources */,
				4B3D23B11337FC0D00DD29B8 /* OFXMLParser.m in Sources */,
				4B48B95514DC23B100546D39 /* OFXMLProcessingInstructions.m in Sources */,
				4B3D23B31337FC0D00DD29B8 /* base64.m in Sources */,
				4BB52CC717B8EA7F00B7EBF5 /* codepage_437.m in Sources */,
				4B3D23B41337FC0D00DD29B8 /* iso_8859_15.m in Sources */,
				4BEF2D3117A5BF5200BB8BA3 /* forwarding.S in Sources */,
				4B3D23B51337FC0D00DD29B8 /* foundation-compat.m in Sources */,
				4B3D23EE1337FFD000DD29B8 /* of_asprintf.m in Sources */,
				4BA355BA14879BDD00442EF4 /* of_strptime.m in Sources */,
				4B3D23B91337FC0D00DD29B8 /* unicode.m in Sources */,
				4B3D23BA1337FC0D00DD29B8 /* windows_1252.m in Sources */,

Modified src/Makefile from [9aa006347f] to [45aff8468f].

111
112
113
114
115
116
117

118
119
120
121
122
123
124
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125







+







	OFMutableArray_adjacent.m	\
	OFMutableDictionary_hashtable.m	\
	OFMutableSet_hashtable.m	\
	OFMutableString_UTF8.m		\
	OFSet_hashtable.m		\
	OFString_UTF8.m			\
	${ASPRINTF_M}			\
	codepage_437.m			\
	forwarding.S			\
	${FOUNDATION_COMPAT_M}		\
	iso_8859_15.m			\
	windows_1252.m
SRCS_SOCKETS += ${OFSTREAMOBSERVER_KQUEUE_M}	\
		${OFSTREAMOBSERVER_POLL_M}	\
		${OFSTREAMOBSERVER_SELECT_M}	\

Modified src/OFString.h from [eaa607fa2a] to [5f3de292e6].

52
53
54
55
56
57
58


59
60
61
62
63
64
65
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67







+
+







	OF_STRING_ENCODING_ASCII,
	/*! ISO 8859-1 */
	OF_STRING_ENCODING_ISO_8859_1,
	/*! ISO 8859-15 */
	OF_STRING_ENCODING_ISO_8859_15,
	/*! Windows-1252 */
	OF_STRING_ENCODING_WINDOWS_1252,
	/*! Codepage 437 */
	OF_STRING_ENCODING_CODEPAGE_437,
	/*! Try to automatically detect the encoding */
	OF_STRING_ENCODING_AUTODETECT = 0xFF
} of_string_encoding_t;

enum {
	OF_STRING_SEARCH_BACKWARDS = 1,
	OF_STRING_SKIP_EMPTY	   = 2

Modified src/OFString_UTF8.m from [35d6df4f4a] to [48ca6830d9].

37
38
39
40
41
42
43

44
45
46
47
48
49
50
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51







+







#import "autorelease.h"
#import "macros.h"
#import "of_asprintf.h"
#import "unicode.h"

extern const of_char16_t of_iso_8859_15[128];
extern const of_char16_t of_windows_1252[128];
extern const of_char16_t of_codepage_437[128];

static inline int
memcasecmp(const char *first, const char *second, size_t length)
{
	size_t i;

	for (i = 0; i < length; i++) {
283
284
285
286
287
288
289



290
291
292
293
294
295
296
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300







+
+
+








		switch (encoding) {
		case OF_STRING_ENCODING_ISO_8859_15:
			table = of_iso_8859_15;
			break;
		case OF_STRING_ENCODING_WINDOWS_1252:
			table = of_windows_1252;
			break;
		case OF_STRING_ENCODING_CODEPAGE_437:
			table = of_codepage_437;
			break;
		default:
			@throw [OFInvalidEncodingException exception];
		}

		for (i = j = 0; i < cStringLength; i++) {
			char buffer[4];

Added src/codepage_437.m version [badcc11070].





































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
/*
 * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013
 *   Jonathan Schleifer <js@webkeks.org>
 *
 * All rights reserved.
 *
 * This file is part of ObjFW. It may be distributed under the terms of the
 * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
 * the packaging of this file.
 *
 * Alternatively, it may be distributed under the terms of the GNU General
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#import "OFString.h"

const of_char16_t of_codepage_437[128] = {
	0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7,
	0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5,
	0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9,
	0x00FF, 0x00D6, 0x00DC, 0x00A2, 0x00A3, 0x00A5, 0x20A7, 0x0192,
	0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA,
	0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
	0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556,
	0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510,
	0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F,
	0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
	0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B,
	0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
	0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4,
	0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229,
	0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248,
	0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0
};