Differences From Artifact [e3e9e24720]:
- File
src/OFStream.m
— part of check-in
[da2701ad14]
at
2011-07-17 01:55:16
on branch trunk
— Define __NO_EXT_QNX in files using unistd.h or fcntl.h.
Without this, the headers try to declare functions that use __block as
an argument name and thus fail to compile when using -fblocks. (user: js, size: 25828) [annotate] [blame] [check-ins using]
To Artifact [da83014b0a]:
- File src/OFStream.m — part of check-in [e6fd39d11e] at 2011-09-12 19:57:39 on branch trunk — Rename -[cString] to -[UTF8String]. (user: js, size: 25873) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
666 667 668 669 670 671 672 | return [self readTillDelimiter: delimiter withEncoding: OF_STRING_ENCODING_UTF_8]; } - (OFString*)readTillDelimiter: (OFString*)delimiter withEncoding: (of_string_encoding_t)encoding { | | | | | | 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 | return [self readTillDelimiter: delimiter withEncoding: OF_STRING_ENCODING_UTF_8]; } - (OFString*)readTillDelimiter: (OFString*)delimiter withEncoding: (of_string_encoding_t)encoding { const char *delimiterUTF8String; size_t i, j, delimiterLength, bufferLength, retLength; char *retCString, *buffer, *newCache; OFString *ret; /* FIXME: Convert delimiter to specified charset */ delimiterUTF8String = [delimiter UTF8String]; delimiterLength = [delimiter UTF8StringLength]; j = 0; if (delimiterLength == 0) @throw [OFInvalidArgumentException newWithClass: isa selector: _cmd]; /* Look if there's something in our cache */ if (cache != NULL) { for (i = 0; i < cacheLength; i++) { if (cache[i] != delimiterUTF8String[j++]) j = 0; if (j == delimiterLength || cache[i] == '\0') { if (cache[i] == '\0') delimiterLength = 1; ret = [OFString |
︙ | ︙ | |||
735 736 737 738 739 740 741 | } bufferLength = [self _readNBytes: of_pagesize intoBuffer: buffer]; /* Look if there's the delimiter or \0 */ for (i = 0; i < bufferLength; i++) { | | | 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 | } bufferLength = [self _readNBytes: of_pagesize intoBuffer: buffer]; /* Look if there's the delimiter or \0 */ for (i = 0; i < bufferLength; i++) { if (buffer[i] != delimiterUTF8String[j++]) j = 0; if (j == delimiterLength || buffer[i] == '\0') { if (buffer[i] == '\0') delimiterLength = 1; retLength = cacheLength + i + 1 - |
︙ | ︙ | |||
1242 1243 1244 1245 1246 1247 1248 | fromBuffer: [dataArray cArray]]; return [dataArray count] * [dataArray itemSize]; } - (size_t)writeString: (OFString*)string { | | | | | | 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 | fromBuffer: [dataArray cArray]]; return [dataArray count] * [dataArray itemSize]; } - (size_t)writeString: (OFString*)string { size_t length = [string UTF8StringLength]; [self writeNBytes: length fromBuffer: [string UTF8String]]; return length; } - (size_t)writeLine: (OFString*)string { size_t stringLength = [string UTF8StringLength]; char *buffer; buffer = [self allocMemoryWithSize: stringLength + 1]; @try { memcpy(buffer, [string UTF8String], stringLength); buffer[stringLength] = '\n'; [self writeNBytes: stringLength + 1 fromBuffer: buffer]; } @finally { [self freeMemory: buffer]; } |
︙ | ︙ | |||
1286 1287 1288 1289 1290 1291 1292 | return ret; } - (size_t)writeFormat: (OFConstantString*)format withArguments: (va_list)arguments { | | | | | | 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 | return ret; } - (size_t)writeFormat: (OFConstantString*)format withArguments: (va_list)arguments { char *UTF8String; int length; if (format == nil) @throw [OFInvalidArgumentException newWithClass: isa selector: _cmd]; if ((length = of_vasprintf(&UTF8String, [format UTF8String], arguments)) == -1) @throw [OFInvalidFormatException newWithClass: isa]; @try { [self writeNBytes: length fromBuffer: UTF8String]; } @finally { free(UTF8String); } return length; } - (size_t)pendingBytes { |
︙ | ︙ |