Differences From Artifact [3f64dd68d8]:
- File
src/OFStream.m
— part of check-in
[033054ad75]
at
2009-05-29 19:21:57
on branch trunk
— A few renames.
OFExceptions:
* OFNoMemException to OFOutOfMemoryException.
* OFMemNotPartOfObjException to OFMemoryNotPartOfObjectException.OFObject:
* -[addItemToMemoryPool:] to -[addMemoryToPool:].
* -[allocWithSize:] to -[allocMemoryWithSize:].
* -[allocNItems:withSize] to -[allocMemoryForNItems:withSize:].
* -[resizeMem:toSize] to -[resizeMemory:toSize:].
* -[resizeMem:toNItems:withSize:] to
-[resizeMemoryToNItems:withSize:].
* -[freeMem] to -[freeMemory:].OFString:
* -[urlencode] to -[urlEncodedString].
* -[urldecode] to -[urlDecodedString]. (user: js, size: 3921) [annotate] [blame] [check-ins using]
To Artifact [a25cf5ad1f]:
- File src/OFStream.m — part of check-in [f1dae95070] at 2009-06-02 19:25:36 on branch trunk — Improve -[readLine] in OFStream. (user: js, size: 4451) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
41 42 43 44 45 46 47 48 49 50 51 52 53 54 | GetSystemInfo(&si); pagesize = si.dwPageSize - 1; } #endif return self; } - (size_t)readNBytes: (size_t)size intoBuffer: (char*)buf { @throw [OFNotImplementedException newWithClass: isa andSelector: _cmd]; } | > > > > > > | 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | GetSystemInfo(&si); pagesize = si.dwPageSize - 1; } #endif return self; } - (BOOL)atEndOfStream { @throw [OFNotImplementedException newWithClass: isa andSelector: _cmd]; } - (size_t)readNBytes: (size_t)size intoBuffer: (char*)buf { @throw [OFNotImplementedException newWithClass: isa andSelector: _cmd]; } |
︙ | ︙ | |||
93 94 95 96 97 98 99 100 101 102 103 104 105 106 | } } /* Read until we get a newline or \0 */ tmp = [self allocMemoryWithSize: pagesize]; for (;;) { @try { len = [self readNBytes: pagesize - 1 intoBuffer: tmp]; } @catch (OFException *e) { [self freeMemory: tmp]; @throw e; } | > > > > > > > > > > > > > > > > > > > > > > > | 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | } } /* 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_c = [self allocMemoryWithSize: cache_len + 1]; memcpy(ret_c, cache, cache_len); ret_c[cache_len] = '\0'; @try { ret = [OFString stringWithCString: ret_c]; } @finally { [self freeMemory: ret_c]; } [self freeMemory: cache]; cache = NULL; cache_len = 0; return ret; } @try { len = [self readNBytes: pagesize - 1 intoBuffer: tmp]; } @catch (OFException *e) { [self freeMemory: tmp]; @throw e; } |
︙ | ︙ | |||
115 116 117 118 119 120 121 | } @catch (OFException *e) { [self freeMemory: tmp]; @throw e; } if (cache != NULL) memcpy(ret_c, cache, cache_len); memcpy(ret_c + cache_len, tmp, i); | | | 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | } @catch (OFException *e) { [self freeMemory: tmp]; @throw e; } if (cache != NULL) memcpy(ret_c, cache, cache_len); memcpy(ret_c + cache_len, tmp, i); ret_c[cache_len + i] = '\0'; if (i < len) { @try { tmp2 = [self allocMemoryWithSize: len - i - 1]; } @catch (OFException *e) { |
︙ | ︙ | |||
139 140 141 142 143 144 145 | cache_len = len - i - 1; } else { if (cache != NULL) [self freeMemory: cache]; cache = NULL; cache_len = 0; } | < > | 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | cache_len = len - i - 1; } else { if (cache != NULL) [self freeMemory: cache]; cache = NULL; cache_len = 0; } [self freeMemory: tmp]; @try { ret = [OFString stringWithCString: ret_c]; } @finally { [self freeMemory: ret_c]; } return ret; |
︙ | ︙ |