ObjFW  Check-in [c509ecf6c7]

Overview
Comment:Flush the write cache before seeking.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: c509ecf6c7b3c8bd90677c3926c39f43e5b77328766e539c66f8ebc8c23af119
User & Date: js on 2010-04-09 17:06:55
Other Links: manifest | tags
Context
2010-04-09
20:11
Rename -[cacheWrites] to -[bufferWrites]. check-in: c5c17fdd30 user: js tags: trunk
17:06
Flush the write cache before seeking. check-in: c509ecf6c7 user: js tags: trunk
15:43
Work around a compiler bug that can happen in the configure script. check-in: 90548e55c8 user: js tags: trunk
Changes

Modified src/OFSeekableStream.m from [2f22e7d287] to [943a2b61b5].

29
30
31
32
33
34
35

36
37
38
39
40
41
42
43
44
45
46
47
48

49
50
51
52
53
54
55
56
57
58
59



60

61
62
63
64
65
66
67
68
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64

65
66
67
68
69
70
71
72
73







+













+











+
+
+
-
+








{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}

- seekToOffset: (off_t)offset
{
	[self flushWriteCache];
	[self _seekToOffset: offset];

	[self freeMemory: cache];
	cache = NULL;
	cache_len = 0;

	return self;
}

- (off_t)seekForwardWithOffset: (off_t)offset
{
	off_t ret;

	[self flushWriteCache];
	ret = [self _seekForwardWithOffset: offset - cache_len];

	[self freeMemory: cache];
	cache = NULL;
	cache_len = 0;

	return ret;
}

- (off_t)seekToOffsetRelativeToEnd: (off_t)offset
{
	off_t ret;

	[self flushWriteCache];
	off_t ret = [self _seekToOffsetRelativeToEnd: offset];
	ret = [self _seekToOffsetRelativeToEnd: offset];

	[self freeMemory: cache];
	cache = NULL;
	cache_len = 0;

	return ret;
}
@end

Modified src/OFStream.m from [0c60b9fcc6] to [7fc39d31ba].

502
503
504
505
506
507
508



509
510
511
512
513
514
515
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518







+
+
+







	use_wcache = YES;

	return self;
}

- flushWriteCache
{
	if (wcache == NULL)
		return self;

	[self _writeNBytes: wcache_len
		fromBuffer: wcache];

	[self freeMemory: wcache];
	wcache = NULL;
	wcache_len = 0;
	use_wcache = NO;