[mythtv] This piece of code is driving me nuts!

Roger James roger at beardandsandals.co.uk
Sat Nov 19 09:32:36 UTC 2016


Doh!!!! My bad. I misread the std::vector docs. The first resize will 
always be smaller than the second, and the second only initialises the ones 
it adds. I am an idiot!

So a simple  check that all the vector elements are zero could be used to 
check for completeness provided that the table was not segmented. In the 
segmented case case knowledge of segment last section number for each 
segment is also required.


On 19 November 2016 9:15:11 am Ian Campbell <ijc at hellion.org.uk> wrote:

> On Fri, 2016-11-18 at 20:10 +0000, roger wrote:
>>
>> On 18/11/16 19:31, Gary Buhrmaster wrote:
>> > On Fri, Nov 18, 2016 at 5:53 PM, roger <roger at beardandsandals.co.uk
>> > wrote:
>> >> This piece of code in mpgestreamdata.cpp is driving me nuts.
>> > I suspect that you have not looked at the implementation
>> > of a Qt vector resize method, which only sets values for
>> > new elements.  So, from quick look, it sets the initial
>> > (0-31, depending on endz) elements to 0x00, and than
>> > the rest (to 32) to 0xff.
>>
>> Unfortunately, sections_t is a std::vector not Qt QVector.
>
> According to http://en.cppreference.com/w/cpp/container/vector/resize
> std::vector::resize has the same behaviour as Gary describes for Qt
> vector's resize, that is new elements are set to the given value.
>
> Ian.
> _______________________________________________
> mythtv-dev mailing list
> mythtv-dev at mythtv.org
> http://lists.mythtv.org/mailman/listinfo/mythtv-dev
> http://wiki.mythtv.org/Mailing_List_etiquette
> MythTV Forums: https://forum.mythtv.org




More information about the mythtv-dev mailing list