diff --git a/source/graphics/ObjectEntry.h b/source/graphics/ObjectEntry.h index e09b3ff5e1..654072e418 100644 --- a/source/graphics/ObjectEntry.h +++ b/source/graphics/ObjectEntry.h @@ -8,6 +8,7 @@ struct SPropPoint; #include #include +#include #include "CStr.h" #include "Overlay.h" diff --git a/source/lib/res/file/file.cpp b/source/lib/res/file/file.cpp index 9bd5d5eece..2055857607 100644 --- a/source/lib/res/file/file.cpp +++ b/source/lib/res/file/file.cpp @@ -148,7 +148,7 @@ get_another_entry: // we need the full pathname for this. don't use path_append because // it would unnecessarily call strlen. - CHECK_ERR(stat(pdi->pp.path, &s)); + CHECK_ERR(stat(pdi->pp->path, &s)); #endif // skip "undesirable" entries that POSIX readdir returns: diff --git a/source/lib/res/file/file_util.cpp b/source/lib/res/file/file_util.cpp index 0b745203c9..8b53280fc5 100644 --- a/source/lib/res/file/file_util.cpp +++ b/source/lib/res/file/file_util.cpp @@ -2,6 +2,7 @@ #include "file_internal.h" +#include static bool dirent_less(const DirEnt& d1, const DirEnt& d2) { @@ -303,4 +304,4 @@ void next_numbered_filename(const char* fn_fmt, do snprintf(next_fn, PATH_MAX, fn_fmt, nfi->next_num++); while(exists(next_fn)); -} \ No newline at end of file +} diff --git a/source/lib/sysdep/unix/dir_watch_fam.cpp b/source/lib/sysdep/unix/dir_watch_fam.cpp index 77a3fd2434..ba30f736ca 100644 --- a/source/lib/sysdep/unix/dir_watch_fam.cpp +++ b/source/lib/sysdep/unix/dir_watch_fam.cpp @@ -41,6 +41,7 @@ LibError dir_add_watch(const char* const n_full_path, intptr_t* const watch) { initialized = -1; DISPLAY_ERROR(L"Error initializing FAM; hotloading will be disabled"); + return ERR_FAIL; // NOWARN } } diff --git a/source/simulation/BaseEntityCollection.h b/source/simulation/BaseEntityCollection.h index 69272883b5..b0e66fa15d 100644 --- a/source/simulation/BaseEntityCollection.h +++ b/source/simulation/BaseEntityCollection.h @@ -19,6 +19,7 @@ #define BASEENT_COLLECTION_INCLUDED #include +#include #include "CStr.h" #include "Singleton.h" #include "ObjectEntry.h" diff --git a/source/tools/atlas/GameInterface/Shareable.h b/source/tools/atlas/GameInterface/Shareable.h index 919b788d29..182edd3cbf 100644 --- a/source/tools/atlas/GameInterface/Shareable.h +++ b/source/tools/atlas/GameInterface/Shareable.h @@ -114,12 +114,14 @@ template struct static_assert_test{}; sizeof(REQUIRE_TYPE_TO_BE_SHAREABLE_FAILURE< T, (bool)(Shareable::TypeIsShareable) >)> \ static_assert_typedef_ +// Should be an empty string when cast to either char* or wchar_t* +// (which requires length >= 4, since GCC's sizeof(wchar_t)==4) +static const char empty_str[4] = { 0, 0, 0, 0 }; // Shareable strings: template class Shareable< std::basic_string > { typedef std::basic_string wrapped_type; - const static C null = 0; // for null strings of the right type C* buf; // null-terminated string (perhaps with embedded nulls) size_t length; // size of buf (including null) @@ -171,7 +173,7 @@ public: // without constructing a new std::basic_string then calling c_str on that const C* c_str() const { - return buf ? buf : &null; + return buf ? buf : (C*)empty_str; } }; diff --git a/source/tools/atlas/GameInterface/SharedMemory.h b/source/tools/atlas/GameInterface/SharedMemory.h index 0095b2f1c5..d8dbe9ccee 100644 --- a/source/tools/atlas/GameInterface/SharedMemory.h +++ b/source/tools/atlas/GameInterface/SharedMemory.h @@ -61,4 +61,4 @@ template void ShareableDelete(T* p) #endif -#endif // SHAREDMEMORY_H__ \ No newline at end of file +#endif // SHAREDMEMORY_H__