[Bug 2276561] Review Request: rust-onenote_parser - Parser for Microsoft OneNote® files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



https://bugzilla.redhat.com/show_bug.cgi?id=2276561

Orion Poplawski <orion@xxxxxxxx> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Doc Type|---                         |If docs needed, set a value



--- Comment #1 from Orion Poplawski <orion@xxxxxxxx> ---
So my naive patch is:

diff -up onenote_parser-0.3.1/src/errors.rs.widestring
onenote_parser-0.3.1/src/errors.rs
--- onenote_parser-0.3.1/src/errors.rs.widestring       2006-07-23
19:21:28.000000000 -0600
+++ onenote_parser-0.3.1/src/errors.rs  2024-04-22 21:31:52.083264294 -0600
@@ -51,8 +51,8 @@ impl From<std::string::FromUtf16Error> f
     }
 }

-impl From<widestring::MissingNulError<u16>> for Error {
-    fn from(err: widestring::MissingNulError<u16>) -> Self {
+impl From<widestring::error::MissingNulTerminator> for Error {
+    fn from(err: widestring::error::MissingNulTerminator) -> Self {
         ErrorKind::from(err).into()
     }
 }
@@ -128,6 +128,6 @@ pub enum ErrorKind {
     #[error("UTF-16 string is missing null terminator: {err}")]
     Utf16MissingNull {
         #[from]
-        err: widestring::MissingNulError<u16>,
+        err: widestring::error::MissingNulTerminator,
     },
 }
diff -up onenote_parser-0.3.1/src/utils.rs.widestring
onenote_parser-0.3.1/src/utils.rs
--- onenote_parser-0.3.1/src/utils.rs.widestring        2006-07-23
19:21:28.000000000 -0600
+++ onenote_parser-0.3.1/src/utils.rs   2024-04-22 21:41:02.878758421 -0600
@@ -12,7 +12,7 @@ impl Utf16ToString for &[u8] {
             .map(|v| u16::from_le_bytes([v[0], v[1]]))
             .collect();

-        let value = U16CString::from_vec_with_nul(data)?;
+        let value = U16CString::from_vec_truncate(data);

         Ok(value.to_string()?)
     }

I dropped the ? because rust said it couldn't be applied but that led to:

error[E0277]: `?` couldn't convert the error to `errors::Error`
  --> src/utils.rs:17:29
   |
17 |         Ok(value.to_string()?)
   |                             ^ the trait `From<Utf16Error>` is not
implemented for `errors::Error`, which is required by
`std::result::Result<String, errors::Error>:
FromResidual<std::result::Result<Infallible, Utf16Error>>`
   |
   = note: the question mark operation (`?`) implicitly performs a conversion
on the error value using the `From` trait
   = help: the following other types implement trait `From<T>`:
             <errors::Error as From<uuid::Error>>
             <errors::Error as From<widestring::error::MissingNulTerminator>>
             <errors::Error as From<errors::ErrorKind>>
             <errors::Error as From<std::io::Error>>
             <errors::Error as From<FromUtf16Error>>
   = note: required for `std::result::Result<String, errors::Error>` to
implement `FromResidual<std::result::Result<Infallible, Utf16Error>>`


At this point I'll just say I know nothing about rust and will stop.  Help
appreciated.


-- 
You are receiving this mail because:
You are always notified about changes to this product and component
You are on the CC list for the bug.
https://bugzilla.redhat.com/show_bug.cgi?id=2276561

Report this comment as SPAM: https://bugzilla.redhat.com/enter_bug.cgi?product=Bugzilla&format=report-spam&short_desc=Report%20of%20Bug%202276561%23c1
--
_______________________________________________
package-review mailing list -- package-review@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to package-review-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/package-review@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue




[Index of Archives]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite Conditions]     [KDE Users]

  Powered by Linux