Skip to content

Commit

Permalink
refactor: convert types explicitly
Browse files Browse the repository at this point in the history
  • Loading branch information
tonytonyjan committed Dec 31, 2017
1 parent 64dd5cc commit 2db63d9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions ext/jaro_winkler/jaro.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ double jaro_distance_from_codes(uint32_t *codepoints1, size_t len1,
codepoints2[i] = tolower(codepoints2[i]);
}

int32_t window_size = len2 / 2 - 1;
int32_t window_size = (int32_t)len2 / 2 - 1;
if (window_size < 0)
window_size = 0;

Expand All @@ -50,7 +50,7 @@ double jaro_distance_from_codes(uint32_t *codepoints1, size_t len1,
// count number of matching characters
size_t match_count = 0;
for (size_t i = 0; i < len1; i++) {
size_t left = (i >= window_size) ? i - window_size : 0;
size_t left = (i >= (size_t)window_size) ? i - window_size : 0;
size_t right =
(i + window_size <= len2 - 1) ? (i + window_size) : (len2 - 1);
if (right > len2 - 1)
Expand Down
2 changes: 1 addition & 1 deletion ext/jaro_winkler/jaro_winkler.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ VALUE distance(size_t argc, VALUE *argv, VALUE self,
VALUE s1, s2, opt;
CodePoints cp1, cp2;

rb_scan_args(argc, argv, "2:", &s1, &s2, &opt);
rb_scan_args((int32_t)argc, argv, "2:", &s1, &s2, &opt);
codepoints_init(&cp1, s1);
codepoints_init(&cp2, s2);

Expand Down

0 comments on commit 2db63d9

Please sign in to comment.