flutter: windows: Fix build error because of disabling warning 4996
This commit is contained in:
parent
77254675e1
commit
9e6e6a6ac7
|
@ -152,6 +152,10 @@
|
|||
#define likely(expr) (__builtin_expect(!!(expr), 1))
|
||||
#define unlikely(expr) (__builtin_expect(!!(expr), 0))
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define sscanf sscanf_s
|
||||
#endif
|
||||
|
||||
#ifdef FLUTTER_UI
|
||||
#include "base.h"
|
||||
#endif // FLUTTER_UI
|
||||
|
|
20
src/uci.cpp
20
src/uci.cpp
|
@ -160,6 +160,25 @@ void UCI::loop(int argc, char *argv[])
|
|||
Position *pos = new Position;
|
||||
string token, cmd;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
switch (rule.piecesCount) {
|
||||
case 9:
|
||||
strncpy_s(StartFEN, BUFSIZ, StartFEN9, BUFSIZ - 1);
|
||||
break;
|
||||
case 10:
|
||||
strncpy_s(StartFEN, BUFSIZ, StartFEN10, BUFSIZ - 1);
|
||||
break;
|
||||
case 11:
|
||||
strncpy_s(StartFEN, BUFSIZ, StartFEN11, BUFSIZ - 1);
|
||||
break;
|
||||
case 12:
|
||||
strncpy_s(StartFEN, BUFSIZ, StartFEN12, BUFSIZ - 1);
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
break;
|
||||
}
|
||||
#else
|
||||
switch (rule.piecesCount) {
|
||||
case 9:
|
||||
strncpy(StartFEN, StartFEN9, BUFSIZ - 1);
|
||||
|
@ -177,6 +196,7 @@ void UCI::loop(int argc, char *argv[])
|
|||
assert(0);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
StartFEN[BUFSIZ - 1] = '\0';
|
||||
|
||||
|
|
|
@ -39,7 +39,11 @@ bool CommandQueue::write(const char *command)
|
|||
return false;
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
strncpy_s(commands[writeIndex], COMMAND_LENGTH, command, COMMAND_LENGTH);
|
||||
#else
|
||||
strncpy(commands[writeIndex], command, COMMAND_LENGTH);
|
||||
#endif
|
||||
|
||||
if (readIndex == -1) {
|
||||
readIndex = writeIndex;
|
||||
|
@ -60,8 +64,13 @@ bool CommandQueue::read(char *dest)
|
|||
return false;
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
strncpy_s(dest, 4096, (char const *)commands[readIndex], 4096); // See uci.cpp LINE_INPUT_MAX_CHAR
|
||||
strncpy_s(commands[readIndex], 4096, "", COMMAND_LENGTH);
|
||||
#else
|
||||
strncpy(dest, commands[readIndex], 4096); // See uci.cpp LINE_INPUT_MAX_CHAR
|
||||
strncpy(commands[readIndex], "", COMMAND_LENGTH);
|
||||
#endif
|
||||
|
||||
if (++readIndex == MAX_COMMAND_COUNT) {
|
||||
readIndex = 0;
|
||||
|
|
Loading…
Reference in New Issue