You can just do:

num_depths = last - avail_depths;

C++'s pointer subtraction semantics will do the right hing.

15-bit depth seems like a very weird thing to support and I wouldn't be surprised if SS simply doesn't work with it, but that XListDepths() doesn't return it on other platforms. I think we can just remove it from the list on all platforms (i.e. without the ifdef).

Also, might as well do it before the std::sort() call above.