libcdio-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Libcdio-devel] [PATCH v3 1/2] Clean up rock.h and fix the use of char a


From: Pete Batard
Subject: [Libcdio-devel] [PATCH v3 1/2] Clean up rock.h and fix the use of char arrays in iso_su_ce_s
Date: Wed, 22 Mar 2023 21:02:27 +0000

Using char arrays for extent, offset and size results in from_733()
issues when processing CE data.
Also harmonize to always use stdint types where possible.
---
 include/cdio/rock.h | 20 ++++++++++----------
 lib/iso9660/rock.c  |  6 +++---
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/include/cdio/rock.h b/include/cdio/rock.h
index 33774c7a..ff26835b 100644
--- a/include/cdio/rock.h
+++ b/include/cdio/rock.h
@@ -98,24 +98,24 @@ PRAGMA_BEGIN_PACKED
 
 /*! system-use-sharing protocol */
 typedef struct iso_su_sp_s{
-  unsigned char magic[2];
+  uint8_t       magic[2];
   uint8_t       skip;
 } GNUC_PACKED iso_su_sp_t;
 
 /*! system-use extension record */
 typedef struct iso_su_er_s {
   iso711_t      len_id;  /**< Identifier length. Value 10?. */
-  unsigned char len_des;
-  unsigned char len_src;
+  uint8_t       len_des;
+  uint8_t       len_src;
   iso711_t      ext_ver; /**< Extension version. Value 1? */
-  char data[EMPTY_ARRAY_SIZE];
+  char          data[EMPTY_ARRAY_SIZE];
 } GNUC_PACKED iso_su_er_t;
 
 typedef struct iso_su_ce_s {
-  char extent[8];
-  char offset[8];
-  char size[8];
-} iso_su_ce_t;
+  iso733_t      extent;
+  iso733_t      offset;
+  iso733_t      size;
+} GNUC_PACKED iso_su_ce_t;
 
 /*! POSIX file attributes, PX. See Rock Ridge Section 4.1.2 */
 typedef struct iso_rock_px_s {
@@ -165,7 +165,7 @@ typedef struct iso_rock_sl_part_s {
 
 /*! Symbolic link. See Rock Ridge Section 4.1.3 */
 typedef struct iso_rock_sl_s {
-  unsigned char flags;
+  uint8_t flags;
   iso_rock_sl_part_t link;
 } GNUC_PACKED iso_rock_sl_t ;
 
@@ -184,7 +184,7 @@ typedef enum {
 
 
 typedef struct iso_rock_nm_s {
-  unsigned char flags;
+  uint8_t flags;
   char name[EMPTY_ARRAY_SIZE];
 } GNUC_PACKED iso_rock_nm_t ;
 
diff --git a/lib/iso9660/rock.c b/lib/iso9660/rock.c
index ff420dca..a4353661 100644
--- a/lib/iso9660/rock.c
+++ b/lib/iso9660/rock.c
@@ -107,9 +107,9 @@ realloc_symlink(/*in/out*/ iso9660_stat_t *p_stat, uint8_t 
i_grow)
   void *buffer = NULL
 
 #define CHECK_CE                                \
-  { cont_extent = from_733(*rr->u.CE.extent);   \
-    cont_offset = from_733(*rr->u.CE.offset);   \
-    cont_size = from_733(*rr->u.CE.size);       \
+  { cont_extent = from_733(rr->u.CE.extent);    \
+    cont_offset = from_733(rr->u.CE.offset);    \
+    cont_size = from_733(rr->u.CE.size);        \
     (void)cont_extent; (void)cont_offset, (void)cont_size; }
 
 #define SETUP_ROCK_RIDGE(DE,CHR,LEN)                           \
-- 
2.39.1.windows.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]