BLD: fix build warnings
xref #25995, #17936

AFAICT these warnings are caused by cython casting `len(some_ndarray)` to `int` or `Py_ssize_t` but casting `len(some_memoryview)` to `size_t`.  Easiest fix is to declare the affected len variables as `size_t` since we know they'll never be negative.