Adjust warn
parent
8b13223314
commit
813d0aecdd
|
@ -545,7 +545,7 @@ aiMesh *SubMesh::ConvertToAssimpMesh(Mesh *parent) {
|
|||
dest->mNumUVComponents[0] = static_cast<unsigned int>(uv1Element->ComponentCount());
|
||||
dest->mTextureCoords[0] = new aiVector3D[dest->mNumVertices];
|
||||
} else {
|
||||
ASSIMP_LOG_WARN(Formatter::format() << "Ogre imported UV0 type " << uv1Element->TypeToString() << " is not compatible with Assimp. Ignoring UV.");
|
||||
ASSIMP_LOG_WARN_F("Ogre imported UV0 type ", uv1Element->TypeToString(), " is not compatible with Assimp. Ignoring UV.");
|
||||
uv1 = 0;
|
||||
}
|
||||
}
|
||||
|
@ -554,7 +554,7 @@ aiMesh *SubMesh::ConvertToAssimpMesh(Mesh *parent) {
|
|||
dest->mNumUVComponents[1] = static_cast<unsigned int>(uv2Element->ComponentCount());
|
||||
dest->mTextureCoords[1] = new aiVector3D[dest->mNumVertices];
|
||||
} else {
|
||||
ASSIMP_LOG_WARN(Formatter::format() << "Ogre imported UV0 type " << uv2Element->TypeToString() << " is not compatible with Assimp. Ignoring UV.");
|
||||
ASSIMP_LOG_WARN_F("Ogre imported UV0 type ", uv2Element->TypeToString(), " is not compatible with Assimp. Ignoring UV.");
|
||||
uv2 = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -174,7 +174,7 @@ static void UnknownChunk(StreamReaderLE * /*stream*/, const SIBChunk &chunk) {
|
|||
static_cast<char>(chunk.Tag & 0xff)
|
||||
};
|
||||
|
||||
ASSIMP_LOG_WARN((Formatter::format(), "SIB: Skipping unknown '", ai_str_toprintable(temp, 4), "' chunk."));
|
||||
ASSIMP_LOG_WARN_F("SIB: Skipping unknown '", ai_str_toprintable(temp, 4), "' chunk.");
|
||||
}
|
||||
|
||||
// Reads a UTF-16LE string and returns it at UTF-8.
|
||||
|
|
|
@ -197,13 +197,14 @@ void Logger::info(const char *message) {
|
|||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
void Logger::warn(const char *message) {
|
||||
|
||||
void Logger::warnInternal(Assimp::Formatter::format f) {
|
||||
std::string message = f;
|
||||
// TODO: Should limit sizes in the formatter.
|
||||
// SECURITY FIX: see above
|
||||
if (strlen(message) > MAX_LOG_MESSAGE_LENGTH) {
|
||||
if (message.length() > MAX_LOG_MESSAGE_LENGTH) {
|
||||
return;
|
||||
}
|
||||
return OnWarn(message);
|
||||
return OnWarn(message.c_str());
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
|
|
|
@ -119,8 +119,10 @@ public:
|
|||
// ----------------------------------------------------------------------
|
||||
/** @brief Writes a warning message
|
||||
* @param message Warn message*/
|
||||
void warn(const char* message);
|
||||
void warn(const std::string &message);
|
||||
template<typename... T>
|
||||
void warn(T&&... args) {
|
||||
warnInternal(Assimp::Formatter::format(), std::forward<T>(args)...);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
/** @brief Writes an error message
|
||||
|
@ -225,6 +227,14 @@ protected:
|
|||
*/
|
||||
virtual void OnError(const char* message) = 0;
|
||||
|
||||
protected:
|
||||
void warnInternal(Assimp::Formatter::format f);
|
||||
|
||||
template<typename... T, typename U>
|
||||
void warnInternal(Assimp::Formatter::format f, U&& u, T&&... args) {
|
||||
warnInternal(std::move(f << std::forward<U>(u)), std::forward<T>(args)...);
|
||||
}
|
||||
|
||||
protected:
|
||||
LogSeverity m_Severity;
|
||||
};
|
||||
|
@ -283,12 +293,6 @@ void Logger::error(const std::string &message) {
|
|||
return error(message.c_str());
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
inline
|
||||
void Logger::warn(const std::string &message) {
|
||||
return warn(message.c_str());
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
inline
|
||||
void Logger::info(const std::string &message) {
|
||||
|
@ -299,7 +303,7 @@ void Logger::info(const std::string &message) {
|
|||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#define ASSIMP_LOG_WARN_F(string, ...) \
|
||||
Assimp::DefaultLogger::get()->warn((Assimp::Formatter::format(string), __VA_ARGS__))
|
||||
Assimp::DefaultLogger::get()->warn((string, __VA_ARGS__))
|
||||
|
||||
#define ASSIMP_LOG_ERROR_F(string, ...) \
|
||||
Assimp::DefaultLogger::get()->error((Assimp::Formatter::format(string), __VA_ARGS__))
|
||||
|
|
Loading…
Reference in New Issue