Skip to content

Commit

Permalink
Fix MAGIC_NO_CHECK_JSON and add support for MAGIC_NO_COMPRESS_FORK, M…
Browse files Browse the repository at this point in the history
…AGIC_NO_CHECK_SIMH
  • Loading branch information
Souravgoswami authored and Sergyenko committed Sep 27, 2024
1 parent 4d9c118 commit 8c13dc4
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions ext/libmagic/modes.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ void modes(volatile VALUE rb_klass) {
rb_define_const(rb_klass, "MAGIC_NO_CHECK_APPTYPE", INT2FIX(MAGIC_NO_CHECK_APPTYPE));
#endif

#ifdef MAGIC_NO_COMPRESS_FORK
rb_define_const(rb_klass, "MAGIC_NO_COMPRESS_FORK", INT2FIX(MAGIC_NO_COMPRESS_FORK));
#endif

#ifdef MAGIC_NO_CHECK_CDF
rb_define_const(rb_klass, "MAGIC_NO_CHECK_CDF", INT2FIX(MAGIC_NO_CHECK_CDF));
#endif
Expand Down Expand Up @@ -67,6 +71,10 @@ void modes(volatile VALUE rb_klass) {
#ifdef MAGIC_NO_CHECK_CSV
rb_define_const(rb_klass, "MAGIC_NO_CHECK_CSV", INT2FIX(MAGIC_NO_CHECK_CSV));
#endif

#ifdef MAGIC_NO_CHECK_SIMH
rb_define_const(rb_klass, "MAGIC_NO_CHECK_SIMH", INT2FIX(MAGIC_NO_CHECK_SIMH));
#endif
}

VALUE lsmodes(volatile VALUE obj) {
Expand Down Expand Up @@ -98,6 +106,10 @@ VALUE lsmodes(volatile VALUE obj) {
rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_NO_CHECK_APPTYPE")), INT2FIX(MAGIC_NO_CHECK_APPTYPE));
#endif

#ifdef MAGIC_NO_COMPRESS_FORK
rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_NO_COMPRESS_FORK")), INT2FIX(MAGIC_NO_COMPRESS_FORK));
#endif

#ifdef MAGIC_NO_CHECK_CDF
rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_NO_CHECK_CDF")), INT2FIX(MAGIC_NO_CHECK_CDF));
#endif
Expand Down Expand Up @@ -130,12 +142,16 @@ VALUE lsmodes(volatile VALUE obj) {
rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_NO_CHECK_TOKENS")), INT2FIX(MAGIC_NO_CHECK_TOKENS));
#endif

#ifdef MAGIC_NO_CHECK_CSV
#ifdef MAGIC_NO_CHECK_JSON
rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_NO_CHECK_JSON")), INT2FIX(MAGIC_NO_CHECK_JSON));
#endif

#ifdef MAGIC_NO_CHECK_CSV
rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_NO_CHECK_CSV")), INT2FIX(MAGIC_NO_CHECK_CSV));
#endif

#ifdef MAGIC_NO_CHECK_CSV
rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_NO_CHECK_JSON")), INT2FIX(MAGIC_NO_CHECK_JSON));
#ifdef MAGIC_NO_CHECK_SIMH
rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_NO_CHECK_SIMH")), INT2FIX(MAGIC_NO_CHECK_SIMH));
#endif

return hash;
Expand Down

0 comments on commit 8c13dc4

Please sign in to comment.