projects
/
laserbrain_demo
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
metascene initial implementation
[laserbrain_demo]
/
src
/
datamap.cc
diff --git
a/src/datamap.cc
b/src/datamap.cc
index
19aaf44
..
ee7de51
100644
(file)
--- a/
src/datamap.cc
+++ b/
src/datamap.cc
@@
-112,7
+112,7
@@
int datamap_lookup(const char *in, char *buf, int bsz)
res = it->second;
} else {
// try matching with the available mappings
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++) {
int num = dmap.size();
for(int i=0; i<num; i++) {
@@
-130,7
+130,7
@@
int datamap_lookup(const char *in, char *buf, int bsz)
if(buf) {
int n = std::min(bsz - 1, (int)res.length());
memcpy(buf, res.c_str(), n);
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;
}
}
return res.length() + 1;
}