ObjFW  Diff

Differences From Artifact [fef21b43fd]:

To Artifact [831a79cc1f]:


372
373
374
375
376
377
378
379

380
381
382
383
384
385
386
387
388
389
390
391
372
373
374
375
376
377
378

379
380
381
382


383
384
385
386
387
388
389







-
+



-
-







	if (fd == -1 || eos || (ret = write(fd, buf, size)) < size)
		@throw [OFWriteFailedException newWithClass: isa
						       size: size];

	return ret;
}

- _seekToOffset: (off_t)offset
- (void)_seekToOffset: (off_t)offset
{
	if (lseek(fd, offset, SEEK_SET) == -1)
		@throw [OFSeekFailedException newWithClass: isa];

	return self;
}

- (size_t)_seekForwardWithOffset: (off_t)offset
{
	off_t ret;

	if ((ret = lseek(fd, offset, SEEK_CUR)) == -1)
400
401
402
403
404
405
406
407

408
409
410
411
412
413
414
415
416
417
418
419
420
398
399
400
401
402
403
404

405
406
407
408
409


410
411
412
413
414
415
416







-
+




-
-








	if ((ret = lseek(fd, offset, SEEK_END)) == -1)
		@throw [OFSeekFailedException newWithClass: isa];

	return ret;
}

- close
- (void)close
{
	if (fd != -1)
		close(fd);
	fd = -1;

	return self;
}

- (void)dealloc
{
	if (closable && fd != -1)
		close(fd);