[matroska] r761 - trunk/RbMatroska

[email protected]
Newsgroups gmane.comp.multimedia.matroska.cvs
Message-ID <[email protected]>
Author: mosu
Date: 2004-09-08 20:27:18 +0400 (Wed, 08 Sep 2004)
New Revision: 761

Modified:
   trunk/RbMatroska/ebml.rb
Log:
Added a global "no EBML id" element to Ebml::Id. Raise an exception if map_ids has not been called prior to reading elements.

Modified: trunk/RbMatroska/ebml.rb
===================================================================
--- trunk/RbMatroska/ebml.rb	2004-09-08 16:25:20 UTC (rev 760)
+++ trunk/RbMatroska/ebml.rb	2004-09-08 16:27:18 UTC (rev 761)
@@ -62,6 +62,11 @@
       format = "(0x%0" + (@size * 2).to_s + "x, %d)"
       return sprintf(format, @value, @size)
     end
+
+    def Id.none
+      @@none = Id.new(-1, -1)
+      return @@none
+    end
   end                           # class Id
 
   class Element
@@ -80,8 +85,7 @@
     end
 
     def Element.global_id
-      @@no_id ||= Id.new(0, 0)
-      return @@no_id
+      return Id.none
     end
 
     def skip(ef)
@@ -333,6 +337,7 @@
     end
 
     def find_class_for_id(id)
+      raise Error, "IDs not mapped" unless (@id_mapping)
       return @id_mapping[id.value] if (@id_mapping.has_key?(id.value))
       return Element
     end
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.