From 9fa0b5ab4e2eca32755c9a0e70f6d9d23342c6b2 Mon Sep 17 00:00:00 2001 From: Damien Zammit Date: Fri, 7 Aug 2015 04:53:36 +1000 Subject: Fixing ptx Signed-off-by: Damien Zammit --- ptfformat.cc | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/ptfformat.cc b/ptfformat.cc index aa91ce7..17f1735 100644 --- a/ptfformat.cc +++ b/ptfformat.cc @@ -18,6 +18,7 @@ #include #include +#include #include using namespace std; @@ -725,7 +726,16 @@ PTFFormat::parserest10(void) { } for (i = k; i < len-70; i++) { if ( (ptfunxored[i ] == 0x5a) && - (ptfunxored[i+1] == 0x03)) { + (ptfunxored[i+1] == 0x02)) { + k = i; + break; + } + } + k++; + for (i = k; i < len-70; i++) { + if ( (ptfunxored[i ] == 0x5a) && + (ptfunxored[i+1] == 0x02)) { + k = i; break; } } @@ -734,14 +744,16 @@ PTFFormat::parserest10(void) { uint32_t findex = 0; for (i = k; i < len-70; i++) { if ( (ptfunxored[i ] == 0x5a) && - (ptfunxored[i+1] == 0x04)) { + (ptfunxored[i+1] == 0x08)) { break; } if ( (ptfunxored[i ] == 0x5a) && - (ptfunxored[i+1] == 0x03)) { + (ptfunxored[i+1] == 0x01)) { uint8_t lengthofname = ptfunxored[i+9]; - + if (ptfunxored[i+13] == 0x5a) { + continue; + } char name[256] = {0}; for (j = 0; j < lengthofname; j++) { name[j] = ptfunxored[i+13+j]; @@ -762,7 +774,7 @@ PTFFormat::parserest10(void) { +offsetbytes +somethingbytes +skipbytes - +40]; + +37]; /*rindex = ptfunxored[j+5 +startbytes +lengthbytes @@ -835,6 +847,12 @@ PTFFormat::parserest10(void) { (int64_t)(length*this->ratefactor), }; + if (strlen(name) == 0) { + continue; + } + if (length == 0) { + continue; + } f.index = findex; //printf("something=%d\n", something); @@ -900,7 +918,7 @@ PTFFormat::parserest10(void) { break; } if ( (ptfunxored[k ] == 0x5a) && - (ptfunxored[k+1] == 0x02)) { + (ptfunxored[k+1] == 0x03)) { uint8_t lengthofname = 0; lengthofname = ptfunxored[k+9]; -- cgit v1.2.3