[libbluray-devel] register number is unsigned

hpi1 git at videolan.org
Thu May 4 13:46:57 CEST 2017


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Thu May  4 14:26:02 2017 +0300| [aacb78329f46eee9e17651954ca131a8693e2e46] | committer: hpi1

register number is unsigned

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=aacb78329f46eee9e17651954ca131a8693e2e46
---

 src/libbluray/register.c | 20 ++++++++++----------
 src/libbluray/register.h | 16 ++++++++--------
 2 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/src/libbluray/register.c b/src/libbluray/register.c
index 60bd06c2..731a3927 100644
--- a/src/libbluray/register.c
+++ b/src/libbluray/register.c
@@ -362,9 +362,9 @@ void bd_psr_restore_state(BD_REGISTERS *p)
  * GPR read / write
  */
 
-int bd_gpr_write(BD_REGISTERS *p, int reg, uint32_t val)
+int bd_gpr_write(BD_REGISTERS *p, unsigned int reg, uint32_t val)
 {
-    if (reg < 0 || reg >= BD_GPR_COUNT) {
+    if (reg >= BD_GPR_COUNT) {
         BD_DEBUG(DBG_BLURAY, "bd_gpr_write(%d): invalid register\n", reg);
         return -1;
     }
@@ -373,9 +373,9 @@ int bd_gpr_write(BD_REGISTERS *p, int reg, uint32_t val)
     return 0;
 }
 
-uint32_t bd_gpr_read(BD_REGISTERS *p, int reg)
+uint32_t bd_gpr_read(BD_REGISTERS *p, unsigned int reg)
 {
-    if (reg < 0 || reg >= BD_GPR_COUNT) {
+    if (reg >= BD_GPR_COUNT) {
         BD_DEBUG(DBG_BLURAY, "bd_gpr_read(%d): invalid register\n", reg);
         return 0;
     }
@@ -387,11 +387,11 @@ uint32_t bd_gpr_read(BD_REGISTERS *p, int reg)
  * PSR read / write
  */
 
-uint32_t bd_psr_read(BD_REGISTERS *p, int reg)
+uint32_t bd_psr_read(BD_REGISTERS *p, unsigned int reg)
 {
     uint32_t val;
 
-    if (reg < 0 || reg >= BD_PSR_COUNT) {
+    if (reg >= BD_PSR_COUNT) {
         BD_DEBUG(DBG_BLURAY, "bd_psr_read(%d): invalid register\n", reg);
         return -1;
     }
@@ -405,9 +405,9 @@ uint32_t bd_psr_read(BD_REGISTERS *p, int reg)
     return val;
 }
 
-int bd_psr_setting_write(BD_REGISTERS *p, int reg, uint32_t val)
+int bd_psr_setting_write(BD_REGISTERS *p, unsigned int reg, uint32_t val)
 {
-    if (reg < 0 || reg >= BD_PSR_COUNT) {
+    if (reg >= BD_PSR_COUNT) {
         BD_DEBUG(DBG_BLURAY, "bd_psr_write(%d, %d): invalid register\n", reg, val);
         return -1;
     }
@@ -447,7 +447,7 @@ int bd_psr_setting_write(BD_REGISTERS *p, int reg, uint32_t val)
     return 0;
 }
 
-int bd_psr_write(BD_REGISTERS *p, int reg, uint32_t val)
+int bd_psr_write(BD_REGISTERS *p, unsigned int reg, uint32_t val)
 {
     if ((reg == 13) ||
         (reg >= 15 && reg <= 21) ||
@@ -461,7 +461,7 @@ int bd_psr_write(BD_REGISTERS *p, int reg, uint32_t val)
   return bd_psr_setting_write(p, reg, val);
 }
 
-int bd_psr_write_bits(BD_REGISTERS *p, int reg, uint32_t val, uint32_t mask)
+int bd_psr_write_bits(BD_REGISTERS *p, unsigned int reg, uint32_t val, uint32_t mask)
 {
     int result;
 
diff --git a/src/libbluray/register.h b/src/libbluray/register.h
index e2638559..757eeb4a 100644
--- a/src/libbluray/register.h
+++ b/src/libbluray/register.h
@@ -104,7 +104,7 @@ BD_PRIVATE void bd_registers_free(BD_REGISTERS *);
  * @param reg  register number
  * @return value stored in register, -1 on error (invalid register number)
  */
-uint32_t bd_gpr_read(BD_REGISTERS *, int reg);
+uint32_t bd_gpr_read(BD_REGISTERS *, unsigned int reg);
 
 /**
  *
@@ -115,7 +115,7 @@ uint32_t bd_gpr_read(BD_REGISTERS *, int reg);
  * @param val  new value for register
  * @return 0 on success, -1 on error (invalid register number)
  */
-int bd_gpr_write(BD_REGISTERS *, int reg, uint32_t val);
+int bd_gpr_write(BD_REGISTERS *, unsigned int reg, uint32_t val);
 
 
 /*
@@ -130,7 +130,7 @@ int bd_gpr_write(BD_REGISTERS *, int reg, uint32_t val);
  * @param reg  register number
  * @return value stored in register, -1 on error (invalid register number)
  */
-uint32_t bd_psr_read(BD_REGISTERS *, int reg);
+uint32_t bd_psr_read(BD_REGISTERS *, unsigned int reg);
 
 /**
  *
@@ -143,7 +143,7 @@ uint32_t bd_psr_read(BD_REGISTERS *, int reg);
  * @param val  new value for register
  * @return 0 on success, -1 on error (invalid register number)
  */
-int bd_psr_write(BD_REGISTERS *, int reg, uint32_t val);
+int bd_psr_write(BD_REGISTERS *, unsigned int reg, uint32_t val);
 
 /**
  *
@@ -159,7 +159,7 @@ int bd_psr_write(BD_REGISTERS *, int reg, uint32_t val);
  * @param mask  bit mask. bits to be written are set to 1.
  * @return 0 on success, -1 on error (invalid register number)
  */
-BD_PRIVATE int bd_psr_write_bits(BD_REGISTERS *, int reg, uint32_t val, uint32_t mask);
+BD_PRIVATE int bd_psr_write_bits(BD_REGISTERS *, unsigned int reg, uint32_t val, uint32_t mask);
 
 /**
  *
@@ -172,7 +172,7 @@ BD_PRIVATE int bd_psr_write_bits(BD_REGISTERS *, int reg, uint32_t val, uint32_t
  * @param val  new value for register
  * @return 0 on success, -1 on error (invalid register number)
  */
-BD_PRIVATE int bd_psr_setting_write(BD_REGISTERS *, int reg, uint32_t val);
+BD_PRIVATE int bd_psr_setting_write(BD_REGISTERS *, unsigned int reg, uint32_t val);
 
 /**
  *
@@ -234,9 +234,9 @@ BD_PRIVATE void bd_psr_reset_backup_registers(BD_REGISTERS *);
 
 /* event data */
 typedef struct {
-    int      ev_type; /* event type */
+    unsigned ev_type; /* event type */
 
-    int      psr_idx; /* register index */
+    unsigned psr_idx; /* register index */
     uint32_t old_val; /* old value of register */
     uint32_t new_val; /* new value of register */
 } BD_PSR_EVENT;



More information about the libbluray-devel mailing list