Use size_t for string offset values for compatibility.
Add "const" to new variables when appropriate.