Skip to content

Commit

Permalink
Merge pull request #25657 from Dr15Jones/strtok_testUCTUnpacker
Browse files Browse the repository at this point in the history
Use strtok_r in testUCTUnpacker.cpp
  • Loading branch information
cmsbuild committed Jan 22, 2019
2 parents 368407a + 742185e commit 6993e39
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions EventFilter/L1TXRawToDigi/test/testUCTUnpacker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ int main(int argc, char **argv) {
uint64_t fedRawDataArray[694];
char line[256];
while(cin.getline(line, 256)) {
char* iToken = strtok(line, ":");
char* saveptr;
char* iToken = strtok_r(line, ":",&saveptr);
if(iToken == 0) continue;
if(sscanf(iToken, "%d", &index) == 1) {
if(index < 694) {
char* fToken = strtok(NULL, "\n");
char* fToken = strtok_r(nullptr, "\n",&saveptr);
if(fToken == 0) continue;
if(sscanf(fToken, "%lX", &fedRawDataArray[index]) != 1) {
cerr << "oops! format error :(" << endl;
Expand Down

0 comments on commit 6993e39

Please sign in to comment.