ObjFW  Diff

Differences From Artifact [0d39282550]:

To Artifact [ed7607de4d]:


92
93
94
95
96
97
98
99

100
101
102
103
104

105
106
107
108
109
110
111
112
113

114
115
116
117
118
119
120
92
93
94
95
96
97
98

99
100
101
102
103

104
105
106
107
108
109
110
111
112

113
114
115
116
117
118
119
120







-
+




-
+








-
+







			OFString **objects = [arguments objects];
			size_t i, count = [arguments count];
			char **argv;

			argv = [self allocMemoryWithSize: sizeof(char*)
						   count: count + 2];

			argv[0] = (char*)[programName cStringWithEncoding:
			argv[0] = (char*)[programName cStringUsingEncoding:
			    OF_STRING_ENCODING_NATIVE];

			for (i = 0; i < count; i++)
				argv[i + 1] = (char*)[objects[i]
				    cStringWithEncoding:
				    cStringUsingEncoding:
				    OF_STRING_ENCODING_NATIVE];

			argv[i + 1] = NULL;

			close(readPipe[0]);
			close(writePipe[1]);
			dup2(writePipe[0], 0);
			dup2(readPipe[1], 1);
			execvp([program cStringWithEncoding:
			execvp([program cStringUsingEncoding:
			    OF_STRING_ENCODING_NATIVE], argv);

			@throw [OFInitializationFailedException
			    exceptionWithClass: [self class]];
		case -1:
			@throw [OFInitializationFailedException
			    exceptionWithClass: [self class]];
195
196
197
198
199
200
201
202

203
204

205
206
207
208
209
210
211
195
196
197
198
199
200
201

202
203

204
205
206
207
208
209
210
211







-
+

-
+







			[argumentsString appendString: tmp];

			if (containsSpaces)
				[argumentsString appendString: @"\""];
		}

		argumentsCString = strdup([argumentsString
		    cStringWithEncoding: OF_STRING_ENCODING_NATIVE]);
		    cStringUsingEncoding: OF_STRING_ENCODING_NATIVE]);
		@try {
			if (!CreateProcess([program cStringWithEncoding:
			if (!CreateProcess([program cStringUsingEncoding:
			    OF_STRING_ENCODING_NATIVE], argumentsCString, NULL,
			    NULL, TRUE, 0, NULL, NULL, &si, &pi))
				@throw [OFInitializationFailedException
				    exceptionWithClass: [self class]];
		} @finally {
			free(argumentsString);
		}