lz4-ruby 0.1.4 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,60 @@
1
+ /*
2
+ LZ4 HC - High Compression Mode of LZ4
3
+ Header File
4
+ Copyright (C) 2011-2012, Yann Collet.
5
+ BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
6
+
7
+ Redistribution and use in source and binary forms, with or without
8
+ modification, are permitted provided that the following conditions are
9
+ met:
10
+
11
+ * Redistributions of source code must retain the above copyright
12
+ notice, this list of conditions and the following disclaimer.
13
+ * Redistributions in binary form must reproduce the above
14
+ copyright notice, this list of conditions and the following disclaimer
15
+ in the documentation and/or other materials provided with the
16
+ distribution.
17
+
18
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+
30
+ You can contact the author at :
31
+ - LZ4 homepage : http://fastcompression.blogspot.com/p/lz4.html
32
+ - LZ4 source repository : http://code.google.com/p/lz4/
33
+ */
34
+ #pragma once
35
+
36
+
37
+ #if defined (__cplusplus)
38
+ extern "C" {
39
+ #endif
40
+
41
+
42
+ int LZ4_compressHC (const char* source, char* dest, int isize);
43
+
44
+ /*
45
+ LZ4_compressHC :
46
+ return : the number of bytes in compressed buffer dest
47
+ note : destination buffer must be already allocated.
48
+ To avoid any problem, size it to handle worst cases situations (input data not compressible)
49
+ Worst case size evaluation is provided by function LZ4_compressBound() (see "lz4.h")
50
+ */
51
+
52
+
53
+ /* Note :
54
+ Decompression functions are provided within regular LZ4 source code (see "lz4.h") (BSD license)
55
+ */
56
+
57
+
58
+ #if defined (__cplusplus)
59
+ }
60
+ #endif
File without changes
@@ -1,4 +1,10 @@
1
- require 'lz4ruby'
1
+ if /(mswin|mingw)/ =~ RUBY_PLATFORM
2
+ /(\d+\.\d+)/ =~ RUBY_VERSION
3
+ ver = $1
4
+ require "#{ver}/lz4ruby.so"
5
+ else
6
+ require 'lz4ruby'
7
+ end
2
8
 
3
9
  class LZ4
4
10
  def self.compress(source, src_size = nil)
@@ -11,8 +11,17 @@ require 'test/unit'
11
11
  require 'shoulda'
12
12
 
13
13
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'ext'))
14
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'ext/lz4ruby'))
15
15
  $LOAD_PATH.unshift(File.dirname(__FILE__))
16
+
17
+ build_native = <<EOS
18
+ cd ext/lz4-ruby
19
+ ruby extconf.rb
20
+ make clean
21
+ make
22
+ EOS
23
+ `#{build_native}`
24
+
16
25
  require 'lz4-ruby'
17
26
 
18
27
  class Test::Unit::TestCase
metadata CHANGED
@@ -1,90 +1,109 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: lz4-ruby
3
- version: !ruby/object:Gem::Version
4
- version: 0.1.4
3
+ version: !ruby/object:Gem::Version
4
+ hash: 23
5
5
  prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 6
10
+ version: 0.1.6
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - KOMIYA Atsushi
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
- date: 2012-06-06 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: shoulda
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: '0'
17
+
18
+ date: 2012-06-13 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
22
21
  type: :development
22
+ name: shoulda
23
23
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ! '>='
28
- - !ruby/object:Gem::Version
29
- version: '0'
30
- - !ruby/object:Gem::Dependency
31
- name: rdoc
32
- requirement: !ruby/object:Gem::Requirement
24
+ version_requirements: &id001 !ruby/object:Gem::Requirement
33
25
  none: false
34
- requirements:
35
- - - ~>
36
- - !ruby/object:Gem::Version
37
- version: '3.12'
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ requirement: *id001
34
+ - !ruby/object:Gem::Dependency
38
35
  type: :development
36
+ name: rdoc
39
37
  prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ~>
44
- - !ruby/object:Gem::Version
45
- version: '3.12'
46
- - !ruby/object:Gem::Dependency
47
- name: bundler
48
- requirement: !ruby/object:Gem::Requirement
38
+ version_requirements: &id002 !ruby/object:Gem::Requirement
49
39
  none: false
