Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#699 closed patch (fixed)

AutoExpire::FillDBOrdered uses ints for filesizes

Reported by: Robert Tsai <rtsai1111> Owned by: cpinkham
Priority: minor Milestone: unknown
Component: mythtv Version: head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

Change [7944] casts a string to an "int" for filesize, which is bad for files > 2GB. The code should use QString::toLongLong() instead of QString::toInt()

This manifests itself as negative numbers being output by "mythbackend --printexpire".

Attachments (2)

mythtv.printexpire.diff (454 bytes) - added by Robert Tsai <rtsai1111> 14 years ago.
mythtv.printexpire.2.diff (533 bytes) - added by Robert Tsai <rtsai1111> 14 years ago.
Use stringToLongLong instead of toLongLong

Download all attachments as: .zip

Change History (7)

Changed 14 years ago by Robert Tsai <rtsai1111>

Attachment: mythtv.printexpire.diff added

comment:1 Changed 14 years ago by Isaac Richards

toLongLong doesn't exist in older versions of Qt.

comment:2 Changed 14 years ago by anonymous

Can you make and test a patch that in MySQL does the divide by 1024 and then multiply the toInt() by 1024 and see if you can work around it that way? If that works, check programinfo.cpp to see if another change is necessary there when/if we load the filesize.

comment:3 Changed 14 years ago by Robert Tsai <rtsai1111>

Dividing by 1024 in the SQL query (and re-multiplying the result by 1024) works, but I don't like it. The code in programinfo.cpp does something different:

filesize = stringToLongLong(query.value(xx).toString());

So I'll do that.

QString::stringToLongLong appears to be new to qt-3.2; I assume its use in programinfo.cpp means it's OK? The QT version prerequisites and/or support requirements are not in the mythtv.org documentation for compiling source code ...

Changed 14 years ago by Robert Tsai <rtsai1111>

Attachment: mythtv.printexpire.2.diff added

Use stringToLongLong instead of toLongLong

comment:4 Changed 14 years ago by cpinkham

Resolution: fixed
Status: newclosed

(In [8017]) Close #699 by applying Robert Tsai's patch. AutoExpire? wasn't properly handling filesizes over ~2GB because of overflow using toInt() when the filesize is really a long long.

comment:5 Changed 14 years ago by cpinkham

stringToLongLong() is actually a Myth function in libs/libmyth/util.cpp. I should have remembered that from when we put the filesize in the DB.

Note: See TracTickets for help on using tickets.