diff --git a/cmd/fitconv/fitcsv/csv_to_fit.go b/cmd/fitconv/fitcsv/csv_to_fit.go index 72861e3a..d229d677 100644 --- a/cmd/fitconv/fitcsv/csv_to_fit.go +++ b/cmd/fitconv/fitcsv/csv_to_fit.go @@ -20,6 +20,7 @@ import ( "github.com/muktihari/fit/profile/typedef" "github.com/muktihari/fit/profile/untyped/mesgnum" "github.com/muktihari/fit/proto" + "golang.org/x/exp/slices" ) type CSVToFITConv struct { @@ -29,9 +30,9 @@ type CSVToFITConv struct { fit proto.FIT - fieldsArray [256]proto.Field - developerFieldsArray [256]proto.DeveloperField - protoValuesArray [256]proto.Value + fieldsArray [255]proto.Field + developerFieldsArray [255]proto.DeveloperField + protoValuesArray [255]proto.Value fieldDescriptions []*mesgdef.FieldDescription @@ -134,10 +135,8 @@ loop: } if c.streamEnc == nil { - mesg.Fields = make([]proto.Field, len(mesg.Fields)) - copy(mesg.Fields, c.fieldsArray[:]) - mesg.DeveloperFields = make([]proto.DeveloperField, len(mesg.DeveloperFields)) - copy(mesg.DeveloperFields, c.developerFieldsArray[:]) + mesg.Fields = slices.Clone(mesg.Fields) + mesg.DeveloperFields = slices.Clone(mesg.DeveloperFields) c.fit.Messages = append(c.fit.Messages, mesg) continue loop } diff --git a/decoder/decoder.go b/decoder/decoder.go index 9177f424..49cd38f3 100644 --- a/decoder/decoder.go +++ b/decoder/decoder.go @@ -50,8 +50,8 @@ type Decoder struct { accumulator *Accumulator crc16 hash.Hash16 - fieldsArray [256]proto.Field - developersFieldsArray [256]proto.DeveloperField + fieldsArray [255]proto.Field + developersFieldsArray [255]proto.DeveloperField options options diff --git a/internal/cmd/fitgen/profile/mesgdef/mesgdef.tmpl b/internal/cmd/fitgen/profile/mesgdef/mesgdef.tmpl index 16afdae1..71023c4b 100644 --- a/internal/cmd/fitgen/profile/mesgdef/mesgdef.tmpl +++ b/internal/cmd/fitgen/profile/mesgdef/mesgdef.tmpl @@ -90,7 +90,7 @@ func (m *{{ .Name }}) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/aad_accel_features_gen.go b/profile/mesgdef/aad_accel_features_gen.go index 44f17bd7..37e5cad4 100755 --- a/profile/mesgdef/aad_accel_features_gen.go +++ b/profile/mesgdef/aad_accel_features_gen.go @@ -72,7 +72,7 @@ func (m *AadAccelFeatures) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/accelerometer_data_gen.go b/profile/mesgdef/accelerometer_data_gen.go index f15f6b83..65bfb630 100755 --- a/profile/mesgdef/accelerometer_data_gen.go +++ b/profile/mesgdef/accelerometer_data_gen.go @@ -82,7 +82,7 @@ func (m *AccelerometerData) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/activity_gen.go b/profile/mesgdef/activity_gen.go index 08b3e211..4e5be972 100755 --- a/profile/mesgdef/activity_gen.go +++ b/profile/mesgdef/activity_gen.go @@ -76,7 +76,7 @@ func (m *Activity) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/ant_channel_id_gen.go b/profile/mesgdef/ant_channel_id_gen.go index c2a06a00..0a1a53c3 100755 --- a/profile/mesgdef/ant_channel_id_gen.go +++ b/profile/mesgdef/ant_channel_id_gen.go @@ -66,7 +66,7 @@ func (m *AntChannelId) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/ant_rx_gen.go b/profile/mesgdef/ant_rx_gen.go index 4d309a5b..7b957e23 100755 --- a/profile/mesgdef/ant_rx_gen.go +++ b/profile/mesgdef/ant_rx_gen.go @@ -80,7 +80,7 @@ func (m *AntRx) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/ant_tx_gen.go b/profile/mesgdef/ant_tx_gen.go index 03c37c39..5df4fb6a 100755 --- a/profile/mesgdef/ant_tx_gen.go +++ b/profile/mesgdef/ant_tx_gen.go @@ -80,7 +80,7 @@ func (m *AntTx) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/aviation_attitude_gen.go b/profile/mesgdef/aviation_attitude_gen.go index 36349320..b389f516 100755 --- a/profile/mesgdef/aviation_attitude_gen.go +++ b/profile/mesgdef/aviation_attitude_gen.go @@ -92,7 +92,7 @@ func (m *AviationAttitude) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/barometer_data_gen.go b/profile/mesgdef/barometer_data_gen.go index 802c7bbc..ea3b43e3 100755 --- a/profile/mesgdef/barometer_data_gen.go +++ b/profile/mesgdef/barometer_data_gen.go @@ -66,7 +66,7 @@ func (m *BarometerData) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/beat_intervals_gen.go b/profile/mesgdef/beat_intervals_gen.go index f681319b..c81c65c5 100755 --- a/profile/mesgdef/beat_intervals_gen.go +++ b/profile/mesgdef/beat_intervals_gen.go @@ -64,7 +64,7 @@ func (m *BeatIntervals) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/bike_profile_gen.go b/profile/mesgdef/bike_profile_gen.go index 365580fa..514b0146 100755 --- a/profile/mesgdef/bike_profile_gen.go +++ b/profile/mesgdef/bike_profile_gen.go @@ -122,7 +122,7 @@ func (m *BikeProfile) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/blood_pressure_gen.go b/profile/mesgdef/blood_pressure_gen.go index d6016bb3..89185d23 100755 --- a/profile/mesgdef/blood_pressure_gen.go +++ b/profile/mesgdef/blood_pressure_gen.go @@ -80,7 +80,7 @@ func (m *BloodPressure) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/cadence_zone_gen.go b/profile/mesgdef/cadence_zone_gen.go index e7433541..37125d55 100755 --- a/profile/mesgdef/cadence_zone_gen.go +++ b/profile/mesgdef/cadence_zone_gen.go @@ -62,7 +62,7 @@ func (m *CadenceZone) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/camera_event_gen.go b/profile/mesgdef/camera_event_gen.go index 52abd62a..1fdb1c53 100755 --- a/profile/mesgdef/camera_event_gen.go +++ b/profile/mesgdef/camera_event_gen.go @@ -68,7 +68,7 @@ func (m *CameraEvent) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/capabilities_gen.go b/profile/mesgdef/capabilities_gen.go index a6d5774d..f7d35d0e 100755 --- a/profile/mesgdef/capabilities_gen.go +++ b/profile/mesgdef/capabilities_gen.go @@ -69,7 +69,7 @@ func (m *Capabilities) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/chrono_shot_data_gen.go b/profile/mesgdef/chrono_shot_data_gen.go index 71cf97ee..f8470757 100755 --- a/profile/mesgdef/chrono_shot_data_gen.go +++ b/profile/mesgdef/chrono_shot_data_gen.go @@ -66,7 +66,7 @@ func (m *ChronoShotData) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/chrono_shot_session_gen.go b/profile/mesgdef/chrono_shot_session_gen.go index 98ff915a..76239444 100755 --- a/profile/mesgdef/chrono_shot_session_gen.go +++ b/profile/mesgdef/chrono_shot_session_gen.go @@ -74,7 +74,7 @@ func (m *ChronoShotSession) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/climb_pro_gen.go b/profile/mesgdef/climb_pro_gen.go index 28608741..d0e35436 100755 --- a/profile/mesgdef/climb_pro_gen.go +++ b/profile/mesgdef/climb_pro_gen.go @@ -74,7 +74,7 @@ func (m *ClimbPro) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/connectivity_gen.go b/profile/mesgdef/connectivity_gen.go index 10ea6e52..43a0bed0 100755 --- a/profile/mesgdef/connectivity_gen.go +++ b/profile/mesgdef/connectivity_gen.go @@ -82,7 +82,7 @@ func (m *Connectivity) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/course_gen.go b/profile/mesgdef/course_gen.go index 8f93ea66..64a2318c 100755 --- a/profile/mesgdef/course_gen.go +++ b/profile/mesgdef/course_gen.go @@ -64,7 +64,7 @@ func (m *Course) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/course_point_gen.go b/profile/mesgdef/course_point_gen.go index 8681ac5f..6682881c 100755 --- a/profile/mesgdef/course_point_gen.go +++ b/profile/mesgdef/course_point_gen.go @@ -77,7 +77,7 @@ func (m *CoursePoint) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/developer_data_id_gen.go b/profile/mesgdef/developer_data_id_gen.go index 370c785b..a11bee57 100755 --- a/profile/mesgdef/developer_data_id_gen.go +++ b/profile/mesgdef/developer_data_id_gen.go @@ -58,7 +58,7 @@ func (m *DeveloperDataId) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/device_aux_battery_info_gen.go b/profile/mesgdef/device_aux_battery_info_gen.go index ab1a7ddd..79964c1b 100755 --- a/profile/mesgdef/device_aux_battery_info_gen.go +++ b/profile/mesgdef/device_aux_battery_info_gen.go @@ -70,7 +70,7 @@ func (m *DeviceAuxBatteryInfo) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/device_info_gen.go b/profile/mesgdef/device_info_gen.go index 3fbe7468..08368a54 100755 --- a/profile/mesgdef/device_info_gen.go +++ b/profile/mesgdef/device_info_gen.go @@ -98,7 +98,7 @@ func (m *DeviceInfo) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/device_settings_gen.go b/profile/mesgdef/device_settings_gen.go index 78a86306..c3e1a976 100755 --- a/profile/mesgdef/device_settings_gen.go +++ b/profile/mesgdef/device_settings_gen.go @@ -112,7 +112,7 @@ func (m *DeviceSettings) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/dive_alarm_gen.go b/profile/mesgdef/dive_alarm_gen.go index 3bec0293..54ce6c75 100755 --- a/profile/mesgdef/dive_alarm_gen.go +++ b/profile/mesgdef/dive_alarm_gen.go @@ -89,7 +89,7 @@ func (m *DiveAlarm) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/dive_apnea_alarm_gen.go b/profile/mesgdef/dive_apnea_alarm_gen.go index 155f9480..89aa1af0 100755 --- a/profile/mesgdef/dive_apnea_alarm_gen.go +++ b/profile/mesgdef/dive_apnea_alarm_gen.go @@ -89,7 +89,7 @@ func (m *DiveApneaAlarm) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/dive_gas_gen.go b/profile/mesgdef/dive_gas_gen.go index b8f41019..134ceb73 100755 --- a/profile/mesgdef/dive_gas_gen.go +++ b/profile/mesgdef/dive_gas_gen.go @@ -66,7 +66,7 @@ func (m *DiveGas) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/dive_settings_gen.go b/profile/mesgdef/dive_settings_gen.go index 9ce2b0d0..c9780320 100755 --- a/profile/mesgdef/dive_settings_gen.go +++ b/profile/mesgdef/dive_settings_gen.go @@ -130,7 +130,7 @@ func (m *DiveSettings) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/dive_summary_gen.go b/profile/mesgdef/dive_summary_gen.go index 880fad30..b0bd229e 100755 --- a/profile/mesgdef/dive_summary_gen.go +++ b/profile/mesgdef/dive_summary_gen.go @@ -106,7 +106,7 @@ func (m *DiveSummary) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/event_gen.go b/profile/mesgdef/event_gen.go index 46bcbc5d..825f8207 100755 --- a/profile/mesgdef/event_gen.go +++ b/profile/mesgdef/event_gen.go @@ -106,7 +106,7 @@ func (m *Event) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/exd_data_concept_configuration_gen.go b/profile/mesgdef/exd_data_concept_configuration_gen.go index e48b6c4e..6c042c20 100755 --- a/profile/mesgdef/exd_data_concept_configuration_gen.go +++ b/profile/mesgdef/exd_data_concept_configuration_gen.go @@ -86,7 +86,7 @@ func (m *ExdDataConceptConfiguration) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/exd_data_field_configuration_gen.go b/profile/mesgdef/exd_data_field_configuration_gen.go index bea1b03a..4556bef6 100755 --- a/profile/mesgdef/exd_data_field_configuration_gen.go +++ b/profile/mesgdef/exd_data_field_configuration_gen.go @@ -76,7 +76,7 @@ func (m *ExdDataFieldConfiguration) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/exd_screen_configuration_gen.go b/profile/mesgdef/exd_screen_configuration_gen.go index 246ce5fd..fd56789d 100755 --- a/profile/mesgdef/exd_screen_configuration_gen.go +++ b/profile/mesgdef/exd_screen_configuration_gen.go @@ -64,7 +64,7 @@ func (m *ExdScreenConfiguration) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/exercise_title_gen.go b/profile/mesgdef/exercise_title_gen.go index 3e086700..8b160bac 100755 --- a/profile/mesgdef/exercise_title_gen.go +++ b/profile/mesgdef/exercise_title_gen.go @@ -64,7 +64,7 @@ func (m *ExerciseTitle) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/field_capabilities_gen.go b/profile/mesgdef/field_capabilities_gen.go index 265e26ac..035218ff 100755 --- a/profile/mesgdef/field_capabilities_gen.go +++ b/profile/mesgdef/field_capabilities_gen.go @@ -66,7 +66,7 @@ func (m *FieldCapabilities) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/field_description_gen.go b/profile/mesgdef/field_description_gen.go index 41ae9a27..3c9aafde 100755 --- a/profile/mesgdef/field_description_gen.go +++ b/profile/mesgdef/field_description_gen.go @@ -76,7 +76,7 @@ func (m *FieldDescription) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/file_capabilities_gen.go b/profile/mesgdef/file_capabilities_gen.go index d1f5b2ec..effe1264 100755 --- a/profile/mesgdef/file_capabilities_gen.go +++ b/profile/mesgdef/file_capabilities_gen.go @@ -68,7 +68,7 @@ func (m *FileCapabilities) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/file_creator_gen.go b/profile/mesgdef/file_creator_gen.go index 6cc88161..8d7df599 100755 --- a/profile/mesgdef/file_creator_gen.go +++ b/profile/mesgdef/file_creator_gen.go @@ -60,7 +60,7 @@ func (m *FileCreator) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/file_id_gen.go b/profile/mesgdef/file_id_gen.go index 7dce90a6..06f043b7 100755 --- a/profile/mesgdef/file_id_gen.go +++ b/profile/mesgdef/file_id_gen.go @@ -64,7 +64,7 @@ func (m *FileId) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/goal_gen.go b/profile/mesgdef/goal_gen.go index 18b89a6d..924bc74c 100755 --- a/profile/mesgdef/goal_gen.go +++ b/profile/mesgdef/goal_gen.go @@ -84,7 +84,7 @@ func (m *Goal) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/gps_metadata_gen.go b/profile/mesgdef/gps_metadata_gen.go index 1b1189f0..d2310982 100755 --- a/profile/mesgdef/gps_metadata_gen.go +++ b/profile/mesgdef/gps_metadata_gen.go @@ -79,7 +79,7 @@ func (m *GpsMetadata) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/gyroscope_data_gen.go b/profile/mesgdef/gyroscope_data_gen.go index 6ed8feea..0d2af2ab 100755 --- a/profile/mesgdef/gyroscope_data_gen.go +++ b/profile/mesgdef/gyroscope_data_gen.go @@ -76,7 +76,7 @@ func (m *GyroscopeData) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/hr_gen.go b/profile/mesgdef/hr_gen.go index 220a8466..ebaab3bb 100755 --- a/profile/mesgdef/hr_gen.go +++ b/profile/mesgdef/hr_gen.go @@ -80,7 +80,7 @@ func (m *Hr) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/hr_zone_gen.go b/profile/mesgdef/hr_zone_gen.go index cf1edb65..4a8bc31d 100755 --- a/profile/mesgdef/hr_zone_gen.go +++ b/profile/mesgdef/hr_zone_gen.go @@ -62,7 +62,7 @@ func (m *HrZone) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/hrm_profile_gen.go b/profile/mesgdef/hrm_profile_gen.go index 7297ba33..6af1f70f 100755 --- a/profile/mesgdef/hrm_profile_gen.go +++ b/profile/mesgdef/hrm_profile_gen.go @@ -66,7 +66,7 @@ func (m *HrmProfile) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/hrv_gen.go b/profile/mesgdef/hrv_gen.go index 878f5952..627e12a7 100755 --- a/profile/mesgdef/hrv_gen.go +++ b/profile/mesgdef/hrv_gen.go @@ -58,7 +58,7 @@ func (m *Hrv) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/hrv_status_summary_gen.go b/profile/mesgdef/hrv_status_summary_gen.go index 161a2e7e..de5ad334 100755 --- a/profile/mesgdef/hrv_status_summary_gen.go +++ b/profile/mesgdef/hrv_status_summary_gen.go @@ -76,7 +76,7 @@ func (m *HrvStatusSummary) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/hrv_value_gen.go b/profile/mesgdef/hrv_value_gen.go index eb69c916..2d91bf74 100755 --- a/profile/mesgdef/hrv_value_gen.go +++ b/profile/mesgdef/hrv_value_gen.go @@ -64,7 +64,7 @@ func (m *HrvValue) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/hsa_accelerometer_data_gen.go b/profile/mesgdef/hsa_accelerometer_data_gen.go index c479fda4..e45c1121 100755 --- a/profile/mesgdef/hsa_accelerometer_data_gen.go +++ b/profile/mesgdef/hsa_accelerometer_data_gen.go @@ -73,7 +73,7 @@ func (m *HsaAccelerometerData) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/hsa_body_battery_data_gen.go b/profile/mesgdef/hsa_body_battery_data_gen.go index dece5034..42ee4290 100755 --- a/profile/mesgdef/hsa_body_battery_data_gen.go +++ b/profile/mesgdef/hsa_body_battery_data_gen.go @@ -68,7 +68,7 @@ func (m *HsaBodyBatteryData) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/hsa_configuration_data_gen.go b/profile/mesgdef/hsa_configuration_data_gen.go index 11c000f6..ab87cc3f 100755 --- a/profile/mesgdef/hsa_configuration_data_gen.go +++ b/profile/mesgdef/hsa_configuration_data_gen.go @@ -64,7 +64,7 @@ func (m *HsaConfigurationData) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/hsa_event_gen.go b/profile/mesgdef/hsa_event_gen.go index 9c8ee207..f4a14711 100755 --- a/profile/mesgdef/hsa_event_gen.go +++ b/profile/mesgdef/hsa_event_gen.go @@ -62,7 +62,7 @@ func (m *HsaEvent) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/hsa_gyroscope_data_gen.go b/profile/mesgdef/hsa_gyroscope_data_gen.go index bc8fb935..4d6f1aa6 100755 --- a/profile/mesgdef/hsa_gyroscope_data_gen.go +++ b/profile/mesgdef/hsa_gyroscope_data_gen.go @@ -73,7 +73,7 @@ func (m *HsaGyroscopeData) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/hsa_heart_rate_data_gen.go b/profile/mesgdef/hsa_heart_rate_data_gen.go index 5e417c79..5d314aa7 100755 --- a/profile/mesgdef/hsa_heart_rate_data_gen.go +++ b/profile/mesgdef/hsa_heart_rate_data_gen.go @@ -66,7 +66,7 @@ func (m *HsaHeartRateData) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/hsa_respiration_data_gen.go b/profile/mesgdef/hsa_respiration_data_gen.go index 0512b063..510b72d4 100755 --- a/profile/mesgdef/hsa_respiration_data_gen.go +++ b/profile/mesgdef/hsa_respiration_data_gen.go @@ -65,7 +65,7 @@ func (m *HsaRespirationData) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/hsa_spo2_data_gen.go b/profile/mesgdef/hsa_spo2_data_gen.go index 9538b61e..d6489054 100755 --- a/profile/mesgdef/hsa_spo2_data_gen.go +++ b/profile/mesgdef/hsa_spo2_data_gen.go @@ -66,7 +66,7 @@ func (m *HsaSpo2Data) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/hsa_step_data_gen.go b/profile/mesgdef/hsa_step_data_gen.go index a1ca54fb..7aecb029 100755 --- a/profile/mesgdef/hsa_step_data_gen.go +++ b/profile/mesgdef/hsa_step_data_gen.go @@ -64,7 +64,7 @@ func (m *HsaStepData) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/hsa_stress_data_gen.go b/profile/mesgdef/hsa_stress_data_gen.go index cfcf93c9..2635329e 100755 --- a/profile/mesgdef/hsa_stress_data_gen.go +++ b/profile/mesgdef/hsa_stress_data_gen.go @@ -64,7 +64,7 @@ func (m *HsaStressData) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/hsa_wrist_temperature_data_gen.go b/profile/mesgdef/hsa_wrist_temperature_data_gen.go index 7442608d..7b1d5668 100755 --- a/profile/mesgdef/hsa_wrist_temperature_data_gen.go +++ b/profile/mesgdef/hsa_wrist_temperature_data_gen.go @@ -65,7 +65,7 @@ func (m *HsaWristTemperatureData) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/jump_gen.go b/profile/mesgdef/jump_gen.go index 8a3a094a..778d3a44 100755 --- a/profile/mesgdef/jump_gen.go +++ b/profile/mesgdef/jump_gen.go @@ -89,7 +89,7 @@ func (m *Jump) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/lap_gen.go b/profile/mesgdef/lap_gen.go index 3d527999..defd1c4b 100755 --- a/profile/mesgdef/lap_gen.go +++ b/profile/mesgdef/lap_gen.go @@ -315,7 +315,7 @@ func (m *Lap) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/length_gen.go b/profile/mesgdef/length_gen.go index fb94f0d7..dfb55047 100755 --- a/profile/mesgdef/length_gen.go +++ b/profile/mesgdef/length_gen.go @@ -112,7 +112,7 @@ func (m *Length) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/magnetometer_data_gen.go b/profile/mesgdef/magnetometer_data_gen.go index 3a1b7b39..2a502297 100755 --- a/profile/mesgdef/magnetometer_data_gen.go +++ b/profile/mesgdef/magnetometer_data_gen.go @@ -76,7 +76,7 @@ func (m *MagnetometerData) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/max_met_data_gen.go b/profile/mesgdef/max_met_data_gen.go index 9f6328d8..e21dbf48 100755 --- a/profile/mesgdef/max_met_data_gen.go +++ b/profile/mesgdef/max_met_data_gen.go @@ -76,7 +76,7 @@ func (m *MaxMetData) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/memo_glob_gen.go b/profile/mesgdef/memo_glob_gen.go index 9cc80470..cf19ab6a 100755 --- a/profile/mesgdef/memo_glob_gen.go +++ b/profile/mesgdef/memo_glob_gen.go @@ -68,7 +68,7 @@ func (m *MemoGlob) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/mesg_capabilities_gen.go b/profile/mesgdef/mesg_capabilities_gen.go index f4ab4182..8f031349 100755 --- a/profile/mesgdef/mesg_capabilities_gen.go +++ b/profile/mesgdef/mesg_capabilities_gen.go @@ -66,7 +66,7 @@ func (m *MesgCapabilities) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/mesgdef.go b/profile/mesgdef/mesgdef.go index 8bf49805..6a5307bd 100644 --- a/profile/mesgdef/mesgdef.go +++ b/profile/mesgdef/mesgdef.go @@ -8,11 +8,13 @@ import ( "github.com/muktihari/fit/proto" ) +// Factory defines a contract that any Factory containing these method can be used by mesgdef's structs. type Factory interface { + // CreateField create new field based on defined messages in the factory. If not found, it returns new field with "unknown" name. CreateField(mesgNum typedef.MesgNum, num byte) proto.Field } -var pool = sync.Pool{New: func() any { return new([256]proto.Field) }} +var pool = sync.Pool{New: func() any { return new([255]proto.Field) }} type Options struct { Factory Factory // If not specified, factory.StandardFactory() will be used. diff --git a/profile/mesgdef/mesgdef_test.go b/profile/mesgdef/mesgdef_test.go index 929338fd..f6c17446 100644 --- a/profile/mesgdef/mesgdef_test.go +++ b/profile/mesgdef/mesgdef_test.go @@ -13,11 +13,11 @@ import ( ) func TestFieldPool(t *testing.T) { - arr, ok := pool.Get().(*[256]proto.Field) - defer pool.Put(arr) + arr, ok := pool.Get().(*[255]proto.Field) if !ok { t.Fatalf("expected ok, got not ok") } + defer pool.Put(arr) } func TestDefaultOptions(t *testing.T) { diff --git a/profile/mesgdef/met_zone_gen.go b/profile/mesgdef/met_zone_gen.go index 60d61e49..86a9613e 100755 --- a/profile/mesgdef/met_zone_gen.go +++ b/profile/mesgdef/met_zone_gen.go @@ -66,7 +66,7 @@ func (m *MetZone) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/monitoring_gen.go b/profile/mesgdef/monitoring_gen.go index 2f31193f..a372f311 100755 --- a/profile/mesgdef/monitoring_gen.go +++ b/profile/mesgdef/monitoring_gen.go @@ -126,7 +126,7 @@ func (m *Monitoring) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/monitoring_hr_data_gen.go b/profile/mesgdef/monitoring_hr_data_gen.go index 40b0a72b..0f03b79f 100755 --- a/profile/mesgdef/monitoring_hr_data_gen.go +++ b/profile/mesgdef/monitoring_hr_data_gen.go @@ -64,7 +64,7 @@ func (m *MonitoringHrData) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/monitoring_info_gen.go b/profile/mesgdef/monitoring_info_gen.go index c2d52b42..35230936 100755 --- a/profile/mesgdef/monitoring_info_gen.go +++ b/profile/mesgdef/monitoring_info_gen.go @@ -76,7 +76,7 @@ func (m *MonitoringInfo) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/nmea_sentence_gen.go b/profile/mesgdef/nmea_sentence_gen.go index b8791012..8a4f501b 100755 --- a/profile/mesgdef/nmea_sentence_gen.go +++ b/profile/mesgdef/nmea_sentence_gen.go @@ -64,7 +64,7 @@ func (m *NmeaSentence) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/obdii_data_gen.go b/profile/mesgdef/obdii_data_gen.go index 21e1477f..ce0733aa 100755 --- a/profile/mesgdef/obdii_data_gen.go +++ b/profile/mesgdef/obdii_data_gen.go @@ -76,7 +76,7 @@ func (m *ObdiiData) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/ohr_settings_gen.go b/profile/mesgdef/ohr_settings_gen.go index 4303e5d0..754e9e67 100755 --- a/profile/mesgdef/ohr_settings_gen.go +++ b/profile/mesgdef/ohr_settings_gen.go @@ -62,7 +62,7 @@ func (m *OhrSettings) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/one_d_sensor_calibration_gen.go b/profile/mesgdef/one_d_sensor_calibration_gen.go index 332aef77..daca84e6 100755 --- a/profile/mesgdef/one_d_sensor_calibration_gen.go +++ b/profile/mesgdef/one_d_sensor_calibration_gen.go @@ -70,7 +70,7 @@ func (m *OneDSensorCalibration) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/power_zone_gen.go b/profile/mesgdef/power_zone_gen.go index 585a3fc1..77ca13b1 100755 --- a/profile/mesgdef/power_zone_gen.go +++ b/profile/mesgdef/power_zone_gen.go @@ -62,7 +62,7 @@ func (m *PowerZone) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/raw_bbi_gen.go b/profile/mesgdef/raw_bbi_gen.go index 7293a832..f13e8e1c 100755 --- a/profile/mesgdef/raw_bbi_gen.go +++ b/profile/mesgdef/raw_bbi_gen.go @@ -78,7 +78,7 @@ func (m *RawBbi) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/record_gen.go b/profile/mesgdef/record_gen.go index 05a76e1e..cdb15c38 100755 --- a/profile/mesgdef/record_gen.go +++ b/profile/mesgdef/record_gen.go @@ -237,7 +237,7 @@ func (m *Record) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/respiration_rate_gen.go b/profile/mesgdef/respiration_rate_gen.go index c80a37ab..3835a655 100755 --- a/profile/mesgdef/respiration_rate_gen.go +++ b/profile/mesgdef/respiration_rate_gen.go @@ -64,7 +64,7 @@ func (m *RespirationRate) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/schedule_gen.go b/profile/mesgdef/schedule_gen.go index 5177a824..e78d5456 100755 --- a/profile/mesgdef/schedule_gen.go +++ b/profile/mesgdef/schedule_gen.go @@ -72,7 +72,7 @@ func (m *Schedule) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/sdm_profile_gen.go b/profile/mesgdef/sdm_profile_gen.go index 5403189a..aa3d0772 100755 --- a/profile/mesgdef/sdm_profile_gen.go +++ b/profile/mesgdef/sdm_profile_gen.go @@ -74,7 +74,7 @@ func (m *SdmProfile) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/segment_file_gen.go b/profile/mesgdef/segment_file_gen.go index 905fb3f6..340bb814 100755 --- a/profile/mesgdef/segment_file_gen.go +++ b/profile/mesgdef/segment_file_gen.go @@ -79,7 +79,7 @@ func (m *SegmentFile) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/segment_id_gen.go b/profile/mesgdef/segment_id_gen.go index d2775275..9dfd2ea8 100755 --- a/profile/mesgdef/segment_id_gen.go +++ b/profile/mesgdef/segment_id_gen.go @@ -74,7 +74,7 @@ func (m *SegmentId) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/segment_lap_gen.go b/profile/mesgdef/segment_lap_gen.go index e6067080..1ba20b5b 100755 --- a/profile/mesgdef/segment_lap_gen.go +++ b/profile/mesgdef/segment_lap_gen.go @@ -259,7 +259,7 @@ func (m *SegmentLap) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/segment_leaderboard_entry_gen.go b/profile/mesgdef/segment_leaderboard_entry_gen.go index 33f53397..d8c80169 100755 --- a/profile/mesgdef/segment_leaderboard_entry_gen.go +++ b/profile/mesgdef/segment_leaderboard_entry_gen.go @@ -72,7 +72,7 @@ func (m *SegmentLeaderboardEntry) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/segment_point_gen.go b/profile/mesgdef/segment_point_gen.go index b1c0371c..75375d70 100755 --- a/profile/mesgdef/segment_point_gen.go +++ b/profile/mesgdef/segment_point_gen.go @@ -81,7 +81,7 @@ func (m *SegmentPoint) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/session_gen.go b/profile/mesgdef/session_gen.go index 60dfb8fb..962c4efb 100755 --- a/profile/mesgdef/session_gen.go +++ b/profile/mesgdef/session_gen.go @@ -381,7 +381,7 @@ func (m *Session) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/set_gen.go b/profile/mesgdef/set_gen.go index 31fe6dc9..058070d4 100755 --- a/profile/mesgdef/set_gen.go +++ b/profile/mesgdef/set_gen.go @@ -87,7 +87,7 @@ func (m *Set) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/skin_temp_overnight_gen.go b/profile/mesgdef/skin_temp_overnight_gen.go index 9fa133f3..bf11c3a8 100755 --- a/profile/mesgdef/skin_temp_overnight_gen.go +++ b/profile/mesgdef/skin_temp_overnight_gen.go @@ -69,7 +69,7 @@ func (m *SkinTempOvernight) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/slave_device_gen.go b/profile/mesgdef/slave_device_gen.go index eb8e28a1..053737ab 100755 --- a/profile/mesgdef/slave_device_gen.go +++ b/profile/mesgdef/slave_device_gen.go @@ -60,7 +60,7 @@ func (m *SlaveDevice) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/sleep_assessment_gen.go b/profile/mesgdef/sleep_assessment_gen.go index 6fe60cf3..48965d43 100755 --- a/profile/mesgdef/sleep_assessment_gen.go +++ b/profile/mesgdef/sleep_assessment_gen.go @@ -86,7 +86,7 @@ func (m *SleepAssessment) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/sleep_level_gen.go b/profile/mesgdef/sleep_level_gen.go index 4f0362de..f0104f24 100755 --- a/profile/mesgdef/sleep_level_gen.go +++ b/profile/mesgdef/sleep_level_gen.go @@ -62,7 +62,7 @@ func (m *SleepLevel) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/software_gen.go b/profile/mesgdef/software_gen.go index 741ae935..aa717b0a 100755 --- a/profile/mesgdef/software_gen.go +++ b/profile/mesgdef/software_gen.go @@ -64,7 +64,7 @@ func (m *Software) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/speed_zone_gen.go b/profile/mesgdef/speed_zone_gen.go index d73a8f78..55ad75d6 100755 --- a/profile/mesgdef/speed_zone_gen.go +++ b/profile/mesgdef/speed_zone_gen.go @@ -64,7 +64,7 @@ func (m *SpeedZone) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/split_gen.go b/profile/mesgdef/split_gen.go index cd988b4a..cfce5196 100755 --- a/profile/mesgdef/split_gen.go +++ b/profile/mesgdef/split_gen.go @@ -99,7 +99,7 @@ func (m *Split) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/split_summary_gen.go b/profile/mesgdef/split_summary_gen.go index 1f79d2a8..8cb8766d 100755 --- a/profile/mesgdef/split_summary_gen.go +++ b/profile/mesgdef/split_summary_gen.go @@ -86,7 +86,7 @@ func (m *SplitSummary) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/spo2_data_gen.go b/profile/mesgdef/spo2_data_gen.go index 06f6aa14..58d5a4a8 100755 --- a/profile/mesgdef/spo2_data_gen.go +++ b/profile/mesgdef/spo2_data_gen.go @@ -66,7 +66,7 @@ func (m *Spo2Data) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/sport_gen.go b/profile/mesgdef/sport_gen.go index fe68b2d6..a220ee9f 100755 --- a/profile/mesgdef/sport_gen.go +++ b/profile/mesgdef/sport_gen.go @@ -62,7 +62,7 @@ func (m *Sport) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/stress_level_gen.go b/profile/mesgdef/stress_level_gen.go index 456499b7..b0b2d078 100755 --- a/profile/mesgdef/stress_level_gen.go +++ b/profile/mesgdef/stress_level_gen.go @@ -62,7 +62,7 @@ func (m *StressLevel) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/tank_summary_gen.go b/profile/mesgdef/tank_summary_gen.go index 26f892fa..4bb0f21f 100755 --- a/profile/mesgdef/tank_summary_gen.go +++ b/profile/mesgdef/tank_summary_gen.go @@ -70,7 +70,7 @@ func (m *TankSummary) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/tank_update_gen.go b/profile/mesgdef/tank_update_gen.go index ce014dea..b96acbc9 100755 --- a/profile/mesgdef/tank_update_gen.go +++ b/profile/mesgdef/tank_update_gen.go @@ -66,7 +66,7 @@ func (m *TankUpdate) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/three_d_sensor_calibration_gen.go b/profile/mesgdef/three_d_sensor_calibration_gen.go index e5e717f8..d0bc94e0 100755 --- a/profile/mesgdef/three_d_sensor_calibration_gen.go +++ b/profile/mesgdef/three_d_sensor_calibration_gen.go @@ -73,7 +73,7 @@ func (m *ThreeDSensorCalibration) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/time_in_zone_gen.go b/profile/mesgdef/time_in_zone_gen.go index 6658df93..17e85f25 100755 --- a/profile/mesgdef/time_in_zone_gen.go +++ b/profile/mesgdef/time_in_zone_gen.go @@ -93,7 +93,7 @@ func (m *TimeInZone) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/timestamp_correlation_gen.go b/profile/mesgdef/timestamp_correlation_gen.go index e20b0f98..7503557e 100755 --- a/profile/mesgdef/timestamp_correlation_gen.go +++ b/profile/mesgdef/timestamp_correlation_gen.go @@ -74,7 +74,7 @@ func (m *TimestampCorrelation) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/totals_gen.go b/profile/mesgdef/totals_gen.go index e80160d1..f1343959 100755 --- a/profile/mesgdef/totals_gen.go +++ b/profile/mesgdef/totals_gen.go @@ -78,7 +78,7 @@ func (m *Totals) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/training_file_gen.go b/profile/mesgdef/training_file_gen.go index 228babdd..7b3b616f 100755 --- a/profile/mesgdef/training_file_gen.go +++ b/profile/mesgdef/training_file_gen.go @@ -70,7 +70,7 @@ func (m *TrainingFile) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/user_profile_gen.go b/profile/mesgdef/user_profile_gen.go index cac053dd..edf3938e 100755 --- a/profile/mesgdef/user_profile_gen.go +++ b/profile/mesgdef/user_profile_gen.go @@ -116,7 +116,7 @@ func (m *UserProfile) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/video_clip_gen.go b/profile/mesgdef/video_clip_gen.go index 1f8d0919..3395dd7c 100755 --- a/profile/mesgdef/video_clip_gen.go +++ b/profile/mesgdef/video_clip_gen.go @@ -72,7 +72,7 @@ func (m *VideoClip) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/video_description_gen.go b/profile/mesgdef/video_description_gen.go index 2f44a716..57c63ed8 100755 --- a/profile/mesgdef/video_description_gen.go +++ b/profile/mesgdef/video_description_gen.go @@ -62,7 +62,7 @@ func (m *VideoDescription) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/video_frame_gen.go b/profile/mesgdef/video_frame_gen.go index 1235898f..182dfc50 100755 --- a/profile/mesgdef/video_frame_gen.go +++ b/profile/mesgdef/video_frame_gen.go @@ -64,7 +64,7 @@ func (m *VideoFrame) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/video_gen.go b/profile/mesgdef/video_gen.go index 50f4f584..db336340 100755 --- a/profile/mesgdef/video_gen.go +++ b/profile/mesgdef/video_gen.go @@ -62,7 +62,7 @@ func (m *Video) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/video_title_gen.go b/profile/mesgdef/video_title_gen.go index 88a1ca1c..40b430d2 100755 --- a/profile/mesgdef/video_title_gen.go +++ b/profile/mesgdef/video_title_gen.go @@ -62,7 +62,7 @@ func (m *VideoTitle) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/watchface_settings_gen.go b/profile/mesgdef/watchface_settings_gen.go index 9fee0fa1..97bbd6bb 100755 --- a/profile/mesgdef/watchface_settings_gen.go +++ b/profile/mesgdef/watchface_settings_gen.go @@ -62,7 +62,7 @@ func (m *WatchfaceSettings) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/weather_alert_gen.go b/profile/mesgdef/weather_alert_gen.go index d24d5390..bfed16fa 100755 --- a/profile/mesgdef/weather_alert_gen.go +++ b/profile/mesgdef/weather_alert_gen.go @@ -70,7 +70,7 @@ func (m *WeatherAlert) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/weather_conditions_gen.go b/profile/mesgdef/weather_conditions_gen.go index 4ba46a65..e2d9ab33 100755 --- a/profile/mesgdef/weather_conditions_gen.go +++ b/profile/mesgdef/weather_conditions_gen.go @@ -93,7 +93,7 @@ func (m *WeatherConditions) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/weight_scale_gen.go b/profile/mesgdef/weight_scale_gen.go index 64710368..42827b03 100755 --- a/profile/mesgdef/weight_scale_gen.go +++ b/profile/mesgdef/weight_scale_gen.go @@ -88,7 +88,7 @@ func (m *WeightScale) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/workout_gen.go b/profile/mesgdef/workout_gen.go index 0e4698fb..c78ea251 100755 --- a/profile/mesgdef/workout_gen.go +++ b/profile/mesgdef/workout_gen.go @@ -74,7 +74,7 @@ func (m *Workout) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/workout_session_gen.go b/profile/mesgdef/workout_session_gen.go index bda96529..c8d9e089 100755 --- a/profile/mesgdef/workout_session_gen.go +++ b/profile/mesgdef/workout_session_gen.go @@ -72,7 +72,7 @@ func (m *WorkoutSession) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/workout_step_gen.go b/profile/mesgdef/workout_step_gen.go index e6a7ce0a..7b91e659 100755 --- a/profile/mesgdef/workout_step_gen.go +++ b/profile/mesgdef/workout_step_gen.go @@ -96,7 +96,7 @@ func (m *WorkoutStep) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/profile/mesgdef/zones_target_gen.go b/profile/mesgdef/zones_target_gen.go index 62c7795b..7263af52 100755 --- a/profile/mesgdef/zones_target_gen.go +++ b/profile/mesgdef/zones_target_gen.go @@ -66,7 +66,7 @@ func (m *ZonesTarget) ToMesg(options *Options) proto.Message { fac := options.Factory - arr := pool.Get().(*[256]proto.Field) + arr := pool.Get().(*[255]proto.Field) defer pool.Put(arr) fields := arr[:0] // Create slice from array with zero len. diff --git a/proto/value_unmarshal.go b/proto/value_unmarshal.go index aba8a71d..b0409e1a 100755 --- a/proto/value_unmarshal.go +++ b/proto/value_unmarshal.go @@ -246,8 +246,8 @@ func trimUTF8NullTerminatedString(b []byte) []byte { return b[:pos] } -// smallpool is an [256]byte array pool. -var smallpool = sync.Pool{New: func() any { return new([256]byte) }} +// smallpool is an [255]byte array pool. +var smallpool = sync.Pool{New: func() any { return new([255]byte) }} // utf8String converts b into a valid utf8 string. // Any invalid utf8 character will be converted into utf8.RuneError. @@ -255,7 +255,7 @@ func utf8String(b []byte) string { if utf8.Valid(b) { // Fast path return string(b) } - arr := smallpool.Get().(*[256]byte) + arr := smallpool.Get().(*[255]byte) defer smallpool.Put(arr) buf := arr[:0] for len(b) > 0 {