res = it->second;
} else {
// try matching with the available mappings
- res = std::string(in);
+ res = root.empty() ? std::string(in) : root + "/" + std::string(in);
int num = dmap.size();
for(int i=0; i<num; i++) {
if(buf) {
int n = std::min(bsz - 1, (int)res.length());
memcpy(buf, res.c_str(), n);
- buf[bsz - 1] = 0; // make sure it's null-terminated even if it got truncated
+ buf[n] = 0; // make sure it's null-terminated even if it got truncated
}
return res.length() + 1;
}