On Wed, 2014-04-30 at 15:19 +0200, Patrick Ohly wrote:
> It's permanently increasing repoffset.
> 
> I've not looked further, but I suspect that this is because of using
> LABEL twice, once indirectly via the group field and once via the
> position field.
> 
> I'll try applying different <property> elements, even if that means more
> duplication in the profile.

That had even weirder effects, so I am back at the <position
field="LABEL"> approach and trying to figure out where the endless loop
comes from.

Attached my current field list and profile.

It hangs parsing:

ADR;TYPE=HOME:PO;neighborhood;home address\n;City;State;ZIP;Country

The (almost) endless loop comes from this code:

              // note: repArray will be updated below (if property not empty or 
!overwriteempty)
              dostore=true; // we can store
              do {
                repoffset = aRepArray[repid]*repinc;
                // - set flag if repeat offset should be incremented after 
storing an empty property or not
                overwriteempty = propnameextP->overwriteEmpty;
                // - check if target property main value is empty (must be, or 
we will skip that repetition)
                dostore = false; // if no field exists, we do not store
                for (sInt16 e=0; e<aPropP->numValues; e++) {
                  if (aPropP->convdefs[e].fieldid==FID_NOT_SUPPORTED)
                    continue; // no field, no need to check it
                  sInt16 e_fid = aPropP->convdefs[e].fieldid+baseoffset;
                  sInt16 e_rep = repoffset;
                  aItem.adjustFidAndIndex(e_fid,e_rep);
                  // - get base field
                  TItemField *e_basefldP = aItem.getField(e_fid);
                  TItemField *e_fldP = NULL;
                  if (e_basefldP)
                    e_fldP=e_basefldP->getArrayField(e_rep,true); // get leaf 
field, if it exists
                  if (!e_basefldP || (e_fldP && e_fldP->isAssigned())) {
                    // base field of one of the main fields does not exist or 
leaf field is already assigned
                    // -> skip that repetition
===>                dostore = false;
                    break;
                  }
                  else
                    dostore = true; // at least one field exists, we might store
                }
                // check if we can test more repetitions
                if (!dostore) {
                  if (aRepArray[repid]+1<maxrep || maxrep==REP_ARRAY) {
                    // we can increment and try next repetition
                    aRepArray[repid]++;
                  }
                  else
                    break; // no more possible repetitions with this position 
rule (check next rule)
                }
              } while (!dostore);

It sets dostore = false at the line indicated above. Then it increments
aRepArray[repid] and tried again, failing again and again. That's
because the e_fid calculated for aItem.getField(e_fid) is beyond the end
of my field list. Therefore e_basefldP is always going to NULL for all
repetitions.

I'm a bit lost about baseoffset. What does it mean?

In my case, ADR is defined has having 7 values plus the extra TYPE and
LABEL:

        <property name="ADR" values="7" groupfield="GROUP_TAG">
          <value index="0" field="ADR_POBOX"/>
          <value index="1" field="ADR_ADDTL"/>
          <value index="2" field="ADR_STREET"/>
          <value index="3" field="ADR_CITY"/>
          <value index="4" field="ADR_REG"/>
          <value index="5" field="ADR_ZIP"/>
          <value index="6" field="ADR_COUNTRY"/>
          <position field="LABEL" repeat="array" increment="1" minshow="0" 
overwriteempty="no"/>
          <parameter name="TYPE" default="yes" positional="no" show="yes">
            <value field="ADR_STREET_FLAGS" conversion="multimix" combine=",">
              <enum name="HOME"     value="B0"/>
              <enum name="WORK"     value="B1"/>
              <enum mode="ignore"   value="B2"/> <!-- OTHER -->

              <!-- enum mode="prefix" name="X-CustomLabel-" value="1.L"/ -->
              <!-- enum mode="prefix" name="X-Synthesis-Ref" value="2.L"/ -->
            </value>
          </parameter>
          <parameter name="X-ABLabel" rule="HAVE-ABLABEL-PARAMETER">
            <value field="LABEL"/>
          </parameter>
        </property>

The ADR_* fields are consecutive. LABEL is somewhere else entirely
(almost at the end of my field list).

Here's what I see when at the dostore = false line:

