Commit 7d4a69b0 authored by Claes's avatar Claes Committed by Esteban Blanc

wb GetNextAttrRef() bugfix for attrobjects with disableattr

parent afc88119
......@@ -167,6 +167,10 @@ public:
{
return m_adrep;
}
void addFlagsDisableAttr()
{
m_flags |= PWR_MASK_DISABLEATTR;
}
void castId(pwr_tCastId* castid);
pwr_tDisableAttr disabled();
pwr_tCid adefCid();
......
......@@ -362,8 +362,8 @@ pwr_tStatus ldh_CreateObject(ldh_tSession session, pwr_tOid* oid,
try {
wb_name n(name);
//if (!n)
// return n.sts();
if (name && !n)
return n.sts();
wb_cdef cdef = sp->cdef(cid);
......
......@@ -610,7 +610,7 @@ void wb_merep::classVersion(pwr_tStatus* sts, pwr_tCid cid, pwr_tTime* time)
}
void wb_merep::insertCattObject(
pwr_tStatus* sts, pwr_tCid cid, wb_adrep* adp, int offset)
pwr_tStatus* sts, pwr_tCid cid, wb_adrep* adp, int offset, int disableattr)
{
merep_sClassAttrKey key;
merep_sClassAttr* item;
......@@ -634,12 +634,12 @@ void wb_merep::insertCattObject(
if (ODD(*sts)) {
// Insert in found item
item->offset[item->numOffset] = offset + adp->offset();
item->flags[item->numOffset++] = adp->flags();
item->flags[item->numOffset++] = adp->flags() | disableattr;
} else {
// Insert a new item
item = (merep_sClassAttr*)tree_Insert(sts, m_catt_tt, &key);
item->offset[item->numOffset] = offset + adp->offset();
item->flags[item->numOffset++] = adp->flags();
item->flags[item->numOffset++] = adp->flags() | disableattr;
}
// Look for class attributes in this class
......@@ -654,7 +654,12 @@ void wb_merep::insertCattObject(
for (ad = bd->adrep(sts); ODD(*sts);
adnext = ad->next(sts), delete ad, ad = adnext) {
if (ad->flags() & PWR_MASK_CLASS && cdh_tidIsCid(ad->tid())) {
insertCattObject(sts, cid, ad, offset + adp->offset());
if (ad->flags() & PWR_MASK_SUPERCLASS)
insertCattObject(sts, cid, ad, offset + adp->offset(),
disableattr);
else
insertCattObject(sts, cid, ad, offset + adp->offset(),
ad->flags() & PWR_MASK_DISABLEATTR);
if (EVEN(*sts))
return;
}
......@@ -692,7 +697,7 @@ void wb_merep::insertCattObject(
adnext = ad->next(sts), delete ad, ad = adnext) {
if (ad->flags() & PWR_MASK_CLASS && cdh_tidIsCid(ad->tid())) {
insertCattObject(sts, cid, ad,
offset + adp->offset() + j * adp->size() / adp->nElement());
offset + adp->offset() + j * adp->size() / adp->nElement(), ad->flags() & PWR_MASK_DISABLEATTR);
if (EVEN(*sts))
return;
}
......@@ -740,7 +745,8 @@ tree_sTable* wb_merep::buildCatt(pwr_tStatus* sts)
for (ad = bd->adrep(sts); ODD(*sts);
adnext = ad->next(sts), delete ad, ad = adnext) {
if (ad->flags() & PWR_MASK_CLASS && cdh_tidIsCid(ad->tid())) {
insertCattObject(sts, cid, ad, 0);
insertCattObject(sts, cid, ad, 0,
ad->flags() & PWR_MASK_DISABLEATTR);
if (EVEN(*sts))
throw wb_error(*sts);
}
......@@ -776,7 +782,8 @@ tree_sTable* wb_merep::buildCatt(pwr_tStatus* sts)
for (ad = bd->adrep(sts); ODD(*sts);
adnext = ad->next(sts), delete ad, ad = adnext) {
if (ad->flags() & PWR_MASK_CLASS && cdh_tidIsCid(ad->tid())) {
insertCattObject(sts, cid, ad, 0);
insertCattObject(sts, cid, ad, 0,
ad->flags() & PWR_MASK_DISABLEATTR);
if (EVEN(*sts))
throw wb_error(*sts);
}
......
......@@ -109,7 +109,8 @@ public:
void classVersion(pwr_tStatus* sts, pwr_tCid cid, pwr_tTime* time);
tree_sTable* buildCatt(pwr_tStatus* sts);
void insertCattObject(
pwr_tStatus* sts, pwr_tCid cid, wb_adrep* adp, int offset);
pwr_tStatus* sts, pwr_tCid cid, wb_adrep* adp, int offset,
int disableattr);
tree_sTable* catt_tt()
{
return m_catt_tt;
......
......@@ -424,6 +424,8 @@ wb_attribute wb_volume::attribute(const pwr_sAttrRef* arp) const
wb_attribute a(LDH__SUCCESS, orep, adrep, idx);
if (arp->Flags.b.Shadowed)
a.setShadowed(true);
if (arp->Flags.b.DisableAttr)
a.addFlagsDisableAttr();
delete bdrep;
orep->unref();
return a;
......@@ -1240,12 +1242,14 @@ void wb_volume::nextAref(pwr_tCid cid, pwr_sAttrRef* arp, pwr_sAttrRef* oarp)
*oarp = pwr_cNAttrRef;
oarp->Objid = op->oid();
oarp->Flags.b.ObjectAttr = 1;
if (item->flags[i] & PWR_MASK_DISABLEATTR)
oarp->Flags.b.DisableAttr = 1;
oarp->Offset = item->offset[i];
oarp->Size = bd_size;
oarp->Body = cdh_cidToBid(cid, pwr_eBix_rt);
op->unref();
if (item->flags[0] & PWR_MASK_DISABLEATTR) {
if (item->flags[i] & PWR_MASK_DISABLEATTR) {
wb_attribute a = attribute(oarp);
if (a.disabled()) {
pwr_sAttrRef aref = *oarp;
......@@ -1297,6 +1301,8 @@ void wb_volume::nextAref(pwr_tCid cid, pwr_sAttrRef* arp, pwr_sAttrRef* oarp)
*oarp = pwr_cNAttrRef;
oarp->Objid = ol->oid();
oarp->Flags.b.ObjectAttr = 1;
if (item->flags[0] & PWR_MASK_DISABLEATTR)
oarp->Flags.b.DisableAttr = 1;
oarp->Offset = item->offset[0];
oarp->Size = bd_size;
oarp->Body = cdh_cidToBid(cid, pwr_eBix_rt);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment