Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#4643 closed patch (fixed)

test for empty string

Reported by: Erik Hovland <erik@…> Owned by: danielk
Priority: minor Milestone: 0.21
Component: mythtv Version: head
Severity: low Keywords:
Cc: Ticket locked: no

Description

In the file avformatdecoder.cpp, in the member function AvFormatDecoder::ScanStreams? there are two tests for the validity of the character array language. Since it is an array and not a pointer, checking for its validity is likely not correct. If you look at what is attempted inside the test brackets you see that what is likely is that the coder is testing to see if the string is empty.

So the test has been changed to check for emptiness of string instead of validity of pointer.

Attachments (2)

fix-test-for-empty-string (1.3 KB) - added by Erik Hovland <erik@…> 12 years ago.
changes test from pointer validity to string emptiness
4643-v1.patch (2.2 KB) - added by danielk 12 years ago.
Untested fix. The original patch may have create some unexpected results when there are no languages defined. This patch should work, but I haven't tested it yet.

Download all attachments as: .zip

Change History (5)

Changed 12 years ago by Erik Hovland <erik@…>

Attachment: fix-test-for-empty-string added

changes test from pointer validity to string emptiness

comment:1 Changed 12 years ago by danielk

Owner: changed from Isaac Richards to danielk
Status: newassigned

Changed 12 years ago by danielk

Attachment: 4643-v1.patch added

Untested fix. The original patch may have create some unexpected results when there are no languages defined. This patch should work, but I haven't tested it yet.

comment:2 Changed 12 years ago by danielk

Resolution: fixed
Status: assignedclosed

(In [16027]) Fixes #4643. Fix for a broken empty string check.

Erik Hovland found the problem. I wrote a different fix so that this doesn't break anything, if there is no language defined this defaults to using the 'und'efined language.

comment:3 Changed 12 years ago by Erik Hovland <erik@…>

Indeed, the defect seems fixed. And your patch is definitely a better fix. Don't forget to commit your patch to the trunk.

Note: See TracTickets for help on using tickets.