patch-libhfsp_src_volume_c 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. $OpenBSD: patch-libhfsp_src_volume_c,v 1.1 2011/02/06 16:03:55 fgsch Exp $
  2. --- libhfsp/src/volume.c.orig Tue Mar 26 18:00:29 2002
  3. +++ libhfsp/src/volume.c Sat Jan 29 06:01:51 2011
  4. @@ -323,7 +323,8 @@ void* volume_writefork(void *p, hfsp_fork_raw* f)
  5. */
  6. static int volume_readbuf(hfsp_vh* vh, void* p)
  7. {
  8. - if ( (vh->signature = bswabU16_inc(p)) != HFSP_VOLHEAD_SIG)
  9. + vh->signature = bswabU16_inc(p);
  10. + if (vh->signature != HFSP_VOLHEAD_SIG)
  11. HFSP_ERROR(-1, "This is not a HFS+ volume");
  12. vh->version = bswabU16_inc(p);
  13. vh->attributes = bswabU32_inc(p);
  14. @@ -345,7 +346,7 @@ static int volume_readbuf(hfsp_vh* vh, void* p)
  15. vh->write_count = bswabU32_inc(p);
  16. vh->encodings_bmp = bswabU64_inc(p);
  17. memcpy(vh->finder_info, p, 32);
  18. - ((char*) p) += 32; // finderinfo is not used by now
  19. + p = (((char *)p) + 32); // finderinfo is not used by now
  20. p = volume_readfork(p, &vh->alloc_file );
  21. p = volume_readfork(p, &vh->ext_file );
  22. p = volume_readfork(p, &vh->cat_file );
  23. @@ -381,7 +382,7 @@ static int volume_writebuf(hfsp_vh* vh, void* p)
  24. bstoreU32_inc(p, vh->write_count );
  25. bstoreU64_inc(p, vh->encodings_bmp );
  26. memcpy(p, vh->finder_info, 32);
  27. - ((char*) p) += 32; // finderinfo is not used by now
  28. + p = (((char *)p) + 32); // finderinfo is not used by now
  29. p = volume_writefork(p, &vh->alloc_file );
  30. p = volume_writefork(p, &vh->ext_file );
  31. p = volume_writefork(p, &vh->cat_file );
  32. @@ -417,12 +418,12 @@ static int volume_read_wrapper(volume * vol, hfsp_vh*
  33. UInt16 embeds, embedl; /* Start/lenght of embedded area in blocks */
  34. - ((char*) p) += 0x12; /* skip unneeded HFS vol fields */
  35. + p = (((char *)p) + 0x12); /* skip unneeded HFS vol fields */
  36. drAlBlkSiz = bswabU32_inc(p); /* offset 0x14 */
  37. - ((char*) p) += 0x4; /* skip unneeded HFS vol fields */
  38. + p = (((char *)p) + 0x4); /* skip unneeded HFS vol fields */
  39. drAlBlSt = bswabU16_inc(p); /* offset 0x1C */
  40. - ((char*) p) += 0x5E; /* skip unneeded HFS vol fields */
  41. + p = (((char *)p) + 0x5E); /* skip unneeded HFS vol fields */
  42. signature = bswabU16_inc(p); /* offset 0x7C, drEmbedSigWord */
  43. if (signature != HFSP_VOLHEAD_SIG)
  44. HFSP_ERROR(-1, "This looks like a normal HFS volume");