Skip to content

Conversation

@VeryEvilHumna
Copy link
Contributor

@VeryEvilHumna VeryEvilHumna commented Jul 10, 2025

I also ran into a type issue (trying to pass i32 in u32) while compiling on Windows. Compiler suggested a patch that fixed the problem, but I have no experience with Rust and no time to test if it breaks Linux build, that's why I haven't included it in the PR. There is the patch from git:

diff --git a/src/ocr.rs b/src/ocr.rs
index ef0e193..53b8741 100644
--- a/src/ocr.rs
+++ b/src/ocr.rs
@@ -40,7 +40,7 @@ impl Ocr {
                     &CString::new("/dev/null").unwrap(),
                 )
                 .unwrap();
-            set_log_level(leptonica_sys::L_SEVERITY_ERROR);
+            set_log_level(leptonica_sys::L_SEVERITY_ERROR.try_into().unwrap());
         }
         if let Some(binarization) = binarization {
             leptess
@@ -77,7 +77,7 @@ impl Ocr {
         let filename = CString::new(img.as_str()).expect("null in filename");
         let mut cpix = leptonica_plumbing::Pix::read_with_hint(
             &filename,
-            leptonica_sys::L_JPEG_CONTINUE_WITH_BAD_DATA,
+            leptonica_sys::L_JPEG_CONTINUE_WITH_BAD_DATA.try_into().unwrap(),
         )?;

         if let Some(scale) = self.scale {

Maybe that's just because of newer leptonica version than one ocrlocate used on date of its initial creation

@bepvte bepvte merged commit 8d7f896 into bepvte:main Jul 11, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants