Added osgDB::stringcopy and stringcopyfixedsize
This commit is contained in:
parent
bc6a8948cc
commit
6d7d58fa12
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
namespace osgDB {
|
namespace osgDB {
|
||||||
|
|
||||||
@ -131,6 +132,11 @@ struct FileNameComparator
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
void stringcopy(char* dest, const char* src, size_t length);
|
||||||
|
|
||||||
|
#define stringcopyfixedsize(DEST, SRC) stringcopy(DEST, SRC, sizeof(DEST));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -487,6 +487,14 @@ std::string osgDB::getPathRelative(const std::string& from, const std::string& t
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void osgDB::stringcopy(char* dest, const char* src, size_t length)
|
||||||
|
{
|
||||||
|
strncpy(dest, src, length-1);
|
||||||
|
dest[length-1] = '\0';
|
||||||
|
OSG_NOTICE<<"osgDB::stringcopy(["<<dest<<"], src=["<<src<<"], "<<length<<")"<<std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//using namespace osgDB;
|
//using namespace osgDB;
|
||||||
//std::string testA = getPathRelative("C:\\a\\b", "C:\\a/b/d/f"); // d/f
|
//std::string testA = getPathRelative("C:\\a\\b", "C:\\a/b/d/f"); // d/f
|
||||||
//std::string testB = getPathRelative("C:\\a\\d", "C:\\a/b/d/f"); // ../b/d/f
|
//std::string testB = getPathRelative("C:\\a\\d", "C:\\a/b/d/f"); // ../b/d/f
|
||||||
|
Loading…
Reference in New Issue
Block a user