Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Fix compilation errors from implicit typecasts #136

Merged
merged 3 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ doc/
ext/mathematical/lib
file.svg
Gemfile.lock
*.gem
InstalledFiles
lib/bundler/man
lib/mathematical.bundle
Expand Down
7 changes: 7 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,10 @@ inherit_gem:
AllCops:
Exclude:
- 'ext/mathematical/mtex2MML/**/*'

# temporary fix for current rubocop bug
# https://github.com/rubocop/rubocop/issues/13093
Lint/ImplicitStringConcatenation:
Enabled: false
Lint/RedundantCopDisableDirective:
Enabled: false
10 changes: 5 additions & 5 deletions ext/mathematical/mathematical.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ VALUE process(VALUE self, unsigned long maxsize, const char *latex_code, unsigne
cairo_surface_t *surface;

if (format == FORMAT_SVG) {
surface = cairo_svg_surface_create_for_stream (cairoSvgSurfaceCallback, self, width_pt, height_pt);
surface = cairo_svg_surface_create_for_stream (cairoSvgSurfaceCallback, (void *)self, width_pt, height_pt);
} else if (format == FORMAT_PNG) {
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height);
}
Expand All @@ -146,7 +146,7 @@ VALUE process(VALUE self, unsigned long maxsize, const char *latex_code, unsigne

switch (format) {
case FORMAT_PNG:
cairo_surface_write_to_png_stream (cairo_get_target (cairo), cairoPngSurfaceCallback, self);
cairo_surface_write_to_png_stream (cairo_get_target (cairo), cairoPngSurfaceCallback, (void *)self);
break;
default:
break;
Expand Down Expand Up @@ -229,7 +229,7 @@ static VALUE MATHEMATICAL_process(VALUE self, VALUE rb_Input, VALUE rb_ParseType
args[4] = rb_iv_get(self, "@delimiter");
args[5] = rb_ParseType;

output = rb_rescue(process_helper, args, process_rescue, rb_Input);
output = rb_rescue(process_helper, (VALUE)&args[0], process_rescue, rb_Input);
break;
}
case T_ARRAY: {
Expand All @@ -253,7 +253,7 @@ static VALUE MATHEMATICAL_process(VALUE self, VALUE rb_Input, VALUE rb_ParseType
args[4] = rb_iv_get(self, "@delimiter");
args[5] = rb_ParseType;

hash = rb_rescue(process_helper, args, process_rescue, math);
hash = rb_rescue(process_helper, (VALUE)&args[0], process_rescue, math);

rb_ary_store(output, i, hash);
}
Expand All @@ -262,7 +262,7 @@ static VALUE MATHEMATICAL_process(VALUE self, VALUE rb_Input, VALUE rb_ParseType
default: {
/* should be impossible, Ruby code prevents this */
print_and_raise(rb_eTypeError, "not valid value");
output = NULL;
output = (VALUE)NULL;
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/mathematical/fixtures_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def strip_id(blob)
Dir["#{fixtures_dir}/before/*.text"].each do |before|
name = before.split("/").last

define_method "test_#{name}" do
define_method :"test_#{name}" do
source = File.read(before)

if ENV["MATHEMATICAL_GENERATE_SAMPLE"]
Expand Down
2 changes: 1 addition & 1 deletion test/mathematical/mathjax_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class MathJaxTest < Minitest::Test

SKIPPED = []
Dir["#{MATHJAX_TEX_DIR}/**/*.txt"].each do |tex|
define_method "test_#{tex}" do
define_method :"test_#{tex}" do
tex_contents = File.read(tex)
data = nil

Expand Down
3 changes: 2 additions & 1 deletion test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
require "bundler/setup"
require "mathematical"
require "minitest/autorun"
require "minitest/pride"
# minitest/pride broken on gh runners
# require "minitest/pride"
require "math-to-itex"
require "pp"

Expand Down
Loading