Skip to content

Commit

Permalink
tidy: A couple of fixes.
Browse files Browse the repository at this point in the history
1) Add braces around statements.

2) Initialize a variable.

3) Use the string equality operator instead of the compare function.

4) Quiet false positive warning about a potential nullptr passed to
function.  The static analyzers don't know that the argc argument to
main() will always be greater than zero.  Coping the first entry of
argv outside of the for loop eliminates the false positive.
  • Loading branch information
linuxdude42 committed Jan 6, 2025
1 parent cfe7923 commit 37e173c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 4 additions & 3 deletions mythtv/programs/mythbackend/mythbackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,11 @@ int main(int argc, char **argv)
{
char ** newargv = new char * [argc + 2];
std::string webonly = "--webonly";
int newargc = 0;
for (int ix = 0 ; ix < argc ; ++ix)
newargv[0] = argv[0];
int newargc = 1;
for (int ix = 1 ; ix < argc ; ++ix)
{
if (webonly.compare(argv[ix]) != 0)
if (webonly != argv[ix])
newargv[newargc++] = argv[ix];
}
if (retval == 259)
Expand Down
4 changes: 3 additions & 1 deletion mythtv/programs/mythbackend/servicesv2/v2dvr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -713,15 +713,17 @@ bool V2Dvr::ReactivateRecording(int RecordedId,
MythDB::DBError("ReactivateRecording", query);
return false;
}
int recId;
int recId {0};
if (query.next())
recId = query.value(0).toInt();
else
return false;
ri = RecordingInfo(recId);
}
else
{
throw QString("Recorded ID or Channel ID and StartTime or RecordId are invalid.");
}
if (ri.GetChanID() && ri.HasPathname())
{
ri.ReactivateRecording();
Expand Down

0 comments on commit 37e173c

Please sign in to comment.