(gdb) p *aPropP
$20 = {<sysync::noncopyable> = {<No data fields>}, next = 0x19d5c80, propname = 
"ADR", nameExts = 0x19d5990, 
  groupFieldID = 90, numValues = 7, convdefs = 0x19d58d8, unprocessed = false, 
valuelist = false, 
  expandlist = false, valuesep = 59 ';', altvaluesep = 0 '\000', allowFoldAtSep 
= false, parameterDefs = 0x19d59c0, 
  mandatory = false, showInCTCap = true, canFilter = false, suppressEmpty = 
false, delayedProcessing = 0, 
  modeDependency = sysync::numMimeModes, nextNameExt = 0, propGroup = 66, 
dependsOnRemoterule = false, 
  ruleDependency = 0x0, dependencyRuleName = ""}
(gdb) p e
$21 = 4
(gdb) p aPropP->convdefs[0]
$22 = {<sysync::noncopyable> = {<No data fields>}, fieldid = 75, enumdefs = 
0x0, convmode = 0, 
  combineSep = 0 '\000'}
(gdb) p aPropP->convdefs[1]
$23 = {<sysync::noncopyable> = {<No data fields>}, fieldid = 71, enumdefs = 
0x0, convmode = 0, 
  combineSep = 0 '\000'}
(gdb) p aPropP->convdefs[2]
$24 = {<sysync::noncopyable> = {<No data fields>}, fieldid = 70, enumdefs = 
0x0, convmode = 0, 
  combineSep = 0 '\000'}
(gdb) p aPropP->convdefs[3]
$25 = {<sysync::noncopyable> = {<No data fields>}, fieldid = 76, enumdefs = 
0x0, convmode = 0, 
  combineSep = 0 '\000'}
(gdb) p aPropP->convdefs[4]
$26 = {<sysync::noncopyable> = {<No data fields>}, fieldid = 77, enumdefs = 
0x0, convmode = 0, 
  combineSep = 0 '\000'}
(gdb) p baseoffset
$27 = 16
(gdb) p e_fid
$28 = 93
(gdb) p *propnameextP
$29 = {<sysync::noncopyable> = {<No data fields>}, next = 0x0, musthave_ids = 
0, forbidden_ids = 0, 
  addtlSend_ids = 0, fieldidoffs = 16, maxRepeat = 32767, repeatInc = 1, 
minShow = 0, overwriteEmpty = false, 
  readOnly = false, repeatID = 27}

This last fieldid = 77  corresponds to ADR_REG, but because we add
baseoffset = 16 (from propnameextP->fieldidoffs) we end up with an
invalid index.

Does the code perhaps expect that the <position field> is one of the
fields that the propertie's values get stored in? It seems so.

And does the code check for existence of values in the fields for
parameters at all? It doesn't seem so, which foils my current plan to
reuse the LABEL field for multiple different properties.

-- 
Best Regards, Patrick Ohly

The content of this message is my personal opinion only and although
I am an employee of Intel, the statements I make here in no way
represent Intel's position on the issue, nor am I authorized to speak
on behalf of Intel on this matter.


Attachment: 01vcard-profile.xml
Description: XML document

Attachment: 00vcard-fieldlist.xml
Description: XML document

