Skip to content

Commit

Permalink
Fix C pointer conversion errors
Browse files Browse the repository at this point in the history
C++ compilation failed without these explicit casts.
  • Loading branch information
stanhu committed Jul 9, 2024
1 parent e6bf734 commit 7f026b4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ext/charlock_holmes/converter.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ static VALUE rb_converter_convert(VALUE self, VALUE rb_txt, VALUE rb_src_enc, VA
if (status != U_BUFFER_OVERFLOW_ERROR) {
rb_raise(rb_eArgError, "%s", u_errorName(status));
}
out_buf = malloc(out_len);
out_buf = (char *) malloc(out_len);

// now do the actual conversion
status = U_ZERO_ERROR;
Expand Down
2 changes: 1 addition & 1 deletion ext/charlock_holmes/encoding_detector.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ static VALUE rb_encdec__alloc(VALUE klass)
UErrorCode status = U_ZERO_ERROR;
VALUE obj;

detector = calloc(1, sizeof(charlock_detector_t));
detector = (charlock_detector_t *) calloc(1, sizeof(charlock_detector_t));
obj = Data_Wrap_Struct(klass, NULL, rb_encdec__free, (void *)detector);

detector->csd = ucsdet_open(&status);
Expand Down

0 comments on commit 7f026b4

Please sign in to comment.