dbalatero / levenshtein-ffi

Fast string edit distance computation, using the Damerau-Levenshtein algorithm.
BSD 2-Clause "Simplified" License
149 stars 24 forks source link

Modernize the gem and fix Ruby 3.2 compat #12

Open casperisfine opened 1 year ago

casperisfine commented 1 year ago

The gem no longer compiles on modern rubies, mostly on macOS with newer clang:

compiling levenshtein.c
levenshtein.c:24:23: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'unsigned int' [-Wshorten-64-to-32]
    if (!len1) return len2;
               ~~~~~~ ^~~~
levenshtein.c:25:23: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'unsigned int' [-Wshorten-64-to-32]
    if (!len2) return len1;
               ~~~~~~ ^~~~
2 warnings generated.

(NB: returning an unsigned long might make more sense)