Hello Patrick, On 02.05.2014, at 13:44, Patrick Ohly <patrick.o...@intel.com> wrote:
> Exactly, that's what I need and get with the patch. > > [...] > >>> That means that the check has to be "LABEL[0] does not exist". >> >> Yes. Fortunately, TItemField differentiates between empty and unassigned; >> the check needs to be for the latter. > > Unassigned is not good enough. If the LABEL array gets extended at the > end (for example, because the third ADR had a X-ABLabel parameter), then > I have unassigned entries at the beginning of the array which must not > be used, because there are already other properties associated with > them. Agreed. > Here's the patch: There's one problem with this - it would break the case where the target of a repeating property is not an array field but multiple plain fields accessed via offset. Plain fields always exist, so you'll always end with dostore==false. I would recommend to play safe and add a new option on TParameterDefinition to enable this check (and possibly other related checks). Maybe a bool called "sharedfield", with a default of "false". If it turns out you need changes in the behaviour for property field checking as well, the same flag could also be added to TPropertyDefinition. Or if you see need for even more flexibility, an option "storagecheck" in TConversionDef to choose between "none", "unassigned", "append", ... might do the trick in a more general way (and leave room for more tricks to come :-). Default for parameters would be "none", for properties "unassigned". For the shared LABEL parameter you would specify "append" to enable the check you suggest in the patch below, but on a parameter-by-parameter basis. > diff --git a/src/sysync/mimedirprofile.cpp b/src/sysync/mimedirprofile.cpp > index 5b0ecc7..3699ad0 100644 > --- a/src/sysync/mimedirprofile.cpp > +++ b/src/sysync/mimedirprofile.cpp > @@ -4154,6 +4154,35 @@ bool TMimeDirProfileHandler::parseProperty( > else > dostore = true; // at least one field exists, we might > store > } > + // - check if fields used for parameters are empty > + const TParameterDefinition *paramP = aPropP->parameterDefs; > + while (paramP) { > + if (mimeModeMatch(paramP->modeDependency) > +#ifndef NO_REMOTE_RULES > + && (!paramP->ruleDependency || > isActiveRule(paramP->ruleDependency)) > +#endif > + ) { > + if (paramP->convdef.fieldid==FID_NOT_SUPPORTED) > + continue; // no field, no need to check it > + sInt16 e_fid = paramP->convdef.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) { > + // base field of one of the main fields does not exist > or leaf field is already in use > + // (unassigned is not good enough, otherwise we might > end up adding information > + // to some other, previously parsed property using the > same array field) > + // -> skip that repetition > + dostore=false; > + break; > + } > + } > + paramP=paramP->next; > + } > // check if we can test more repetitions > if (!dostore) { > if (aRepArray[repid]+1<maxrep || maxrep==REP_ARRAY) { > [...] Best Regards, Lukas
signature.asc
Description: Message signed with OpenPGP using GPGMail
_______________________________________________ os-libsynthesis mailing list os-libsynthesis@synthesis.ch http://lists.synthesis.ch/mailman/listinfo/os-libsynthesis