2
0
forked from Ivasoft/DSView

Parse 128 bit numberic value accurately

This commit is contained in:
dreamsourcelabTAI
2022-02-07 13:46:49 +08:00
parent cd449045b0
commit c7a3fb40a4
8 changed files with 37 additions and 117 deletions

View File

@@ -76,7 +76,9 @@ Annotation::Annotation(const srd_proto_data *const pdata, DecoderStatus *status)
char **annotations = pda->ann_text;
while(annotations && *annotations) {
key.append(*annotations, strlen(*annotations));
if ((*annotations)[0] != '\n'){
key.append(*annotations, strlen(*annotations));
}
annotations++;
}
@@ -92,7 +94,9 @@ Annotation::Annotation(const srd_proto_data *const pdata, DecoderStatus *status)
if (resItem != NULL){
char **annotations = pda->ann_text;
while(annotations && *annotations) {
resItem->src_lines.push_back(QString::fromUtf8(*annotations));
if ((*annotations)[0] != '\n'){
resItem->src_lines.push_back(QString::fromUtf8(*annotations));
}
annotations++;
}
@@ -101,14 +105,6 @@ Annotation::Annotation(const srd_proto_data *const pdata, DecoderStatus *status)
strcpy(resItem->str_number_hex, pda->str_number_hex);
resItem->is_numeric = true;
}
/*
//disable auto convert to numberic format
else if (resItem->src_lines.size() == 1 && _type >= 100 && _type < 200){
if (is_hex_number_str(resItem->src_lines[0].toLatin1().data())){
resItem->is_numeric = true;
}
}
*/
_status->m_bNumeric |= resItem->is_numeric;
}

View File

@@ -26,12 +26,12 @@
#include <vector>
#include <QString>
#define DECODER_MAX_DATA_BLOCK_LEN 25
#define DECODER_MAX_DATA_BLOCK_LEN 35
struct AnnotationSourceItem
{
bool is_numeric;
char str_number_hex[18]; //numerical value hex format string
char str_number_hex[DECODER_MAX_DATA_BLOCK_LEN]; //numerical value hex format string
long long numberic_value;
std::vector<QString> src_lines; //the origin source string lines
std::vector<QString> cvt_lines; //the converted to bin/hex/oct format string lines