Opened 12 years ago

Closed 12 years ago

#4312 closed defect (fixed)

literal string compare issues (found with gcc-4.3)

Reported by: ro@… Owned by: danielk
Priority: minor Milestone: unknown
Component: mythtv Version: head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

up to now I found three string compare issues in the mythtv code:

this one should probably get a shorter solution: --- libs/libmythtv/tv_rec.cpp +++ libs/libmythtv/tv_rec.cpp @@ -2109,7 +2109,7 @@

for (uint j = 0; j < kSpacerListSize; j++) {

QString qprefix = add_spacer(

  • prefix, (spacers[j] == "_") ? "
    _" : spacers[j]);

+ prefix, (!strcmp(spacers[j],"_")) ? "
_" : spacers[j]);

query.prepare(basequery.arg(qprefix) + cardquery[i]);

if (!query.exec()
!query.isActive())

at least the first of the following two will probably not even have worked before: --- libs/libmyth/managedlist.cpp +++ libs/libmyth/managedlist.cpp @@ -290,7 +290,7 @@

if (!item)

return false;

  • if (item->name() == "unnamed")

+ if (!strcmp(item->name(),"unnamed"))

item->setName( QString( "ITEM-%1").arg(itemList.count()));

if (!child(item->name()) && !item->parent())

--- libs/libmythtv/xine_demux_sputext.c +++ libs/libmythtv/xine_demux_sputext.c @@ -676,7 +676,7 @@

sub_readtext((char *) &line,&current->text[1]); current->lines = 2;

  • if ((current->text[0]=="") && (current->text[1]=="")) {

+ if (!strlen(current->text[0]) && !strlen(current->text[1])) {

return NULL;

}

Attachments (2)

mythtv-stringcompare.dif (445 bytes) - added by ro@… 12 years ago.
mythtv-stringliteral.dif (654 bytes) - added by ro@… 12 years ago.

Download all attachments as: .zip

Change History (5)

Changed 12 years ago by ro@…

Attachment: mythtv-stringcompare.dif added

comment:1 Changed 12 years ago by danielk

Owner: changed from Isaac Richards to danielk
Status: newassigned

Changed 12 years ago by ro@…

Attachment: mythtv-stringliteral.dif added

comment:2 Changed 12 years ago by ro@…

attached the diffs as files, cut'n'paste didn't work so good ...

comment:3 Changed 12 years ago by danielk

Resolution: fixed
Status: assignedclosed

(In [15136]) Fixes #4310. Fixes #4312. Removes dependence on [c]string operator==(), gcc 4.3 complains; for xine_demux_sputext.c I used the gcc 4.3 fix being used upstream, for the other's I used the QString operator==().

Note: See TracTickets for help on using tickets.