forked from qt-creator/qt-creator
Terminal: Coverity warning fixes
Change-Id: If96291ff6df97f7e85840eb0951cc3f4abfab0f6 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -343,15 +343,16 @@ void ShellProcess::configChildProcess()
|
|||||||
struct utmpx utmpxInfo;
|
struct utmpx utmpxInfo;
|
||||||
memset(&utmpxInfo, 0, sizeof(utmpxInfo));
|
memset(&utmpxInfo, 0, sizeof(utmpxInfo));
|
||||||
|
|
||||||
strncpy(utmpxInfo.ut_user, qgetenv("USER"), sizeof(utmpxInfo.ut_user));
|
strncpy(utmpxInfo.ut_user, qgetenv("USER"), sizeof(utmpxInfo.ut_user) - 1);
|
||||||
|
|
||||||
QString device(m_handleSlaveName);
|
QString device(m_handleSlaveName);
|
||||||
if (device.startsWith("/dev/"))
|
if (device.startsWith("/dev/"))
|
||||||
device = device.mid(5);
|
device = device.mid(5);
|
||||||
|
|
||||||
const char *d = device.toLatin1().constData();
|
const auto deviceAsLatin1 = device.toLatin1();
|
||||||
|
const char *d = deviceAsLatin1.constData();
|
||||||
|
|
||||||
strncpy(utmpxInfo.ut_line, d, sizeof(utmpxInfo.ut_line));
|
strncpy(utmpxInfo.ut_line, d, sizeof(utmpxInfo.ut_line) - 1);
|
||||||
|
|
||||||
strncpy(utmpxInfo.ut_id, d + strlen(d) - sizeof(utmpxInfo.ut_id), sizeof(utmpxInfo.ut_id));
|
strncpy(utmpxInfo.ut_id, d + strlen(d) - sizeof(utmpxInfo.ut_id), sizeof(utmpxInfo.ut_id));
|
||||||
|
|
||||||
|
|||||||
2
src/libs/3rdparty/libvterm/src/state.c
vendored
2
src/libs/3rdparty/libvterm/src/state.c
vendored
@@ -1842,7 +1842,7 @@ static void request_status_string(VTermState *state, VTermStringFragment frag)
|
|||||||
|
|
||||||
case ' '|('q'<<8): {
|
case ' '|('q'<<8): {
|
||||||
// Query DECSCUSR
|
// Query DECSCUSR
|
||||||
int reply;
|
int reply = 2;
|
||||||
switch(state->mode.cursor_shape) {
|
switch(state->mode.cursor_shape) {
|
||||||
case VTERM_PROP_CURSORSHAPE_BLOCK: reply = 2; break;
|
case VTERM_PROP_CURSORSHAPE_BLOCK: reply = 2; break;
|
||||||
case VTERM_PROP_CURSORSHAPE_UNDERLINE: reply = 4; break;
|
case VTERM_PROP_CURSORSHAPE_UNDERLINE: reply = 4; break;
|
||||||
|
|||||||
@@ -3813,8 +3813,10 @@ void ProjectExplorerPluginPrivate::openTerminalHere(const EnvironmentGetter &env
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
BuildConfiguration *bc = activeBuildConfiguration(ProjectTree::projectForNode(currentNode));
|
BuildConfiguration *bc = activeBuildConfiguration(ProjectTree::projectForNode(currentNode));
|
||||||
if (!bc)
|
if (!bc) {
|
||||||
Terminal::Hooks::instance().openTerminalHook()({{}, currentNode->directory(), environment});
|
Terminal::Hooks::instance().openTerminalHook()({{}, currentNode->directory(), environment});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
IDeviceConstPtr buildDevice = BuildDeviceKitAspect::device(bc->target()->kit());
|
IDeviceConstPtr buildDevice = BuildDeviceKitAspect::device(bc->target()->kit());
|
||||||
|
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ void TerminalPane::setFocus()
|
|||||||
bool TerminalPane::hasFocus() const
|
bool TerminalPane::hasFocus() const
|
||||||
{
|
{
|
||||||
if (const auto t = currentTerminal())
|
if (const auto t = currentTerminal())
|
||||||
t->hasFocus();
|
return t->hasFocus();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user