Commit 95943564 authored by Claes Sjofors's avatar Claes Sjofors

Wb attribute offset fix for large array fix

parent 2185a17a
...@@ -118,7 +118,7 @@ wb_adrep *wb_bdrep::adrep( pwr_tStatus *sts, const char *aname) ...@@ -118,7 +118,7 @@ wb_adrep *wb_bdrep::adrep( pwr_tStatus *sts, const char *aname)
return 0; return 0;
} }
offset += n.attrIndex(i) * adrep->size() / adrep->nElement(); offset += n.attrIndex(i) * (adrep->size() / adrep->nElement());
} }
if ( (i != n.attributes() - 1) && adrep->isClass()) { if ( (i != n.attributes() - 1) && adrep->isClass()) {
......
...@@ -611,9 +611,9 @@ void wb_cdrep::convertSubClass( pwr_tCid cid, wb_merep *merep, ...@@ -611,9 +611,9 @@ void wb_cdrep::convertSubClass( pwr_tCid cid, wb_merep *merep,
for ( int j = 0; j < MIN(adrep_source->nElement(), adrep_target->nElement()); j++) { for ( int j = 0; j < MIN(adrep_source->nElement(), adrep_target->nElement()); j++) {
convertSubClass( adrep_target->subClass(), merep, convertSubClass( adrep_target->subClass(), merep,
(char *)body_source + adrep_source->offset() + (char *)body_source + adrep_source->offset() +
j * adrep_source->size() / adrep_source->nElement(), j * (adrep_source->size() / adrep_source->nElement()),
(char *)body_target + adrep_target->offset() + (char *)body_target + adrep_target->offset() +
j * adrep_target->size() / adrep_target->nElement()); j * (adrep_target->size() / adrep_target->nElement()));
} }
} }
else { else {
...@@ -788,9 +788,9 @@ void wb_cdrep::convertObject( wb_merep *merep, void *rbody, void *dbody, ...@@ -788,9 +788,9 @@ void wb_cdrep::convertObject( wb_merep *merep, void *rbody, void *dbody,
for ( int j = 0; j < MIN(adrep_source->nElement(), adrep_target->nElement()); j++) { for ( int j = 0; j < MIN(adrep_source->nElement(), adrep_target->nElement()); j++) {
convertSubClass( adrep_target->subClass(), merep, convertSubClass( adrep_target->subClass(), merep,
(char *)body_source + adrep_source->offset() + (char *)body_source + adrep_source->offset() +
j * adrep_source->size() / adrep_source->nElement(), j * (adrep_source->size() / adrep_source->nElement()),
(char *)body_target + adrep_target->offset() + (char *)body_target + adrep_target->offset() +
j * adrep_target->size() / adrep_target->nElement()); j * (adrep_target->size() / adrep_target->nElement()));
} }
} }
else { else {
...@@ -909,13 +909,13 @@ void wb_cdrep::updateTemplateSubClass( wb_adrep *subattr, char *body, pwr_tOid o ...@@ -909,13 +909,13 @@ void wb_cdrep::updateTemplateSubClass( wb_adrep *subattr, char *body, pwr_tOid o
while ( ODD(sts)) { while ( ODD(sts)) {
int elements = adrep->isArray() ? adrep->nElement() : 1; int elements = adrep->isArray() ? adrep->nElement() : 1;
if ( adrep->isClass()) { if ( adrep->isClass()) {
updateTemplateSubClass( adrep, body + i * subattr->size() / subattr_elements + adrep->offset(), updateTemplateSubClass( adrep, body + i * (subattr->size() / subattr_elements) + adrep->offset(),
oid, toid, aoffs); oid, toid, aoffs);
} }
else { else {
switch ( adrep->type()) { switch ( adrep->type()) {
case pwr_eType_Objid: { case pwr_eType_Objid: {
pwr_tOid *oidp = (pwr_tOid *)(body + i * subattr->size() / subattr_elements + pwr_tOid *oidp = (pwr_tOid *)(body + i * (subattr->size() / subattr_elements) +
adrep->offset()); adrep->offset());
for ( int j = 0; j < elements; j++) { for ( int j = 0; j < elements; j++) {
if ( cdh_ObjidIsEqual( *oidp, toid)) if ( cdh_ObjidIsEqual( *oidp, toid))
...@@ -925,7 +925,7 @@ void wb_cdrep::updateTemplateSubClass( wb_adrep *subattr, char *body, pwr_tOid o ...@@ -925,7 +925,7 @@ void wb_cdrep::updateTemplateSubClass( wb_adrep *subattr, char *body, pwr_tOid o
break; break;
} }
case pwr_eType_AttrRef: { case pwr_eType_AttrRef: {
pwr_sAttrRef *arp = (pwr_sAttrRef *)(body + i * subattr->size() / subattr_elements + pwr_sAttrRef *arp = (pwr_sAttrRef *)(body + i * (subattr->size() / subattr_elements) +
adrep->offset()); adrep->offset());
for ( int j = 0; j < elements; j++) { for ( int j = 0; j < elements; j++) {
if ( cdh_ObjidIsEqual( arp->Objid, toid)) { if ( cdh_ObjidIsEqual( arp->Objid, toid)) {
......
...@@ -1467,13 +1467,13 @@ void wb_vrepced::updateTemplateRef( wb_adrep *subattr, char *body, pwr_tAttrRef ...@@ -1467,13 +1467,13 @@ void wb_vrepced::updateTemplateRef( wb_adrep *subattr, char *body, pwr_tAttrRef
if ( adrep->isClass()) { if ( adrep->isClass()) {
pwr_tAttrRef aaref = aref; pwr_tAttrRef aaref = aref;
aaref.Offset += i * bdrep->size(); aaref.Offset += i * bdrep->size();
updateTemplateRef( adrep, (char *)body + i * subattr->size() / subattr_elements + updateTemplateRef( adrep, (char *)body + i * (subattr->size() / subattr_elements) +
adrep->offset(), aaref, toid); adrep->offset(), aaref, toid);
} }
else { else {
switch ( adrep->type()) { switch ( adrep->type()) {
case pwr_eType_Objid: { case pwr_eType_Objid: {
pwr_tOid *oidp = (pwr_tOid *)(body + i * subattr->size() / subattr_elements + pwr_tOid *oidp = (pwr_tOid *)(body + i * (subattr->size() / subattr_elements) +
adrep->offset()); adrep->offset());
for ( int j = 0; j < elements; j++) { for ( int j = 0; j < elements; j++) {
if ( cdh_ObjidIsEqual( *oidp, toid)) if ( cdh_ObjidIsEqual( *oidp, toid))
...@@ -1483,7 +1483,7 @@ void wb_vrepced::updateTemplateRef( wb_adrep *subattr, char *body, pwr_tAttrRef ...@@ -1483,7 +1483,7 @@ void wb_vrepced::updateTemplateRef( wb_adrep *subattr, char *body, pwr_tAttrRef
break; break;
} }
case pwr_eType_AttrRef: { case pwr_eType_AttrRef: {
pwr_sAttrRef *arp = (pwr_sAttrRef *)(body + i * subattr->size() / subattr_elements + pwr_sAttrRef *arp = (pwr_sAttrRef *)(body + i * (subattr->size() / subattr_elements) +
adrep->offset()); adrep->offset());
for ( int j = 0; j < elements; j++) { for ( int j = 0; j < elements; j++) {
if ( cdh_ObjidIsEqual( arp->Objid, toid)) { if ( cdh_ObjidIsEqual( arp->Objid, toid)) {
......
...@@ -2395,7 +2395,7 @@ void wb_vrepdb::checkAttributes(pwr_tCid cid) ...@@ -2395,7 +2395,7 @@ void wb_vrepdb::checkAttributes(pwr_tCid cid)
for ( int j = 0; j < o_adrep->nElement(); j++) { for ( int j = 0; j < o_adrep->nElement(); j++) {
a.cid = cid; a.cid = cid;
a.bix = bix; a.bix = bix;
a.offset = o_adrep->offset() + j * o_adrep->size() / o_adrep->nElement(); a.offset = o_adrep->offset() + j * (o_adrep->size() / o_adrep->nElement());
tree_Insert(&sts, m_aref_th, &a); tree_Insert(&sts, m_aref_th, &a);
} }
} }
...@@ -2473,8 +2473,8 @@ void wb_vrepdb::checkAttributes(pwr_tCid cid) ...@@ -2473,8 +2473,8 @@ void wb_vrepdb::checkAttributes(pwr_tCid cid)
for ( int j = 0; j < MIN(o_adrep->nElement(),n_adrep->nElement()); j++) { for ( int j = 0; j < MIN(o_adrep->nElement(),n_adrep->nElement()); j++) {
checkSubClass( cid, o_adrep->subClass(), checkSubClass( cid, o_adrep->subClass(),
o_adrep->offset() + j * o_adrep->size() / o_adrep->nElement(), o_adrep->offset() + j * (o_adrep->size() / o_adrep->nElement()),
n_adrep->offset() + j * n_adrep->size() / n_adrep->nElement(), n_adrep->offset() + j * (n_adrep->size() / n_adrep->nElement()),
body); body);
} }
} }
...@@ -2588,8 +2588,8 @@ void wb_vrepdb::checkSubClass(pwr_tCid cid, pwr_tCid subcid, unsigned int o_offs ...@@ -2588,8 +2588,8 @@ void wb_vrepdb::checkSubClass(pwr_tCid cid, pwr_tCid subcid, unsigned int o_offs
if ( o_adrep->isArray()) { if ( o_adrep->isArray()) {
for ( int j = 0; j < MIN(o_adrep->nElement(),n_adrep->nElement()); j++) { for ( int j = 0; j < MIN(o_adrep->nElement(),n_adrep->nElement()); j++) {
checkSubClass( cid, n_adrep->subClass(), checkSubClass( cid, n_adrep->subClass(),
o_adrep->offset() + o_offset + j * o_adrep->size() / o_adrep->nElement(), o_adrep->offset() + o_offset + j * (o_adrep->size() / o_adrep->nElement()),
n_adrep->offset() + n_offset + j * n_adrep->size() / n_adrep->nElement(), n_adrep->offset() + n_offset + j * (n_adrep->size() / n_adrep->nElement()),
body); body);
} }
} }
...@@ -2604,7 +2604,7 @@ void wb_vrepdb::checkSubClass(pwr_tCid cid, pwr_tCid subcid, unsigned int o_offs ...@@ -2604,7 +2604,7 @@ void wb_vrepdb::checkSubClass(pwr_tCid cid, pwr_tCid subcid, unsigned int o_offs
for ( int j = 0; j < o_adrep->nElement(); j++) { for ( int j = 0; j < o_adrep->nElement(); j++) {
a.cid = cid; a.cid = cid;
a.bix = bix; a.bix = bix;
a.offset = o_adrep->offset() + o_offset + j * o_adrep->size() / o_adrep->nElement(); a.offset = o_adrep->offset() + o_offset + j * (o_adrep->size() / o_adrep->nElement());
tree_Insert(&sts, m_aref_th, &a); tree_Insert(&sts, m_aref_th, &a);
} }
} }
......
...@@ -2396,7 +2396,7 @@ void wb_vrepdbms::checkAttributes(pwr_tCid cid) ...@@ -2396,7 +2396,7 @@ void wb_vrepdbms::checkAttributes(pwr_tCid cid)
for ( int j = 0; j < o_adrep->nElement(); j++) { for ( int j = 0; j < o_adrep->nElement(); j++) {
a.cid = cid; a.cid = cid;
a.bix = bix; a.bix = bix;
a.offset = o_adrep->offset() + j * o_adrep->size() / o_adrep->nElement(); a.offset = o_adrep->offset() + j * (o_adrep->size() / o_adrep->nElement());
tree_Insert(&sts, m_aref_th, &a); tree_Insert(&sts, m_aref_th, &a);
} }
} }
...@@ -2474,8 +2474,8 @@ void wb_vrepdbms::checkAttributes(pwr_tCid cid) ...@@ -2474,8 +2474,8 @@ void wb_vrepdbms::checkAttributes(pwr_tCid cid)
for ( int j = 0; j < MIN(o_adrep->nElement(),n_adrep->nElement()); j++) { for ( int j = 0; j < MIN(o_adrep->nElement(),n_adrep->nElement()); j++) {
checkSubClass( cid, o_adrep->subClass(), checkSubClass( cid, o_adrep->subClass(),
o_adrep->offset() + j * o_adrep->size() / o_adrep->nElement(), o_adrep->offset() + j * (o_adrep->size() / o_adrep->nElement()),
n_adrep->offset() + j * n_adrep->size() / n_adrep->nElement(), n_adrep->offset() + j * (n_adrep->size() / n_adrep->nElement()),
body); body);
} }
} }
...@@ -2589,8 +2589,8 @@ void wb_vrepdbms::checkSubClass(pwr_tCid cid, pwr_tCid subcid, unsigned int o_of ...@@ -2589,8 +2589,8 @@ void wb_vrepdbms::checkSubClass(pwr_tCid cid, pwr_tCid subcid, unsigned int o_of
if ( o_adrep->isArray()) { if ( o_adrep->isArray()) {
for ( int j = 0; j < MIN(o_adrep->nElement(),n_adrep->nElement()); j++) { for ( int j = 0; j < MIN(o_adrep->nElement(),n_adrep->nElement()); j++) {
checkSubClass( cid, n_adrep->subClass(), checkSubClass( cid, n_adrep->subClass(),
o_adrep->offset() + o_offset + j * o_adrep->size() / o_adrep->nElement(), o_adrep->offset() + o_offset + j * (o_adrep->size() / o_adrep->nElement()),
n_adrep->offset() + n_offset + j * n_adrep->size() / n_adrep->nElement(), n_adrep->offset() + n_offset + j * (n_adrep->size() / n_adrep->nElement()),
body); body);
} }
} }
...@@ -2605,7 +2605,7 @@ void wb_vrepdbms::checkSubClass(pwr_tCid cid, pwr_tCid subcid, unsigned int o_of ...@@ -2605,7 +2605,7 @@ void wb_vrepdbms::checkSubClass(pwr_tCid cid, pwr_tCid subcid, unsigned int o_of
for ( int j = 0; j < o_adrep->nElement(); j++) { for ( int j = 0; j < o_adrep->nElement(); j++) {
a.cid = cid; a.cid = cid;
a.bix = bix; a.bix = bix;
a.offset = o_adrep->offset() + o_offset + j * o_adrep->size() / o_adrep->nElement(); a.offset = o_adrep->offset() + o_offset + j * (o_adrep->size() / o_adrep->nElement());
tree_Insert(&sts, m_aref_th, &a); tree_Insert(&sts, m_aref_th, &a);
} }
} }
......
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