Fix formatting
parent
39664d608d
commit
97b8e41997
|
@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
|
|||
|
||||
Copyright (c) 2006-2021, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
@ -40,20 +39,19 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/** @file RemoveComments.cpp
|
||||
/**
|
||||
* @file RemoveComments.cpp
|
||||
* @brief Defines the CommentRemover utility class
|
||||
*/
|
||||
|
||||
#include <assimp/RemoveComments.h>
|
||||
#include <assimp/ParsingUtils.h>
|
||||
|
||||
namespace Assimp {
|
||||
namespace Assimp {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Remove line comments from a file
|
||||
void CommentRemover::RemoveLineComments(const char* szComment,
|
||||
char* szBuffer, char chReplacement /* = ' ' */)
|
||||
{
|
||||
void CommentRemover::RemoveLineComments(const char* szComment, char* szBuffer, char chReplacement /* = ' ' */) {
|
||||
// validate parameters
|
||||
ai_assert(nullptr != szComment);
|
||||
ai_assert(nullptr != szBuffer);
|
||||
|
@ -75,8 +73,9 @@ void CommentRemover::RemoveLineComments(const char* szComment,
|
|||
}
|
||||
|
||||
if (!strncmp(szBuffer + i,szComment,len)) {
|
||||
while (i < lenBuffer && !IsLineEnd(szBuffer[i]))
|
||||
while (i < lenBuffer && !IsLineEnd(szBuffer[i])) {
|
||||
szBuffer[i++] = chReplacement;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -84,9 +83,8 @@ void CommentRemover::RemoveLineComments(const char* szComment,
|
|||
// ------------------------------------------------------------------------------------------------
|
||||
// Remove multi-line comments from a file
|
||||
void CommentRemover::RemoveMultiLineComments(const char* szCommentStart,
|
||||
const char* szCommentEnd,char* szBuffer,
|
||||
char chReplacement)
|
||||
{
|
||||
const char* szCommentEnd,char* szBuffer,
|
||||
char chReplacement) {
|
||||
// validate parameters
|
||||
ai_assert(nullptr != szCommentStart);
|
||||
ai_assert(nullptr != szCommentEnd);
|
||||
|
@ -99,18 +97,20 @@ void CommentRemover::RemoveMultiLineComments(const char* szCommentStart,
|
|||
|
||||
while (*szBuffer) {
|
||||
// skip over quotes
|
||||
if (*szBuffer == '\"' || *szBuffer == '\'')
|
||||
if (*szBuffer == '\"' || *szBuffer == '\'') {
|
||||
while (*szBuffer++ && *szBuffer != '\"' && *szBuffer != '\'');
|
||||
}
|
||||
|
||||
if (!strncmp(szBuffer,szCommentStart,len2)) {
|
||||
while (*szBuffer) {
|
||||
if (!::strncmp(szBuffer,szCommentEnd,len)) {
|
||||
for (unsigned int i = 0; i < len;++i)
|
||||
for (unsigned int i = 0; i < len;++i) {
|
||||
*szBuffer++ = chReplacement;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
*szBuffer++ = chReplacement;
|
||||
*szBuffer++ = chReplacement;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue