Static_MARCField::GetSubField does not return all subfields.
Status: Alpha
Brought to you by:
markbasedow
os:windows2000 sp2
compiler:vc7.0
test data:loc MARC
In file static_marcfield.cpp,function
Static_MARCField::GetSubField doesnot return all
subfields.
Some subrecords does not have a subrecord
terminator,so in this condition,the function will not return
aa valid string.
string Static_MARCField::GetSubField(char c)
{
string str;
unsigned char * start = 0, * end = 0;
int i = 0;
while(i < iLength)
{
if(start)
{
//2005-3-27,cuijianhai
if((buf[i] == 30) || (buf[i]
== 31)||i == (iLength - 1))
{
end = buf +
i;
int l = end -
start;
char * p =
new char [l + 1];
memcpy(p,
start, l);
p[l] = 0;
str = p;
delete [] p;
break;
}
}
if((buf[i - 1] == 31) && (buf[i] == c))
{
start = buf + i + 1;
}
++i;
}
return str;
}