diff options
| author | Brian Potchik <brian@vector35.com> | 2018-10-14 22:47:22 -0400 |
|---|---|---|
| committer | Brian Potchik <brian@vector35.com> | 2018-10-18 17:50:25 -0400 |
| commit | 80cb1f68c83112c4d99893ad2f23bf22abdc4a6d (patch) | |
| tree | 9ebd185b5d61fedccfd811d5b4a4720a1f669da0 /filemetadata.cpp | |
| parent | e01f0e0fe635c0fe703fbdd09d44a5d7da7c4b93 (diff) | |
Initial Enhanced Settings System.
Diffstat (limited to 'filemetadata.cpp')
| -rw-r--r-- | filemetadata.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/filemetadata.cpp b/filemetadata.cpp index bbde5d72..20fd38a8 100644 --- a/filemetadata.cpp +++ b/filemetadata.cpp @@ -17,7 +17,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS // IN THE SOFTWARE. - +#include <cstring> #include "binaryninjaapi.h" using namespace BinaryNinja; @@ -98,8 +98,9 @@ char* UndoAction::SerializeCallback(void* ctxt) { UndoAction* action = (UndoAction*)ctxt; Value data = action->Serialize(); - FastWriter writer; - string json = writer.write(data); + Json::StreamWriterBuilder builder; + builder["indentation"] = ""; + string json = Json::writeString(builder, data); return BNAllocString(json.c_str()); } catch (exception& e) @@ -140,9 +141,10 @@ bool UndoActionType::DeserializeCallback(void* ctxt, const char* data, BNUndoAct try { UndoActionType* type = (UndoActionType*)ctxt; - Reader reader; + unique_ptr<CharReader> reader(CharReaderBuilder().newCharReader()); Value val; - if (!reader.parse(data, val, false)) + string errors; + if (!reader->parse(data, data + strlen(data), &val, &errors)) { LogError("Invalid JSON while deserializing undo action"); return false; |
