Overview
Comment: | Use +[stringWithCString:andLength:] in -[readLine]. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
328decd2470017205af39519a569915d |
User & Date: | js on 2009-07-17 11:25:49 |
Other Links: | manifest | tags |
Context
2009-07-17
| ||
12:41 | Add OFString (OFHashing) category. check-in: d051b1302d user: js tags: trunk | |
11:25 | Use +[stringWithCString:andLength:] in -[readLine]. check-in: 328decd247 user: js tags: trunk | |
2009-07-16
| ||
23:59 | OFConstString: Throw OFNotImplementedException for unavailable methods. check-in: 9bcba32807 user: js tags: trunk | |
Changes
Modified src/OFStream.m from [b556a211fc] to [fc7e1fba0a].
︙ | ︙ | |||
66 67 68 69 70 71 72 | OFString *ret; /* Look if there's a line or \0 in our cache */ if (cache != NULL) { for (i = 0; i < cache_len; i++) { if (OF_UNLIKELY(cache[i] == '\n' || cache[i] == '\0')) { | < | | < < | < < < < | < < < < < < < < < < < | < < < > | 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | OFString *ret; /* Look if there's a line or \0 in our cache */ if (cache != NULL) { for (i = 0; i < cache_len; i++) { if (OF_UNLIKELY(cache[i] == '\n' || cache[i] == '\0')) { ret = [OFString stringWithCString: cache andLength: i]; tmp = [self allocMemoryWithSize: cache_len - i - 1]; memcpy(tmp, cache + i + 1, cache_len - i - 1); [self freeMemory: cache]; cache = tmp; cache_len -= i + 1; return ret; } } } /* Read until we get a newline or \0 */ tmp = [self allocMemoryWithSize: pagesize]; for (;;) { if ([self atEndOfStream]) { [self freeMemory: tmp]; if (cache == NULL) return nil; ret = [OFString stringWithCString: cache andLength: cache_len]; [self freeMemory: cache]; cache = NULL; cache_len = 0; return ret; } |
︙ | ︙ |