Differences From Artifact [49cc46fab4]:
- File src/OFProcess.m — part of check-in [7e5c81e186] at 2018-01-03 19:49:46 on branch trunk — Update copyright notice (user: js, size: 14246) [annotate] [blame] [check-ins using]
To Artifact [bf28fd0153]:
- File
src/OFProcess.m
— part of check-in
[505137f25f]
at
2018-02-25 04:31:30
on branch trunk
— Reintroduce of_char{16,32}_t
There is no reliable way to check if C++ already defined those, as Clang
now defines char{16,32}_t even when it is not in C++ 11 mode. So we
cannot check if we are not in C++ 11 and then define them and otherwise
rely on the C++ 11 types. (user: js, size: 14267) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
55 56 57 58 59 60 61 | @interface OFProcess () #ifndef OF_WINDOWS - (void)of_getArgv: (char ***)argv forProgramName: (OFString *)programName andArguments: (OFArray *)arguments; - (char **)of_environmentForDictionary: (OFDictionary *)dictionary; #else | | | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | @interface OFProcess () #ifndef OF_WINDOWS - (void)of_getArgv: (char ***)argv forProgramName: (OFString *)programName andArguments: (OFArray *)arguments; - (char **)of_environmentForDictionary: (OFDictionary *)dictionary; #else - (of_char16_t *)of_environmentForDictionary: (OFDictionary *)dictionary; #endif @end @implementation OFProcess + (instancetype)processWithProgram: (OFString *)program { return [[[self alloc] initWithProgram: program] autorelease]; |
︙ | ︙ | |||
221 222 223 224 225 226 227 | objc_autoreleasePoolPop(pool); #else SECURITY_ATTRIBUTES sa; PROCESS_INFORMATION pi; STARTUPINFOW si; void *pool; OFMutableString *argumentsString; | | | 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | objc_autoreleasePoolPop(pool); #else SECURITY_ATTRIBUTES sa; PROCESS_INFORMATION pi; STARTUPINFOW si; void *pool; OFMutableString *argumentsString; of_char16_t *argumentsCopy; size_t length; sa.nLength = sizeof(sa); sa.bInheritHandle = TRUE; sa.lpSecurityDescriptor = NULL; if (!CreatePipe(&_readPipe[0], &_readPipe[1], &sa, 0)) |
︙ | ︙ | |||
290 291 292 293 294 295 296 | [argumentsString appendString: tmp]; if (containsSpaces) [argumentsString appendString: @"\""]; } length = [argumentsString UTF16StringLength]; | | | 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 | [argumentsString appendString: tmp]; if (containsSpaces) [argumentsString appendString: @"\""]; } length = [argumentsString UTF16StringLength]; argumentsCopy = [self allocMemoryWithSize: sizeof(of_char16_t) count: length + 1]; memcpy(argumentsCopy, [argumentsString UTF16String], ([argumentsString UTF16StringLength] + 1) * 2); @try { if (!CreateProcessW([program UTF16String], argumentsCopy, NULL, NULL, TRUE, CREATE_UNICODE_ENVIRONMENT, |
︙ | ︙ | |||
396 397 398 399 400 401 402 | } envp[i] = NULL; return envp; } #else | | | | | | 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 | } envp[i] = NULL; return envp; } #else - (of_char16_t *)of_environmentForDictionary: (OFDictionary *)environment { OFMutableData *env; OFEnumerator *keyEnumerator, *objectEnumerator; OFString *key, *object; const of_char16_t equal = '='; const of_char16_t zero[2] = { 0, 0 }; if (environment == nil) return NULL; env = [OFMutableData dataWithItemSize: sizeof(of_char16_t)]; keyEnumerator = [environment keyEnumerator]; objectEnumerator = [environment objectEnumerator]; while ((key = [keyEnumerator nextObject]) != nil && (object = [objectEnumerator nextObject]) != nil) { [env addItems: [key UTF16String] count: [key UTF16StringLength]]; |
︙ | ︙ |