[PATCH] KEncodingProber fixes

Peter Oberndorfer kumbayo84 at arcor.de
Sat Mar 21 20:10:23 GMT 2009

Actually return the values detected by unicodeTest().
Make the old deprecated encodingName() method still return values.
The new encoding method is preferred since it does not leak memory.

Fix a memory leak in setProberType
Rename encodingNameByteArray() to encoding() as suggested
Remove a unused #define
Add some unit tests

thanks to Jeff Mitchell for parts of the patch

This is my work in progress for today.
This makes the unicodeTest() function useful again.
I plan to continue tomorrow, and to add some more testcases,
test if things still work properly without a BOM.
And finally if everything is OK, and everybody agrees, commit the patch.
I might need some help backporing it.

 kate/document/katebuffer.cpp             |    2 +-
 kdecore/localization/kencodingprober.cpp |   30 ++++---
 kdecore/localization/kencodingprober.h   |    4 +-
 kdecore/tests/CMakeLists.txt             |    1 +
 kdecore/tests/kencodingprobertest.cpp    |  126 ++++++++++++++++++++++++++++++
 kdecore/tests/kencodingprobertest.h      |   36 +++++++++
 6 files changed, 184 insertions(+), 15 deletions(-)
 create mode 100644 kdecore/tests/kencodingprobertest.cpp
 create mode 100644 kdecore/tests/kencodingprobertest.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 82f2e582de7e0a21632a14421330a18f670874bc.diff
Type: text/x-diff
Size: 10710 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20090321/773a0954/attachment.diff>

More information about the kde-core-devel mailing list