50
- requirements:
40
+ requirements:
51
41
  - - ~>
52
- - !ruby/object:Gem::Version
53
- version: 1.1.4
42
+ - !ruby/object:Gem::Version
43
+ hash: 31
44
+ segments:
45
+ - 3
46
+ - 12
47
+ version: "3.12"
48
+ requirement: *id002
49
+ - !ruby/object:Gem::Dependency
54
50
  type: :development
51
+ name: bundler
55
52
  prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
53
+ version_requirements: &id003 !ruby/object:Gem::Requirement
57
54
  none: false
58
- requirements:
55
+ requirements:
59
56
  - - ~>
60
- - !ruby/object:Gem::Version
61
- version: 1.1.4
62
- - !ruby/object:Gem::Dependency
57
+ - !ruby/object:Gem::Version
58
+ hash: 23
59
+ segments:
60
+ - 1
61
+ - 0
62
+ - 0
63
+ version: 1.0.0
64
+ requirement: *id003
65
+ - !ruby/object:Gem::Dependency
66
+ type: :development
63
67
  name: jeweler
64
- requirement: !ruby/object:Gem::Requirement
68
+ prerelease: false
69
+ version_requirements: &id004 !ruby/object:Gem::Requirement
65
70
  none: false
66
- requirements:
71
+ requirements:
67
72
  - - ~>
68
- - !ruby/object:Gem::Version
73
+ - !ruby/object:Gem::Version
74
+ hash: 49
75
+ segments:
76
+ - 1
77
+ - 8
78
+ - 3
69
79
  version: 1.8.3
80
+ requirement: *id004
81
+ - !ruby/object:Gem::Dependency
70
82
  type: :development
83
+ name: rake-compiler
71
84
  prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
85
+ version_requirements: &id005 !ruby/object:Gem::Requirement
73
86
  none: false
74
- requirements:
75
- - - ~>
76
- - !ruby/object:Gem::Version
77
- version: 1.8.3
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ hash: 3
91
+ segments:
92
+ - 0
93
+ version: "0"
94
+ requirement: *id005
78
95
  description: Ruby bindings for LZ4. LZ4 is a very fast lossless compression algorithm.
79
96
  email: komiya.atsushi@gmail.com
80
97
  executables: []
81
- extensions:
82
- - ext/extconf.rb
83
- extra_rdoc_files:
98
+
99
+ extensions:
100
+ - ext/lz4ruby/extconf.rb
101
+ extra_rdoc_files:
84
102
  - LICENSE.txt
85
103
  - README.rdoc
86
- files:
104
+ files:
87
105
  - .document
106
+ - Gemfile
88
107
  - LICENSE.txt
89
108
  - README.rdoc
90
109
  - Rakefile
@@ -95,38 +114,47 @@ files:
95
114
  - benchmarking/compressor_lz4.rb
96
115
  - benchmarking/compressor_lzo.rb
97
116
  - benchmarking/compressor_snappy.rb
98
- - ext/extconf.rb
99
- - ext/lz4ruby.c
117
+ - ext/lz4ruby/extconf.rb
118
+ - ext/lz4ruby/lz4.c
119
+ - ext/lz4ruby/lz4.h
120
+ - ext/lz4ruby/lz4hc.c
121
+ - ext/lz4ruby/lz4hc.h
122
+ - ext/lz4ruby/lz4ruby.c
100
123
  - lib/lz4-ruby.rb
101
- - lz4-ruby.gemspec
102
124
  - test/helper.rb
103
125
  - test/test_lz4-ruby.rb
104
126
  homepage: http://github.com/komiya-atsushi/lz4-ruby
105
- licenses:
127
+ licenses:
106
128
  - MIT
107
129
  post_install_message:
108
130
  rdoc_options: []
109
- require_paths:
131
+
132
+ require_paths:
110
133
  - lib
111
- required_ruby_version: !ruby/object:Gem::Requirement
134
+ required_ruby_version: !ruby/object:Gem::Requirement
112
135
  none: false
113
- requirements:
114
- - - ! '>='
115
- - !ruby/object:Gem::Version
116
- version: '0'
117
- segments:
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ hash: 3
140
+ segments:
118
141
  - 0
