Gentoo Archives: gentoo-commits

From: "Hans de Graaff (graaff)" <graaff@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in dev-ruby/sqlite-ruby/files: sqlite-ruby-2.2.3-19compat.patch
Date: Sat, 30 Jan 2010 09:15:06
Message-Id: E1Nb9Pz-0000nu-5d@stork.gentoo.org
1 graaff 10/01/30 09:15:03
2
3 Added: sqlite-ruby-2.2.3-19compat.patch
4 Log:
5 Convert to ruby-fakegem. Apply ruby19 patch from ruby overlay.
6 (Portage version: 2.1.7.16/cvs/Linux x86_64)
7
8 Revision Changes Path
9 1.1 dev-ruby/sqlite-ruby/files/sqlite-ruby-2.2.3-19compat.patch
10
11 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-ruby/sqlite-ruby/files/sqlite-ruby-2.2.3-19compat.patch?rev=1.1&view=markup
12 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-ruby/sqlite-ruby/files/sqlite-ruby-2.2.3-19compat.patch?rev=1.1&content-type=text/plain
13
14 Index: sqlite-ruby-2.2.3-19compat.patch
15 ===================================================================
16 diff -ru a/ext/sqlite-api.c b/ext/sqlite-api.c
17 --- a/ext/sqlite-api.c 1970-01-01 01:00:00.000000000 +0100
18 +++ b/ext/sqlite-api.c 2008-10-01 14:23:25.000000000 +0200
19 @@ -67,6 +67,12 @@
20 /* special macro for helping RDoc to ignore "section"-level comments. */
21 #define NO_RDOC
22
23 +/* Ruby 1.9 compatiblity */
24 +#ifndef RSTRING_LEN
25 +#define RSTRING_LEN(str) RSTRING(str)->len
26 +#define RSTRING_PTR(str) RSTRING(str)->ptr
27 +#endif
28 +
29 /*>=-----------------------------------------------------------------------=<*
30 * CONSTANTS
31 * ------------------------------------------------------------------------
32 @@ -780,8 +786,8 @@
33 {
34 case T_STRING:
35 sqlite_set_result_string( func_ptr,
36 - RSTRING(result)->ptr,
37 - RSTRING(result)->len );
38 + RSTRING_PTR(result),
39 + RSTRING_LEN(result) );
40 break;
41
42 case T_FIXNUM:
43 @@ -817,8 +823,8 @@
44 GetFunc( func_ptr, func );
45 Check_Type( string, T_STRING );
46
47 - sqlite_set_result_error( func_ptr, RSTRING(string)->ptr,
48 - RSTRING(string)->len );
49 + sqlite_set_result_error( func_ptr, RSTRING_PTR(string),
50 + RSTRING_LEN(string) );
51
52 return string;
53 }
54 diff -ru a/lib/sqlite/database.rb b/lib/sqlite/database.rb
55 --- a/lib/sqlite/database.rb 1970-01-01 01:00:00.000000000 +0100
56 +++ b/lib/sqlite/database.rb 2008-10-01 16:42:34.000000000 +0200
57 @@ -30,7 +30,6 @@
58 # =============================================================================
59 #++
60
61 -require 'base64'
62 require 'sqlite_api'
63 require 'sqlite/pragmas'
64 require 'sqlite/statement'
65 @@ -85,13 +84,13 @@
66 # Returns a string that represents the serialization of the given object.
67 # The string may safely be used in an SQL statement.
68 def self.encode( object )
69 - Base64.encode64( Marshal.dump( object ) ).strip
70 + [Marshal.dump(object)].pack('m').strip
71 end
72
73 # Unserializes the object contained in the given string. The string must be
74 # one that was returned by #encode.
75 def self.decode( string )
76 - Marshal.load( Base64.decode64( string ) )
77 + Marshal.load( string.unpack('m').first )
78 end
79
80 # Return +true+ if the string is a valid (ie, parsable) SQL statement, and
81 diff -ru a/lib/sqlite/pragmas.rb b/lib/sqlite/pragmas.rb
82 --- a/lib/sqlite/pragmas.rb 1970-01-01 01:00:00.000000000 +0100
83 +++ b/lib/sqlite/pragmas.rb 2008-10-01 16:46:45.000000000 +0200
84 @@ -60,8 +60,8 @@
85 case mode
86 when String
87 case mode.downcase
88 - when "on", "yes", "true", "y", "t": mode = "'ON'"
89 - when "off", "no", "false", "n", "f": mode = "'OFF'"
90 + when "on", "yes", "true", "y", "t" then mode = "'ON'"
91 + when "off", "no", "false", "n", "f" then mode = "'OFF'"
92 else
93 raise Exceptions::DatabaseException,
94 "unrecognized pragma parameter #{mode.inspect}"