aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2013-04-02 21:15:14 -0700
committerH. Peter Anvin <hpa@zytor.com>2013-04-02 21:15:14 -0700
commit1c96b61d4076b3821d855ddf589db80c18d59ee9 (patch)
treeebb324276e23d34677aa1259a2d195604a79fdf8
parent8e927a77d83e5182baff3ab152696065c3b50345 (diff)
downloadsyslinux-1c96b61d4076b3821d855ddf589db80c18d59ee9.tar.gz
syslinux-1c96b61d4076b3821d855ddf589db80c18d59ee9.tar.xz
syslinux-1c96b61d4076b3821d855ddf589db80c18d59ee9.zip
iso9660: use generic get_le32() accessor in SUSP/Rock Ridge code
Use the new get_le32() accessor in the SUSP/Rock Ridge code. Signed-off-by: H. Peter Anvin <hpa@zytor.com> Cc: Thomas Schmitt <scdbackup@gmx.net>
-rw-r--r--core/fs/iso9660/susp_rr.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/core/fs/iso9660/susp_rr.c b/core/fs/iso9660/susp_rr.c
index e758586f..bbeae975 100644
--- a/core/fs/iso9660/susp_rr.c
+++ b/core/fs/iso9660/susp_rr.c
@@ -30,6 +30,7 @@
#include <cache.h>
#include <disk.h>
#include <fs.h>
+#include <byteswap.h>
#include "iso9660_fs.h"
#else /* ! Isolinux_rockridge_in_libisofS */
@@ -99,15 +100,9 @@ static int susp_rr_is_out_of_mem(void *pt)
}
-static uint32_t susp_rr_read_lsb(uint8_t *buf, int bytes)
+static uint32_t susp_rr_read_lsb32(const void *buf)
{
- int i;
- uint32_t ret = 0;
-
- for (i = 0; i < bytes; i++) {
- ret += ((uint32_t) buf[i]) << (i * 8);
- }
- return ret;
+ return get_le32(buf);
}
@@ -274,9 +269,9 @@ static int susp_rr_iterate(struct susp_rr_iter *iter, char **pos_pt)
}
/* Register address data of next Continuation Area */
u_entry = (uint8_t *) entries;
- iter->next_lba = susp_rr_read_lsb(u_entry + 4, 4);
- iter->next_offset = susp_rr_read_lsb(u_entry + 12, 4);
- iter->next_length = susp_rr_read_lsb(u_entry + 20, 4);
+ iter->next_lba = susp_rr_read_lsb32(u_entry + 4);
+ iter->next_offset = susp_rr_read_lsb32(u_entry + 12);
+ iter->next_length = susp_rr_read_lsb32(u_entry + 20);
}
*pos_pt = entries;
@@ -461,7 +456,7 @@ int susp_rr_check_signatures(struct fs_info *fs, int flag)
#endif /* Isolinux_rockridge_in_libisofS */
/* Obtain first dir_rec of root directory */
- lba = susp_rr_read_lsb(((uint8_t *) &(sbi->root)) + 2, 4);
+ lba = susp_rr_read_lsb32(((uint8_t *) &(sbi->root)) + 2);
dir_rec = (char *) get_cache(fs->fs_dev, lba);
if (dir_rec == NULL)
goto no_susp;