Corretto comportamento deegli Zoom Field nel caso non ci siano retrun nel range 0 - size()

git-svn-id: svn://10.65.10.50/trunk@3907 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 1996-11-18 14:19:32 +00:00
parent 2bcd38f979
commit f5b9343d4b

View File

@ -4000,11 +4000,17 @@ const char* TZoom_field::reformat(const char* data) const
}
const char* TZoom_field::raw2win(const char* data) const
{
char* n = strchr(data, '\n');
if (n != NULL) *n = '\0';
_ctl_data._park = data;
if (n != NULL) *n = '\n';
{
TFixed_string str(data);
int a_capo = str.find('\n');
if (a_capo < 0 || a_capo > (int)size())
a_capo = min((int)size(), str.len());
const char c = str[a_capo];
str[a_capo] = '\0';
_ctl_data._park = str;
str[a_capo] = c;
return _ctl_data._park;
}
@ -4019,11 +4025,10 @@ const char* TZoom_field::win2raw(const char* data) const
// Aggiungo le righe del memo a partire dalla seconda
a_capo = _str.find('\n');
if (a_capo >= 0)
{
const char* d = _str;
str << (d+a_capo);
}
if (a_capo < 0 || a_capo > (int)size())
a_capo = min((int) size(), _str.len());
const char* d = _str;
str << (d+a_capo);
return str;
}