Skip to content

Commit

Permalink
fix_data() endianness isset(field_name)
Browse files Browse the repository at this point in the history
  • Loading branch information
adriangibbons committed Aug 15, 2015
1 parent 6329485 commit 3a0e552
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions php-FIT-File-Analysis.php
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,8 @@ private function fix_data($options) {
$mesg_name = $this->data_mesg_info[$mesg['global_mesg_num']]['mesg_name'];

foreach($mesg['field_defns'] as $field) {
if($field['base_type'] === 131) { // Convert uint16 to sint16
// Convert uint16 to sint16
if($field['base_type'] === 131 && isset($this->data_mesg_info[$mesg['global_mesg_num']]['field_defns'][$field['field_definition_number']]['field_name'])) {
$field_name = $this->data_mesg_info[$mesg['global_mesg_num']]['field_defns'][$field['field_definition_number']]['field_name'];
if(is_array($this->data_mesgs[$mesg_name][$field_name])) {
foreach($this->data_mesgs[$mesg_name][$field_name] as &$v) {
Expand All @@ -800,7 +801,8 @@ private function fix_data($options) {
$this->data_mesgs[$mesg_name][$field_name] = -1 * ($this->data_mesgs[$mesg_name][$field_name] - 0x7FFF);
}
}
else if($field['base_type'] === 133) { // Convert uint32 to sint32
// Convert uint32 to sint32
else if($field['base_type'] === 133 && isset($this->data_mesg_info[$mesg['global_mesg_num']]['field_defns'][$field['field_definition_number']]['field_name'])) {
$field_name = $this->data_mesg_info[$mesg['global_mesg_num']]['field_defns'][$field['field_definition_number']]['field_name'];
if(is_array($this->data_mesgs[$mesg_name][$field_name])) {
foreach($this->data_mesgs[$mesg_name][$field_name] as &$v) {
Expand Down

0 comments on commit 3a0e552

Please sign in to comment.