]> xenbits.xen.org Git - xenclient/ruby-dbus.git/commitdiff
Support for ruby 1.9.
authorJean Guyader <jean.guyader@eu.citrix.com>
Fri, 19 Jun 2009 13:25:53 +0000 (14:25 +0100)
committerJean Guyader <jean.guyader@eu.citrix.com>
Fri, 19 Jun 2009 13:25:53 +0000 (14:25 +0100)
  In ruby 1.9 "hello"[1] -> "e"
  In ruby 1.8 "hello"[1] -> 101

lib/dbus/auth.rb
lib/dbus/marshall.rb

index 42a3243b522a214b2ba2a215c6e6a69cec3eca11..9ae515a6b569c95a270c1f953446dc4ae5067029 100644 (file)
@@ -30,7 +30,7 @@ module DBus
       # obtain for "1000" => 31303030 This is what the server is expecting.
       # Why? I dunno. How did I come to that conclusion? by looking at rbus
       # code. I have no idea how he found that out.
-      return Process.uid.to_s.split(//).collect { |a| "%x" % a[0] }.join
+      return Process.uid.to_s.split(//).collect { |a| "%x" % a[0].ord }.join
     end
   end
 
index 23a0f3b4bd44b19a5daa42f0ca1ccb88df43037a..c2426d43396d437592f4ef6881748cd73280936b 100644 (file)
@@ -94,7 +94,7 @@ module DBus
 
     # Retrieve the series of bytes until the next NULL (\0) byte.
     def get_nul_terminated
-      raise IncompleteBufferException if not @buffy[@idx..-1] =~ /^([^\0]*)\0/
+      raise IncompleteBufferException if not @buffy[@idx..-1].ord =~ /^([^\0]*)\0/
       str = $1
       raise IncompleteBufferException if @idx + str.size + 1 > @buffy.size
       @idx += str.size + 1
@@ -109,7 +109,7 @@ module DBus
       ret = @buffy.slice(@idx, str_sz)
       raise IncompleteBufferException if @idx + str_sz + 1 > @buffy.size
       @idx += str_sz
-      if @buffy[@idx] != 0
+      if @buffy[@idx].ord != 0
         raise InvalidPacketException, "String is not nul-terminated"
       end
       @idx += 1
@@ -124,7 +124,7 @@ module DBus
       ret = @buffy.slice(@idx, str_sz)
       raise IncompleteBufferException if @idx + str_sz + 1 >= @buffy.size
       @idx += str_sz
-      if @buffy[@idx] != 0
+      if @buffy[@idx].ord != 0
         raise InvalidPacketException, "Type is not nul-terminated"
       end
       @idx += 1