Changeset 14185


Ignore:
Timestamp:
Aug 29, 2013, 12:37:37 AM (8 years ago)
Author:
jordan
Message:

revert quint64/quint32/qint64/qint32 use to inttypes to match libtransmission's API

Location:
trunk/qt
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/qt/app.cc

    r14177 r14185  
    478478  args.append (QStringList ());                       // actions - unused for plain passive popups
    479479  args.append (QVariantMap ());                       // hints - unused atm
    480   args.append (qint32 (-1));                          // use the default timeout period
     480  args.append (int32_t (-1));                          // use the default timeout period
    481481  m.setArguments (args);
    482482  QDBusMessage replyMsg = QDBusConnection::sessionBus ().call (m);
  • trunk/qt/details.cc

    r14177 r14185  
    413413  double leftUntilDone = 0;
    414414  double available = 0;
    415   qint64 haveTotal = 0;
    416   qint64 haveVerified = 0;
    417   qint64 haveUnverified = 0;
    418   qint64 verifiedPieces = 0;
     415  int64_t haveTotal = 0;
     416  int64_t haveVerified = 0;
     417  int64_t haveUnverified = 0;
     418  int64_t verifiedPieces = 0;
    419419  if (torrents.empty ())
    420420    {
     
    429429              haveTotal += t->haveTotal ();
    430430              haveUnverified += t->haveUnverified ();
    431               const quint64 v = t->haveVerified ();
     431              const uint64_t v = t->haveVerified ();
    432432              haveVerified += v;
    433433              if (t->pieceSize ())
     
    481481  else
    482482    {
    483       quint64 d = 0;
    484       quint64 f = 0;
     483      uint64_t d = 0;
     484      uint64_t f = 0;
    485485      foreach (const Torrent * t, torrents)
    486486        {
     
    504504  else
    505505    {
    506       quint64 u = 0;
    507       quint64 d = 0;
     506      uint64_t u = 0;
     507      uint64_t d = 0;
    508508      foreach (const Torrent * t, torrents)
    509509        {
     
    634634    {
    635635      int pieces = 0;
    636       quint64 size = 0;
    637       quint32 pieceSize = torrents[0]->pieceSize ();
     636      uint64_t size = 0;
     637      uint32_t pieceSize = torrents[0]->pieceSize ();
    638638      foreach (const Torrent * t, torrents)
    639639        {
  • trunk/qt/file-tree.cc

    r14177 r14185  
    164164
    165165void
    166 FileTreeItem :: getSubtreeWantedSize (quint64& have, quint64& total) const
     166FileTreeItem :: getSubtreeWantedSize (uint64_t& have, uint64_t& total) const
    167167{
    168168  if (myIsWanted)
     
    180180{
    181181  double d(0);
    182   quint64 have(0), total(0);
     182  uint64_t have(0), total(0);
    183183
    184184  getSubtreeWantedSize (have, total);
     
    200200  else
    201201    {
    202       quint64 have = 0;
    203       quint64 total = 0;
     202      uint64_t have = 0;
     203      uint64_t total = 0;
    204204      getSubtreeWantedSize (have, total);
    205205      str = Formatter::sizeToString (total);
     
    213213                        bool           wanted,
    214214                        int            priority,
    215                         quint64       haveSize,
     215                        uint64_t       haveSize,
    216216                        bool           updateFields)
    217217{
     
    606606                          bool                  wanted,
    607607                          int                   priority,
    608                           quint64              totalSize,
    609                           quint64              have,
     608                          uint64_t              totalSize,
     609                          uint64_t              have,
    610610                          QList<QModelIndex>  & rowsAdded,
    611611                          bool                  updateFields)
  • trunk/qt/file-tree.h

    r14177 r14185  
    4444    virtual ~FileTreeItem();
    4545
    46     FileTreeItem (const QString& name="", int fileIndex=-1, quint64 size=0):
     46    FileTreeItem (const QString& name="", int fileIndex=-1, uint64_t size=0):
    4747      myFileIndex (fileIndex),
    4848      myParent (0),
     
    6464    const QString& name () const { return myName; }
    6565    QVariant data (int column, int role) const;
    66     std::pair<int,int> update (const QString& name, bool want, int priority, quint64 have, bool updateFields);
     66    std::pair<int,int> update (const QString& name, bool want, int priority, uint64_t have, bool updateFields);
    6767    void twiddleWanted (QSet<int>& fileIds, bool&);
    6868    void twiddlePriority (QSet<int>& fileIds, int&);
    6969    int fileIndex () const { return myFileIndex; }
    70     quint64 totalSize () const { return myTotalSize; }
     70    uint64_t totalSize () const { return myTotalSize; }
    7171
    7272  private:
     
    7575    QString priorityString () const;
    7676    QString sizeString () const;
    77     void getSubtreeWantedSize (quint64& have, quint64& total) const;
     77    void getSubtreeWantedSize (uint64_t& have, uint64_t& total) const;
    7878    double progress () const;
    7979    int priority () const;
     
    8888    int myPriority;
    8989    bool myIsWanted;
    90     quint64 myHaveSize;
    91     const quint64 myTotalSize;
     90    uint64_t myHaveSize;
     91    const uint64_t myTotalSize;
    9292    size_t myFirstUnhashedRow;
    9393};
     
    121121    void addFile (int index, const QString& filename,
    122122                  bool wanted, int priority,
    123                   quint64 size, quint64 have,
     123                  uint64_t size, uint64_t have,
    124124                  QList<QModelIndex>& rowsAdded,
    125125                  bool torrentChanged);
  • trunk/qt/formatter.cc

    r14177 r14185  
    9393
    9494QString
    95 Formatter :: memToString (qint64 bytes)
     95Formatter :: memToString (int64_t bytes)
    9696{
    9797  if (bytes < 0)
     
    107107
    108108QString
    109 Formatter :: sizeToString (qint64 bytes)
     109Formatter :: sizeToString (int64_t bytes)
    110110{
    111111  if (bytes < 0)
  • trunk/qt/formatter.h

    r14177 r14185  
    3131  public:
    3232
    33     static QString memToString (qint64 bytes);
    34     static QString sizeToString (qint64 bytes);
     33    static QString memToString (int64_t bytes);
     34    static QString sizeToString (int64_t bytes);
    3535    static QString speedToString (const Speed& speed);
    3636    static QString percentToString (double x);
  • trunk/qt/freespace-label.cc

    r14177 r14185  
    3737  connect (&myTimer, SIGNAL(timeout()), this, SLOT(onTimer()));
    3838
    39   connect (&mySession, SIGNAL(executed(qint64, const QString&, struct tr_variant*)),
    40            this,       SLOT(onSessionExecuted(qint64, const QString&, struct tr_variant*)));
     39  connect (&mySession, SIGNAL(executed(int64_t, const QString&, struct tr_variant*)),
     40           this,       SLOT(onSessionExecuted(int64_t, const QString&, struct tr_variant*)));
    4141
    4242  setPath (path);
     
    5757FreespaceLabel :: onTimer ()
    5858{
    59   const qint64 tag = mySession.getUniqueTag ();
     59  const int64_t tag = mySession.getUniqueTag ();
    6060  const QByteArray myPathUtf8 = myPath.toUtf8 ();
    6161
     
    7272
    7373void
    74 FreespaceLabel :: onSessionExecuted (qint64 tag, const QString& result, struct tr_variant * arguments)
     74FreespaceLabel :: onSessionExecuted (int64_t tag, const QString& result, struct tr_variant * arguments)
    7575{
    7676  Q_UNUSED (result);
     
    8282
    8383  // update the label
    84   qint64 bytes = -1;
     84  int64_t bytes = -1;
    8585  tr_variantDictFindInt (arguments, TR_KEY_size_bytes, &bytes);
    8686  if (bytes >= 0)
  • trunk/qt/freespace-label.h

    r14177 r14185  
    3232  private:
    3333    Session& mySession;
    34     qint64 myTag;
     34    int64_t myTag;
    3535    QString myPath;
    3636    QTimer myTimer;
    3737
    3838  private slots:
    39     void onSessionExecuted (qint64 tag, const QString& result, struct tr_variant * arguments);
     39    void onSessionExecuted (int64_t tag, const QString& result, struct tr_variant * arguments);
    4040    void onTimer ();
    4141};
  • trunk/qt/options.cc

    r14177 r14185  
    4848
    4949void
    50 FileAdded :: executed (qint64 tag, const QString& result, struct tr_variant * arguments)
     50FileAdded :: executed (int64_t tag, const QString& result, struct tr_variant * arguments)
    5151{
    5252  Q_UNUSED (arguments);
     
    376376  // rpc spec section 3.4 "adding a torrent"
    377377
    378   const qint64 tag = mySession.getUniqueTag ();
     378  const int64_t tag = mySession.getUniqueTag ();
    379379  tr_variant top;
    380380  tr_variantInitDict (&top, 3);
     
    456456  if (myTrashCheck->isChecked () && (myAdd.type==AddData::FILENAME))
    457457    fileAdded->setFileToDelete (myAdd.filename);
    458   connect (&mySession, SIGNAL (executed (qint64,const QString&, struct tr_variant*)),
    459            fileAdded, SLOT (executed (qint64,const QString&, struct tr_variant*)));
     458  connect (&mySession, SIGNAL (executed (int64_t,const QString&, struct tr_variant*)),
     459           fileAdded, SLOT (executed (int64_t,const QString&, struct tr_variant*)));
    460460
    461461  mySession.exec (&top);
     
    569569namespace
    570570{
    571   quint64 getPieceSize (const tr_info * info, tr_piece_index_t pieceIndex)
     571  uint64_t getPieceSize (const tr_info * info, tr_piece_index_t pieceIndex)
    572572  {
    573573    if (pieceIndex != info->pieceCount - 1)
     
    595595    }
    596596
    597   qint64 leftInPiece = getPieceSize (&myInfo, myVerifyPieceIndex) - myVerifyPiecePos;
    598   qint64 leftInFile = file->length - myVerifyFilePos;
    599   qint64 bytesThisPass = std::min (leftInFile, leftInPiece);
    600   bytesThisPass = std::min (bytesThisPass, (qint64)sizeof (myVerifyBuf));
     597  int64_t leftInPiece = getPieceSize (&myInfo, myVerifyPieceIndex) - myVerifyPiecePos;
     598  int64_t leftInFile = file->length - myVerifyFilePos;
     599  int64_t bytesThisPass = std::min (leftInFile, leftInPiece);
     600  bytesThisPass = std::min (bytesThisPass, (int64_t)sizeof (myVerifyBuf));
    601601
    602602  if (myVerifyFile.isOpen () && myVerifyFile.seek (myVerifyFilePos))
    603603    {
    604       qint64 numRead = myVerifyFile.read (myVerifyBuf, bytesThisPass);
     604      int64_t numRead = myVerifyFile.read (myVerifyBuf, bytesThisPass);
    605605      if (numRead == bytesThisPass)
    606606        myVerifyHash.addData (myVerifyBuf, numRead);
     
    650650  if (done)
    651651    {
    652       quint64 have = 0;
     652      uint64_t have = 0;
    653653      foreach (const TrFile& f, myFiles)
    654654        have += f.have;
  • trunk/qt/options.h

    r14177 r14185  
    5656
    5757  public slots:
    58     void executed (qint64 tag, const QString& result, struct tr_variant * arguments);
     58    void executed (int64_t tag, const QString& result, struct tr_variant * arguments);
    5959
    6060  private:
    61     const qint64 myTag;
     61    const int64_t myTag;
    6262    QString myName;
    6363    QString myDelFile;
     
    118118    char myVerifyBuf[2048*4];
    119119    QFile myVerifyFile;
    120     quint64 myVerifyFilePos;
     120    uint64_t myVerifyFilePos;
    121121    int myVerifyFileIndex;
    122     quint32 myVerifyPieceIndex;
    123     quint32 myVerifyPiecePos;
     122    uint32_t myVerifyPieceIndex;
     123    uint32_t myVerifyPiecePos;
    124124    void clearVerify ();
    125125    QVector<bool> myVerifyFlags;
    126126    QCryptographicHash myVerifyHash;
    127     typedef QMap<quint32,qint32> mybins_t;
     127    typedef QMap<uint32_t,int32_t> mybins_t;
    128128    mybins_t myVerifyBins;
    129129    QTimer myEditTimer;
  • trunk/qt/prefs.cc

    r14177 r14185  
    152152      double d;
    153153      bool boolVal;
    154       qint64 intVal;
     154      int64_t intVal;
    155155      const char * str;
    156156      size_t strLen;
  • trunk/qt/session.cc

    r14177 r14185  
    700700      QNetworkReply * reply = networkAccessManager ()->post (request, requestData);
    701701      reply->setProperty (REQUEST_DATA_PROPERTY_KEY, requestData);
    702       connect (reply, SIGNAL (downloadProgress (qint64,qint64)), this, SIGNAL (dataReadProgress ()));
    703       connect (reply, SIGNAL (uploadProgress (qint64,qint64)), this, SIGNAL (dataSendProgress ()));
     702      connect (reply, SIGNAL (downloadProgress (int64_t,int64_t)), this, SIGNAL (dataReadProgress ()));
     703      connect (reply, SIGNAL (uploadProgress (int64_t,int64_t)), this, SIGNAL (dataSendProgress ()));
    704704
    705705#ifdef DEBUG_HTTP
     
    765765    if (!err)
    766766    {
    767         qint64 tag = -1;
     767        int64_t tag = -1;
    768768        const char * result = NULL;
    769769        tr_variant * args = NULL;
     
    803803
    804804                case TAG_BLOCKLIST_UPDATE: {
    805                     qint64 intVal = 0;
     805                    int64_t intVal = 0;
    806806                    if (tr_variantDictFindDict (&top, TR_KEY_arguments, &args))
    807807                        if (tr_variantDictFindInt (args, TR_KEY_blocklist_size, &intVal))
     
    812812                case TAG_RENAME_PATH:
    813813                  {
    814                     qint64 id = 0;
     814                    int64_t id = 0;
    815815                    const char * result = 0;
    816816                    if (tr_variantDictFindStr (&top, TR_KEY_result, &result, 0) && strcmp (result, "success"))
     
    886886Session :: updateStats (tr_variant * d, struct tr_session_stats * stats)
    887887{
    888   qint64 i;
     888  int64_t i;
    889889
    890890  if (tr_variantDictFindInt (d, TR_KEY_uploadedBytes, &i))
     
    919919Session :: updateInfo (tr_variant * d)
    920920{
    921   qint64 i;
     921  int64_t i;
    922922  const char * str;
    923923
     
    950950          case QVariant :: Int:
    951951            {
    952               qint64 val;
     952              int64_t val;
    953953              if (tr_variantGetInt (b, &val))
    954954                myPrefs.set (i, (int)val);
     
    10151015
    10161016void
    1017 Session :: setBlocklistSize (qint64 i)
     1017Session :: setBlocklistSize (int64_t i)
    10181018{
    10191019  myBlocklistSize = i;
  • trunk/qt/session.h

    r14177 r14185  
    6060
    6161  public:
    62     qint64 blocklistSize () const { return myBlocklistSize; }
    63     void setBlocklistSize (qint64 i);
     62    int64_t blocklistSize () const { return myBlocklistSize; }
     63    void setBlocklistSize (int64_t i);
    6464    void updateBlocklist ();
    6565    void portTest ();
     
    8585
    8686  public:
    87     qint64 getUniqueTag () { return nextUniqueTag++; }
     87    int64_t getUniqueTag () { return nextUniqueTag++; }
    8888
    8989  private:
     
    135135  signals:
    136136    void responseReceived (const QByteArray& json);
    137     void executed (qint64 tag, const QString& result, struct tr_variant * arguments);
     137    void executed (int64_t tag, const QString& result, struct tr_variant * arguments);
    138138    void sourceChanged ();
    139139    void portTested (bool isOpen);
     
    148148
    149149  private:
    150     qint64 nextUniqueTag;
    151     qint64 myBlocklistSize;
     150    int64_t nextUniqueTag;
     151    int64_t myBlocklistSize;
    152152    Prefs& myPrefs;
    153153    tr_session * mySession;
  • trunk/qt/torrent-delegate.cc

    r14177 r14185  
    8181    const bool isDone( tor.isDone( ) );
    8282    const bool isSeed( tor.isSeed( ) );
    83     const quint64 haveTotal( tor.haveTotal( ) );
     83    const uint64_t haveTotal( tor.haveTotal( ) );
    8484    QString str;
    8585    double seedRatio;
  • trunk/qt/torrent-model.cc

    r14177 r14185  
    132132    tr_variant * child;
    133133    while(( child = tr_variantListChild( torrents, i++ ))) {
    134         qint64 intVal;
     134        int64_t intVal;
    135135        if( tr_variantGetInt( child, &intVal ) )
    136136            removeTorrent( intVal );
     
    156156        while(( child = tr_variantListChild( torrents, i++ )))
    157157        {
    158             qint64 id;
     158            int64_t id;
    159159            if( tr_variantDictFindInt( child, TR_KEY_id, &id ) )
    160160            {
  • trunk/qt/torrent.cc

    r14177 r14185  
    467467  bool changed = false;
    468468  const bool was_seed = isSeed ();
    469   const quint64 old_verified_size = haveVerified ();
     469  const uint64_t old_verified_size = haveVerified ();
    470470
    471471  if (!lookup_initialized)
     
    493493          case QVariant :: Int:
    494494            {
    495               qint64 val;
     495              int64_t val;
    496496              if (tr_variantGetInt (child, &val))
    497497                changed |= setInt (property_index, val);
     
    514514          case QVariant :: ULongLong:
    515515            {
    516               qint64 val;
     516              int64_t val;
    517517              if (tr_variantGetInt (child, &val))
    518518                changed |= setSize (property_index, val);
     
    528528          case QVariant :: DateTime:
    529529            {
    530               qint64 val;
     530              int64_t val;
    531531              if (tr_variantGetInt (child, &val) && val)
    532532                changed |= setDateTime (property_index, QDateTime :: fromTime_t(val));
     
    550550    {
    551551      const char * str;
    552       qint64 intVal;
     552      int64_t intVal;
    553553      int i = 0;
    554554      tr_variant * child;
     
    581581      for (int i=0; i<n && i<myFiles.size(); ++i)
    582582        {
    583           qint64 intVal;
     583          int64_t intVal;
    584584          bool boolVal;
    585585          tr_variant * child = tr_variantListChild (files, i);
     
    641641        {
    642642          bool b;
    643           qint64 i;
     643          int64_t i;
    644644          size_t len;
    645645          const char * str;
     
    718718          double d;
    719719          bool b;
    720           qint64 i;
     720          int64_t i;
    721721          size_t len;
    722722          const char * str;
  • trunk/qt/torrent.h

    r14177 r14185  
    104104  int priority;
    105105  QString filename;
    106   quint64 size;
    107   quint64 have;
     106  uint64_t size;
     107  uint64_t have;
    108108};
    109109
     
    254254        bool isPrivate( ) const { return getBool( IS_PRIVATE ); }
    255255        bool getSeedRatio( double& setme ) const;
    256         quint64 haveVerified( ) const { return getSize( HAVE_VERIFIED ); }
    257         quint64 haveUnverified( ) const { return getSize( HAVE_UNCHECKED ); }
    258         quint64 desiredAvailable( ) const { return getSize( DESIRED_AVAILABLE ); }
    259         quint64 haveTotal( ) const { return haveVerified( ) + haveUnverified(); }
    260         quint64 totalSize( ) const { return getSize( TOTAL_SIZE ); }
    261         quint64 sizeWhenDone( ) const { return getSize( SIZE_WHEN_DONE ); }
    262         quint64 leftUntilDone( ) const { return getSize( LEFT_UNTIL_DONE ); }
    263         quint64 pieceSize( ) const { return getSize( PIECE_SIZE ); }
     256        uint64_t haveVerified( ) const { return getSize( HAVE_VERIFIED ); }
     257        uint64_t haveUnverified( ) const { return getSize( HAVE_UNCHECKED ); }
     258        uint64_t desiredAvailable( ) const { return getSize( DESIRED_AVAILABLE ); }
     259        uint64_t haveTotal( ) const { return haveVerified( ) + haveUnverified(); }
     260        uint64_t totalSize( ) const { return getSize( TOTAL_SIZE ); }
     261        uint64_t sizeWhenDone( ) const { return getSize( SIZE_WHEN_DONE ); }
     262        uint64_t leftUntilDone( ) const { return getSize( LEFT_UNTIL_DONE ); }
     263        uint64_t pieceSize( ) const { return getSize( PIECE_SIZE ); }
    264264        bool hasMetadata( ) const { return getDouble( METADATA_PERCENT_DONE ) >= 1.0; }
    265265        bool isMagnet( ) const { return magnetTorrent; }
     
    269269        double percentDone( ) const { return getDouble( PERCENT_DONE ); }
    270270        double metadataPercentDone( ) const { return getDouble( METADATA_PERCENT_DONE ); }
    271         quint64 downloadedEver( ) const { return getSize( DOWNLOADED_EVER ); }
    272         quint64 uploadedEver( ) const { return getSize( UPLOADED_EVER ); }
    273         quint64 failedEver( ) const { return getSize( FAILED_EVER ); }
     271        uint64_t downloadedEver( ) const { return getSize( DOWNLOADED_EVER ); }
     272        uint64_t uploadedEver( ) const { return getSize( UPLOADED_EVER ); }
     273        uint64_t failedEver( ) const { return getSize( FAILED_EVER ); }
    274274        int compareTracker( const Torrent& ) const;
    275275        int compareSeedRatio( const Torrent& ) const;
Note: See TracChangeset for help on using the changeset viewer.