119
- hash: 70067389
120
- required_rubygems_version: !ruby/object:Gem::Requirement
142
+ version: "0"
143
+ required_rubygems_version: !ruby/object:Gem::Requirement
121
144
  none: false
122
- requirements:
123
- - - ! '>='
124
- - !ruby/object:Gem::Version
125
- version: '0'
145
+ requirements:
146
+ - - ">="
147
+ - !ruby/object:Gem::Version
148
+ hash: 3
149
+ segments:
150
+ - 0
151
+ version: "0"
126
152
  requirements: []
153
+
127
154
  rubyforge_project:
128
- rubygems_version: 1.8.23
155
+ rubygems_version: 1.8.24
129
156
  signing_key:
130
157
  specification_version: 3
131
158
  summary: Ruby bindings for LZ4 (Extremely Fast Compression algorithm).
132
159
  test_files: []
160
+
@@ -1,28 +0,0 @@
1
- require 'mkmf'
2
-
3
- LZ4_REV_NO = 66
4
-
5
- URL = "http://lz4.googlecode.com/svn-history/r#{LZ4_REV_NO}/trunk/"
6
-
7
- def download_from_web(file)
8
- File.delete(file) if File.file?(file)
9
- `wget #{URL}/#{file}`
10
-
11
- if $?.exitstatus != 0
12
- return false
13
- end
14
-
15
- return true
16
- end
17
-
18
- [ "lz4.c",
19
- "lz4.h",
20
- "lz4hc.c",
21
- "lz4hc.h" ].each do |filename|
22
- exit if !download_from_web(filename)
23
- end
24
-
25
- $CFLAGS += " -Wall "
26
-
27
- create_makefile('lz4ruby')
28
-
@@ -1,66 +0,0 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = "lz4-ruby"
8
- s.version = "0.1.4"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["KOMIYA Atsushi"]
12
- s.date = "2012-06-06"
13
- s.description = "Ruby bindings for LZ4. LZ4 is a very fast lossless compression algorithm."
14
- s.email = "komiya.atsushi@gmail.com"
15
- s.extensions = ["ext/extconf.rb"]
16
- s.extra_rdoc_files = [
17
- "LICENSE.txt",
18
- "README.rdoc"
19
- ]
20
- s.files = [
21
- ".document",
22
- "LICENSE.txt",
23
- "README.rdoc",
24
- "Rakefile",
25
- "VERSION",
26
- "benchmarking/bench.rb",
27
- "benchmarking/bench_all.sh",
28
- "benchmarking/compressor.rb",
29
- "benchmarking/compressor_lz4.rb",
30
- "benchmarking/compressor_lzo.rb",
31
- "benchmarking/compressor_snappy.rb",
32
- "ext/extconf.rb",
33
- "ext/lz4ruby.c",
34
- "lib/lz4-ruby.rb",
35
- "lz4-ruby.gemspec",
36
- "test/helper.rb",
37
- "test/test_lz4-ruby.rb"
38
- ]
39
- s.homepage = "http://github.com/komiya-atsushi/lz4-ruby"
40
- s.licenses = ["MIT"]
41
- s.require_paths = ["lib"]
42
- s.rubygems_version = "1.8.23"
43
- s.summary = "Ruby bindings for LZ4 (Extremely Fast Compression algorithm)."
44
-
45
- if s.respond_to? :specification_version then
46
- s.specification_version = 3
47
-
48
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
49
- s.add_development_dependency(%q<shoulda>, [">= 0"])
50
- s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
51
- s.add_development_dependency(%q<bundler>, ["~> 1.1.4"])
52
- s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
53
- else
54
- s.add_dependency(%q<shoulda>, [">= 0"])
55
- s.add_dependency(%q<rdoc>, ["~> 3.12"])
56
- s.add_dependency(%q<bundler>, ["~> 1.1.4"])
57
- s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
58
- end
59
- else
60
- s.add_dependency(%q<shoulda>, [">= 0"])
61
- s.add_dependency(%q<rdoc>, ["~> 3.12"])
62
- s.add_dependency(%q<bundler>, ["~> 1.1.4"])
63
- s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
64
- end
65
- end
66
-