@@ -285,7 +285,6 @@ _mstl3_addmsr_impl (MS3TraceList *mstl, const MS3Record *msr, MS3RecordPtr **ppr
285285 int8_t splitversion , int8_t autoheal , uint32_t flags ,
286286 const MS3Tolerance * tolerance )
287287{
288- (void )flags ; /* Unused */
289288 MS3TraceID * id = NULL ;
290289 MS3TraceID * previd [MSTRACEID_SKIPLIST_HEIGHT ] = {NULL };
291290
@@ -320,8 +319,12 @@ _mstl3_addmsr_impl (MS3TraceList *mstl, const MS3Record *msr, MS3RecordPtr **ppr
320319 return NULL ;
321320 }
322321
322+ /* If splitversion is true and MSF_SPLITISVERSION is set in flags, use splitversion
323+ * as the version, otherwise use msr->pubversion */
324+ int8_t pubversion = (flags & MSF_SPLITISVERSION ) ? splitversion : msr -> pubversion ;
325+
323326 /* Search for matching trace ID */
324- id = mstl3_findID (mstl , msr -> sid , (splitversion ) ? msr -> pubversion : 0 , previd );
327+ id = mstl3_findID (mstl , msr -> sid , (splitversion ) ? pubversion : 0 , previd );
325328
326329 /* If no matching ID was found create new MS3TraceID and MS3TraceSeg entries */
327330 if (!id )
@@ -335,7 +338,7 @@ _mstl3_addmsr_impl (MS3TraceList *mstl, const MS3Record *msr, MS3RecordPtr **ppr
335338
336339 /* Populate MS3TraceID */
337340 memcpy (id -> sid , msr -> sid , sizeof (id -> sid ));
338- id -> pubversion = msr -> pubversion ;
341+ id -> pubversion = pubversion ;
339342 id -> earliest = msr -> starttime ;
340343 id -> latest = endtime ;
341344 id -> numsegments = 1 ;
@@ -627,8 +630,8 @@ _mstl3_addmsr_impl (MS3TraceList *mstl, const MS3Record *msr, MS3RecordPtr **ppr
627630 } /* End of searching segment list */
628631
629632 /* Track largest publication version */
630- if (msr -> pubversion > id -> pubversion )
631- id -> pubversion = msr -> pubversion ;
633+ if (pubversion > id -> pubversion )
634+ id -> pubversion = pubversion ;
632635
633636 /* Track earliest and latest times */
634637 if (msr -> starttime < id -> earliest )
@@ -707,7 +710,7 @@ _mstl3_addmsr_impl (MS3TraceList *mstl, const MS3Record *msr, MS3RecordPtr **ppr
707710 }
708711
709712 return seg ;
710- } /* End of mstl3_addmsr_recordptr () */
713+ } /* End of _mstl3_addmsr_impl () */
711714
712715/** ************************************************************************
713716 * @brief Add data coverage from an ::MS3Record to a ::MS3TraceList
@@ -745,12 +748,18 @@ _mstl3_addmsr_impl (MS3TraceList *mstl, const MS3Record *msr, MS3RecordPtr **ppr
745748 * @param[in] msr ::MS3Record containing the data to add to list
746749 * @param[in] splitversion Flag to control splitting of version/quality
747750 * @param[in] autoheal Flag to control automatic merging of segments
748- * @param[in] flags Flags to control optional functionality (unused)
751+ * @param[in] flags Flags to control optional functionality
752+ * @parblock
753+ * - \c ::MSF_PPUPDATETIME : Store update time (as nstime_t) at ::MS3TraceSeg.prvtptr
754+ * - \c ::MSF_SPLITISVERSION : Use \a splitversion as the version, otherwise use msr->pubversion
755+ * @endparblock
749756 * @param[in] tolerance Tolerance function pointers as ::MS3Tolerance
750757 *
751758 * @returns a pointer to the ::MS3TraceSeg updated or NULL on error.
752759 *
753- * \sa mstl3_addmsr_recordptr() \sa mstl3_readbuffer() \sa ms3_readtracelist()
760+ * \sa mstl3_addmsr_recordptr()
761+ * \sa mstl3_readbuffer()
762+ * \sa ms3_readtracelist()
754763 *
755764 * \ref MessageOnError - this function logs a message on error
756765 ***************************************************************************/
0 commit comments