You are here: Forum Home → ANT Developers Forums → ANT+ FIT Forum Has Moved → Thread
std::wstring wstring_name(L"TestUser Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.");
userProfileMesg.SetFriendlyName(wstring_name);
msvcp120d.dll!6b05cee6() Unknown
[Frames below may be incorrect and/or missing, no symbols loaded for msvcp120d.dll]
[External Code]
encode.exe!fit::FieldBase::SetSTRINGValue(const std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> > & value, const unsigned char fieldArrayIndex) Line 1045 C++
> encode.exe!fit::Mesg::SetFieldSTRINGValue(const unsigned char fieldNum, const std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> > & value, const unsigned char fieldArrayIndex) Line 848 C++
encode.exe!fit::UserProfileMesg::SetFriendlyName(std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> > friendlyName) Line 126 C++
encode.exe!EncodeSettingsFile() Line 116 C++
encode.exe!main() Line 207 C++
[External Code]
void FieldBase::SetSTRINGValue(const FIT_WSTRING& value, const FIT_UINT8 fieldArrayIndex)
{
if (!IsValid())
return;
Unicode::UTF8_STRING stringValue = Unicode::Encode_BaseToUTF8(value);
FIT_UINT8 stringLength = (FIT_UINT8)stringValue.length();
FIT_UINT8 idx = 0;
FIT_UINT8 nextIdx = 0;
FIT_UINT8 numStrings = (FIT_UINT8)stringIndexes.size();
FIT_UINT8 dif = 0;
if ( fieldArrayIndex < numStrings )
{
idx = stringIndexes[fieldArrayIndex];
if (fieldArrayIndex + 1 < numStrings)
{
nextIdx = stringIndexes[fieldArrayIndex + 1];
dif = (FIT_UINT8)( (value.length() + 1) - (nextIdx - idx) );
values.erase(values.begin() + idx, values.begin() + nextIdx);
}
else
{
values.erase(values.begin() + idx, values.end());
}
for (auto i = 0; i < stringLength + 1; i++)
values.insert(values.begin() + idx + i, 0);
}
else
{
idx = (FIT_UINT8)values.size();
numStrings++;
stringIndexes.push_back(idx);
for (auto j = 0; j < stringLength + 1; j++)
{
values.push_back(0);
}
}
int i;
for (i = 0; i < (int)stringValue.length(); i++)
{
values[idx + i] = static_cast<FIT_BYTE>(stringValue[i]); // <<<<< exception thrown here
}
values[idx + i] = 0; // null terminate
}