ruby-magic 0.3.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3dea9ed4324b8adf546bff646bda68832110b1dd267776295b5d6a54461038e1
4
- data.tar.gz: 67395237f2ef75e6124811ae3b0f8542efe46e788c14679c9f7b5fab8ab80565
3
+ metadata.gz: 8f6fd376f0f6b9df5dd11ad1165a4c060a7391ae626feb57356782cb97ca3db0
4
+ data.tar.gz: 9c583624bee1a090a4098ea9ff6526d414efe624b437738a19f3f7a7b7895b82
5
5
  SHA512:
6
- metadata.gz: 6f7e59de47ee8dc1f0768eb3cd8fa485d360d3b83023b6dc37ae88063608e7644765a643f4e679cca632225b01a4fff41aae7abd1cc2e17670a52f312f8a9d1c
7
- data.tar.gz: c1a21b1091470709646fb44e790c4315b5b5551f56af67b80ac587add7ce7d0cee8703a5ebae8da9d9751d6b222c2e51e0b8a7a155c28f764544950c1d01c41d
6
+ metadata.gz: 190f13b5566e31b180f32b1f83b970998a6a95018d3cf71055d31f22de30ccf6e18221223dfe9a7826b53063300036cdabb501670ae09af95b175f6dd5b1e41e
7
+ data.tar.gz: add7827d9a2663a612f9b5d486efa9fe4eb064aadf67f62ed314d8d173f5dfd172ae9851640ff9d01fe55031bb2810758fabcdf69643148bfb7a1259ef8bbef8
checksums.yaml.gz.sig ADDED
@@ -0,0 +1,3 @@
1
+ ;Cd���}�����=1�O.���\~�Z#���%��:&hW�m�T<���o����v߅]���\Vg�� �p�/�cL9��Y@_\_Ά?�y�nHM$�[���<qy�ۓ��
2
+ 1���+��j�,�߯� l����*U���}�����gp���QOU�d�
3
+ ^V�,*}cJa�;�po�� �ݎ ��}�<�x���gX��]� S�9����ƥ?.����O�OS|�4a 4ދ5���m���Fa=��g���,��#�a�^�to��&��K�Y��0[B��߅���A G���qoۑ���s4�^�E���C����/z�D$�&�l_��3��؟�=�,#c��!��'��'C���z�H��
data/CONTRIBUTORS.md ADDED
@@ -0,0 +1,16 @@
1
+ # Ruby Magic contributors
2
+
3
+ We thank all of our [contributors][1]!
4
+
5
+ The following is a list of people who have contributed at some point to the code
6
+ of Ruby Magic. They are hereby acknowledged and collectively identified as "The
7
+ Ruby Magic Authors". Copyright is held by the original contributor according to
8
+ the versioning history; see [LICENSE](LICENSE) file.
9
+
10
+ - Igor Victor ([@gogainda](https://github.com/gogainda))
11
+ - John Hawthorn ([@jhawthorn](https://github.com/jhawthorn))
12
+ - Mike Dalessio ([@flavorjones](https://github.com/flavorjones))
13
+ - Shinya Maeda ([@dosuken123](https://github.com/dosuken123))
14
+ - Stan Hu ([@stanhu](https://github.com/stanhu))
15
+
16
+ [1]: https://github.com/kwilczynski/ruby-magic/graphs/contributors "Contributors"
data/NOTICE CHANGED
@@ -464,3 +464,42 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
464
464
  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
465
465
  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
466
466
  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
467
+
468
+ * file
469
+
470
+ file(1) Command and the libmagic(3) library.
471
+
472
+ LICENSE:
473
+ BSD, CDDL
474
+
475
+ HOMEPAGE:
476
+ http://darwinsys.com/file
477
+
478
+ Copyright (c) Ian F. Darwin 1986, 1987, 1989, 1990, 1991, 1992, 1994, 1995.
479
+ Software written by Ian F. Darwin and others;
480
+ maintained 1994- Christos Zoulas.
481
+
482
+ This software is not subject to any export provision of the United States
483
+ Department of Commerce, and may be exported to any country or planet.
484
+
485
+ Redistribution and use in source and binary forms, with or without
486
+ modification, are permitted provided that the following conditions
487
+ are met:
488
+ 1. Redistributions of source code must retain the above copyright
489
+ notice immediately at the beginning of the file, without modification,
490
+ this list of conditions, and the following disclaimer.
491
+ 2. Redistributions in binary form must reproduce the above copyright
492
+ notice, this list of conditions and the following disclaimer in the
493
+ documentation and/or other materials provided with the distribution.
494
+
495
+ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
496
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
497
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
498
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
499
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
500
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
501
+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
502
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
503
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
504
+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
505
+ SUCH DAMAGE.
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # File Magic in Ruby
2
2
 
3
- [![Build Status](https://travis-ci.org/kwilczynski/ruby-magic.svg)](https://travis-ci.org/kwilczynski/ruby-magic)
3
+ [![Build Status](https://travis-ci.com/kwilczynski/ruby-magic.svg)](https://travis-ci.com/kwilczynski/ruby-magic)
4
4
  [![Documentation Status](https://inch-ci.org/github/kwilczynski/ruby-magic.svg)](https://inch-ci.org/github/kwilczynski/ruby-magic)
5
5
  [![Gem Version](https://badge.fury.io/rb/ruby-magic.svg)](http://badge.fury.io/rb/ruby-magic)
6
6
  [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
@@ -14,13 +14,14 @@ Provides simple interface to [libmagic][1] for Ruby Programming Language.
14
14
  1. [Contributing](#contributing)
15
15
  2. [Versioning](#versioning)
16
16
  3. [Author](#author)
17
+ 4. [Contributors](#contributors)
17
18
  4. [Copyright](#copyright)
18
19
  5. [License](#license)
19
20
 
20
21
  ## Contributing
21
22
 
22
- See [CONTRIBUTING.md](CONTRIBUTING.md) for best practices and instructions on
23
- setting up your development environment.
23
+ See the [CONTRIBUTING.md](CONTRIBUTING.md) for best practices and instructions
24
+ on setting up your development environment.
24
25
 
25
26
  ## Versioning
26
27
 
@@ -31,6 +32,11 @@ For the versions available, see the tags on this repository.
31
32
 
32
33
  Krzysztof Wilczyński (<kw@linux.com>)
33
34
 
35
+ ## Contributors
36
+
37
+ See the [CONTRIBUTORS.md](CONTRIBUTORS.md) file for a list of contributors to
38
+ the project.
39
+
34
40
  ## Copyright
35
41
 
36
42
  Copyright 2013-2021 Krzysztof Wilczyński
data/dependencies.yml ADDED
@@ -0,0 +1,22 @@
1
+ libmagic:
2
+ version: "5.39"
3
+ sha256: "f05d286a76d9556243d0cb05814929c2ecf3a5ba07963f8f70bfaaa70517fad1"
4
+ # Manually verified checksum:
5
+ #
6
+ # $ gpg --verify file-5.39.tar.gz.asc file-5.39.tar.gz
7
+ # gpg: Signature made Mon Jun 15 02:06:08 2020 CEST
8
+ # gpg: using DSA key 0x71112AB16CB33B3A
9
+ # gpg: Good signature from "Christos Zoulas (personal key) <christos@zoulas.com>" [unknown]
10
+ # gpg: aka "Christos Zoulas (NetBSD key) <christos@netbsd.org>" [unknown]
11
+ # gpg: WARNING: This key is not certified with a trusted signature!
12
+ # gpg: There is no indication that the signature belongs to the owner.
13
+ # Primary key fingerprint: BE04 995B A8F9 0ED0 C0C1 76C4 7111 2AB1 6CB3 3B3A
14
+ #
15
+ # Using this PGP signature:
16
+ #
17
+ # -----BEGIN PGP SIGNATURE-----
18
+ #
19
+ # iEYEABECAAYFAl7mu3AACgkQcREqsWyzOzppXACgoqokKabq7bwN9aKvd/H/yhF+
20
+ # 9PUAoOPrAtxFkfNUvtqK/trY+v/Gk5JM
21
+ # =tA6a
22
+ # -----END PGP SIGNATURE-----
data/ext/magic/common.h CHANGED
@@ -26,45 +26,60 @@ extern "C" {
26
26
  #include <errno.h>
27
27
  #include <assert.h>
28
28
  #include <sys/stat.h>
29
+
29
30
  #include <magic.h>
31
+
30
32
  #include <ruby.h>
33
+ #include <ruby/version.h>
31
34
 
32
35
  #if defined(HAVE_RUBY_IO_H)
33
36
  # include <ruby/io.h>
34
37
  #else
35
38
  # include <rubyio.h>
36
- #endif
39
+ #endif /* HAVE_RUBY_IO_H */
37
40
 
38
- #if !defined(BIT)
39
- # define BIT(n) (1 << (n))
40
- #endif
41
+ #define BIT(n) (1 << (n))
41
42
 
42
43
  #if !defined(UNUSED)
43
44
  # define UNUSED(x) (void)(x)
44
- #endif
45
+ #endif /* UNUSED */
46
+
47
+ #define ARRAY_SIZE(a) (int)(sizeof(a) / sizeof((a)[0]))
45
48
 
46
49
  #if defined(F_DUPFD_CLOEXEC)
47
50
  # define HAVE_F_DUPFD_CLOEXEC 1
48
- #endif
51
+ #endif /* F_DUPFD_CLOEXEC */
49
52
 
50
53
  #if defined(O_CLOEXEC)
51
54
  # define HAVE_O_CLOEXEC 1
52
- #endif
55
+ #endif /* O_CLOEXEC */
53
56
 
54
57
  #if defined(POSIX_CLOSE_RESTART)
55
58
  # define HAVE_POSIX_CLOSE_RESTART 1
56
- #endif
59
+ #endif /* POSIX_CLOSE_RESTART */
57
60
 
58
61
  #define MAGIC_EXTENSION_SEPARATOR "/"
59
62
  #define MAGIC_CONTINUE_SEPARATOR "\n- "
60
63
 
64
+ #if !defined(MAGIC_SYSTEM_LIBRARIES)
65
+ # define MAGIC_STATUS_CHECK(x) x
66
+ #else
67
+ # define MAGIC_STATUS_CHECK(x) 1
68
+ #endif /* MAGIC_SYSTEM_LIBRARIES */
69
+
70
+ #if !defined(MAGIC_CUSTOM_CHECK_TYPE)
71
+ # define MAGIC_CHECK_RUBY_TYPE(o, t) Check_Type((o), (t))
72
+ #else
73
+ # define MAGIC_CHECK_RUBY_TYPE(o, t) magic_check_ruby_type((o), (t))
74
+ #endif /* MAGIC_CUSTOM_CHECK_TYPE */
75
+
61
76
  #if !defined(MAGIC_NO_CHECK_CSV)
62
77
  # define MAGIC_NO_CHECK_CSV 0
63
- #endif
78
+ #endif /* MAGIC_NO_CHECK_CSV */
64
79
 
65
80
  #if !defined(MAGIC_NO_CHECK_JSON)
66
81
  # define MAGIC_NO_CHECK_JSON 0
67
- #endif
82
+ #endif /* MAGIC_NO_CHECK_JSON */
68
83
 
69
84
  #define DATA_P(x) (RB_TYPE_P((x), T_DATA))
70
85
  #define BOOLEAN_P(x) (RB_TYPE_P((x), T_TRUE) || RB_TYPE_P((x), T_FALSE))
@@ -72,33 +87,48 @@ extern "C" {
72
87
  #define ARRAY_P(x) (RB_TYPE_P((x), T_ARRAY))
73
88
  #define FILE_P(x) (RB_TYPE_P((x), T_FILE))
74
89
 
75
- #define RVAL2CBOOL(x) (RTEST(x))
76
- #define CBOOL2RVAL(x) ((x) ? Qtrue : Qfalse)
90
+ #define RVAL2CBOOL(b) (RTEST(b))
91
+ #define CBOOL2RVAL(b) ((b) ? Qtrue : Qfalse)
77
92
 
78
- #define RVAL2CSTR(x) (NIL_P(x) ? NULL : StringValueCStr(x))
79
- #define CSTR2RVAL(x) ((x) == NULL ? Qnil : rb_str_new2(x))
93
+ #define RVAL2CSTR(s) (NIL_P(s) ? NULL : StringValueCStr(s))
94
+ #define CSTR2RVAL(s) ((s) == NULL ? Qnil : rb_str_new2((const char *)s))
95
+
96
+ #define RSTRING_EMPTY_P(s) (RSTRING_LEN(s) == 0)
80
97
 
81
98
  #define RARRAY_EMPTY rb_ary_new()
82
99
  #define RARRAY_EMPTY_P(a) (RARRAY_LEN(a) == 0)
83
100
  #define RARRAY_FIRST(a) (RARRAY_EMPTY_P(a) ? Qnil : rb_ary_entry((a), 0))
84
101
 
102
+ #if RUBY_API_VERSION_CODE > 20700
103
+ # define RVALUE_TYPE enum ruby_value_type
104
+ #else
105
+ # define RVALUE_TYPE int
106
+ #endif /* RUBY_API_VERSION_CODE > 20700 */
107
+
108
+ #if RUBY_API_VERSION_CODE >= 20700
109
+ # define HAVE_RUBY_GC_COMPACT 1
110
+ # define MAGIC_GC_MARK(x) rb_gc_mark_movable((x))
111
+ #else
112
+ # define MAGIC_GC_MARK(x) rb_gc_mark((x))
113
+ #endif /* RUBY_API_VERSION_CODE >= 20700 */
114
+
85
115
  #define CLASS_NAME(o) (NIL_P((o)) ? "nil" : rb_obj_classname((o)))
86
116
 
87
117
  #if !defined(T_INTEGER)
88
118
  # define T_INTEGER rb_cInteger
89
- #endif
119
+ #endif /* T_INTEGER */
90
120
 
91
121
  #if !defined(HAVE_RB_IO_T)
92
122
  # define rb_io_t OpenFile
93
- #endif
123
+ #endif /* HAVE_RB_IO_T */
94
124
 
95
125
  #if !defined(GetReadFile)
96
126
  # define FPTR_TO_FD(p) ((p)->fd)
97
127
  #else
98
128
  # define FPTR_TO_FD(p) (fileno(GetReadFile(p)))
99
- #endif
129
+ #endif /* GetReadFile */
100
130
 
101
- #define NOGVL_FUNCTION (VALUE (*)(void *))
131
+ #define NOGVL_FUNCTION (VALUE(*)(void *))
102
132
 
103
133
  #if defined(HAVE_RB_THREAD_CALL_WITHOUT_GVL) && \
104
134
  defined(HAVE_RUBY_THREAD_H) && HAVE_RUBY_THREAD_H
@@ -123,7 +153,10 @@ fake_blocking_region(VALUE (*f)(ANYARGS), void *data)
123
153
  }
124
154
  # define NOGVL(f, d) \
125
155
  fake_blocking_region(NOGVL_FUNCTION(f), (d))
126
- #endif
156
+ #endif /*
157
+ * HAVE_RB_THREAD_CALL_WITHOUT_GVL
158
+ * HAVE_RUBY_THREAD_H
159
+ */
127
160
 
128
161
  #if defined(__cplusplus)
129
162
  }