ObjFW  Diff

Differences From Artifact [499c5dab3d]:

To Artifact [6a59691f03]:

  • File src/OFProcess.m — part of check-in [3d16a30f41] at 2013-06-22 12:12:36 on branch trunk — Rework exceptions.

    This mostly removes the argument for the class in which the exception
    occurred. As backtraces were recently added for all platforms, the
    passed class does not give any extra information on where the exception
    occurred anymore.

    This also removes a few other arguments which were not too helpful. In
    the past, the idea was to pass as many arguments as possible so that it
    is easier to find the origin of the exception. However, as backtraces
    are a much better way to find the origin, those are not useful anymore
    and just make the exception more cumbersome to use. The rule is now to
    only pass arguments that might help in recovering from the exception or
    provide information that is otherwise not easily accessible. (user: js, size: 11311) [annotate] [blame] [check-ins using]


388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
	    !ReadFile(_readPipe[0], buffer, length, &ret, NULL)) {
		if (GetLastError() == ERROR_BROKEN_PIPE) {
			_atEndOfStream = true;
			return 0;
		}

#endif
		@throw [OFReadFailedException exceptionWithClass: [self class]
							  stream: self
						 requestedLength: length];
	}

	if (ret == 0)
		_atEndOfStream = true;

	return ret;
}







|
<
|







388
389
390
391
392
393
394
395

396
397
398
399
400
401
402
403
	    !ReadFile(_readPipe[0], buffer, length, &ret, NULL)) {
		if (GetLastError() == ERROR_BROKEN_PIPE) {
			_atEndOfStream = true;
			return 0;
		}

#endif
		@throw [OFReadFailedException exceptionWithStream: self

						  requestedLength: length];
	}

	if (ret == 0)
		_atEndOfStream = true;

	return ret;
}
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
#else
	DWORD ret;

	if (_writePipe[1] == NULL || _atEndOfStream ||
	    !WriteFile(_writePipe[1], buffer, length, &ret, NULL) ||
	    ret < length)
#endif
		@throw [OFWriteFailedException exceptionWithClass: [self class]
							   stream: self
						  requestedLength: length];
}

- (int)fileDescriptorForReading
{
#ifndef _WIN32
	return _readPipe[0];
#else







|
<
|







411
412
413
414
415
416
417
418

419
420
421
422
423
424
425
426
#else
	DWORD ret;

	if (_writePipe[1] == NULL || _atEndOfStream ||
	    !WriteFile(_writePipe[1], buffer, length, &ret, NULL) ||
	    ret < length)
#endif
		@throw [OFWriteFailedException exceptionWithStream: self

						   requestedLength: length];
}

- (int)fileDescriptorForReading
{
#ifndef _WIN32
	return _readPipe[0];
#else