@@ -411,7 +411,7 @@ namespace COMMON_NS
411411 *
412412 * @returns The gSOAP type.
413413 */
414- int getGsoapType () const ;
414+ long getGsoapType () const ;
415415
416416 /* *
417417 * Creates an returns an EML2.0 data object reference which targets this data object
@@ -831,11 +831,13 @@ namespace COMMON_NS
831831 throw std::underflow_error (" Cannot deal with negative values when using unsigned integer" );
832832 }
833833 }
834- if (rangeArray->Value + rangeArray-> Count > static_cast <uint64_t >((std::numeric_limits<T>::max)())) {
835- throw std::overflow_error (" The range integer values are superior to maximum value of read datatype. " );
834+ if (rangeArray->Count > static_cast <uint64_t >((std::numeric_limits<T>::max)())) {
835+ throw std::overflow_error (" Please use a larger integer type " );
836836 }
837- for (T i = 0 ; i < static_cast <T>(rangeArray->Count ); ++i) {
838- arrayOutput[i] = i + static_cast <T>(rangeArray->Value );
837+ const T initialValue = static_cast <T>(rangeArray->Value );
838+ const T count = static_cast <T>(rangeArray->Count );
839+ for (T i = 0 ; i < count; ++i) {
840+ arrayOutput[i] = i + initialValue;
839841 }
840842 return (std::numeric_limits<T>::max)();
841843 }
@@ -871,22 +873,27 @@ namespace COMMON_NS
871873 if (latticeArray->StartValue < (std::numeric_limits<T>::min)() || latticeArray->Offset [0 ]->Value < (std::numeric_limits<T>::min)()) {
872874 throw std::underflow_error (" Too low integers in XML for the C++ chosen datatype" );
873875 }
874- if (latticeArray->StartValue > (std::numeric_limits<T>::max)() ||
875- latticeArray->Offset [0 ]->Value > (std::numeric_limits<T>::max)()) {
876+ if (latticeArray->StartValue > static_cast <int64_t >((std::numeric_limits<T>::max)()) ||
877+ latticeArray->Offset [0 ]->Value > static_cast <int64_t >((std::numeric_limits<T>::max)()) ||
878+ latticeArray->Offset [0 ]->Count > static_cast <uint64_t >((std::numeric_limits<T>::max)())) {
876879 throw std::overflow_error (" Too big integers in XML for the C++ chosen datatype" );
877880 }
878881 }
879882 else {
880883 if (latticeArray->StartValue < 0 || latticeArray->Offset [0 ]->Value < 0 ) {
881884 throw std::underflow_error (" Cannot deal with negative values when using unsigned integer" );
882885 }
883- if (static_cast <uint64_t >(latticeArray->StartValue ) > (std::numeric_limits<T>::max)() ||
884- static_cast <uint64_t >(latticeArray->Offset [0 ]->Value ) > (std::numeric_limits<T>::max)()) {
886+ if (static_cast <uint64_t >(latticeArray->StartValue ) > static_cast <uint64_t >((std::numeric_limits<T>::max)()) ||
887+ static_cast <uint64_t >(latticeArray->Offset [0 ]->Value ) > static_cast <uint64_t >((std::numeric_limits<T>::max)()) ||
888+ latticeArray->Offset [0 ]->Count > static_cast <uint64_t >((std::numeric_limits<T>::max)())) {
885889 throw std::overflow_error (" Too big integers in XML for the C++ chosen datatype" );
886890 }
887891 }
888- for (uint64_t i = 0 ; i <= latticeArray->Offset [0 ]->Count ; ++i) {
889- arrayOutput[i] = static_cast <T>(latticeArray->StartValue ) + (i * static_cast <T>(latticeArray->Offset [0 ]->Value ));
892+ const T start = static_cast <T>(latticeArray->StartValue );
893+ const T step = static_cast <T>(latticeArray->Offset [0 ]->Value );
894+ const T count = static_cast <T>(latticeArray->Offset [0 ]->Count );
895+ for (T i = 0 ; i <= count; ++i) {
896+ arrayOutput[i] = static_cast <T>(start + i * step);
890897 }
891898 return (std::numeric_limits<T>::max)();
892899 }
@@ -932,12 +939,12 @@ namespace COMMON_NS
932939 if (latticeArray->Offset .empty () || latticeArray->Offset .size () > 1 ) {
933940 throw std::invalid_argument (" The integer lattice array of UUID " + getUuid () + " contains zero or more than one offset." );
934941 }
935- if (latticeArray->Offset [0 ]->Count < 0 ) {
936- throw std::invalid_argument (" The count of the integer lattice array of UUID " + getUuid () + " is negative which is not valid." );
937- }
938942
939- for (size_t i = 0 ; i <= static_cast <size_t >(latticeArray->Offset [0 ]->Count ); ++i) {
940- arrayOutput[i] = latticeArray->StartValue + (i * latticeArray->Offset [0 ]->Value );
943+ const T start = static_cast <T>(latticeArray->StartValue );
944+ const T step = static_cast <T>(latticeArray->Offset [0 ]->Value );
945+ const T count = static_cast <T>(latticeArray->Offset [0 ]->Count );
946+ for (T i = 0 ; i <= count; ++i) {
947+ arrayOutput[i] = static_cast <T>(start + i * step);
941948 }
942949 return (std::numeric_limits<T>::max)();
943950 }
@@ -949,7 +956,7 @@ namespace COMMON_NS
949956 std::sregex_token_iterator endToken;
950957 size_t index = 0 ;
951958 while (it != endToken) {
952- arrayOutput[index++] = std::stoll (*it++);
959+ arrayOutput[index++] = static_cast <T>( std::stoll (*it++) );
953960 }
954961 return (std::numeric_limits<T>::max)();
955962 }
@@ -1076,7 +1083,7 @@ namespace COMMON_NS
10761083 /* *
10771084 * Create an external data array part pointing to a named dataset in an HDF proxy
10781085 */
1079- gsoap_eml2_3::eml23__ExternalDataArrayPart* createExternalDataArrayPart (const std::string& datasetName, LONG64 count, EML2_NS::AbstractHdfProxy* proxy = nullptr ) const ;
1086+ gsoap_eml2_3::eml23__ExternalDataArrayPart* createExternalDataArrayPart (const std::string& datasetName, uint64_t count, EML2_NS::AbstractHdfProxy* proxy = nullptr ) const ;
10801087
10811088 gsoap_resqml2_0_1::resqml20__IndexableElements mapIndexableElement (gsoap_eml2_3::eml23__IndexableElement toMap) const ;
10821089
0 commit comments