[vlc-devel] [PATCH] Support the Metacube protocol when streaming over HTTP.

Steinar H. Gunderson sgunderson at bigfoot.com
Tue Feb 18 10:31:46 CET 2014


On Tue, Feb 18, 2014 at 10:01:03AM +0100, Denis Charmet wrote:
>> +uint16_t metacube2_compute_crc(const struct metacube2_block_header *hdr)
>> +{
>> +    static const int data_len = sizeof(hdr->size) + sizeof(hdr->flags);
> why static?

Because it's a compile-time constant? It's a relatively common idiom,
especially in C++ where this is allowed:

class Foo {
	static const int k = 42;
};

and this is not:

class Foo {
	const int k = 42;
};

>> +    const uint8_t *data = (uint8_t *)&hdr->size;
>> +    uint16_t crc = METACUBE2_CRC_START;
>> +    int i, j;
> use C99, you can declare your variable inside your for.

Note that this code is cut-and-pasted from upstream code. But I can change it
if you're happy with it diverging (I already changed the indentation).

/* Steinar */
-- 
Homepage: http://www.sesse.net/



More information about the vlc-devel mailing list