- SYNCLVL              : n/a          maxoccur=0, maxsize=0 (unlimited)
- REV                  : AVAILABLE    maxoccur=1, maxsize=0 (unlimited)
- UID                  : n/a          maxoccur=0, maxsize=0 (unlimited)
- N_LAST               : AVAILABLE    maxoccur=1, maxsize=0 (unlimited)
- N_FIRST              : AVAILABLE    maxoccur=1, maxsize=0 (unlimited)
- N_MIDDLE             : AVAILABLE    maxoccur=1, maxsize=0 (unlimited)
- N_PREFIX             : AVAILABLE    maxoccur=1, maxsize=0 (unlimited)
- N_SUFFIX             : AVAILABLE    maxoccur=1, maxsize=0 (unlimited)
- NICKNAME             : AVAILABLE    maxoccur=1, maxsize=0 (unlimited)
- TITLE                : AVAILABLE    maxoccur=1, maxsize=0 (unlimited)
- FN                   : AVAILABLE    maxoccur=1, maxsize=0 (unlimited)
- FILE_AS              : AVAILABLE    maxoccur=1, maxsize=0 (unlimited)
- GENDER               : AVAILABLE    maxoccur=1, maxsize=0 (unlimited)
- CATEGORIES           : AVAILABLE    maxoccur=0, maxsize=0 (unlimited)
- ORG_NAME             : AVAILABLE    maxoccur=1, maxsize=0 (unlimited)
- ORG_DIVISION         : AVAILABLE    maxoccur=1, maxsize=0 (unlimited)
- ORG_OFFICE           : AVAILABLE    maxoccur=1, maxsize=0 (unlimited)
- ORG_TEAM             : AVAILABLE    maxoccur=1, maxsize=0 (unlimited)
- ROLE                 : AVAILABLE    maxoccur=1, maxsize=0 (unlimited)
- BDAY                 : AVAILABLE    maxoccur=1, maxsize=0 (unlimited)
- ANNIVERSARY          : AVAILABLE    maxoccur=1, maxsize=0 (unlimited)
- XDATE                : n/a          maxoccur=0, maxsize=0 (unlimited)
- TEL                  : n/a          maxoccur=0, maxsize=0 (unlimited)
- TEL_FLAGS            : n/a          maxoccur=0, maxsize=0 (unlimited)
- TEL_LABEL            : n/a          maxoccur=0, maxsize=0 (unlimited)
- TEL_ID               : n/a          maxoccur=0, maxsize=0 (unlimited)
- TEL_SLOT             : n/a          maxoccur=0, maxsize=0 (unlimited)
- EMAIL                : n/a          maxoccur=0, maxsize=0 (unlimited)
- EMAIL_FLAGS          : n/a          maxoccur=0, maxsize=0 (unlimited)
- EMAIL_LABEL          : n/a          maxoccur=0, maxsize=0 (unlimited)
- EMAIL_ID             : n/a          maxoccur=0, maxsize=0 (unlimited)
- EMAIL_SLOT           : n/a          maxoccur=0, maxsize=0 (unlimited)
- WEB                  : n/a          maxoccur=0, maxsize=0 (unlimited)
- WEB_FLAGS            : n/a          maxoccur=0, maxsize=0 (unlimited)
- WEB_LABEL            : n/a          maxoccur=0, maxsize=0 (unlimited)
- WEB_ID               : n/a          maxoccur=0, maxsize=0 (unlimited)
- CALURI               : AVAILABLE    maxoccur=1, maxsize=0 (unlimited)
- FBURL                : AVAILABLE    maxoccur=1, maxsize=0 (unlimited)
- BLOGURL              : AVAILABLE    maxoccur=1, maxsize=0 (unlimited)
- VIDEOURL             : AVAILABLE    maxoccur=1, maxsize=0 (unlimited)
- RELATEDNAMES         : n/a          maxoccur=0, maxsize=0 (unlimited)
- MANAGER              : AVAILABLE    maxoccur=1, maxsize=0 (unlimited)
- ASSISTANT            : AVAILABLE    maxoccur=1, maxsize=0 (unlimited)
- SPOUSE               : AVAILABLE    maxoccur=1, maxsize=0 (unlimited)
- WANTS_HTML           : AVAILABLE    maxoccur=1, maxsize=0 (unlimited)
- IMPP                 : n/a          maxoccur=0, maxsize=0 (unlimited)
- IMPP_SERVICE         : n/a          maxoccur=0, maxsize=0 (unlimited)
- IMPP_SLOT            : n/a          maxoccur=0, maxsize=0 (unlimited)
- AIM_HANDLE           : AVAILABLE    maxoccur=1, maxsize=0 (unlimited)
- AIM_SLOT             : AVAILABLE    maxoccur=0, maxsize=0 (unlimited)
- GADUGADU_HANDLE      : AVAILABLE    maxoccur=1, maxsize=0 (unlimited)
- GADUGADU_SLOT        : AVAILABLE    maxoccur=0, maxsize=0 (unlimited)
- GROUPWISE_HANDLE     : AVAILABLE    maxoccur=1, maxsize=0 (unlimited)
- GROUPWISE_SLOT       : AVAILABLE    maxoccur=0, maxsize=0 (unlimited)
- ICQ_HANDLE           : AVAILABLE    maxoccur=1, maxsize=0 (unlimited)
- ICQ_SLOT             : AVAILABLE    maxoccur=0, maxsize=0 (unlimited)
- JABBER_HANDLE        : AVAILABLE    maxoccur=1, maxsize=0 (unlimited)
- JABBER_SLOT          : AVAILABLE    maxoccur=0, maxsize=0 (unlimited)
- MSN_HANDLE           : AVAILABLE    maxoccur=1, maxsize=0 (unlimited)
- MSN_SLOT             : AVAILABLE    maxoccur=0, maxsize=0 (unlimited)
- YAHOO_HANDLE         : AVAILABLE    maxoccur=1, maxsize=0 (unlimited)
- YAHOO_SLOT           : AVAILABLE    maxoccur=0, maxsize=0 (unlimited)
- SKYPE_HANDLE         : AVAILABLE    maxoccur=1, maxsize=0 (unlimited)
- SKYPE_SLOT           : AVAILABLE    maxoccur=0, maxsize=0 (unlimited)
- SIP_HANDLE           : AVAILABLE    maxoccur=0, maxsize=0 (unlimited)
- SIP_SLOT             : AVAILABLE    maxoccur=0, maxsize=0 (unlimited)
- IM_ADDRESS           : AVAILABLE    maxoccur=1, maxsize=0 (unlimited)
- MEANWHILE_HANDLE     : AVAILABLE    maxoccur=0, maxsize=0 (unlimited)
- IRC_HANDLE           : AVAILABLE    maxoccur=0, maxsize=0 (unlimited)
- SMS_HANDLE           : AVAILABLE    maxoccur=0, maxsize=0 (unlimited)
- ADR_STREET           : n/a          maxoccur=0, maxsize=0 (unlimited)
- ADR_ADDTL            : n/a          maxoccur=0, maxsize=0 (unlimited)
- ADR_STREET_FLAGS     : n/a          maxoccur=0, maxsize=0 (unlimited)
- ADR_STREET_LABEL     : n/a          maxoccur=0, maxsize=0 (unlimited)
- ADR_STREET_ID        : n/a          maxoccur=0, maxsize=0 (unlimited)
- ADR_POBOX            : n/a          maxoccur=0, maxsize=0 (unlimited)
- ADR_CITY             : n/a          maxoccur=0, maxsize=0 (unlimited)
- ADR_REG              : n/a          maxoccur=0, maxsize=0 (unlimited)
- ADR_ZIP              : n/a          maxoccur=0, maxsize=0 (unlimited)
- ADR_COUNTRY          : n/a          maxoccur=0, maxsize=0 (unlimited)
- NOTE                 : AVAILABLE    maxoccur=1, maxsize=0 (unlimited)
- PHOTO                : AVAILABLE    maxoccur=1, maxsize=0 (unlimited)
- PHOTO_TYPE           : AVAILABLE    maxoccur=0, maxsize=0 (unlimited)
- PHOTO_VALUE          : AVAILABLE    maxoccur=0, maxsize=0 (unlimited)
- GEO_LAT              : AVAILABLE    maxoccur=1, maxsize=0 (unlimited)
- GEO_LONG             : AVAILABLE    maxoccur=1, maxsize=0 (unlimited)
- CRYPTOENCRYPTPREF    : AVAILABLE    maxoccur=1, maxsize=0 (unlimited)
- CRYPTOPROTOPREF      : AVAILABLE    maxoccur=1, maxsize=0 (unlimited)
- CRYPTOSIGNPREF       : AVAILABLE    maxoccur=1, maxsize=0 (unlimited)
- OPENPGPFP            : AVAILABLE    maxoccur=1, maxsize=0 (unlimited)
- GROUP_TAG            : n/a          maxoccur=0, maxsize=0 (unlimited)
- LABEL                : AVAILABLE    maxoccur=0, maxsize=0 (unlimited)
- XPROPS               : AVAILABLE    maxoccur=0, maxsize=0 (unlimited)
_______________________________________________
os-libsynthesis mailing list
os-libsynthesis@synthesis.ch
http://lists.synthesis.ch/mailman/listinfo/os-libsynthesis

Reply via email to