[libbluray-devel] Fixed register read (BD-J)

hpi1 git at videolan.org
Fri Sep 14 09:34:31 CEST 2012


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Fri Sep 14 09:47:49 2012 +0300| [0805331c8aa60a5ec0562145e514e9784a76a46a] | committer: hpi1

Fixed register read (BD-J)
(merge from dslibbluray)

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

 src/libbluray/bdj/java/org/videolan/Libbluray.java |   14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/src/libbluray/bdj/java/org/videolan/Libbluray.java b/src/libbluray/bdj/java/org/videolan/Libbluray.java
index bed21fc..b9cf54b 100644
--- a/src/libbluray/bdj/java/org/videolan/Libbluray.java
+++ b/src/libbluray/bdj/java/org/videolan/Libbluray.java
@@ -135,25 +135,21 @@ public class Libbluray {
         int ret = writePSRN(nativePointer, num, value);
 
         if (ret == -1)
-            throw new IllegalArgumentException("Invalid GPR");
+            throw new IllegalArgumentException("Invalid PSR");
     }
 
     public static int readGPR(int num) {
-        int value = readGPRN(nativePointer, num);
-
-        if (value == -1)
+        if (num < 0 || (num >= 4096))
             throw new IllegalArgumentException("Invalid GPR");
 
-        return value;
+        return readGPRN(nativePointer, num);
     }
 
     public static int readPSR(int num) {
-        int value = readPSRN(nativePointer, num);
-
-        if (value == -1)
+        if (num < 0 || (num >= 128))
             throw new IllegalArgumentException("Invalid PSR");
 
-        return value;
+        return readPSRN(nativePointer, num);
     }
 
     public static Bdjo getBdjo(String name) {



More information about the libbluray-devel mailing list