libcdio-devel
[Top][All Lists]
Advanced

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

[Libcdio-devel] [PATCH v2 1/2] Clean up rock.h and fix the use of signed


From: Pete Batard
Subject: [Libcdio-devel] [PATCH v2 1/2] Clean up rock.h and fix the use of signed chars in iso_su_ce_s
Date: Sat, 18 Mar 2023 22:26:32 +0000
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0

Using char's for extent, offset and size could result in from_733() sign-
extending the returned value, which means that processing an offset like
0xc4000000000000c4 would return 0xffffffc4 instead of 0x000000c4.
Also harmonize to always use stdint types where possible.
---
 include/cdio/rock.h | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/include/cdio/rock.h b/include/cdio/rock.h
index 33774c7a..548228bf 100644
--- a/include/cdio/rock.h
+++ b/include/cdio/rock.h
@@ -98,23 +98,23 @@ 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];
+  uint8_t       extent[8];
+  uint8_t       offset[8];
+  uint8_t       size[8];
 } iso_su_ce_t;
  /*! POSIX file attributes, PX. See Rock Ridge Section 4.1.2 */
@@ -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 ;
 -- 2.39.1.windows.1




reply via email to

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