From 4ff7ebbb3f59786ff1319d019f377a1b125459d8 Mon Sep 17 00:00:00 2001 From: Conrad Braam Date: Tue, 5 Feb 2019 13:34:23 +0000 Subject: [PATCH] resolved free and long datas --- TEST_APPS/device/nfcapp/nfcprocessEeprom.cpp | 1 - TEST_APPS/device/nfcapp/nfctestshim.cpp | 5 ++--- TEST_APPS/device/nfcapp/nfctestshim.h | 1 - TEST_APPS/icetea_plugins/nfc_test_parsers.py | 11 ++++++----- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/TEST_APPS/device/nfcapp/nfcprocessEeprom.cpp b/TEST_APPS/device/nfcapp/nfcprocessEeprom.cpp index e53d401daf..717ca4643f 100644 --- a/TEST_APPS/device/nfcapp/nfcprocessEeprom.cpp +++ b/TEST_APPS/device/nfcapp/nfcprocessEeprom.cpp @@ -99,7 +99,6 @@ void NFCProcessEEPROM::on_ndef_message_written(nfc_err_t result) } // complete the async test method here cmd_ready(CMDLINE_RETCODE_SUCCESS); - free(long_string); // free buffer allocated by the command class now } void NFCProcessEEPROM::on_ndef_message_read(nfc_err_t result) diff --git a/TEST_APPS/device/nfcapp/nfctestshim.cpp b/TEST_APPS/device/nfcapp/nfctestshim.cpp index abe74a9934..79ba38dc74 100644 --- a/TEST_APPS/device/nfcapp/nfctestshim.cpp +++ b/TEST_APPS/device/nfcapp/nfctestshim.cpp @@ -285,9 +285,8 @@ void NFCTestShim::cmd_erase() void NFCTestShim::cmd_write_long(char *text_string) { MessageBuilder builder(_ndef_poster_message); - long_string = text_string; // copy the pointer and free it when the write completes Text text(Text::UTF8, span_from_cstr("en-US"), - span_from_cstr((const char *)(long_string))); + span_from_cstr((const char *)(text_string))); text.append_as_record(builder, true); _ndef_write_buffer_used = builder.get_message().size(); @@ -299,8 +298,8 @@ void NFCTestShim::cmd_write_long(char *text_string) // not on a wire, and we just stored the message in _ndef_write_buffer above set_last_nfc_error(NFC_OK); cmd_ready(CMDLINE_RETCODE_SUCCESS); - free(long_string); // free buffer allocated by the command class now #endif + free(text_string); // free buffer allocated by the command class now trace_printf("NFCTestShim::write_long() exit\r\n"); } diff --git a/TEST_APPS/device/nfcapp/nfctestshim.h b/TEST_APPS/device/nfcapp/nfctestshim.h index 4fe8ea162c..29967718f6 100644 --- a/TEST_APPS/device/nfcapp/nfctestshim.h +++ b/TEST_APPS/device/nfcapp/nfctestshim.h @@ -100,7 +100,6 @@ protected: uint8_t _ndef_buffer[MBED_CONF_APP_TEST_NDEF_MSG_MAX]; // driver I/O buffer bool _discovery_restart; // default true, restart discovery loop again on remote disconnect events::EventQueue &_queue; - char *long_string; }; // forward declare single instance diff --git a/TEST_APPS/icetea_plugins/nfc_test_parsers.py b/TEST_APPS/icetea_plugins/nfc_test_parsers.py index bd4439dd08..ee2895b65d 100644 --- a/TEST_APPS/icetea_plugins/nfc_test_parsers.py +++ b/TEST_APPS/icetea_plugins/nfc_test_parsers.py @@ -115,12 +115,13 @@ class NfcTestParsers(PluginBase): if data is not False: started_read_data = True if started_read_data: # read data until we see a }} pair - values = self.find_all_hex_data(line, "([0-9a-f\s]*)") + line_values = "" + if "{{nfcmessage=" in line: + line_values = line[13:] + else: + line_values = line + values = self.find_all_hex_data(line_values, "([0-9a-f\s]*)") if values is not False: - if "{{nfcmessage" in line: - value = values[0] # first (and possibly only data line) - else: - value += values[0] # concatenate (2nd and possibly last data line) partial_data += value if PluginBase.find_one(line, ".*(}})") is not False: # search for end marker started_read_data = False