X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;ds=sidebyside;f=radiant%2Ffiletypes.cpp;h=9da5537f3131c5273a4221e13f97334ace01c04c;hb=550b552a0b1912ac0ef62ffc611e23860749df50;hp=87cb205c15b4afd6fc7519b3458b08d380f717d7;hpb=3c73487420fde8d4a3b5360d8b99e48132517900;p=xonotic%2Fnetradiant.git diff --git a/radiant/filetypes.cpp b/radiant/filetypes.cpp index 87cb205c..9da5537f 100644 --- a/radiant/filetypes.cpp +++ b/radiant/filetypes.cpp @@ -29,13 +29,14 @@ #include "os/path.h" #include #include +#include class RadiantFileTypeRegistry : public IFileTypeRegistry { struct filetype_copy_t { filetype_copy_t( const char* moduleName, const filetype_t other ) - : m_moduleName( moduleName ), m_name( other.name ), m_pattern( other.pattern ), m_can_load( other.can_load ), m_can_import( other.can_import ), m_can_save( other.can_save ){ + : m_can_load( other.can_load ), m_can_import( other.can_import ), m_can_save( other.can_save ), m_moduleName( moduleName ), m_name( other.name ), m_pattern( other.pattern ) { } const char* getModuleName() const { return m_moduleName.c_str(); @@ -87,15 +88,15 @@ IFileTypeRegistry* GetFileTypeRegistry(){ const char* findModuleName( IFileTypeRegistry* registry, const char* moduleType, const char* extension ){ class SearchFileTypeList : public IFileTypeList { - char m_pattern[128]; + u::BufferVal<128> m_pattern; const char* m_moduleName; public: SearchFileTypeList( const char* ext ) : m_moduleName( "" ){ - m_pattern[0] = '*'; - m_pattern[1] = '.'; - strncpy( m_pattern + 2, ext, 125 ); - m_pattern[127] = '\0'; + m_pattern.mut()[0] = '*'; + m_pattern.mut()[1] = '.'; + m_pattern.copy(ext, 2); + m_pattern.terminate(); } void addType( const char* moduleName, filetype_t type ){ if ( extension_equal( m_pattern, type.pattern ) ) {