Home | History | Annotate | Download | only in mac

Lines Matching refs:offset

92   off_t offset;
93 if (FindHeader(valid_cpu_type, valid_cpu_subtype, offset)) {
95 return WalkHeader64AtOffset(offset);
97 return WalkHeaderAtOffset(offset);
103 bool MachoWalker::ReadBytes(void *buffer, size_t size, off_t offset) {
105 if (offset < 0)
108 if (offset + size > memory_size_) {
109 if (static_cast<size_t>(offset) >= memory_size_)
111 size = memory_size_ - static_cast<size_t>(offset);
114 memcpy(buffer, static_cast<char *>(memory_) + offset, size);
117 return pread(file_, buffer, size, offset) == (ssize_t)size;
121 bool MachoWalker::CurrentHeader(struct mach_header_64 *header, off_t *offset) {
124 *offset = current_header_offset_;
133 off_t &offset) {
139 offset = sizeof(magic);
167 offset = 0;
171 offset = 0;
173 if (!ReadBytes(&fat, sizeof(fat), offset))
179 offset += sizeof(fat);
184 if (!ReadBytes(&arch, sizeof(arch), offset))
193 offset = arch.offset;
197 offset += sizeof(arch);
204 bool MachoWalker::WalkHeaderAtOffset(off_t offset) {
206 if (!ReadBytes(&header, sizeof(header), offset))
221 current_header_offset_ = offset;
222 offset += current_header_size_;
223 bool result = WalkHeaderCore(offset, header.ncmds, swap);
230 bool MachoWalker::WalkHeader64AtOffset(off_t offset) {
232 if (!ReadBytes(&header, sizeof(header), offset))
241 current_header_offset_ = offset;
242 offset += current_header_size_;
243 bool result = WalkHeaderCore(offset, header.ncmds, swap);
250 bool MachoWalker::WalkHeaderCore(off_t offset, uint32_t number_of_commands,
254 if (!ReadBytes(&cmd, sizeof(cmd), offset))
261 if (callback_ && !callback_(this, &cmd, offset, swap, callback_context_))
264 offset += cmd.cmdsize;