Commit Graph

64 Commits

Author SHA1 Message Date
Martchus 9f134725c7 Fix handling of non-ASCII characters when resizing file 2023-11-07 23:33:46 +01:00
Martchus 3da25a39a4 Improve documentation of save/write
* Mention std::filesystem::filesystem_error explicitly
* Mention std::runtime_error last as it is the most generic exception type
* Use fully qualified class names
2023-11-07 23:00:33 +01:00
Martchus 1f42f5fffb Truncate file if it became smaller in all cases 2023-11-07 16:18:41 +01:00
Martchus 92d8324cdc Improve condition for use of `pubsetbuf`
Using this function like this seems only be possible with `libstdc++`. The
standard lib of MSVC does not support it as well. So use it only with
`libstdc++`.
2023-02-28 21:01:23 +01:00
Martchus 7bb9134fd3 Avoid unqualified calls to `std::move` 2023-02-18 19:03:29 +01:00
Martchus 98a11787c1 Use constant for additional buffer size used to decrypt/encrypt 2021-12-11 23:51:52 +01:00
Martchus ff7dc8d772 Fix comment 2021-12-11 23:49:29 +01:00
Martchus d1b7187085 Fix shadowing warning 2021-08-22 00:02:29 +02:00
Martchus 9b4fcdc2b3 Fix typos found via `codespell --skip .git -w` 2021-07-03 19:42:20 +02:00
Martchus 5935ea0691 Fix warnings 2021-03-20 21:55:40 +01:00
Martchus f7c6db0132 Use NativeFileStream and actually throw exceptions in export 2020-02-14 17:37:04 +01:00
Marius Kittler b1a55def8b Use consistent order for visibility attribute 2020-01-29 18:31:23 +01:00
Martchus fb8c99b2d4 Don't suppress IO errors when writing files
* Close or flush streams explicitely so writing is not
  deferred
    * to catch errors in the right place
    * to avoid suppressing errors completely when writing
      would be deferred to the destructor invocation
* Improve comments
2019-12-15 19:43:31 +01:00
Marius Kittler 3afa954ebd Fix old namespaces being mentioned in the documentation 2019-09-04 18:47:45 +02:00
Martchus a3d104cf8b Reduce code for flag enum classes 2019-08-14 01:22:33 +02:00
Martchus a1b694a50b Allow creating a new file in PasswordFile::save()
to ease saving a file under a different location
2019-07-03 23:59:07 +02:00
Marius Kittler b6ad06faa2 Do not close file if not opened in PasswordFile::save() 2019-06-25 11:36:47 +02:00
Martchus b323460dbb Adapt to changes in c++utilities 2019-06-10 22:44:29 +02:00
Marius Kittler 0754760b19 Adapt to c++utilities v5 2019-05-04 22:25:14 +02:00
Marius Kittler 1d06d52f18 Add override to ~ParsingException() 2019-02-06 18:02:14 +01:00
Martchus e29457dfd0 Improve const correctness 2018-12-23 18:57:03 +01:00
Martchus a25282b3d1 Make exception c'tors/d'tors non-inline again
Otherwise it is not possible to throw/catch it accross
library boundaries under Android.
2018-12-22 02:47:33 +01:00
Martchus 42f37a1852 Fix warning about implicit conversion 2018-12-22 02:46:55 +01:00
Martchus 4412c62433 Add remark regarding PasswordFile::isEncryptionUsed() 2018-12-22 02:46:24 +01:00
Marius Kittler 35b09d73b2 Allow inlining simple PasswordFile methods 2018-12-21 17:33:05 +01:00
Marius Kittler 70f62bf94a Set open options
Not used yet but maybe useful later
2018-12-21 17:32:31 +01:00
Marius Kittler c04fdd6cc2 Use override 2018-12-21 17:31:50 +01:00
Marius Kittler af5d9147b4 Improve exception constructors 2018-12-21 17:31:24 +01:00
Martchus 2c856e3976 Add statistics 2018-12-21 01:12:53 +01:00
Martchus b9af93adbd Fix |= operator for flags 2018-12-19 00:14:59 +01:00
Martchus 448c5b1a37 Improve reading/writing overall file
* Allow to hash password N times using SHA-256
* Use flags instead of bool parameter
* Expose extended header
* Fix bugs when reading/writing extended headers
* Store password as std::string

Reading files written with previous versions is still
possible. If new features are not used it is also possible
to read new files with previous versions.
2018-12-18 23:17:19 +01:00
Martchus d9edcc4083 Apply clang-format 2018-12-08 19:09:17 +01:00
Martchus ff76846e8b Don't use pubsetbuf() when using libc++
Otherwise the eof bit is set on attempt to read
2018-12-03 00:28:24 +01:00
Martchus 60d8972dcb Improve error handling when loading file
* Handle IO errors when reading internal buffer
* Throw an error when the decompressed or decrypted buffer
  is empty
2018-12-03 00:26:11 +01:00
Martchus 7fd253f895 Read directly from the vector's buffer 2018-09-08 19:50:28 +02:00
Martchus 51442d0b68 Improve coding style in PasswordFile 2018-09-08 19:50:28 +02:00
Martchus e6f66ce932 Fix warnings, improve coding style 2018-09-07 01:14:21 +02:00
Martchus 30a95e2ffc Add a separate write() method to handle file opening manually
Opening the file manually can be useful, eg. when dealing with
Androids storage access framework.
2018-09-07 00:58:40 +02:00
Martchus e265bbe733 Allow to access underlying file stream directly 2018-09-05 00:33:01 +02:00
Martchus 4c6a271eb8 Improve c'tors and d'tors
* Provide move c'tor
* Actually copy the entries and header info
* Remove useless close() in d'tor (should be called anyways)
2018-09-05 00:32:32 +02:00
Martchus f448e34cd8 Use IoUtilities::NativeFileStream in PasswordFile
* Allows to support UTF-8 characters in the path under Windows
* Allows to open a file from existing file descriptor
* Requires c++utilities to be compiled with USE_NATIVE_FILE_BUFFER
  to take effect.
2018-09-05 00:29:36 +02:00
Martchus ed872b0486 Fix typo 2018-09-04 20:24:43 +02:00
Martchus 405afe4e31 Make Field default-constructable 2018-06-13 00:40:16 +02:00
Martchus 69161989ae Fix missing std prefix 2018-06-12 21:49:16 +02:00
Martchus 968e597c24 Support "file://" protocol 2018-06-12 21:47:38 +02:00
Martchus ca9ac4f747 Make include guards more unique and consistent 2018-06-09 22:30:07 +02:00
Martchus 132be3fd8b Fix making labels unique 2018-06-09 22:09:33 +02:00
Martchus 76e5eec85b Add tests for entry classes 2018-06-09 21:44:43 +02:00
Martchus c6dd177799 Fix NodeEntry::replaceChild() to update indices/children correctly 2018-06-09 21:18:13 +02:00
Martchus ba1e58c1e5 Fix NodeEntry::deleteChildren() to update indices correctly 2018-06-09 21:17:50 +02:00