From 4933231e69d06ffa6ec4ccca16e71de737518878 Mon Sep 17 00:00:00 2001 From: Souravgoswami Date: Thu, 26 Sep 2024 03:36:37 +0530 Subject: [PATCH] Remove extra space before semicolon --- ext/libmagic/definitions.h | 6 +- ext/libmagic/func.h | 118 ++++++++++++------------ ext/libmagic/magic.c | 184 ++++++++++++++++++------------------- ext/libmagic/modes.h | 114 +++++++++++------------ ext/libmagic/params.h | 32 +++---- ext/libmagic/validations.h | 18 ++-- 6 files changed, 236 insertions(+), 236 deletions(-) diff --git a/ext/libmagic/definitions.h b/ext/libmagic/definitions.h index b571134..e16f948 100644 --- a/ext/libmagic/definitions.h +++ b/ext/libmagic/definitions.h @@ -1,4 +1,4 @@ #define RB_UNWRAP(cookie) \ - magic_t *cookie ; \ - TypedData_Get_Struct(self, magic_t, &fileType, cookie) ; \ - if(!*cookie) rb_raise(rb_eFileClosedError, "Magic cookie already closed") ; + magic_t *cookie; \ + TypedData_Get_Struct(self, magic_t, &fileType, cookie); \ + if(!*cookie) rb_raise(rb_eFileClosedError, "Magic cookie already closed"); diff --git a/ext/libmagic/func.h b/ext/libmagic/func.h index 97f5002..8e3b83a 100644 --- a/ext/libmagic/func.h +++ b/ext/libmagic/func.h @@ -11,12 +11,12 @@ */ VALUE _closeGlobal_(VALUE self) { - RB_UNWRAP(cookie) ; + RB_UNWRAP(cookie); - magic_close(*cookie) ; - *cookie = NULL ; - rb_ivar_set(self, rb_intern("@closed"), Qtrue) ; - return self ; + magic_close(*cookie); + *cookie = NULL; + rb_ivar_set(self, rb_intern("@closed"), Qtrue); + return self; } /* @@ -37,7 +37,7 @@ VALUE _closeGlobal_(VALUE self) { */ VALUE _loadGlobal_(VALUE self, VALUE dbPath) { - char *databasePath = NULL ; + char *databasePath = NULL; if (RB_TYPE_P(dbPath, T_STRING)) { databasePath = StringValuePtr(dbPath); @@ -46,16 +46,16 @@ VALUE _loadGlobal_(VALUE self, VALUE dbPath) { // Check if the database is a valid file or not // Raises ruby error which will return. - RB_UNWRAP(cookie) ; + RB_UNWRAP(cookie); - if(databasePath) magic_validate_db(*cookie, databasePath) ; + if(databasePath) magic_validate_db(*cookie, databasePath); if (magic_load(*cookie, databasePath) == -1) { - rb_raise(rb_eRuntimeError, "Failed to load magic database: %s", magic_error(*cookie)) ; + rb_raise(rb_eRuntimeError, "Failed to load magic database: %s", magic_error(*cookie)); } - return self ; + return self; } /* @@ -73,30 +73,30 @@ VALUE _loadGlobal_(VALUE self, VALUE dbPath) { */ VALUE _checkGlobal_(VALUE self) { - RB_UNWRAP(cookie) ; + RB_UNWRAP(cookie); // Database path - VALUE db = rb_iv_get(self, "@db") ; + VALUE db = rb_iv_get(self, "@db"); - char *database = NULL ; + char *database = NULL; if(RB_TYPE_P(db, T_STRING)) { - database = StringValuePtr(db) ; + database = StringValuePtr(db); } // File path - VALUE f = rb_iv_get(self, "@file") ; - char *file = StringValuePtr(f) ; + VALUE f = rb_iv_get(self, "@file"); + char *file = StringValuePtr(f); - if(database) magic_validate_db(*cookie, database) ; + if(database) magic_validate_db(*cookie, database); if (magic_load(*cookie, database) == -1) { - rb_raise(rb_eRuntimeError, "Failed to load magic database: %s", magic_error(*cookie)) ; + rb_raise(rb_eRuntimeError, "Failed to load magic database: %s", magic_error(*cookie)); } - fileReadable(file) ; - const char *mt = magic_file(*cookie, file) ; + fileReadable(file); + const char *mt = magic_file(*cookie, file); - return mt ? rb_str_new_cstr(mt) : Qnil ; + return mt ? rb_str_new_cstr(mt) : Qnil; } /* @@ -113,16 +113,16 @@ VALUE _checkGlobal_(VALUE self) { VALUE _getParamGlobal_(VALUE self, VALUE param) { #if MAGIC_VERSION > 525 - RB_UNWRAP(cookie) ; + RB_UNWRAP(cookie); - unsigned int _param = NUM2UINT(param) ; - unsigned long value ; + unsigned int _param = NUM2UINT(param); + unsigned long value; - int status = magic_getparam(*cookie, _param, &value) ; - if (status) return Qnil ; - return ULONG2NUM(value) ; + int status = magic_getparam(*cookie, _param, &value); + if (status) return Qnil; + return ULONG2NUM(value); #else - return Qnil ; + return Qnil; #endif } @@ -149,20 +149,20 @@ VALUE _getParamGlobal_(VALUE self, VALUE param) { VALUE _setParamGlobal_(VALUE self, VALUE param, VALUE paramVal) { #if MAGIC_VERSION > 525 - unsigned int _param = NUM2UINT(param) ; - unsigned long _paramVal = NUM2ULONG(paramVal) ; + unsigned int _param = NUM2UINT(param); + unsigned long _paramVal = NUM2ULONG(paramVal); - RB_UNWRAP(cookie) ; + RB_UNWRAP(cookie); - unsigned long value ; - magic_setparam(*cookie, _param, &_paramVal) ; + unsigned long value; + magic_setparam(*cookie, _param, &_paramVal); - int status = magic_getparam(*cookie, _param, &value) ; - if (status) return Qnil ; + int status = magic_getparam(*cookie, _param, &value); + if (status) return Qnil; - return ULONG2NUM((int)value) ; + return ULONG2NUM((int)value); #else - return Qnil ; + return Qnil; #endif } @@ -186,25 +186,25 @@ VALUE _setParamGlobal_(VALUE self, VALUE param, VALUE paramVal) { */ VALUE _bufferGlobal_(VALUE self, VALUE string) { - RB_UNWRAP(cookie) ; + RB_UNWRAP(cookie); - VALUE db = rb_iv_get(self, "@db") ; + VALUE db = rb_iv_get(self, "@db"); - char *database = NULL ; + char *database = NULL; if(RB_TYPE_P(db, T_STRING)) { - database = StringValuePtr(db) ; + database = StringValuePtr(db); } - if(database) magic_validate_db(*cookie, database) ; + if(database) magic_validate_db(*cookie, database); if (magic_load(*cookie, database) == -1) { - rb_raise(rb_eRuntimeError, "Failed to load magic database: %s", magic_error(*cookie)) ; + rb_raise(rb_eRuntimeError, "Failed to load magic database: %s", magic_error(*cookie)); } - char *buffer = StringValuePtr(string) ; - const char *buf = magic_buffer(*cookie, buffer, strlen(buffer)) ; + char *buffer = StringValuePtr(string); + const char *buf = magic_buffer(*cookie, buffer, strlen(buffer)); - return buf ? rb_str_new_cstr(buf) : Qnil ; + return buf ? rb_str_new_cstr(buf) : Qnil; } /* @@ -238,19 +238,19 @@ VALUE _bufferGlobal_(VALUE self, VALUE string) { */ VALUE _listGlobal_(VALUE self) { - RB_UNWRAP(cookie) ; + RB_UNWRAP(cookie); - VALUE db = rb_iv_get(self, "@db") ; + VALUE db = rb_iv_get(self, "@db"); - char *database = NULL ; + char *database = NULL; if (RB_TYPE_P(db, T_STRING)) { - database = StringValuePtr(db) ; + database = StringValuePtr(db); } - if(database) magic_validate_db(*cookie, database) ; - int status = magic_list(*cookie, database) ; + if(database) magic_validate_db(*cookie, database); + int status = magic_list(*cookie, database); - return INT2FIX(status) ; + return INT2FIX(status); } /* @@ -285,15 +285,15 @@ VALUE _listGlobal_(VALUE self) { */ VALUE _setflagsGlobal_(VALUE self, VALUE flags) { - unsigned int flag = NUM2UINT(flags) ; + unsigned int flag = NUM2UINT(flags); - RB_UNWRAP(cookie) ; - int status = magic_setflags(*cookie, flag) ; + RB_UNWRAP(cookie); + int status = magic_setflags(*cookie, flag); if (status) { - return Qnil ; + return Qnil; } else { - rb_ivar_set(self, rb_intern("@mode"), flags) ; - return flags ; + rb_ivar_set(self, rb_intern("@mode"), flags); + return flags; } } diff --git a/ext/libmagic/magic.c b/ext/libmagic/magic.c index d43778e..2d7b5e3 100644 --- a/ext/libmagic/magic.c +++ b/ext/libmagic/magic.c @@ -18,20 +18,20 @@ /* * Errors */ -VALUE rb_eFileNotFoundError ; -VALUE rb_eFileNotReadableError ; -VALUE rb_eInvalidDBError ; -VALUE rb_eIsDirError ; -VALUE rb_eFileClosedError ; +VALUE rb_eFileNotFoundError; +VALUE rb_eFileNotReadableError; +VALUE rb_eInvalidDBError; +VALUE rb_eIsDirError; +VALUE rb_eFileClosedError; // Garbage collect void file_free(void *data) { if(data) { - magic_close(*(void **)data) ; - *(void **)data = NULL ; + magic_close(*(void **)data); + *(void **)data = NULL; } - free(data) ; + free(data); } // Filetype @@ -46,7 +46,7 @@ static rb_data_type_t fileType = { #ifdef RUBY_TYPED_FREE_IMMEDIATELY .flags = RUBY_TYPED_FREE_IMMEDIATELY #endif -} ; +}; #include "validations.h" #include "func.h" @@ -67,67 +67,67 @@ static rb_data_type_t fileType = { */ static VALUE _check_(VALUE obj, VALUE args) { if(!RB_TYPE_P(args, T_HASH)) { - rb_raise(rb_eArgError, "Expected hash as argument.") ; + rb_raise(rb_eArgError, "Expected hash as argument."); } // Database Path - VALUE argDBPath = rb_hash_aref(args, ID2SYM(rb_intern("db"))) ; + VALUE argDBPath = rb_hash_aref(args, ID2SYM(rb_intern("db"))); - char *databasePath = NULL ; + char *databasePath = NULL; if (!NIL_P(argDBPath)) { if (!RB_TYPE_P(argDBPath, T_STRING)) { - rb_raise(rb_eArgError, "Database name must be an instance of String.") ; + rb_raise(rb_eArgError, "Database name must be an instance of String."); } - databasePath = StringValuePtr(argDBPath) ; + databasePath = StringValuePtr(argDBPath); } // File path - VALUE argFilePath = rb_hash_aref(args, ID2SYM(rb_intern("file"))) ; + VALUE argFilePath = rb_hash_aref(args, ID2SYM(rb_intern("file"))); if (RB_TYPE_P(argFilePath, T_NIL)) { - rb_raise(rb_eArgError, "Expected `file:\" key as a string, got nil instead") ; + rb_raise(rb_eArgError, "Expected `file:\" key as a string, got nil instead"); } else if (!RB_TYPE_P(argFilePath, T_STRING)) { - rb_raise(rb_eArgError, "Filename must be an instance of String.") ; + rb_raise(rb_eArgError, "Filename must be an instance of String."); } - char *checkPath = StringValuePtr(argFilePath) ; + char *checkPath = StringValuePtr(argFilePath); // Modes - VALUE argModes = rb_hash_aref(args, ID2SYM(rb_intern("mode"))) ; - unsigned int modes ; + VALUE argModes = rb_hash_aref(args, ID2SYM(rb_intern("mode"))); + unsigned int modes; if(RB_TYPE_P(argModes, T_NIL)) { - modes = MAGIC_MIME | MAGIC_CHECK | MAGIC_SYMLINK ; + modes = MAGIC_MIME | MAGIC_CHECK | MAGIC_SYMLINK; } else if (!RB_TYPE_P(argModes, T_FIXNUM)) { - rb_raise(rb_eArgError, "Modes must be an instance of Integer. Check LibmagicRb.constants() or LibmagicRb.lsmodes().") ; + rb_raise(rb_eArgError, "Modes must be an instance of Integer. Check LibmagicRb.constants() or LibmagicRb.lsmodes()."); } else { - modes = FIX2UINT(argModes) ; + modes = FIX2UINT(argModes); } // Checks - struct magic_set *magic = magic_open(modes) ; + struct magic_set *magic = magic_open(modes); if (!magic) { - rb_raise(rb_eRuntimeError, "Failed to initialize magic cookie.") ; + rb_raise(rb_eRuntimeError, "Failed to initialize magic cookie."); } // Check if the database is a valid file or not // Raises ruby error which will return. - fileReadable(checkPath) ; + fileReadable(checkPath); if(databasePath) { - magic_validate_db(magic, databasePath) ; + magic_validate_db(magic, databasePath); } if (magic_load(magic, databasePath) == -1) { magic_close(magic); - rb_raise(rb_eInvalidDBError, "Failed to load magic database: %s", magic_error(magic)) ; + rb_raise(rb_eInvalidDBError, "Failed to load magic database: %s", magic_error(magic)); } - const char *mt = magic_file(magic, checkPath) ; + const char *mt = magic_file(magic, checkPath); - VALUE retVal = mt ? rb_str_new_cstr(mt) : Qnil ; - magic_close(magic) ; + VALUE retVal = mt ? rb_str_new_cstr(mt) : Qnil; + magic_close(magic); - return retVal ; + return retVal; } /* @@ -170,67 +170,67 @@ static VALUE _check_(VALUE obj, VALUE args) { VALUE rb_libmagicRb_initialize(VALUE self, VALUE args) { // Database Path if(!RB_TYPE_P(args, T_HASH)) { - rb_raise(rb_eArgError, "Expected hash as argument.") ; + rb_raise(rb_eArgError, "Expected hash as argument."); } - VALUE argDBPath = rb_hash_aref(args, ID2SYM(rb_intern("db"))) ; + VALUE argDBPath = rb_hash_aref(args, ID2SYM(rb_intern("db"))); if (RB_TYPE_P(argDBPath, T_NIL)) { - rb_ivar_set(self, rb_intern("@db"), Qnil) ; + rb_ivar_set(self, rb_intern("@db"), Qnil); } else if (!RB_TYPE_P(argDBPath, T_STRING)) { - rb_raise(rb_eArgError, "Database name must be an instance of String.") ; + rb_raise(rb_eArgError, "Database name must be an instance of String."); } else { - rb_ivar_set(self, rb_intern("@db"), argDBPath) ; + rb_ivar_set(self, rb_intern("@db"), argDBPath); } // File path - VALUE argFilePath = rb_hash_aref(args, ID2SYM(rb_intern("file"))) ; + VALUE argFilePath = rb_hash_aref(args, ID2SYM(rb_intern("file"))); if (RB_TYPE_P(argFilePath, T_NIL)) { - rb_raise(rb_eArgError, "Expected `file:\" key as a string, got nil instead") ; + rb_raise(rb_eArgError, "Expected `file:\" key as a string, got nil instead"); } else if (!RB_TYPE_P(argFilePath, T_STRING)) { - rb_raise(rb_eArgError, "Filename must be an instance of String.") ; + rb_raise(rb_eArgError, "Filename must be an instance of String."); } - rb_ivar_set(self, rb_intern("@file"), argFilePath) ; + rb_ivar_set(self, rb_intern("@file"), argFilePath); // Modes - VALUE argModes = rb_hash_aref(args, ID2SYM(rb_intern("mode"))) ; - unsigned int modes ; + VALUE argModes = rb_hash_aref(args, ID2SYM(rb_intern("mode"))); + unsigned int modes; if(RB_TYPE_P(argModes, T_NIL)) { - modes = MAGIC_MIME | MAGIC_CHECK | MAGIC_SYMLINK ; + modes = MAGIC_MIME | MAGIC_CHECK | MAGIC_SYMLINK; } else if (!RB_TYPE_P(argModes, T_FIXNUM)) { - rb_raise(rb_eArgError, "Modes must be an instance of Integer. Check LibmagicRb.constants() or LibmagicRb.lsmodes().") ; + rb_raise(rb_eArgError, "Modes must be an instance of Integer. Check LibmagicRb.constants() or LibmagicRb.lsmodes()."); } else { - modes = FIX2UINT(argModes) ; + modes = FIX2UINT(argModes); } - rb_ivar_set(self, rb_intern("@mode"), UINT2NUM(modes)) ; + rb_ivar_set(self, rb_intern("@mode"), UINT2NUM(modes)); - rb_ivar_set(self, rb_intern("@closed"), Qfalse) ; + rb_ivar_set(self, rb_intern("@closed"), Qfalse); - RB_UNWRAP(cookie) ; - magic_setflags(*cookie, modes) ; + RB_UNWRAP(cookie); + magic_setflags(*cookie, modes); - return self ; + return self; } VALUE initAlloc(VALUE self) { - magic_t *cookie ; - cookie = malloc(sizeof(*cookie)) ; + magic_t *cookie; + cookie = malloc(sizeof(*cookie)); if (!cookie) { - rb_raise(rb_eNoMemError, "Failed to allocate memory for magic cookie.") ; + rb_raise(rb_eNoMemError, "Failed to allocate memory for magic cookie."); } - *cookie = magic_open(0) ; + *cookie = magic_open(0); - return TypedData_Wrap_Struct(self, &fileType, cookie) ; + return TypedData_Wrap_Struct(self, &fileType, cookie); } void Init_main() { - rb_global_variable(&rb_eFileNotFoundError) ; - rb_global_variable(&rb_eFileNotReadableError) ; - rb_global_variable(&rb_eInvalidDBError) ; - rb_global_variable(&rb_eIsDirError) ; - rb_global_variable(&rb_eFileClosedError) ; + rb_global_variable(&rb_eFileNotFoundError); + rb_global_variable(&rb_eFileNotReadableError); + rb_global_variable(&rb_eInvalidDBError); + rb_global_variable(&rb_eIsDirError); + rb_global_variable(&rb_eFileClosedError); /* * Libmagic Errors @@ -239,74 +239,74 @@ void Init_main() { /* Adds ability to check mime-type of a file using the libmagic (magic(4)). It uses native extensions and it's quite performant. */ - VALUE cLibmagicRb = rb_define_class("LibmagicRb", rb_cObject) ; + VALUE cLibmagicRb = rb_define_class("LibmagicRb", rb_cObject); - rb_eFileNotFoundError = rb_define_class_under(cLibmagicRb, "FileNotFound", rb_eRuntimeError) ; - rb_eFileNotReadableError = rb_define_class_under(cLibmagicRb, "FileUnreadable", rb_eRuntimeError) ; - rb_eInvalidDBError = rb_define_class_under(cLibmagicRb, "InvalidDBError", rb_eRuntimeError) ; - rb_eIsDirError = rb_define_class_under(cLibmagicRb, "IsDirError", rb_eRuntimeError) ; - rb_eFileClosedError = rb_define_class_under(cLibmagicRb, "FileClosedError", rb_eRuntimeError) ; + rb_eFileNotFoundError = rb_define_class_under(cLibmagicRb, "FileNotFound", rb_eRuntimeError); + rb_eFileNotReadableError = rb_define_class_under(cLibmagicRb, "FileUnreadable", rb_eRuntimeError); + rb_eInvalidDBError = rb_define_class_under(cLibmagicRb, "InvalidDBError", rb_eRuntimeError); + rb_eIsDirError = rb_define_class_under(cLibmagicRb, "IsDirError", rb_eRuntimeError); + rb_eFileClosedError = rb_define_class_under(cLibmagicRb, "FileClosedError", rb_eRuntimeError); /* * Constants */ - modes(cLibmagicRb) ; - params(cLibmagicRb) ; + modes(cLibmagicRb); + params(cLibmagicRb); #if MAGIC_VERSION > 525 - char version[6] ; - sprintf(version, "%0.2f", magic_version() / 100.0) ; + char version[6]; + sprintf(version, "%0.2f", magic_version() / 100.0); /* LibmagicRb::MAGIC_VERSION returns the magic version of the library. For older libmagic version, this can be undefined, so this method will return "0" instead. */ - rb_define_const(cLibmagicRb, "MAGIC_VERSION", rb_str_new_cstr(version)) ; + rb_define_const(cLibmagicRb, "MAGIC_VERSION", rb_str_new_cstr(version)); #else - rb_define_const(cLibmagicRb, "MAGIC_VERSION", rb_str_new_cstr("0")) ; + rb_define_const(cLibmagicRb, "MAGIC_VERSION", rb_str_new_cstr("0")); #endif /* * Singleton Methods */ - rb_define_singleton_method(cLibmagicRb, "check", _check_, 1) ; - rb_define_singleton_method(cLibmagicRb, "lsmodes", lsmodes, 0) ; - rb_define_singleton_method(cLibmagicRb, "lsparams", lsparams, 0) ; + rb_define_singleton_method(cLibmagicRb, "check", _check_, 1); + rb_define_singleton_method(cLibmagicRb, "lsmodes", lsmodes, 0); + rb_define_singleton_method(cLibmagicRb, "lsparams", lsparams, 0); /* * Instance Methods */ - rb_define_alloc_func(cLibmagicRb, initAlloc) ; + rb_define_alloc_func(cLibmagicRb, initAlloc); // LibmagicRb.new() - rb_define_method(cLibmagicRb, "initialize", rb_libmagicRb_initialize, 1) ; + rb_define_method(cLibmagicRb, "initialize", rb_libmagicRb_initialize, 1); // Attributes - rb_define_attr(cLibmagicRb, "closed", 1, 0) ; - rb_define_attr(cLibmagicRb, "mode", 1, 0) ; - rb_define_attr(cLibmagicRb, "file", 1, 1) ; - rb_define_attr(cLibmagicRb, "db", 1, 1) ; + rb_define_attr(cLibmagicRb, "closed", 1, 0); + rb_define_attr(cLibmagicRb, "mode", 1, 0); + rb_define_attr(cLibmagicRb, "file", 1, 1); + rb_define_attr(cLibmagicRb, "db", 1, 1); // Close database - rb_define_method(cLibmagicRb, "close", _closeGlobal_, 0) ; - rb_define_alias(cLibmagicRb, "closed?", "closed") ; + rb_define_method(cLibmagicRb, "close", _closeGlobal_, 0); + rb_define_alias(cLibmagicRb, "closed?", "closed"); // Load database - rb_define_method(cLibmagicRb, "load", _loadGlobal_, 1) ; + rb_define_method(cLibmagicRb, "load", _loadGlobal_, 1); // Check for file mimetype - rb_define_method(cLibmagicRb, "check", _checkGlobal_, 0) ; + rb_define_method(cLibmagicRb, "check", _checkGlobal_, 0); // Get and set params - rb_define_method(cLibmagicRb, "getparam", _getParamGlobal_, 1) ; - rb_define_method(cLibmagicRb, "setparam", _setParamGlobal_, 2) ; + rb_define_method(cLibmagicRb, "getparam", _getParamGlobal_, 1); + rb_define_method(cLibmagicRb, "setparam", _setParamGlobal_, 2); // Set modes dynamically - rb_define_method(cLibmagicRb, "setflags", _setflagsGlobal_, 1) ; - rb_define_method(cLibmagicRb, "mode=", _setflagsGlobal_, 1) ; + rb_define_method(cLibmagicRb, "setflags", _setflagsGlobal_, 1); + rb_define_method(cLibmagicRb, "mode=", _setflagsGlobal_, 1); // Miscellaneous - rb_define_method(cLibmagicRb, "magic_buffer", _bufferGlobal_, 1) ; - rb_define_method(cLibmagicRb, "magic_list", _listGlobal_, 0) ; + rb_define_method(cLibmagicRb, "magic_buffer", _bufferGlobal_, 1); + rb_define_method(cLibmagicRb, "magic_list", _listGlobal_, 0); } diff --git a/ext/libmagic/modes.h b/ext/libmagic/modes.h index 2d72d23..2ff165e 100644 --- a/ext/libmagic/modes.h +++ b/ext/libmagic/modes.h @@ -1,142 +1,142 @@ // In the older versions, there were some missing constants. Don't define them at compile time. void modes(volatile VALUE rb_klass) { - rb_define_const(rb_klass, "MAGIC_NONE", INT2FIX(MAGIC_NONE)) ; - rb_define_const(rb_klass, "MAGIC_DEBUG", INT2FIX(MAGIC_DEBUG)) ; - rb_define_const(rb_klass, "MAGIC_SYMLINK", INT2FIX(MAGIC_SYMLINK)) ; - rb_define_const(rb_klass, "MAGIC_COMPRESS", INT2FIX(MAGIC_COMPRESS)) ; - rb_define_const(rb_klass, "MAGIC_DEVICES", INT2FIX(MAGIC_DEVICES)) ; - rb_define_const(rb_klass, "MAGIC_MIME_TYPE", INT2FIX(MAGIC_MIME_TYPE)) ; - rb_define_const(rb_klass, "MAGIC_MIME_ENCODING", INT2FIX(MAGIC_MIME_ENCODING)) ; - rb_define_const(rb_klass, "MAGIC_MIME", INT2FIX(MAGIC_MIME)) ; - rb_define_const(rb_klass, "MAGIC_CONTINUE", INT2FIX(MAGIC_CONTINUE)) ; - rb_define_const(rb_klass, "MAGIC_CHECK", INT2FIX(MAGIC_CHECK)) ; - rb_define_const(rb_klass, "MAGIC_PRESERVE_ATIME", INT2FIX(MAGIC_PRESERVE_ATIME)) ; - rb_define_const(rb_klass, "MAGIC_RAW", INT2FIX(MAGIC_RAW)) ; - rb_define_const(rb_klass, "MAGIC_ERROR", INT2FIX(MAGIC_ERROR)) ; - rb_define_const(rb_klass, "MAGIC_APPLE", INT2FIX(MAGIC_APPLE)) ; + rb_define_const(rb_klass, "MAGIC_NONE", INT2FIX(MAGIC_NONE)); + rb_define_const(rb_klass, "MAGIC_DEBUG", INT2FIX(MAGIC_DEBUG)); + rb_define_const(rb_klass, "MAGIC_SYMLINK", INT2FIX(MAGIC_SYMLINK)); + rb_define_const(rb_klass, "MAGIC_COMPRESS", INT2FIX(MAGIC_COMPRESS)); + rb_define_const(rb_klass, "MAGIC_DEVICES", INT2FIX(MAGIC_DEVICES)); + rb_define_const(rb_klass, "MAGIC_MIME_TYPE", INT2FIX(MAGIC_MIME_TYPE)); + rb_define_const(rb_klass, "MAGIC_MIME_ENCODING", INT2FIX(MAGIC_MIME_ENCODING)); + rb_define_const(rb_klass, "MAGIC_MIME", INT2FIX(MAGIC_MIME)); + rb_define_const(rb_klass, "MAGIC_CONTINUE", INT2FIX(MAGIC_CONTINUE)); + rb_define_const(rb_klass, "MAGIC_CHECK", INT2FIX(MAGIC_CHECK)); + rb_define_const(rb_klass, "MAGIC_PRESERVE_ATIME", INT2FIX(MAGIC_PRESERVE_ATIME)); + rb_define_const(rb_klass, "MAGIC_RAW", INT2FIX(MAGIC_RAW)); + rb_define_const(rb_klass, "MAGIC_ERROR", INT2FIX(MAGIC_ERROR)); + rb_define_const(rb_klass, "MAGIC_APPLE", INT2FIX(MAGIC_APPLE)); #ifdef MAGIC_EXTENSION - rb_define_const(rb_klass, "MAGIC_EXTENSION", INT2FIX(MAGIC_EXTENSION)) ; + rb_define_const(rb_klass, "MAGIC_EXTENSION", INT2FIX(MAGIC_EXTENSION)); #endif #ifdef MAGIC_COMPRESS_TRANSP - rb_define_const(rb_klass, "MAGIC_COMPRESS_TRANSP", INT2FIX(MAGIC_COMPRESS_TRANSP)) ; + rb_define_const(rb_klass, "MAGIC_COMPRESS_TRANSP", INT2FIX(MAGIC_COMPRESS_TRANSP)); #endif #ifdef MAGIC_NO_CHECK_APPTYPE - rb_define_const(rb_klass, "MAGIC_NO_CHECK_APPTYPE", INT2FIX(MAGIC_NO_CHECK_APPTYPE)) ; + rb_define_const(rb_klass, "MAGIC_NO_CHECK_APPTYPE", INT2FIX(MAGIC_NO_CHECK_APPTYPE)); #endif #ifdef MAGIC_NO_CHECK_CDF - rb_define_const(rb_klass, "MAGIC_NO_CHECK_CDF", INT2FIX(MAGIC_NO_CHECK_CDF)) ; + rb_define_const(rb_klass, "MAGIC_NO_CHECK_CDF", INT2FIX(MAGIC_NO_CHECK_CDF)); #endif #ifdef MAGIC_NO_CHECK_COMPRESS - rb_define_const(rb_klass, "MAGIC_NO_CHECK_COMPRESS", INT2FIX(MAGIC_NO_CHECK_COMPRESS)) ; + rb_define_const(rb_klass, "MAGIC_NO_CHECK_COMPRESS", INT2FIX(MAGIC_NO_CHECK_COMPRESS)); #endif #ifdef MAGIC_NO_CHECK_ELF - rb_define_const(rb_klass, "MAGIC_NO_CHECK_ELF", INT2FIX(MAGIC_NO_CHECK_ELF)) ; + rb_define_const(rb_klass, "MAGIC_NO_CHECK_ELF", INT2FIX(MAGIC_NO_CHECK_ELF)); #endif #ifdef MAGIC_NO_CHECK_ENCODING - rb_define_const(rb_klass, "MAGIC_NO_CHECK_ENCODING", INT2FIX(MAGIC_NO_CHECK_ENCODING)) ; + rb_define_const(rb_klass, "MAGIC_NO_CHECK_ENCODING", INT2FIX(MAGIC_NO_CHECK_ENCODING)); #endif #ifdef MAGIC_NO_CHECK_SOFT - rb_define_const(rb_klass, "MAGIC_NO_CHECK_SOFT", INT2FIX(MAGIC_NO_CHECK_SOFT)) ; + rb_define_const(rb_klass, "MAGIC_NO_CHECK_SOFT", INT2FIX(MAGIC_NO_CHECK_SOFT)); #endif #ifdef MAGIC_NO_CHECK_TAR - rb_define_const(rb_klass, "MAGIC_NO_CHECK_TAR", INT2FIX(MAGIC_NO_CHECK_TAR)) ; + rb_define_const(rb_klass, "MAGIC_NO_CHECK_TAR", INT2FIX(MAGIC_NO_CHECK_TAR)); #endif #ifdef MAGIC_NO_CHECK_TEXT - rb_define_const(rb_klass, "MAGIC_NO_CHECK_TEXT", INT2FIX(MAGIC_NO_CHECK_TEXT)) ; + rb_define_const(rb_klass, "MAGIC_NO_CHECK_TEXT", INT2FIX(MAGIC_NO_CHECK_TEXT)); #endif #ifdef MAGIC_NO_CHECK_TOKENS - rb_define_const(rb_klass, "MAGIC_NO_CHECK_TOKENS", INT2FIX(MAGIC_NO_CHECK_TOKENS)) ; + rb_define_const(rb_klass, "MAGIC_NO_CHECK_TOKENS", INT2FIX(MAGIC_NO_CHECK_TOKENS)); #endif #ifdef MAGIC_NO_CHECK_JSON - rb_define_const(rb_klass, "MAGIC_NO_CHECK_JSON", INT2FIX(MAGIC_NO_CHECK_JSON)) ; + rb_define_const(rb_klass, "MAGIC_NO_CHECK_JSON", INT2FIX(MAGIC_NO_CHECK_JSON)); #endif #ifdef MAGIC_NO_CHECK_CSV - rb_define_const(rb_klass, "MAGIC_NO_CHECK_CSV", INT2FIX(MAGIC_NO_CHECK_CSV)) ; + rb_define_const(rb_klass, "MAGIC_NO_CHECK_CSV", INT2FIX(MAGIC_NO_CHECK_CSV)); #endif } VALUE lsmodes(volatile VALUE obj) { - VALUE hash = rb_hash_new() ; - - rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_NONE")), INT2FIX(MAGIC_NONE)) ; - rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_DEBUG")), INT2FIX(MAGIC_DEBUG)) ; - rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_SYMLINK")), INT2FIX(MAGIC_SYMLINK)) ; - rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_COMPRESS")), INT2FIX(MAGIC_COMPRESS)) ; - rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_DEVICES")), INT2FIX(MAGIC_DEVICES)) ; - rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_MIME_TYPE")), INT2FIX(MAGIC_MIME_TYPE)) ; - rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_MIME_ENCODING")), INT2FIX(MAGIC_MIME_ENCODING)) ; - rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_MIME")), INT2FIX(MAGIC_MIME)) ; - rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_CONTINUE")), INT2FIX(MAGIC_CONTINUE)) ; - rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_CHECK")), INT2FIX(MAGIC_CHECK)) ; - rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_PRESERVE_ATIME")), INT2FIX(MAGIC_PRESERVE_ATIME)) ; - rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_RAW")), INT2FIX(MAGIC_RAW)) ; - rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_ERROR")), INT2FIX(MAGIC_ERROR)) ; - rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_APPLE")), INT2FIX(MAGIC_APPLE)) ; + VALUE hash = rb_hash_new(); + + rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_NONE")), INT2FIX(MAGIC_NONE)); + rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_DEBUG")), INT2FIX(MAGIC_DEBUG)); + rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_SYMLINK")), INT2FIX(MAGIC_SYMLINK)); + rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_COMPRESS")), INT2FIX(MAGIC_COMPRESS)); + rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_DEVICES")), INT2FIX(MAGIC_DEVICES)); + rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_MIME_TYPE")), INT2FIX(MAGIC_MIME_TYPE)); + rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_MIME_ENCODING")), INT2FIX(MAGIC_MIME_ENCODING)); + rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_MIME")), INT2FIX(MAGIC_MIME)); + rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_CONTINUE")), INT2FIX(MAGIC_CONTINUE)); + rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_CHECK")), INT2FIX(MAGIC_CHECK)); + rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_PRESERVE_ATIME")), INT2FIX(MAGIC_PRESERVE_ATIME)); + rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_RAW")), INT2FIX(MAGIC_RAW)); + rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_ERROR")), INT2FIX(MAGIC_ERROR)); + rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_APPLE")), INT2FIX(MAGIC_APPLE)); #ifdef MAGIC_EXTENSION - rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_EXTENSION")), INT2FIX(MAGIC_EXTENSION)) ; + rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_EXTENSION")), INT2FIX(MAGIC_EXTENSION)); #endif #ifdef MAGIC_COMPRESS_TRANSP - rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_COMPRESS_TRANSP")), INT2FIX(MAGIC_COMPRESS_TRANSP)) ; + rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_COMPRESS_TRANSP")), INT2FIX(MAGIC_COMPRESS_TRANSP)); #endif #ifdef MAGIC_NO_CHECK_APPTYPE - rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_NO_CHECK_APPTYPE")), INT2FIX(MAGIC_NO_CHECK_APPTYPE)) ; + rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_NO_CHECK_APPTYPE")), INT2FIX(MAGIC_NO_CHECK_APPTYPE)); #endif #ifdef MAGIC_NO_CHECK_CDF - rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_NO_CHECK_CDF")), INT2FIX(MAGIC_NO_CHECK_CDF)) ; + rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_NO_CHECK_CDF")), INT2FIX(MAGIC_NO_CHECK_CDF)); #endif #ifdef MAGIC_NO_CHECK_COMPRESS - rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_NO_CHECK_COMPRESS")), INT2FIX(MAGIC_NO_CHECK_COMPRESS)) ; + rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_NO_CHECK_COMPRESS")), INT2FIX(MAGIC_NO_CHECK_COMPRESS)); #endif #ifdef MAGIC_NO_CHECK_ELF - rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_NO_CHECK_ELF")), INT2FIX(MAGIC_NO_CHECK_ELF)) ; + rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_NO_CHECK_ELF")), INT2FIX(MAGIC_NO_CHECK_ELF)); #endif #ifdef MAGIC_NO_CHECK_ENCODING - rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_NO_CHECK_ENCODING")), INT2FIX(MAGIC_NO_CHECK_ENCODING)) ; + rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_NO_CHECK_ENCODING")), INT2FIX(MAGIC_NO_CHECK_ENCODING)); #endif #ifdef MAGIC_NO_CHECK_SOFT - rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_NO_CHECK_SOFT")), INT2FIX(MAGIC_NO_CHECK_SOFT)) ; + rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_NO_CHECK_SOFT")), INT2FIX(MAGIC_NO_CHECK_SOFT)); #endif #ifdef MAGIC_NO_CHECK_TAR - rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_NO_CHECK_TAR")), INT2FIX(MAGIC_NO_CHECK_TAR)) ; + rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_NO_CHECK_TAR")), INT2FIX(MAGIC_NO_CHECK_TAR)); #endif #ifdef MAGIC_NO_CHECK_TEXT - rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_NO_CHECK_TEXT")), INT2FIX(MAGIC_NO_CHECK_TEXT)) ; + rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_NO_CHECK_TEXT")), INT2FIX(MAGIC_NO_CHECK_TEXT)); #endif #ifdef MAGIC_NO_CHECK_TOKENS - rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_NO_CHECK_TOKENS")), INT2FIX(MAGIC_NO_CHECK_TOKENS)) ; + rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_NO_CHECK_TOKENS")), INT2FIX(MAGIC_NO_CHECK_TOKENS)); #endif #ifdef MAGIC_NO_CHECK_CSV - rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_NO_CHECK_CSV")), INT2FIX(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)) ; + rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_NO_CHECK_JSON")), INT2FIX(MAGIC_NO_CHECK_JSON)); #endif - return hash ; + return hash; } diff --git a/ext/libmagic/params.h b/ext/libmagic/params.h index 6c1678e..19df01c 100644 --- a/ext/libmagic/params.h +++ b/ext/libmagic/params.h @@ -1,63 +1,63 @@ void params(volatile VALUE rb_klass) { #ifdef MAGIC_PARAM_INDIR_MAX - rb_define_const(rb_klass, "MAGIC_PARAM_INDIR_MAX", UINT2NUM(MAGIC_PARAM_INDIR_MAX)) ; + rb_define_const(rb_klass, "MAGIC_PARAM_INDIR_MAX", UINT2NUM(MAGIC_PARAM_INDIR_MAX)); #endif #ifdef MAGIC_PARAM_NAME_MAX - rb_define_const(rb_klass, "MAGIC_PARAM_NAME_MAX", UINT2NUM(MAGIC_PARAM_NAME_MAX)) ; + rb_define_const(rb_klass, "MAGIC_PARAM_NAME_MAX", UINT2NUM(MAGIC_PARAM_NAME_MAX)); #endif #ifdef MAGIC_PARAM_ELF_NOTES_MAX - rb_define_const(rb_klass, "MAGIC_PARAM_ELF_NOTES_MAX", UINT2NUM(MAGIC_PARAM_ELF_NOTES_MAX)) ; + rb_define_const(rb_klass, "MAGIC_PARAM_ELF_NOTES_MAX", UINT2NUM(MAGIC_PARAM_ELF_NOTES_MAX)); #endif #ifdef MAGIC_PARAM_ELF_PHNUM_MAX - rb_define_const(rb_klass, "MAGIC_PARAM_ELF_PHNUM_MAX", UINT2NUM(MAGIC_PARAM_ELF_PHNUM_MAX)) ; + rb_define_const(rb_klass, "MAGIC_PARAM_ELF_PHNUM_MAX", UINT2NUM(MAGIC_PARAM_ELF_PHNUM_MAX)); #endif #ifdef MAGIC_PARAM_ELF_SHNUM_MAX - rb_define_const(rb_klass, "MAGIC_PARAM_ELF_SHNUM_MAX", UINT2NUM(MAGIC_PARAM_ELF_SHNUM_MAX)) ; + rb_define_const(rb_klass, "MAGIC_PARAM_ELF_SHNUM_MAX", UINT2NUM(MAGIC_PARAM_ELF_SHNUM_MAX)); #endif #ifdef MAGIC_PARAM_REGEX_MAX - rb_define_const(rb_klass, "MAGIC_PARAM_REGEX_MAX", UINT2NUM(MAGIC_PARAM_REGEX_MAX)) ; + rb_define_const(rb_klass, "MAGIC_PARAM_REGEX_MAX", UINT2NUM(MAGIC_PARAM_REGEX_MAX)); #endif #ifdef MAGIC_PARAM_BYTES_MAX - rb_define_const(rb_klass, "MAGIC_PARAM_BYTES_MAX", UINT2NUM(MAGIC_PARAM_BYTES_MAX)) ; + rb_define_const(rb_klass, "MAGIC_PARAM_BYTES_MAX", UINT2NUM(MAGIC_PARAM_BYTES_MAX)); #endif } VALUE lsparams(volatile VALUE obj) { - VALUE hash = rb_hash_new() ; + VALUE hash = rb_hash_new(); #ifdef MAGIC_PARAM_INDIR_MAX - rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_PARAM_INDIR_MAX")), UINT2NUM(MAGIC_PARAM_INDIR_MAX)) ; + rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_PARAM_INDIR_MAX")), UINT2NUM(MAGIC_PARAM_INDIR_MAX)); #endif #ifdef MAGIC_PARAM_NAME_MAX - rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_PARAM_NAME_MAX")), UINT2NUM(MAGIC_PARAM_NAME_MAX)) ; + rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_PARAM_NAME_MAX")), UINT2NUM(MAGIC_PARAM_NAME_MAX)); #endif #ifdef MAGIC_PARAM_ELF_NOTES_MAX - rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_PARAM_ELF_NOTES_MAX")), UINT2NUM(MAGIC_PARAM_ELF_NOTES_MAX)) ; + rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_PARAM_ELF_NOTES_MAX")), UINT2NUM(MAGIC_PARAM_ELF_NOTES_MAX)); #endif #ifdef MAGIC_PARAM_ELF_PHNUM_MAX - rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_PARAM_ELF_PHNUM_MAX")), UINT2NUM(MAGIC_PARAM_ELF_PHNUM_MAX)) ; + rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_PARAM_ELF_PHNUM_MAX")), UINT2NUM(MAGIC_PARAM_ELF_PHNUM_MAX)); #endif #ifdef MAGIC_PARAM_ELF_SHNUM_MAX - rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_PARAM_ELF_SHNUM_MAX")), UINT2NUM(MAGIC_PARAM_ELF_SHNUM_MAX)) ; + rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_PARAM_ELF_SHNUM_MAX")), UINT2NUM(MAGIC_PARAM_ELF_SHNUM_MAX)); #endif #ifdef MAGIC_PARAM_REGEX_MAX - rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_PARAM_REGEX_MAX")), UINT2NUM(MAGIC_PARAM_REGEX_MAX)) ; + rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_PARAM_REGEX_MAX")), UINT2NUM(MAGIC_PARAM_REGEX_MAX)); #endif #ifdef MAGIC_PARAM_BYTES_MAX - rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_PARAM_BYTES_MAX")), UINT2NUM(MAGIC_PARAM_BYTES_MAX)) ; + rb_hash_aset(hash, ID2SYM(rb_intern("MAGIC_PARAM_BYTES_MAX")), UINT2NUM(MAGIC_PARAM_BYTES_MAX)); #endif - return hash ; + return hash; } diff --git a/ext/libmagic/validations.h b/ext/libmagic/validations.h index 88cfd75..2d919ac 100644 --- a/ext/libmagic/validations.h +++ b/ext/libmagic/validations.h @@ -1,23 +1,23 @@ void fileReadable(char *filePath) { - if(access(filePath, F_OK)) rb_raise(rb_eFileNotFoundError, "%s", filePath) ; - if(access(filePath, R_OK)) rb_raise(rb_eFileNotReadableError, "%s", filePath) ; + if(access(filePath, F_OK)) rb_raise(rb_eFileNotFoundError, "%s", filePath); + if(access(filePath, R_OK)) rb_raise(rb_eFileNotReadableError, "%s", filePath); } void magic_validate_db(magic_t cookie, char *databasePath) { - struct stat statbuf ; + struct stat statbuf; if (stat(databasePath, &statbuf) != 0) - rb_raise(rb_eFileNotFoundError, "%s", databasePath) ; + rb_raise(rb_eFileNotFoundError, "%s", databasePath); if(S_ISDIR(statbuf.st_mode)) - rb_raise(rb_eIsDirError, "%s", databasePath) ; + rb_raise(rb_eIsDirError, "%s", databasePath); - if(access(databasePath, R_OK)) rb_raise(rb_eFileNotReadableError, "%s", databasePath) ; + if(access(databasePath, R_OK)) rb_raise(rb_eFileNotReadableError, "%s", databasePath); - int validFile = magic_check(cookie, databasePath) ; + int validFile = magic_check(cookie, databasePath); if (validFile != 0) { - const char *err = magic_error(cookie) ; - rb_raise(rb_eInvalidDBError, "%s (%s is not a valid magic file)", err, databasePath) ; + const char *err = magic_error(cookie); + rb_raise(rb_eInvalidDBError, "%s (%s is not a valid magic file)", err, databasePath); } }