rhi: d3d11: Use qstrncpy to avoid MSVC warning

Switch strncpy to qstrncpy, which internally uses strncpy_s with MSVC.

This way we will not get the following warning:

qrhid3d11.cpp(933): warning C4996: 'strncpy': This function or variable
may be unsafe. Consider using strncpy_s instead. To disable deprecation,
use _CRT_SECURE_NO_WARNINGS. See online help for details.

Change-Id: Iaed86033b0fc182e68804f311ac382c93c72abda
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
bb10
Laszlo Agocs 2020-05-20 18:00:07 +02:00
parent 449b347644
commit c991d87ee2
1 changed files with 2 additions and 4 deletions

View File

@ -932,8 +932,7 @@ void QRhiD3D11::debugMarkBegin(QRhiCommandBuffer *cb, const QByteArray &name)
QD3D11CommandBuffer *cbD = QRHI_RES(QD3D11CommandBuffer, cb);
QD3D11CommandBuffer::Command cmd;
cmd.cmd = QD3D11CommandBuffer::Command::DebugMarkBegin;
strncpy(cmd.args.debugMark.s, name.constData(), sizeof(cmd.args.debugMark.s));
cmd.args.debugMark.s[sizeof(cmd.args.debugMark.s) - 1] = '\0';
qstrncpy(cmd.args.debugMark.s, name.constData(), sizeof(cmd.args.debugMark.s));
cbD->commands.append(cmd);
}
@ -956,8 +955,7 @@ void QRhiD3D11::debugMarkMsg(QRhiCommandBuffer *cb, const QByteArray &msg)
QD3D11CommandBuffer *cbD = QRHI_RES(QD3D11CommandBuffer, cb);
QD3D11CommandBuffer::Command cmd;
cmd.cmd = QD3D11CommandBuffer::Command::DebugMarkMsg;
strncpy(cmd.args.debugMark.s, msg.constData(), sizeof(cmd.args.debugMark.s));
cmd.args.debugMark.s[sizeof(cmd.args.debugMark.s) - 1] = '\0';
qstrncpy(cmd.args.debugMark.s, msg.constData(), sizeof(cmd.args.debugMark.s));
cbD->commands.append(cmd);
}