comparison src/libpst.c @ 58:a8b772313ff4

fixup debug messages #llx rather than #x, fix 7c block documentation to match code
author Carl Byington <carl@five-ten-sg.com>
date Wed, 06 Feb 2008 23:05:56 -0800
parents 034641c26ab9
children 7d5c637aaafb
comparison
equal deleted inserted replaced
57:de3753c3160a 58:a8b772313ff4
1494 DEBUG_RET(); 1494 DEBUG_RET();
1495 return NULL; 1495 return NULL;
1496 } 1496 }
1497 1497
1498 if (pst_getBlockOffsetPointer(pf, i2_head, &subblocks, table_rec.value, &block_offset5)) { 1498 if (pst_getBlockOffsetPointer(pf, i2_head, &subblocks, table_rec.value, &block_offset5)) {
1499 DEBUG_WARN(("internal error (7c.5b.desc offset %#x) in reading block id %#llx\n", table_rec.value, block_id)); 1499 DEBUG_WARN(("internal error (7c.b5.desc offset %#x) in reading block id %#llx\n", table_rec.value, block_id));
1500 freeall(&subblocks, &block_offset1, &block_offset2, &block_offset3, &block_offset4, &block_offset5, &block_offset6, &block_offset7); 1500 freeall(&subblocks, &block_offset1, &block_offset2, &block_offset3, &block_offset4, &block_offset5, &block_offset6, &block_offset7);
1501 DEBUG_RET(); 1501 DEBUG_RET();
1502 return NULL; 1502 return NULL;
1503 } 1503 }
1504 num_recs = (block_offset5.to - block_offset5.from) / 6; // this will give the number of records in this block 1504 num_recs = (block_offset5.to - block_offset5.from) / 6; // this will give the number of records in this block
4141 * @return size of block read into memory 4141 * @return size of block read into memory
4142 */ 4142 */
4143 size_t pst_read_block_size(pst_file *pf, off_t offset, size_t size, char **buf) { 4143 size_t pst_read_block_size(pst_file *pf, off_t offset, size_t size, char **buf) {
4144 size_t rsize; 4144 size_t rsize;
4145 DEBUG_ENT("pst_read_block_size"); 4145 DEBUG_ENT("pst_read_block_size");
4146 DEBUG_READ(("Reading block from %#x, %i bytes\n", offset, size)); 4146 DEBUG_READ(("Reading block from %#llx, %x bytes\n", offset, size));
4147 4147
4148 if (*buf) { 4148 if (*buf) {
4149 DEBUG_READ(("Freeing old memory\n")); 4149 DEBUG_READ(("Freeing old memory\n"));
4150 free(*buf); 4150 free(*buf);
4151 } 4151 }
4153 4153
4154 rsize = pst_getAtPos(pf, offset, *buf, size); 4154 rsize = pst_getAtPos(pf, offset, *buf, size);
4155 if (rsize != size) { 4155 if (rsize != size) {
4156 DEBUG_WARN(("Didn't read all the data. fread returned less [%i instead of %i]\n", rsize, size)); 4156 DEBUG_WARN(("Didn't read all the data. fread returned less [%i instead of %i]\n", rsize, size));
4157 if (feof(pf->fp)) { 4157 if (feof(pf->fp)) {
4158 DEBUG_WARN(("We tried to read past the end of the file at [offset %#x, size %#x]\n", offset, size)); 4158 DEBUG_WARN(("We tried to read past the end of the file at [offset %#llx, size %#x]\n", offset, size));
4159 } else if (ferror(pf->fp)) { 4159 } else if (ferror(pf->fp)) {
4160 DEBUG_WARN(("Error is set on file stream.\n")); 4160 DEBUG_WARN(("Error is set on file stream.\n"));
4161 } else { 4161 } else {
4162 DEBUG_WARN(("I can't tell why it failed\n")); 4162 DEBUG_WARN(("I can't tell why it failed\n"));
4163 } 4163 }