Remove ungetString
AbandonedPublic

Authored by wojnilowicz on Mar 7 2018, 6:30 PM.

Details

Reviewers
tbaumgart
Group Reviewers
KMyMoney
Summary

According to the comment, I delete with this patch, QFile supports seek. qfile variable that is supposed to use ungetString can be one of the following:

  1. KCompressionDevice (implements seek),
  2. KGPGFile (inherits from QFile),
  3. QFile.

It can be seen that all objects support seek. There seems no point in complicating code with ungetString, so it has been removed.

Diff Detail

Repository
R261 KMyMoney
Lint
Lint Skipped
Unit
Unit Tests Skipped
wojnilowicz requested review of this revision.Mar 7 2018, 6:30 PM
wojnilowicz created this revision.
wojnilowicz added a reviewer: tbaumgart.
tbaumgart requested changes to this revision.Mar 10 2018, 8:01 AM

This does not work as you expect it. You cannot seek on a KGPGFile object. This is never gonna work. Just because you see the base object's seek() method does not mean it will work. Did you ever try it? It crashes with a segmentation fault. This change needs to be abandoned.

/**
  * A class for reading and writing data to/from an
  * encrypted e.g. file.
  *
  * This class presents a QFile based object to the application
  * but reads/writes data from/to the file through an instance of GPG.
  *
  * @code
  *
  *  +------------------+   write  +-----------+      +---------+
  *  |                  |--------->|\          |----->|         |
  *  | Application code |   read   | QFile     |      | gpgme++ |
  *  |                  |<---------|/          |<-----|         |
  *  +------------------+          |  KGPGFile |      +---------+
  *                |               |           |
  *                |        control|           |      +-------+
  *                +-------------->|           |----->|       |
  *                                |           |      | File  |
  *                                |           |----->|       |
  *                                |           |      +-------+
  *                                +-----------+
  * @endcode
  *
  * The @p write interface contains methods as write() and putch(), the @p read
  * interface the methods read(), getch() and ungetch(). The @p control interface
  * special methods only available with KGPGFile e.g. addRecipient(), keyAvailable() and
  * GPGAvailable(). Other, more general methods such as open(), close() and flush() are
  * not shown in the above picture.
  */
This revision now requires changes to proceed.Mar 10 2018, 8:01 AM
wojnilowicz abandoned this revision.Mar 10 2018, 10:04 AM

This does not work as you expect it. You cannot seek on a KGPGFile object. This is never gonna work. Just because you see the base object's seek() method does not mean it will work. Did you ever try it? It crashes with a segmentation fault. This change needs to be abandoned.

I didn't test this patch with KGPGFile. I based my assumption only on what KGPGFile is composed of. I wanted to include this change with the previous patch, but I wasn't sure of it and now I'am sure, that we can't get rid of it. Thanks for the testing and the explanation.