[niepce] library: restore assert after porting to Rust
- From: Hubert Figuière <hub src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [niepce] library: restore assert after porting to Rust
- Date: Fri, 17 Nov 2017 02:17:21 +0000 (UTC)
commit 6a0f1b4c95dd40b9bbf1cc03cf56e4b83eddaf60
Author: Hubert Figuière <hub figuiere net>
Date: Tue Nov 14 09:39:35 2017 -0500
library: restore assert after porting to Rust
src/engine/db/library.rs | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/src/engine/db/library.rs b/src/engine/db/library.rs
index a47ef95..2dd645e 100644
--- a/src/engine/db/library.rs
+++ b/src/engine/db/library.rs
@@ -737,7 +737,7 @@ impl Library {
spath = PathBuf::from(p);
} else {
// XXX we should report that error.
- // DBG_ASSERT(!spath.empty(), "couldn't find the main file");
+ dbg_assert!(false, "couldn't find the main file");
continue;
}
let mut p : Option<PathBuf> = None;
@@ -745,11 +745,12 @@ impl Library {
if let Some(p2) = self.get_fs_file(xmp_file_id) {
p = Some(PathBuf::from(p2));
}
- // DBG_ASSERT(!p.empty(), "couldn't find the xmp file path");
+ dbg_assert!(!p.is_none(), "couldn't find the xmp file path");
}
if p.is_none() {
p = Some(spath.with_extension("xmp"));
- // DBG_ASSERT(p != spath, "path must have been changed");
+ dbg_assert!(*p.as_ref().unwrap() != spath,
+ "path must have been changed");
}
let p = p.unwrap();
if p.exists() {
@@ -761,10 +762,10 @@ impl Library {
let sidecar = xmppacket.serialize();
if f.write(sidecar.as_bytes()).is_ok() && (xmp_file_id <= 0) {
let xmp_file_id = self.add_fs_file(p.to_string_lossy().as_ref());
- // DBG_ASSERT(xmp_file_id > 0, "couldn't add xmp_file");
+ dbg_assert!(xmp_file_id > 0, "couldn't add xmp_file");
// XXX handle error
- /*let res =*/ self.add_sidecar_file_to_bundle(id, xmp_file_id);
- // DBG_ASSERT(res, "addSidecarFileToBundle failed");
+ let res = self.add_sidecar_file_to_bundle(id, xmp_file_id);
+ dbg_assert!(res, "addSidecarFileToBundle failed");
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]