[Kde-pim] Review Request 121047: KCodecs: add MIME codecs, improve {encode, decode}RFC2047String()
David Faure
faure at kde.org
Sun Nov 16 21:05:22 GMT 2014
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/121047/#review70478
-----------------------------------------------------------
autotests/CMakeLists.txt
<https://git.reviewboard.kde.org/r/121047/#comment49287>
The more robust (and new in Qt5) way of doing this is QFINDTESTDATA in the test code.
autotests/base64benchmark.cpp
<https://git.reviewboard.kde.org/r/121047/#comment49288>
should be static, it doesn't use any members
autotests/base64benchmark.cpp
<https://git.reviewboard.kde.org/r/121047/#comment49289>
could use reserve(size) for speed
autotests/rfc2047test.cpp
<https://git.reviewboard.kde.org/r/121047/#comment49290>
src/kcodecs.h
<https://git.reviewboard.kde.org/r/121047/#comment49293>
missing space after first comma.
(I would remove the second comma)
src/kcodecs.h
<https://git.reviewboard.kde.org/r/121047/#comment49294>
missing space after first comma.
(I would remove the second comma)
src/kcodecs.h
<https://git.reviewboard.kde.org/r/121047/#comment49295>
The Qt way to do this is to take a pointer, rather than a non-const ref. It makes things clearer when reading the calling code.
src/kcodecs.h
<https://git.reviewboard.kde.org/r/121047/#comment49292>
@since 5.5, in all new methods
src/kcodecs.h
<https://git.reviewboard.kde.org/r/121047/#comment49296>
The Qt way would be to use an enum rather than a bool, again to make the calling code more readable.
src/kcodecs.h
<https://git.reviewboard.kde.org/r/121047/#comment49297>
I doubt this whole comment will be picked up by doxygen, it doesn't seem to document anything in particular...
Also, this particular line reads very strangely...
src/kcodecs.h
<https://git.reviewboard.kde.org/r/121047/#comment49298>
Any reason to use protected instead of private here?
And then, if private, the two static things should be file-static instead (no need to pollute the header)
src/kcodecs.h
<https://git.reviewboard.kde.org/r/121047/#comment49299>
typo, Constructs
src/kcodecs.h
<https://git.reviewboard.kde.org/r/121047/#comment49300>
this "withCRLF" everywhere is definitely worth an enum
src/kcodecs.h
<https://git.reviewboard.kde.org/r/121047/#comment49301>
please port the documentation to the new namespace. Grep for KMime everywhere...
src/kcodecs.h
<https://git.reviewboard.kde.org/r/121047/#comment49302>
kFatal is deprecated
src/kcodecs.h
<https://git.reviewboard.kde.org/r/121047/#comment49303>
move to cpp
src/kcodecs.h
<https://git.reviewboard.kde.org/r/121047/#comment49304>
That is brief indeed :-)
(merge with next line)
src/kcodecs.h
<https://git.reviewboard.kde.org/r/121047/#comment49305>
move all 3 members to a d pointer, if this class should indeed be public.
src/kcodecs.cpp
<https://git.reviewboard.kde.org/r/121047/#comment49307>
These qDebugs should be commented out, or converted to qCDebug with a default to off.
No point in spamming users for data conversion errors, Qt definitely doesn't do that.
src/kcodecs.cpp
<https://git.reviewboard.kde.org/r/121047/#comment49308>
Always use QMutexLocker instead.
src/kcodecs.cpp
<https://git.reviewboard.kde.org/r/121047/#comment49309>
Yes, it does. Use value() instead.
src/kcodecs.cpp
<https://git.reviewboard.kde.org/r/121047/#comment49310>
This could be a qWarning (programmer error).
src/kcodecs.cpp
<https://git.reviewboard.kde.org/r/121047/#comment49311>
QScopedPointer would remove the need for all the "delete dec" statement in all 3 return paths.
src/kcodecsbase64.h
<https://git.reviewboard.kde.org/r/121047/#comment49314>
Does this class actually need to be exported?
Isn't it enough to let apps find codecs by name, just like in Qt?
This removes the need for exporting all the codec implementation classes.
src/kcodecsbase64.h
<https://git.reviewboard.kde.org/r/121047/#comment49313>
What a weird codec name??
- David Faure
On Nov. 14, 2014, 12:41 p.m., Daniel Vrátil wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/121047/
> -----------------------------------------------------------
>
> (Updated Nov. 14, 2014, 12:41 p.m.)
>
>
> Review request for KDE Frameworks, KDEPIM-Libraries and David Faure.
>
>
> Repository: kcodecs
>
>
> Description
> -------
>
> KCodecs currently provides only decodeRFC2047String(), and even that has a comment saying "more robust implementation available in KMime". This patch makes KCodecs::decodeRFC2047String() use the "more robust" implementation from KMime, and adds KCodecs::encodeRFC2047String() counterpart - also using implementation from KMime.
>
> Since KMime also provides codecs implementing various MIME encodings (quoted-printable, base64, uuencode), and the KMmime implementation of decodeRFC2047String() depends on them, I also brought over all the MIME codecs, and make use of them in all the KCodecs static methods. I believe that having a proper and more robust implementation available in a more generic framework like KCodecs is better, than if it was hidden in the KMime framework. As a result, we can make KMime framework to use KCodecs (it already depends on it anyway) for all the encodings, and only leave classes for storing and parsing the "high-level" message/rfc822 messages, and headers. It also reduces code duplication, and makes all applications use the same encode/decode implementations (which is cool, right? :-))
>
> The main reason for this move is that I'm trying to move over to KCodecs one small class from KPimUtils framework in kdepimlibs (which is our universal dumping ground in kdepimlibs that I'm trying to get rid of) for generic email address validation, but it depends on proper implementations of encode/decodeRFC2047String methods, so I ended up moving all this stuff :-) The tiny Email class is not part of this review though, I'll wait for this to get in, then post another review. I believe that this is a rather useful tool that could find wide adoption outside PIM, therefor I decided not to move it from KPimUtils to KMime, but instead move all the interesting, and multi-purpose parts from KMime into KCodecs.
>
> I also moved over related KMime unit-tests (that's why the review is so big).
>
>
> Diffs
> -----
>
> autotests/data/codec_q/all-encoded-decode.q PRE-CREATION
> autotests/data/codec_q/all-encoded-decode.q.expected PRE-CREATION
> autotests/data/codec_q/basic-encode PRE-CREATION
> autotests/data/codec_q/basic-encode.expected PRE-CREATION
> autotests/data/codec_q/null-decode.q PRE-CREATION
> autotests/data/codec_q/null-decode.q.expected PRE-CREATION
> autotests/data/codec_q/null-encode PRE-CREATION
> autotests/data/codec_q/null-encode.expected PRE-CREATION
> autotests/data/codec_quoted-printable/basic-decode.quoted-printable PRE-CREATION
> autotests/data/codec_quoted-printable/basic-decode.quoted-printable.expected PRE-CREATION
> autotests/data/codec_quoted-printable/basic-encode PRE-CREATION
> autotests/data/codec_quoted-printable/basic-encode.expected PRE-CREATION
> autotests/data/codec_quoted-printable/corrupt.quoted-printable PRE-CREATION
> autotests/data/codec_quoted-printable/corrupt.quoted-printable.expected PRE-CREATION
> autotests/data/codec_quoted-printable/corrupt2.quoted-printable PRE-CREATION
> autotests/data/codec_quoted-printable/corrupt2.quoted-printable.expected PRE-CREATION
> autotests/data/codec_quoted-printable/corrupt3.quoted-printable PRE-CREATION
> autotests/data/codec_quoted-printable/corrupt3.quoted-printable.expected PRE-CREATION
> autotests/data/codec_quoted-printable/corrupt4.quoted-printable PRE-CREATION
> autotests/data/codec_quoted-printable/corrupt4.quoted-printable.expected PRE-CREATION
> autotests/data/codec_quoted-printable/wrap-encode PRE-CREATION
> autotests/data/codec_quoted-printable/wrap-encode.expected PRE-CREATION
> autotests/data/codec_x-kmime-rfc2231/all-encoded.x-kmime-rfc2231-decode PRE-CREATION
> autotests/data/codec_x-kmime-rfc2231/all-encoded.x-kmime-rfc2231-decode.expected PRE-CREATION
> autotests/data/codec_x-kmime-rfc2231/basic-encode PRE-CREATION
> autotests/data/codec_x-kmime-rfc2231/basic-encode.expected PRE-CREATION
> autotests/data/codec_x-kmime-rfc2231/null-decode.x-kmime-rfc2231 PRE-CREATION
> autotests/CMakeLists.txt 4c41ba2
> autotests/base64benchmark.cpp PRE-CREATION
> autotests/codectest.h PRE-CREATION
> autotests/codectest.cpp PRE-CREATION
> autotests/data/codec_b/basic-decode.b PRE-CREATION
> autotests/data/codec_b/basic-decode.b.expected PRE-CREATION
> autotests/data/codec_b/basic-encode PRE-CREATION
> autotests/data/codec_b/basic-encode.expected PRE-CREATION
> autotests/data/codec_b/null-decode.b PRE-CREATION
> autotests/data/codec_b/null-decode.b.expected PRE-CREATION
> autotests/data/codec_b/null-encode PRE-CREATION
> autotests/data/codec_b/null-encode.expected PRE-CREATION
> autotests/data/codec_b/padding0-encode PRE-CREATION
> autotests/data/codec_b/padding0-encode.expected PRE-CREATION
> autotests/data/codec_b/padding1-encode PRE-CREATION
> autotests/data/codec_b/padding1-encode.expected PRE-CREATION
> autotests/data/codec_b/padding2-encode PRE-CREATION
> autotests/data/codec_b/padding2-encode.expected PRE-CREATION
> autotests/data/codec_base64/basic-decode.base64 PRE-CREATION
> autotests/data/codec_base64/basic-decode.base64.expected PRE-CREATION
> autotests/data/codec_base64/basic-encode PRE-CREATION
> autotests/data/codec_base64/basic-encode.expected PRE-CREATION
> autotests/data/codec_base64/corrupt.base64 PRE-CREATION
> autotests/data/codec_base64/corrupt.base64.expected PRE-CREATION
> autotests/data/codec_base64/very_small-encode PRE-CREATION
> autotests/data/codec_base64/very_small-encode.expected PRE-CREATION
> autotests/data/codec_x-kmime-rfc2231/null-decode.x-kmime-rfc2231.expected PRE-CREATION
> autotests/data/codec_x-kmime-rfc2231/null-encode PRE-CREATION
> autotests/data/codec_x-kmime-rfc2231/null-encode.expected PRE-CREATION
> autotests/data/codec_x-uuencode/basic-decode.x-uuencode PRE-CREATION
> autotests/data/codec_x-uuencode/basic-decode.x-uuencode.expected PRE-CREATION
> autotests/kcodecstest.h PRE-CREATION
> autotests/kcodecstest.cpp PRE-CREATION
> autotests/rfc2047test.h PRE-CREATION
> autotests/rfc2047test.cpp PRE-CREATION
> src/CMakeLists.txt adc0f2a
> src/kcodecs.h 48effbb
> src/kcodecs.cpp 4fd660d
> src/kcodecsbase64.h PRE-CREATION
> src/kcodecsbase64.cpp PRE-CREATION
> src/kcodecsidentity.h PRE-CREATION
> src/kcodecsidentity.cpp PRE-CREATION
> src/kcodecsqp.h PRE-CREATION
> src/kcodecsqp.cpp PRE-CREATION
> src/kcodecsuuencode.h PRE-CREATION
> src/kcodecsuuencode.cpp PRE-CREATION
>
> Diff: https://git.reviewboard.kde.org/r/121047/diff/
>
>
> Testing
> -------
>
> Builds, all unit-tests pass.
>
>
> Thanks,
>
> Daniel Vrátil
>
>
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/
More information about the kde-pim
mailing list