override public Object unpack(Info vi, csBuffer opb)
{
// also responsible for range checking
InfoMapping0 info = new InfoMapping0();
// !!!!
if (opb.read(1) != 0)
{
info.submaps = opb.read(4) + 1;
}
else
{
info.submaps = 1;
}
if (opb.read(1) != 0)
{
info.coupling_steps = opb.read(8) + 1;
for (int i = 0; i < info.coupling_steps; i++)
{
int testM = opb.read(ilog(vi.channels));
int testA = opb.read(ilog(vi.channels));
info.coupling_mag[i] = testM;
info.coupling_ang[i] = testA;
if (testM < 0 ||
testA < 0 ||
testM >= vi.channels ||
testA >= vi.channels)
{
//goto err_out;
info.free();
return(null);
}
}
}
if (opb.read(2) > 0)
{ /* 2,3:reserved */
//goto err_out;
info.free();
return(null);
}
if (info.submaps > 1)
{
for (int i = 0; i < vi.channels; i++)
{
info.chmuxlist[i] = opb.read(4);
if (info.chmuxlist[i] >= info.submaps)
{
//goto err_out;
info.free();
return(null);
}
}
}
for (int i = 0; i < info.submaps; i++)
{
info.timesubmap[i] = opb.read(8);
if (info.timesubmap[i] >= vi.times)
{
//goto err_out;
info.free();
return(null);
}
info.floorsubmap[i] = opb.read(8);
if (info.floorsubmap[i] >= vi.floors)
{
//goto err_out;
info.free();
return(null);
}
info.residuesubmap[i] = opb.read(8);
if (info.residuesubmap[i] >= vi.residues)
{
//goto err_out;
info.free();
return(null);
}
}
return(info);
//err_out:
//free_info(info);
//return(NULL);
}