Skip to content

Commit

Permalink
handles string type appropriately
Browse files Browse the repository at this point in the history
  • Loading branch information
adriangibbons committed Nov 1, 2015
1 parent 0c03422 commit 8112481
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/phpFITFileAnalysis.php
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ class phpFITFileAnalysis
132 => 'vtmp', // uint16
133 => 'Vtmp', // sint32 - manually convert uint32 to sint32 in fixData()
134 => 'Vtmp', // uint32
7 => 'Ctmp', // string
7 => 'a*tmp', // string
136 => 'ftmp', // float32
137 => 'dtmp', // float64
10 => 'Ctmp', // uint8z
Expand All @@ -527,7 +527,7 @@ class phpFITFileAnalysis
132 => 'ntmp', // uint16
133 => 'Ntmp', // sint32 - manually convert uint32 to sint32 in fixData()
134 => 'Ntmp', // uint32
7 => 'Ctmp', // string
7 => 'a*tmp', // string
136 => 'ftmp', // float32
137 => 'dtmp', // float64
10 => 'Ctmp', // uint8z
Expand Down Expand Up @@ -1093,7 +1093,11 @@ private function readDataRecords()
if ($this->defn_mesgs[$local_mesg_type]['global_mesg_num'] === 20) {
$tmp_record_array[$this->data_mesg_info[$this->defn_mesgs[$local_mesg_type]['global_mesg_num']]['field_defns'][$field_defn['field_definition_number']]['field_name']] = $tmp_value / $this->data_mesg_info[$this->defn_mesgs[$local_mesg_type]['global_mesg_num']]['field_defns'][$field_defn['field_definition_number']]['scale'] - $this->data_mesg_info[$this->defn_mesgs[$local_mesg_type]['global_mesg_num']]['field_defns'][$field_defn['field_definition_number']]['offset'];
} else {
$this->data_mesgs[$this->data_mesg_info[$this->defn_mesgs[$local_mesg_type]['global_mesg_num']]['mesg_name']][$this->data_mesg_info[$this->defn_mesgs[$local_mesg_type]['global_mesg_num']]['field_defns'][$field_defn['field_definition_number']]['field_name']][] = $tmp_value / $this->data_mesg_info[$this->defn_mesgs[$local_mesg_type]['global_mesg_num']]['field_defns'][$field_defn['field_definition_number']]['scale'] - $this->data_mesg_info[$this->defn_mesgs[$local_mesg_type]['global_mesg_num']]['field_defns'][$field_defn['field_definition_number']]['offset'];
if ($field_defn['base_type'] === 7) { // Handle strings appropriately
$this->data_mesgs[$this->data_mesg_info[$this->defn_mesgs[$local_mesg_type]['global_mesg_num']]['mesg_name']][$this->data_mesg_info[$this->defn_mesgs[$local_mesg_type]['global_mesg_num']]['field_defns'][$field_defn['field_definition_number']]['field_name']][] = filter_var($tmp_value, FILTER_SANITIZE_STRING);
} else {
$this->data_mesgs[$this->data_mesg_info[$this->defn_mesgs[$local_mesg_type]['global_mesg_num']]['mesg_name']][$this->data_mesg_info[$this->defn_mesgs[$local_mesg_type]['global_mesg_num']]['field_defns'][$field_defn['field_definition_number']]['field_name']][] = $tmp_value / $this->data_mesg_info[$this->defn_mesgs[$local_mesg_type]['global_mesg_num']]['field_defns'][$field_defn['field_definition_number']]['scale'] - $this->data_mesg_info[$this->defn_mesgs[$local_mesg_type]['global_mesg_num']]['field_defns'][$field_defn['field_definition_number']]['offset'];
}
}
}
}
Expand Down

0 comments on commit 8112481

Please sign in to comment.