autocompl 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/autocompl/repository.rb +11 -1
- data/lib/autocompl/version.rb +1 -1
- data/test/dummy/log/development.log +467 -0
- data/test/dummy/log/test.log +3 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/bin/console +23 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/cache/pg-0.19.0.gem +0 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/cache/pq-0.0.1.gem +0 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/extensions/x86_64-darwin-15/2.3.0-static/pg-0.19.0/gem.build_complete +0 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/extensions/x86_64-darwin-15/2.3.0-static/pg-0.19.0/gem_make.out +78 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/extensions/x86_64-darwin-15/2.3.0-static/pg-0.19.0/mkmf.log +1346 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/extensions/x86_64-darwin-15/2.3.0-static/pg-0.19.0/pg_ext.bundle +0 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/BSDL +22 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ChangeLog +6378 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/Contributors.rdoc +46 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/History.rdoc +363 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/LICENSE +56 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/Manifest.txt +85 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/POSTGRES +23 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/README-OS_X.rdoc +68 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/README-Windows.rdoc +56 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/README.ja.rdoc +14 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/README.rdoc +168 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/Rakefile +216 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/Rakefile.cross +301 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/Makefile +261 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/errorcodes.def +947 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/errorcodes.rb +45 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/errorcodes.txt +467 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/extconf.h +38 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/extconf.rb +112 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/gvl_wrappers.c +13 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/gvl_wrappers.h +257 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/gvl_wrappers.o +0 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/pg.c +667 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/pg.h +395 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/pg.o +0 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/pg_binary_decoder.c +162 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/pg_binary_decoder.o +0 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/pg_binary_encoder.c +162 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/pg_binary_encoder.o +0 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/pg_coder.c +500 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/pg_coder.o +0 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/pg_connection.c +4102 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/pg_connection.o +0 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/pg_copy_coder.c +591 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/pg_copy_coder.o +0 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/pg_errors.c +95 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/pg_errors.o +0 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/pg_ext.bundle +0 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/pg_result.c +1271 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/pg_result.o +0 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/pg_text_decoder.c +421 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/pg_text_decoder.o +0 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/pg_text_encoder.c +683 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/pg_text_encoder.o +0 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/pg_type_map.c +159 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/pg_type_map.o +0 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/pg_type_map_all_strings.c +116 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/pg_type_map_all_strings.o +0 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/pg_type_map_by_class.c +239 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/pg_type_map_by_class.o +0 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/pg_type_map_by_column.c +312 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/pg_type_map_by_column.o +0 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/pg_type_map_by_mri_type.c +284 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/pg_type_map_by_mri_type.o +0 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/pg_type_map_by_oid.c +355 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/pg_type_map_by_oid.o +0 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/pg_type_map_in_ruby.c +299 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/pg_type_map_in_ruby.o +0 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/util.c +149 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/util.h +65 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/util.o +0 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/vc/pg.sln +26 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/vc/pg_18/pg.vcproj +216 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/ext/vc/pg_19/pg_19.vcproj +209 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/lib/pg.rb +64 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/lib/pg/basic_type_mapping.rb +426 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/lib/pg/coder.rb +83 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/lib/pg/connection.rb +271 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/lib/pg/constants.rb +11 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/lib/pg/exceptions.rb +11 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/lib/pg/result.rb +30 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/lib/pg/text_decoder.rb +51 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/lib/pg/text_encoder.rb +35 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/lib/pg/type_map_by_column.rb +15 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/lib/pg_ext.bundle +0 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/sample/array_insert.rb +20 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/sample/async_api.rb +106 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/sample/async_copyto.rb +39 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/sample/async_mixed.rb +56 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/sample/check_conn.rb +21 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/sample/copyfrom.rb +81 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/sample/copyto.rb +19 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/sample/cursor.rb +21 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/sample/disk_usage_report.rb +186 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/sample/issue-119.rb +94 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/sample/losample.rb +69 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/sample/minimal-testcase.rb +17 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/sample/notify_wait.rb +72 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/sample/pg_statistics.rb +294 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/sample/replication_monitor.rb +231 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/sample/test_binary_values.rb +33 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/sample/wal_shipper.rb +434 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/sample/warehouse_partitions.rb +320 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/spec/data/expected_trace.out +26 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/spec/data/random_binary_data +0 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/spec/helpers.rb +352 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/spec/pg/basic_type_mapping_spec.rb +305 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/spec/pg/connection_spec.rb +1676 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/spec/pg/result_spec.rb +449 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/spec/pg/type_map_by_class_spec.rb +138 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/spec/pg/type_map_by_column_spec.rb +222 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/spec/pg/type_map_by_mri_type_spec.rb +136 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/spec/pg/type_map_by_oid_spec.rb +149 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/spec/pg/type_map_in_ruby_spec.rb +164 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/spec/pg/type_map_spec.rb +22 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/spec/pg/type_spec.rb +777 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pg-0.19.0/spec/pg_spec.rb +50 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pq-0.0.1/Gemfile +4 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pq-0.0.1/LICENSE.txt +22 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pq-0.0.1/README.md +76 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pq-0.0.1/Rakefile +1 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pq-0.0.1/bin/console +7 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pq-0.0.1/lib/pq.rb +99 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pq-0.0.1/pq.gemspec +29 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pq-0.0.1/spec/helpers.rb +10 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/gems/pq-0.0.1/spec/queue_spec.rb +84 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/specifications/pg-0.19.0.gemspec +63 -0
- data/test/dummy/vendor/bundle/ruby/2.3.0/specifications/pq-0.0.1.gemspec +49 -0
- metadata +253 -1
@@ -0,0 +1,149 @@
|
|
1
|
+
/*
|
2
|
+
* util.c - Utils for ruby-pg
|
3
|
+
* $Id: util.c,v 5fb9170f6a7d 2015/06/29 11:15:12 kanis $
|
4
|
+
*
|
5
|
+
*/
|
6
|
+
|
7
|
+
#include "pg.h"
|
8
|
+
#include "util.h"
|
9
|
+
|
10
|
+
static const char base64_encode_table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
11
|
+
|
12
|
+
/* Encode _len_ bytes at _in_ as base64 and write output to _out_.
|
13
|
+
*
|
14
|
+
* This encoder runs backwards, so that it is possible to encode a string
|
15
|
+
* in-place (with _out_ == _in_).
|
16
|
+
*/
|
17
|
+
void
|
18
|
+
base64_encode( char *out, char *in, int len)
|
19
|
+
{
|
20
|
+
unsigned char *in_ptr = (unsigned char *)in + len;
|
21
|
+
char *out_ptr = out + BASE64_ENCODED_SIZE(len);
|
22
|
+
int part_len = len % 3;
|
23
|
+
|
24
|
+
if( part_len > 0 ){
|
25
|
+
long byte2 = part_len > 2 ? *--in_ptr : 0;
|
26
|
+
long byte1 = part_len > 1 ? *--in_ptr : 0;
|
27
|
+
long byte0 = *--in_ptr;
|
28
|
+
long triple = (byte0 << 16) + (byte1 << 8) + byte2;
|
29
|
+
|
30
|
+
*--out_ptr = part_len > 2 ? base64_encode_table[(triple >> 0 * 6) & 0x3F] : '=';
|
31
|
+
*--out_ptr = part_len > 1 ? base64_encode_table[(triple >> 1 * 6) & 0x3F] : '=';
|
32
|
+
*--out_ptr = base64_encode_table[(triple >> 2 * 6) & 0x3F];
|
33
|
+
*--out_ptr = base64_encode_table[(triple >> 3 * 6) & 0x3F];
|
34
|
+
}
|
35
|
+
|
36
|
+
while( out_ptr > out ){
|
37
|
+
long byte2 = *--in_ptr;
|
38
|
+
long byte1 = *--in_ptr;
|
39
|
+
long byte0 = *--in_ptr;
|
40
|
+
long triple = (byte0 << 16) + (byte1 << 8) + byte2;
|
41
|
+
|
42
|
+
*--out_ptr = base64_encode_table[(triple >> 0 * 6) & 0x3F];
|
43
|
+
*--out_ptr = base64_encode_table[(triple >> 1 * 6) & 0x3F];
|
44
|
+
*--out_ptr = base64_encode_table[(triple >> 2 * 6) & 0x3F];
|
45
|
+
*--out_ptr = base64_encode_table[(triple >> 3 * 6) & 0x3F];
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
/*
|
50
|
+
* 0.upto(255).map{|a| "\\x#{ (base64_encode_table.index([a].pack("C")) || 0xff).to_s(16) }" }.join
|
51
|
+
*/
|
52
|
+
static const unsigned char base64_decode_table[] =
|
53
|
+
"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"
|
54
|
+
"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"
|
55
|
+
"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x3e\xff\xff\xff\x3f"
|
56
|
+
"\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\xff\xff\xff\xff\xff\xff"
|
57
|
+
"\xff\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e"
|
58
|
+
"\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\xff\xff\xff\xff\xff"
|
59
|
+
"\xff\x1a\x1b\x1c\x1d\x1e\x1f\x20\x21\x22\x23\x24\x25\x26\x27\x28"
|
60
|
+
"\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33\xff\xff\xff\xff\xff"
|
61
|
+
"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"
|
62
|
+
"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"
|
63
|
+
"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"
|
64
|
+
"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"
|
65
|
+
"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"
|
66
|
+
"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"
|
67
|
+
"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"
|
68
|
+
"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff";
|
69
|
+
|
70
|
+
/* Decode _len_ bytes of base64 characters at _in_ and write output to _out_.
|
71
|
+
*
|
72
|
+
* It is possible to decode a string in-place (with _out_ == _in_).
|
73
|
+
*/
|
74
|
+
int
|
75
|
+
base64_decode( char *out, char *in, unsigned int len)
|
76
|
+
{
|
77
|
+
unsigned char a, b, c, d;
|
78
|
+
unsigned char *in_ptr = (unsigned char *)in;
|
79
|
+
unsigned char *out_ptr = (unsigned char *)out;
|
80
|
+
unsigned char *iend_ptr = (unsigned char *)in + len;
|
81
|
+
|
82
|
+
for(;;){
|
83
|
+
if( in_ptr+3 < iend_ptr &&
|
84
|
+
(a=base64_decode_table[in_ptr[0]]) != 0xff &&
|
85
|
+
(b=base64_decode_table[in_ptr[1]]) != 0xff &&
|
86
|
+
(c=base64_decode_table[in_ptr[2]]) != 0xff &&
|
87
|
+
(d=base64_decode_table[in_ptr[3]]) != 0xff )
|
88
|
+
{
|
89
|
+
in_ptr += 4;
|
90
|
+
*out_ptr++ = (a << 2) | (b >> 4);
|
91
|
+
*out_ptr++ = (b << 4) | (c >> 2);
|
92
|
+
*out_ptr++ = (c << 6) | d;
|
93
|
+
} else if (in_ptr < iend_ptr){
|
94
|
+
a = b = c = d = 0xff;
|
95
|
+
while ((a = base64_decode_table[*in_ptr++]) == 0xff && in_ptr < iend_ptr) {}
|
96
|
+
if (in_ptr < iend_ptr){
|
97
|
+
while ((b = base64_decode_table[*in_ptr++]) == 0xff && in_ptr < iend_ptr) {}
|
98
|
+
if (in_ptr < iend_ptr){
|
99
|
+
while ((c = base64_decode_table[*in_ptr++]) == 0xff && in_ptr < iend_ptr) {}
|
100
|
+
if (in_ptr < iend_ptr){
|
101
|
+
while ((d = base64_decode_table[*in_ptr++]) == 0xff && in_ptr < iend_ptr) {}
|
102
|
+
}
|
103
|
+
}
|
104
|
+
}
|
105
|
+
if (a != 0xff && b != 0xff) {
|
106
|
+
*out_ptr++ = (a << 2) | (b >> 4);
|
107
|
+
if (c != 0xff) {
|
108
|
+
*out_ptr++ = (b << 4) | (c >> 2);
|
109
|
+
if (d != 0xff)
|
110
|
+
*out_ptr++ = (c << 6) | d;
|
111
|
+
}
|
112
|
+
}
|
113
|
+
} else {
|
114
|
+
break;
|
115
|
+
}
|
116
|
+
}
|
117
|
+
|
118
|
+
|
119
|
+
return (char*)out_ptr - out;
|
120
|
+
}
|
121
|
+
|
122
|
+
/*
|
123
|
+
* Case-independent comparison of two not-necessarily-null-terminated strings.
|
124
|
+
* At most n bytes will be examined from each string.
|
125
|
+
*/
|
126
|
+
int
|
127
|
+
rbpg_strncasecmp(const char *s1, const char *s2, size_t n)
|
128
|
+
{
|
129
|
+
while (n-- > 0)
|
130
|
+
{
|
131
|
+
unsigned char ch1 = (unsigned char) *s1++;
|
132
|
+
unsigned char ch2 = (unsigned char) *s2++;
|
133
|
+
|
134
|
+
if (ch1 != ch2){
|
135
|
+
if (ch1 >= 'A' && ch1 <= 'Z')
|
136
|
+
ch1 += 'a' - 'A';
|
137
|
+
|
138
|
+
if (ch2 >= 'A' && ch2 <= 'Z')
|
139
|
+
ch2 += 'a' - 'A';
|
140
|
+
|
141
|
+
if (ch1 != ch2)
|
142
|
+
return (int) ch1 - (int) ch2;
|
143
|
+
}
|
144
|
+
if (ch1 == 0)
|
145
|
+
break;
|
146
|
+
}
|
147
|
+
return 0;
|
148
|
+
}
|
149
|
+
|
@@ -0,0 +1,65 @@
|
|
1
|
+
/*
|
2
|
+
* utils.h
|
3
|
+
*
|
4
|
+
*/
|
5
|
+
|
6
|
+
#ifndef __utils_h
|
7
|
+
#define __utils_h
|
8
|
+
|
9
|
+
#define write_nbo16(l,c) ( \
|
10
|
+
*((unsigned char*)(c)+0)=(unsigned char)(((l)>>8)&0xff), \
|
11
|
+
*((unsigned char*)(c)+1)=(unsigned char)(((l) )&0xff)\
|
12
|
+
)
|
13
|
+
|
14
|
+
#define write_nbo32(l,c) ( \
|
15
|
+
*((unsigned char*)(c)+0)=(unsigned char)(((l)>>24L)&0xff), \
|
16
|
+
*((unsigned char*)(c)+1)=(unsigned char)(((l)>>16L)&0xff), \
|
17
|
+
*((unsigned char*)(c)+2)=(unsigned char)(((l)>> 8L)&0xff), \
|
18
|
+
*((unsigned char*)(c)+3)=(unsigned char)(((l) )&0xff)\
|
19
|
+
)
|
20
|
+
|
21
|
+
#define write_nbo64(l,c) ( \
|
22
|
+
*((unsigned char*)(c)+0)=(unsigned char)(((l)>>56LL)&0xff), \
|
23
|
+
*((unsigned char*)(c)+1)=(unsigned char)(((l)>>48LL)&0xff), \
|
24
|
+
*((unsigned char*)(c)+2)=(unsigned char)(((l)>>40LL)&0xff), \
|
25
|
+
*((unsigned char*)(c)+3)=(unsigned char)(((l)>>32LL)&0xff), \
|
26
|
+
*((unsigned char*)(c)+4)=(unsigned char)(((l)>>24LL)&0xff), \
|
27
|
+
*((unsigned char*)(c)+5)=(unsigned char)(((l)>>16LL)&0xff), \
|
28
|
+
*((unsigned char*)(c)+6)=(unsigned char)(((l)>> 8LL)&0xff), \
|
29
|
+
*((unsigned char*)(c)+7)=(unsigned char)(((l) )&0xff)\
|
30
|
+
)
|
31
|
+
|
32
|
+
#define read_nbo16(c) ((int16_t)( \
|
33
|
+
(((uint16_t)(*((unsigned char*)(c)+0)))<< 8L) | \
|
34
|
+
(((uint16_t)(*((unsigned char*)(c)+1))) ) \
|
35
|
+
))
|
36
|
+
|
37
|
+
#define read_nbo32(c) ((int32_t)( \
|
38
|
+
(((uint32_t)(*((unsigned char*)(c)+0)))<<24L) | \
|
39
|
+
(((uint32_t)(*((unsigned char*)(c)+1)))<<16L) | \
|
40
|
+
(((uint32_t)(*((unsigned char*)(c)+2)))<< 8L) | \
|
41
|
+
(((uint32_t)(*((unsigned char*)(c)+3))) ) \
|
42
|
+
))
|
43
|
+
|
44
|
+
#define read_nbo64(c) ((int64_t)( \
|
45
|
+
(((uint64_t)(*((unsigned char*)(c)+0)))<<56LL) | \
|
46
|
+
(((uint64_t)(*((unsigned char*)(c)+1)))<<48LL) | \
|
47
|
+
(((uint64_t)(*((unsigned char*)(c)+2)))<<40LL) | \
|
48
|
+
(((uint64_t)(*((unsigned char*)(c)+3)))<<32LL) | \
|
49
|
+
(((uint64_t)(*((unsigned char*)(c)+4)))<<24LL) | \
|
50
|
+
(((uint64_t)(*((unsigned char*)(c)+5)))<<16LL) | \
|
51
|
+
(((uint64_t)(*((unsigned char*)(c)+6)))<< 8LL) | \
|
52
|
+
(((uint64_t)(*((unsigned char*)(c)+7))) ) \
|
53
|
+
))
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
#define BASE64_ENCODED_SIZE(strlen) (((strlen) + 2) / 3 * 4)
|
58
|
+
#define BASE64_DECODED_SIZE(base64len) (((base64len) + 3) / 4 * 3)
|
59
|
+
|
60
|
+
void base64_encode( char *out, char *in, int len);
|
61
|
+
int base64_decode( char *out, char *in, unsigned int len);
|
62
|
+
|
63
|
+
int rbpg_strncasecmp(const char *s1, const char *s2, size_t n);
|
64
|
+
|
65
|
+
#endif /* end __utils_h */
|
Binary file
|
@@ -0,0 +1,26 @@
|
|
1
|
+
|
2
|
+
Microsoft Visual Studio Solution File, Format Version 10.00
|
3
|
+
# Visual Studio 2008
|
4
|
+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pg", "pg_18\pg.vcproj", "{9A8BF0C8-1D75-4DC0-8D84-BAEFD693795E}"
|
5
|
+
EndProject
|
6
|
+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pg_19", "pg_19\pg_19.vcproj", "{2EE30C74-074F-4611-B39B-38D5F3C9B071}"
|
7
|
+
EndProject
|
8
|
+
Global
|
9
|
+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
10
|
+
Debug|Win32 = Debug|Win32
|
11
|
+
Release|Win32 = Release|Win32
|
12
|
+
EndGlobalSection
|
13
|
+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
14
|
+
{9A8BF0C8-1D75-4DC0-8D84-BAEFD693795E}.Debug|Win32.ActiveCfg = Debug|Win32
|
15
|
+
{9A8BF0C8-1D75-4DC0-8D84-BAEFD693795E}.Debug|Win32.Build.0 = Debug|Win32
|
16
|
+
{9A8BF0C8-1D75-4DC0-8D84-BAEFD693795E}.Release|Win32.ActiveCfg = Release|Win32
|
17
|
+
{9A8BF0C8-1D75-4DC0-8D84-BAEFD693795E}.Release|Win32.Build.0 = Release|Win32
|
18
|
+
{2EE30C74-074F-4611-B39B-38D5F3C9B071}.Debug|Win32.ActiveCfg = Debug|Win32
|
19
|
+
{2EE30C74-074F-4611-B39B-38D5F3C9B071}.Debug|Win32.Build.0 = Debug|Win32
|
20
|
+
{2EE30C74-074F-4611-B39B-38D5F3C9B071}.Release|Win32.ActiveCfg = Release|Win32
|
21
|
+
{2EE30C74-074F-4611-B39B-38D5F3C9B071}.Release|Win32.Build.0 = Release|Win32
|
22
|
+
EndGlobalSection
|
23
|
+
GlobalSection(SolutionProperties) = preSolution
|
24
|
+
HideSolutionNode = FALSE
|
25
|
+
EndGlobalSection
|
26
|
+
EndGlobal
|
@@ -0,0 +1,216 @@
|
|
1
|
+
<?xml version="1.0" encoding="Windows-1252"?>
|
2
|
+
<VisualStudioProject
|
3
|
+
ProjectType="Visual C++"
|
4
|
+
Version="9.00"
|
5
|
+
Name="pg"
|
6
|
+
ProjectGUID="{9A8BF0C8-1D75-4DC0-8D84-BAEFD693795E}"
|
7
|
+
RootNamespace="pg"
|
8
|
+
Keyword="Win32Proj"
|
9
|
+
TargetFrameworkVersion="196613"
|
10
|
+
>
|
11
|
+
<Platforms>
|
12
|
+
<Platform
|
13
|
+
Name="Win32"
|
14
|
+
/>
|
15
|
+
</Platforms>
|
16
|
+
<ToolFiles>
|
17
|
+
</ToolFiles>
|
18
|
+
<Configurations>
|
19
|
+
<Configuration
|
20
|
+
Name="Debug|Win32"
|
21
|
+
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
22
|
+
IntermediateDirectory="$(ConfigurationName)"
|
23
|
+
ConfigurationType="2"
|
24
|
+
CharacterSet="1"
|
25
|
+
>
|
26
|
+
<Tool
|
27
|
+
Name="VCPreBuildEventTool"
|
28
|
+
/>
|
29
|
+
<Tool
|
30
|
+
Name="VCCustomBuildTool"
|
31
|
+
/>
|
32
|
+
<Tool
|
33
|
+
Name="VCXMLDataGeneratorTool"
|
34
|
+
/>
|
35
|
+
<Tool
|
36
|
+
Name="VCWebServiceProxyGeneratorTool"
|
37
|
+
/>
|
38
|
+
<Tool
|
39
|
+
Name="VCMIDLTool"
|
40
|
+
/>
|
41
|
+
<Tool
|
42
|
+
Name="VCCLCompilerTool"
|
43
|
+
Optimization="0"
|
44
|
+
AdditionalIncludeDirectories=""C:\Development\ruby\lib\ruby\1.8\i386-mswin32";C:\Development\msys\local\include"
|
45
|
+
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;PG_EXPORTS;HAVE_LIBPQ_FE_H;HAVE_LIBPQ_LIBPQ_FS_H;HAVE_PQCONNECTIONUSEDPASSWORD;HAVE_PQISTHREADSAFE;HAVE_LO_CREATE;HAVE_PQPREPARE;HAVE_PQEXECPARAMS;HAVE_PQESCAPESTRING;HAVE_PQESCAPESTRINGCONN;HAVE_PG_ENCODING_TO_CHAR;HAVE_PQSETCLIENTENCODING"
|
46
|
+
MinimalRebuild="true"
|
47
|
+
BasicRuntimeChecks="3"
|
48
|
+
RuntimeLibrary="3"
|
49
|
+
UsePrecompiledHeader="0"
|
50
|
+
WarningLevel="3"
|
51
|
+
DebugInformationFormat="4"
|
52
|
+
DisableSpecificWarnings="4996"
|
53
|
+
/>
|
54
|
+
<Tool
|
55
|
+
Name="VCManagedResourceCompilerTool"
|
56
|
+
/>
|
57
|
+
<Tool
|
58
|
+
Name="VCResourceCompilerTool"
|
59
|
+
/>
|
60
|
+
<Tool
|
61
|
+
Name="VCPreLinkEventTool"
|
62
|
+
/>
|
63
|
+
<Tool
|
64
|
+
Name="VCLinkerTool"
|
65
|
+
AdditionalDependencies="libpq.lib msvcrt-ruby18.lib"
|
66
|
+
OutputFile="C:\Development\ruby\lib\ruby\gems\1.8\gems\pg-0.7.9.2009.03.14-x86-mswin32-60\lib\$(ProjectName).so"
|
67
|
+
LinkIncremental="2"
|
68
|
+
AdditionalLibraryDirectories="C:\Development\ruby\lib;C:\Development\msys\local\lib"
|
69
|
+
GenerateDebugInformation="true"
|
70
|
+
SubSystem="2"
|
71
|
+
TargetMachine="1"
|
72
|
+
/>
|
73
|
+
<Tool
|
74
|
+
Name="VCALinkTool"
|
75
|
+
/>
|
76
|
+
<Tool
|
77
|
+
Name="VCManifestTool"
|
78
|
+
/>
|
79
|
+
<Tool
|
80
|
+
Name="VCXDCMakeTool"
|
81
|
+
/>
|
82
|
+
<Tool
|
83
|
+
Name="VCBscMakeTool"
|
84
|
+
/>
|
85
|
+
<Tool
|
86
|
+
Name="VCFxCopTool"
|
87
|
+
/>
|
88
|
+
<Tool
|
89
|
+
Name="VCAppVerifierTool"
|
90
|
+
/>
|
91
|
+
<Tool
|
92
|
+
Name="VCPostBuildEventTool"
|
93
|
+
/>
|
94
|
+
</Configuration>
|
95
|
+
<Configuration
|
96
|
+
Name="Release|Win32"
|
97
|
+
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
98
|
+
IntermediateDirectory="$(ConfigurationName)"
|
99
|
+
ConfigurationType="2"
|
100
|
+
CharacterSet="1"
|
101
|
+
WholeProgramOptimization="1"
|
102
|
+
>
|
103
|
+
<Tool
|
104
|
+
Name="VCPreBuildEventTool"
|
105
|
+
/>
|
106
|
+
<Tool
|
107
|
+
Name="VCCustomBuildTool"
|
108
|
+
/>
|
109
|
+
<Tool
|
110
|
+
Name="VCXMLDataGeneratorTool"
|
111
|
+
/>
|
112
|
+
<Tool
|
113
|
+
Name="VCWebServiceProxyGeneratorTool"
|
114
|
+
/>
|
115
|
+
<Tool
|
116
|
+
Name="VCMIDLTool"
|
117
|
+
/>
|
118
|
+
<Tool
|
119
|
+
Name="VCCLCompilerTool"
|
120
|
+
Optimization="2"
|
121
|
+
EnableIntrinsicFunctions="true"
|
122
|
+
AdditionalIncludeDirectories="C:\Development\msys\local\include;"C:\Development\ruby\lib\ruby\1.8\i386-mswin32_90""
|
123
|
+
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PG_EXPORTS"
|
124
|
+
RuntimeLibrary="2"
|
125
|
+
EnableFunctionLevelLinking="true"
|
126
|
+
UsePrecompiledHeader="2"
|
127
|
+
WarningLevel="3"
|
128
|
+
DebugInformationFormat="3"
|
129
|
+
/>
|
130
|
+
<Tool
|
131
|
+
Name="VCManagedResourceCompilerTool"
|
132
|
+
/>
|
133
|
+
<Tool
|
134
|
+
Name="VCResourceCompilerTool"
|
135
|
+
/>
|
136
|
+
<Tool
|
137
|
+
Name="VCPreLinkEventTool"
|
138
|
+
/>
|
139
|
+
<Tool
|
140
|
+
Name="VCLinkerTool"
|
141
|
+
OutputFile="$(OutDir)\$(ProjectName).so"
|
142
|
+
LinkIncremental="1"
|
143
|
+
GenerateDebugInformation="true"
|
144
|
+
SubSystem="2"
|
145
|
+
OptimizeReferences="2"
|
146
|
+
EnableCOMDATFolding="2"
|
147
|
+
TargetMachine="1"
|
148
|
+
/>
|
149
|
+
<Tool
|
150
|
+
Name="VCALinkTool"
|
151
|
+
/>
|
152
|
+
<Tool
|
153
|
+
Name="VCManifestTool"
|
154
|
+
/>
|
155
|
+
<Tool
|
156
|
+
Name="VCXDCMakeTool"
|
157
|
+
/>
|
158
|
+
<Tool
|
159
|
+
Name="VCBscMakeTool"
|
160
|
+
/>
|
161
|
+
<Tool
|
162
|
+
Name="VCFxCopTool"
|
163
|
+
/>
|
164
|
+
<Tool
|
165
|
+
Name="VCAppVerifierTool"
|
166
|
+
/>
|
167
|
+
<Tool
|
168
|
+
Name="VCPostBuildEventTool"
|
169
|
+
/>
|
170
|
+
</Configuration>
|
171
|
+
</Configurations>
|
172
|
+
<References>
|
173
|
+
</References>
|
174
|
+
<Files>
|
175
|
+
<Filter
|
176
|
+
Name="Source Files"
|
177
|
+
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
178
|
+
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
179
|
+
>
|
180
|
+
<File
|
181
|
+
RelativePath="..\..\compat.c"
|
182
|
+
>
|
183
|
+
</File>
|
184
|
+
<File
|
185
|
+
RelativePath="..\..\pg.c"
|
186
|
+
>
|
187
|
+
</File>
|
188
|
+
</Filter>
|
189
|
+
<Filter
|
190
|
+
Name="Header Files"
|
191
|
+
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
192
|
+
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
193
|
+
>
|
194
|
+
<File
|
195
|
+
RelativePath="..\..\compat.h"
|
196
|
+
>
|
197
|
+
</File>
|
198
|
+
<File
|
199
|
+
RelativePath="..\..\pg.h"
|
200
|
+
>
|
201
|
+
</File>
|
202
|
+
</Filter>
|
203
|
+
<Filter
|
204
|
+
Name="Resource Files"
|
205
|
+
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
|
206
|
+
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
207
|
+
>
|
208
|
+
</Filter>
|
209
|
+
<File
|
210
|
+
RelativePath=".\ReadMe.txt"
|
211
|
+
>
|
212
|
+
</File>
|
213
|
+
</Files>
|
214
|
+
<Globals>
|
215
|
+
</Globals>
|
216
|
+
</VisualStudioProject>
|