summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Ferrell <josh@vector35.com>2024-07-02 17:16:44 -0400
committerJosh Ferrell <josh@vector35.com>2024-07-02 17:16:44 -0400
commit82dabf37d07cfdc8e299bce50d0cccf0fee37333 (patch)
tree6c51d75af1d60f71485d2dbc206e8b3dc257b6c7
parent3f445f23438d98165f81f03492f79ef86d9a5db2 (diff)
Fix many crashes from uncaught exceptions
-rw-r--r--binaryninjacore.h12
-rw-r--r--python/project.py20
-rw-r--r--rust/src/project.rs12
3 files changed, 22 insertions, 22 deletions
diff --git a/binaryninjacore.h b/binaryninjacore.h
index 4f04246a..16d86fc7 100644
--- a/binaryninjacore.h
+++ b/binaryninjacore.h
@@ -3599,12 +3599,12 @@ extern "C"
BINARYNINJACOREAPI char* BNProjectFileGetPathOnDisk(BNProjectFile* file);
BINARYNINJACOREAPI bool BNProjectFileExistsOnDisk(BNProjectFile* file);
BINARYNINJACOREAPI char* BNProjectFileGetName(BNProjectFile* file);
- BINARYNINJACOREAPI void BNProjectFileSetName(BNProjectFile* file, const char* name);
+ BINARYNINJACOREAPI bool BNProjectFileSetName(BNProjectFile* file, const char* name);
BINARYNINJACOREAPI char* BNProjectFileGetDescription(BNProjectFile* file);
- BINARYNINJACOREAPI void BNProjectFileSetDescription(BNProjectFile* file, const char* description);
+ BINARYNINJACOREAPI bool BNProjectFileSetDescription(BNProjectFile* file, const char* description);
BINARYNINJACOREAPI char* BNProjectFileGetId(BNProjectFile* file);
BINARYNINJACOREAPI BNProjectFolder* BNProjectFileGetFolder(BNProjectFile* file);
- BINARYNINJACOREAPI void BNProjectFileSetFolder(BNProjectFile* file, BNProjectFolder* folder);
+ BINARYNINJACOREAPI bool BNProjectFileSetFolder(BNProjectFile* file, BNProjectFolder* folder);
BINARYNINJACOREAPI BNProject* BNProjectFileGetProject(BNProjectFile* file);
BINARYNINJACOREAPI bool BNProjectFileExport(BNProjectFile* file, const char* destination);
BINARYNINJACOREAPI int64_t BNProjectFileGetCreationTimestamp(BNProjectFile* file);
@@ -3616,11 +3616,11 @@ extern "C"
BINARYNINJACOREAPI void BNFreeProjectFolderList(BNProjectFolder** folders, size_t count);
BINARYNINJACOREAPI char* BNProjectFolderGetId(BNProjectFolder* folder);
BINARYNINJACOREAPI char* BNProjectFolderGetName(BNProjectFolder* folder);
- BINARYNINJACOREAPI void BNProjectFolderSetName(BNProjectFolder* folder, const char* name);
+ BINARYNINJACOREAPI bool BNProjectFolderSetName(BNProjectFolder* folder, const char* name);
BINARYNINJACOREAPI char* BNProjectFolderGetDescription(BNProjectFolder* folder);
- BINARYNINJACOREAPI void BNProjectFolderSetDescription(BNProjectFolder* folder, const char* description);
+ BINARYNINJACOREAPI bool BNProjectFolderSetDescription(BNProjectFolder* folder, const char* description);
BINARYNINJACOREAPI BNProjectFolder* BNProjectFolderGetParent(BNProjectFolder* folder);
- BINARYNINJACOREAPI void BNProjectFolderSetParent(BNProjectFolder* folder, BNProjectFolder* parent);
+ BINARYNINJACOREAPI bool BNProjectFolderSetParent(BNProjectFolder* folder, BNProjectFolder* parent);
BINARYNINJACOREAPI BNProject* BNProjectFolderGetProject(BNProjectFolder* folder);
BINARYNINJACOREAPI bool BNProjectFolderExport(BNProjectFolder* folder, const char* destination, void* ctxt,
bool (*progress)(void* ctxt, size_t progress, size_t total));
diff --git a/python/project.py b/python/project.py
index 67597b56..4ea5b4d0 100644
--- a/python/project.py
+++ b/python/project.py
@@ -83,7 +83,7 @@ class ProjectFile:
return f'<ProjectFile: {self.project.name}/{path}>'
@property
- def project(self):
+ def project(self) -> 'Project':
"""
Get the project that owns this file
@@ -133,7 +133,7 @@ class ProjectFile:
return core.BNProjectFileGetName(self._handle) # type: ignore
@name.setter
- def name(self, new_name: str):
+ def name(self, new_name: str) -> bool:
"""
Set the name of this file
@@ -151,7 +151,7 @@ class ProjectFile:
return core.BNProjectFileGetDescription(self._handle) # type: ignore
@description.setter
- def description(self, new_description: str):
+ def description(self, new_description: str) -> bool:
"""
Set the description of this file
@@ -172,14 +172,14 @@ class ProjectFile:
return ProjectFolder(handle=folder_handle)
@folder.setter
- def folder(self, new_folder: Optional['ProjectFolder']):
+ def folder(self, new_folder: Optional['ProjectFolder']) -> bool:
"""
Set the folder that contains this file
:param new_parent: The folder that will contain this file, or None
"""
folder_handle = None if new_folder is None else new_folder._handle
- core.BNProjectFileSetFolder(self._handle, folder_handle)
+ return core.BNProjectFileSetFolder(self._handle, folder_handle)
def export(self, dest: AsPath) -> bool:
"""
@@ -219,7 +219,7 @@ class ProjectFolder:
return f'<ProjectFolder: {self.project.name}/{path}>'
@property
- def project(self):
+ def project(self) -> 'Project':
"""
Get the project that owns this folder
@@ -251,7 +251,7 @@ class ProjectFolder:
return core.BNProjectFolderGetName(self._handle) # type: ignore
@name.setter
- def name(self, new_name: str):
+ def name(self, new_name: str) -> bool:
"""
Set the name of this folder
@@ -269,7 +269,7 @@ class ProjectFolder:
return core.BNProjectFolderGetDescription(self._handle) # type: ignore
@description.setter
- def description(self, new_description: str):
+ def description(self, new_description: str) -> bool:
"""
Set the description of this folder
@@ -290,14 +290,14 @@ class ProjectFolder:
return ProjectFolder(handle=folder_handle)
@parent.setter
- def parent(self, new_parent: Optional['ProjectFolder']):
+ def parent(self, new_parent: Optional['ProjectFolder']) -> bool:
"""
Set the parent folder of this folder
:param new_parent: The folder that will contain this folder, or None
"""
parent_handle = None if new_parent is None else new_parent._handle
- core.BNProjectFolderSetParent(self._handle, parent_handle)
+ return core.BNProjectFolderSetParent(self._handle, parent_handle)
def export(self, dest: AsPath, progress_func: ProgressFuncType = _nop) -> bool:
"""
diff --git a/rust/src/project.rs b/rust/src/project.rs
index 26c2a72e..beb0f008 100644
--- a/rust/src/project.rs
+++ b/rust/src/project.rs
@@ -847,7 +847,7 @@ impl ProjectFolder {
}
/// Set the name of this folder
- pub fn set_name<S: BnStrCompatible>(&self, value: S) {
+ pub fn set_name<S: BnStrCompatible>(&self, value: S) -> bool {
let value_raw = value.into_bytes_with_nul();
unsafe {
BNProjectFolderSetName(
@@ -863,7 +863,7 @@ impl ProjectFolder {
}
/// Set the description of this folder
- pub fn set_description<S: BnStrCompatible>(&self, value: S) {
+ pub fn set_description<S: BnStrCompatible>(&self, value: S) -> bool {
let value_raw = value.into_bytes_with_nul();
unsafe {
BNProjectFolderSetDescription(
@@ -880,7 +880,7 @@ impl ProjectFolder {
}
/// Set the folder that contains this folder
- pub fn set_folder(&self, folder: Option<&ProjectFolder>) {
+ pub fn set_folder(&self, folder: Option<&ProjectFolder>) -> bool {
let folder_handle = folder
.map(|x| unsafe { x.as_raw() as *mut _ })
.unwrap_or(null_mut());
@@ -997,7 +997,7 @@ impl ProjectFile {
}
/// Set the name of this file
- pub fn set_name<S: BnStrCompatible>(&self, value: S) {
+ pub fn set_name<S: BnStrCompatible>(&self, value: S) -> bool {
let value_raw = value.into_bytes_with_nul();
unsafe {
BNProjectFileSetName(
@@ -1013,7 +1013,7 @@ impl ProjectFile {
}
/// Set the description of this file
- pub fn set_description<S: BnStrCompatible>(&self, value: S) {
+ pub fn set_description<S: BnStrCompatible>(&self, value: S) -> bool {
let value_raw = value.into_bytes_with_nul();
unsafe {
BNProjectFileSetDescription(
@@ -1035,7 +1035,7 @@ impl ProjectFile {
}
/// Set the folder that contains this file
- pub fn set_folder(&self, folder: Option<&ProjectFolder>) {
+ pub fn set_folder(&self, folder: Option<&ProjectFolder>) -> bool {
let folder_handle = folder
.map(|x| unsafe { x.as_raw() as *mut _ })
.unwrap_or(null_mut());