[libbluray-devel] DiscImpl: remove leading zeros from Disc ID

hpi1 git at videolan.org
Mon Nov 3 10:14:01 CET 2014


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Thu Oct 30 13:35:29 2014 +0200| [096b09ac9f103523e506e912ea32ce99a69862c5] | committer: hpi1

DiscImpl: remove leading zeros from Disc ID

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

 src/libbluray/bdj/java/org/bluray/ti/DiscImpl.java |   14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/libbluray/bdj/java/org/bluray/ti/DiscImpl.java b/src/libbluray/bdj/java/org/bluray/ti/DiscImpl.java
index cf5bf3c..5de8702 100644
--- a/src/libbluray/bdj/java/org/bluray/ti/DiscImpl.java
+++ b/src/libbluray/bdj/java/org/bluray/ti/DiscImpl.java
@@ -20,10 +20,22 @@ package org.bluray.ti;
 
 public class DiscImpl implements Disc {
     DiscImpl(String id) {
-        this.id = id;
+        /* strip leading zeros */
+        int i;
+        for (i = 0; i < id.length(); i++) {
+            if (id.charAt(i) != '0')
+                break;
+        }
+        this.id = id.substring(i);
+        if (this.id.length() < 1) {
+            this.id = id;
+            org.videolan.Logger.getLogger("DiscImpl").error("Invalid Disc ID " + this.id);
+        }
     }
 
     public String getId() {
+        /* Returns the 128-bit identifier of this disc (from id.bdmv), without leading zeros.
+           Each character in the String represents 4 bits. */
         return id;
     }
 



More information about the libbluray-devel mailing list