ObjFW  Check-in [f82406c3fd]

Overview
Comment:Call FreeEnvironmentStringsW on correct pointer
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: f82406c3fd67982695c21dae7976e7ec56a2a2f8637d0c6398b76b34b25a8365
User & Date: js on 2014-02-12 03:17:12
Original User & Date: js on 2014-02-12 03:17:13
Other Links: manifest | tags
Context
2014-02-12
03:17
OFUDPSocket: Use SOCKET on Win32 check-in: 60be8437d7 user: js tags: trunk
03:17
Call FreeEnvironmentStringsW on correct pointer check-in: f82406c3fd user: js tags: trunk
03:17
Fix compilation with mingw-w64 check-in: 6ba4095f05 user: js tags: trunk
Changes

Modified src/OFApplication.m from [ce308c71b7] to [bad1c6eacd].

169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194

	@try {
		void *pool;
		OFMutableDictionary *environment;
#if defined(__MACH__) && !defined(OF_IOS)
		char **env = *_NSGetEnviron();
#elif defined(__WIN32)
		of_char16_t *env;
#elif !defined(OF_IOS)
		char **env = environ;
#else
		char *env;
#endif

		environment = [[OFMutableDictionary alloc] init];

		atexit(atexitHandler);
#if defined(_WIN32)
		env = GetEnvironmentStringsW();

		while (*env != 0) {
			OFString *tmp, *key, *value;
			size_t length, pos;

			pool = objc_autoreleasePoolPush();








|










|







169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194

	@try {
		void *pool;
		OFMutableDictionary *environment;
#if defined(__MACH__) && !defined(OF_IOS)
		char **env = *_NSGetEnviron();
#elif defined(__WIN32)
		of_char16_t *env, *env0;
#elif !defined(OF_IOS)
		char **env = environ;
#else
		char *env;
#endif

		environment = [[OFMutableDictionary alloc] init];

		atexit(atexitHandler);
#if defined(_WIN32)
		env = env0 = GetEnvironmentStringsW();

		while (*env != 0) {
			OFString *tmp, *key, *value;
			size_t length, pos;

			pool = objc_autoreleasePoolPush();

220
221
222
223
224
225
226
227
228
229
230
231
232
233
234

			[environment setObject: value
					forKey: key];

			objc_autoreleasePoolPop(pool);
		}

		FreeEnvironmentStringsW(env);
#elif !defined(OF_IOS)
		if (env != NULL) {
			for (; *env != NULL; env++) {
				OFString *key, *value;
				char *sep;
				const of_string_encoding_t encoding =
				    [OFString nativeOSEncoding];







|







220
221
222
223
224
225
226
227
228
229
230
231
232
233
234

			[environment setObject: value
					forKey: key];

			objc_autoreleasePoolPop(pool);
		}

		FreeEnvironmentStringsW(env0);
#elif !defined(OF_IOS)
		if (env != NULL) {
			for (; *env != NULL; env++) {
				OFString *key, *value;
				char *sep;
				const of_string_encoding_t encoding =
				    [OFString nativeOSEncoding];