Page 1 of 1

[bug] signed integer limitation on playlist length

Posted: July 2nd, 2014, 1:00 am
by Redsandro
As discussed here I figured that the playlist length is limited to 16384 items.

Now either there's a good reason and you can all laugh at me for bringing this up, or this is the limitation of a 16 bit signed integer. Change this to an unsigned integer and the limit doubles to 32768 entries.

Code: Select all

$ mpc listall | mpc add
error: playlist is at the max size
$ mpc playlist | wc -l
16384

Re: [bug] signed integer limitation on playlist length

Posted: July 2nd, 2014, 12:32 pm
by Qball
Did you actually check the CODE? or just assumed it was a signed/unsigned issue?

If you check the available options for mpd configuration file you will see this has nothing todo with signed integer limitation but it is a configuration option.

Re: [bug] signed integer limitation on playlist length

Posted: July 2nd, 2014, 1:16 pm
by Redsandro
I don't know C++. I ran into the limitation. I recognize the number and the problem I mention from working with bitstreams as a Node developer.
So I didn't "assume", I took an educated guess and I thought I'd improve this nice Deamon by kindly letting the MPD people know.

I didn't think it was a configurable amount, because out of 32768 possibilities it's the only one relevant to this signed/unsigned scenario. In my lousy opinion, it's just silly to use 16384 as a configured limit. If it's not a software limitation, any human readable value would be better (10000, 20000, 30000). if it was any other number, I would have googled first. :ugeek:

Anyway sorry for wasting your rime Qball.

Re: [bug] signed integer limitation on playlist length

Posted: July 2nd, 2014, 1:31 pm
by Qball
No problem. Making it a nice round number might be better.

Re: [bug] signed integer limitation on playlist length

Posted: July 4th, 2014, 7:58 am
by max
Redsandro wrote:this is the limitation of a 16 bit signed integer. Change this to an unsigned integer and the limit doubles to 32768 entries.
Funny. A signed 16 bit integer's upper bound is 32767, not 16384. Unsigned would be 65535, not 32768.

Re: [bug] signed integer limitation on playlist length

Posted: July 4th, 2014, 3:24 pm
by Redsandro
You are right. Apparently, I'm a bit stupid and I missed one bit.
Thanks for correcting me and letting me know. I appreciate that.

However, what's also stupid is using "one of those" binary maximums for an artificial limit. Why do people do that?

Re: [bug] signed integer limitation on playlist length

Posted: July 4th, 2014, 4:30 pm
by Qball
I have _no_ idea why you keep complaining about it and calling it stupid.
This limit has been there for at least 11 years and nobody found this 'arbitrary' number a problem before.
For developers this might have been a very logical number to pick.
Anyway I am closing this topic, feedback is appreciated, this last remark isn't.

Re: [bug] signed integer limitation on playlist length

Posted: July 6th, 2014, 5:33 am
by max
Redsandro wrote:However, what's also stupid is using "one of those" binary maximums for an artificial limit. Why do people do that?
I feel offended that you call me stupid. Please go away.