mirror of
https://github.com/leozide/leocad.git
synced 2026-07-28 04:07:11 +00:00
Replaced strcpy with a safe function.
This commit is contained in:
+2
-3
@@ -4,8 +4,7 @@
|
||||
#include "lc_library.h"
|
||||
#include "lc_model.h"
|
||||
#include "pieceinf.h"
|
||||
#include "lc_partselectionwidget.h"
|
||||
#include "lc_mainwindow.h"
|
||||
#include "lc_string.h"
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#include <windows.h>
|
||||
@@ -238,7 +237,7 @@ std::vector<bool> lcPieceIdStringModel::GetFilteredRows(const QString& FilterTex
|
||||
{
|
||||
const PieceInfo* Info = mSortedPieces[PieceInfoIndex];
|
||||
|
||||
FilteredRows[PieceInfoIndex] = (strcasestr(Info->m_strDescription, Text.c_str()) || strcasestr(Info->mFileName, Text.c_str()));
|
||||
FilteredRows[PieceInfoIndex] = (lcstrcasestr(Info->m_strDescription, Text.c_str()) || lcstrcasestr(Info->mFileName, Text.c_str()));
|
||||
}
|
||||
|
||||
return FilteredRows;
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
#include "lc_global.h"
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
|
||||
char* strcasestr(const char* s, const char* find)
|
||||
{
|
||||
char c, sc;
|
||||
|
||||
if ((c = *find++) != 0)
|
||||
{
|
||||
c = tolower((unsigned char)c);
|
||||
const int len = (int)strlen(find);
|
||||
do
|
||||
{
|
||||
do
|
||||
{
|
||||
if ((sc = *s++) == 0)
|
||||
return (nullptr);
|
||||
} while ((char)tolower((unsigned char)sc) != c);
|
||||
} while (qstrnicmp(s, find, len) != 0);
|
||||
s--;
|
||||
}
|
||||
return ((char *)s);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
char* strupr(char* string)
|
||||
{
|
||||
for (char* c = string; *c; c++)
|
||||
*c = toupper(*c);
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user