@@ -637,7 +637,12 @@ class intelhex {
637
637
638
638
if (!ihContent.empty ())
639
639
{
640
- if (ihIterator != ihContent.end ())
640
+ map<unsigned long , unsigned char >::iterator it \
641
+ = ihContent.end ();
642
+
643
+ --it;
644
+
645
+ if (it != ihIterator)
641
646
{
642
647
result = false ;
643
648
}
@@ -845,7 +850,44 @@ class intelhex {
845
850
return false ;
846
851
}
847
852
848
- bool getData (unsigned char * data, unsigned long address);
853
+ /* *********************************************************************/
854
+ /* ! \brief Returns the data for desired address.
855
+ *
856
+ * Returns the data for the desired address. If the address has no data
857
+ * assigned to it, the function returns false, the pointer to data is not
858
+ * written and the class's address pointer remains unchanged. If the
859
+ * address has data assigned to it, the pointer to data will be written
860
+ * with the data found and the class's address pointer will be moved to
861
+ * this new location.
862
+ *
863
+ * \param data - variable to hold data requested
864
+ * \param address - address to be queried for valid data
865
+ *
866
+ * \retval true - data was available and returned value is valid
867
+ * \retval false - data was not available and returned valid is not
868
+ * valid
869
+ *
870
+ * \sa putData()
871
+ ***********************************************************************/
872
+ bool getData (unsigned char * data, unsigned long address)
873
+ {
874
+ bool found = false ;
875
+ map<unsigned long , unsigned char >::iterator localIterator;
876
+
877
+ if (!ihContent.empty ())
878
+ {
879
+ localIterator = ihContent.find (address);
880
+
881
+ if (localIterator != ihContent.end ())
882
+ {
883
+ found = true ;
884
+ ihIterator = localIterator;
885
+ *data = ihIterator->second ;
886
+ }
887
+ }
888
+
889
+ return found;
890
+ }
849
891
850
892
/* *********************************************************************/
851
893
/* ! \brief Inserts desired byte at the current address pointer.
0 commit comments