diff --git a/include/osgDB/FileNameUtils b/include/osgDB/FileNameUtils index ed1e552b4..da9b11424 100644 --- a/include/osgDB/FileNameUtils +++ b/include/osgDB/FileNameUtils @@ -18,6 +18,7 @@ #include #include +#include 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 diff --git a/src/osgDB/FileNameUtils.cpp b/src/osgDB/FileNameUtils.cpp index f67e527be..c0410ade1 100644 --- a/src/osgDB/FileNameUtils.cpp +++ b/src/osgDB/FileNameUtils.cpp @@ -487,6 +487,14 @@ std::string osgDB::getPathRelative(const std::string& from, const std::string& t 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(["<