Differences From Artifact [466d9af03d]:
- File src/OFData.m — part of check-in [a6f520157a] at 2023-08-08 15:32:43 on branch trunk — A few minor cleanups (user: js, size: 16044) [annotate] [blame] [check-ins using]
To Artifact [c534072540]:
- File
src/OFData.m
— part of check-in
[d1a8c88dc6]
at
2023-08-09 08:14:56
on branch trunk
— Add OFSubdata
This replaces the hack of OFAdjacentData being able to keep a pointer to
the parent. (user: js, size: 16164) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
27 28 29 30 31 32 33 34 35 36 37 38 39 40 | # import "OFFile.h" # import "OFFileManager.h" #endif #import "OFIRI.h" #import "OFIRIHandler.h" #import "OFStream.h" #import "OFString.h" #import "OFSystemInfo.h" #import "OFInvalidArgumentException.h" #import "OFInvalidFormatException.h" #import "OFNotImplementedException.h" #import "OFOutOfMemoryException.h" #import "OFOutOfRangeException.h" | > | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | # import "OFFile.h" # import "OFFileManager.h" #endif #import "OFIRI.h" #import "OFIRIHandler.h" #import "OFStream.h" #import "OFString.h" #import "OFSubdata.h" #import "OFSystemInfo.h" #import "OFInvalidArgumentException.h" #import "OFInvalidFormatException.h" #import "OFNotImplementedException.h" #import "OFOutOfMemoryException.h" #import "OFOutOfRangeException.h" |
︙ | ︙ | |||
559 560 561 562 563 564 565 | OFHashFinalize(&hash); return hash; } - (OFData *)subdataWithRange: (OFRange)range { | < < > > > | | | | | 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 | OFHashFinalize(&hash); return hash; } - (OFData *)subdataWithRange: (OFRange)range { if (range.length > SIZE_MAX - range.location || range.location + range.length > self.count) @throw [OFOutOfRangeException exception]; if (![self isKindOfClass: [OFMutableData class]]) return [[[OFSubdata alloc] initWithData: self range: range] autorelease]; return [OFData dataWithItems: (const unsigned char *)self.items + (range.location * self.itemSize) count: self.count itemSize: self.itemSize]; } - (OFString *)description { OFMutableString *ret = [OFMutableString stringWithString: @"<"]; const unsigned char *items = self.items; size_t count = self.count, itemSize = self.itemSize; |
︙ | ︙ |