rem: if ((GetTimeStamps (TimeStamp, time_stamps) + 1) != num_pages)
add: { num_timestamps = GetTimeStamps (TimeStamp, time_stamps) + 1; if (num_timestamps < num_pages)
context: SpliceTrack (UNICODE *TrackName, UNICODE *TrackText, UNICODE *TimeStamp, void (*cb) ()){	unsigned long startTime;	UNICODE **split_text = NULL;	if (TrackText)	{		if (TrackName == 0)		{			if (tct)			{				int slen1, slen2;				UNICODE *oTT;				oTT = (UNICODE *)last_tag->data;				slen1 = wstrlen (oTT);				slen2 = wstrlen (TrackText);				last_tag->data = HRealloc (oTT, slen1 + slen2 + 1);				wstrcpy (&((UNICODE *)last_tag->data)[slen1], TrackText);			}		}		else		{			int num_pages, page_counter;			sint32 time_stamps[50];			split_text = SplitSubPages (TrackText, time_stamps, &num_pages);			if (! split_text)			{				fprintf (stderr, "SpliceTrack(): Failed to parse sutitles\n");				return;			}			if (no_page_break && tct)			{				int slen1, slen2;				UNICODE *oTT;				oTT = (UNICODE *)last_tag->data;				slen1 = wstrlen (oTT);				slen2 = wstrlen (split_text[0]);				last_tag->data = HRealloc (oTT, slen1 + slen2 + 1);				wstrcpy (&((UNICODE *)last_tag->data)[slen1], split_text[0]);				HFree (split_text[0]);			}			else				tct++;			fprintf (stderr, "SpliceTrack(): loading %s\n", TrackName);			if (TimeStamp)				if ((GetTimeStamps (TimeStamp, time_stamps) + 1) != num_pages)					fprintf (stderr, "SpliceTrack(): number of timestamps doesn't match number of pages!\n");			startTime = 0;			for (page_counter = 0; page_counter < num_pages; page_counter++)			{				if (! sound_sample)				{					TFB_SoundDecoder *decoder;					track_mutex = CreateMutex();					sound_sample = (TFB_SoundSample *) HMalloc (sizeof (TFB_SoundSample));					sound_sample->num_buffers = 8;					sound_sample->buffer_tag = HMalloc (sizeof (TFB_SoundTag *) * sound_sample->num_buffers);					sound_sample->buffer = HMalloc (sizeof (uint32) * sound_sample->num_buffers);					TFBSound_GenBuffers (sound_sample->num_buffers, sound_sample->buffer);					decoder = SoundDecoder_Load (TrackName, 4096, startTime, time_stamps[page_counter]);					sound_sample->read_chain_ptr = create_soundchain (decoder, 0.0);					sound_sample->decoder = decoder;					first_chain = last_chain = sound_sample->read_chain_ptr;					sound_sample->length = 0;					sound_sample->play_chain_ptr = 0;				}				else				{					TFB_SoundDecoder *decoder;					decoder =  SoundDecoder_Load (TrackName, 4096, startTime, time_stamps[page_counter]);					last_chain->next = create_soundchain (decoder, sound_sample->length);					last_chain = last_chain->next;				}				startTime += abs (time_stamps[page_counter]);							// fprintf (stderr, "page (%d of %d): %d ts: %d\n",page_counter, num_pages, startTime, time_stamps[page_counter]);				if (last_chain->decoder)				{					//fprintf (stderr, "    decoder: %s, rate %d format %x\n",					//	last_chain->decoder->decoder_info,					//	last_chain->decoder->frequency,					//	last_chain->decoder->format);					sound_sample->length += last_chain->decoder->length;					if (! no_page_break)					{						last_chain->tag.type = MIX_BUFFER_TAG_TEXT;						// last_chain->tag.value = (void *)(((tct - 1) << 8) | page_counter);						last_chain->tag.value = tct - 1;						last_chain->tag.data = (void *)split_text[page_counter];						last_chain->tag.callback = cb;						last_tag = &last_chain->tag;					}					no_page_break = 0;				}				else				{					fprintf (stderr, "SpliceTrack(): couldn't load %s\n", TrackName);					TFBSound_DeleteBuffers (sound_sample->num_buffers, sound_sample->buffer);					destroy_soundchain (first_chain);					first_chain = NULL;					HFree (sound_sample->buffer);					HFree (sound_sample);					sound_sample = NULL;				}			}		}	}}