From 8c13dc499b622a3c018095f9f04b9ae947e811b7 Mon Sep 17 00:00:00 2001 From: Souravgoswami Date: Thu, 26 Sep 2024 04:00:17 +0530 Subject: [PATCH] Fix MAGIC_NO_CHECK_JSON and add support for MAGIC_NO_COMPRESS_FORK, MAGIC_NO_CHECK_SIMH --- ext/libmagic/modes.h | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/ext/libmagic/modes.h b/ext/libmagic/modes.h index 2ff165e..5c53e9b 100644 --- a/ext/libmagic/modes.h +++ b/ext/libmagic/modes.h @@ -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 @@ -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) { @@ -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 @@ -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;