Commit 155bdfb4 authored by Albert Astals Cid's avatar Albert Astals Cid

Fix linking of kdecore

Without this I get

CMakeFiles/KF5Codecs.dir/kcharsets.cpp.o: In function KCharsets::fromEntity(QString const&)': kcharsets.cpp:(.text+0x5cf): undefined reference tokde_findEntity'

Use gperf C++ generated code instead of C

See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=41194 for more info

REVIEW: 128750
parent ba77ceb1
......@@ -21,7 +21,7 @@
#include "kcharsets.h"
#include "kfilterdev.h"
#include "kentities.c"
#include "kentities.cc"
#include "kconfig.h"
#include "kdebug.h"
......@@ -524,7 +524,7 @@ QChar KCharsets::fromEntity(const QString &str)
}
const QByteArray raw ( str.toLatin1() );
const entity *e = kde_findEntity( raw, raw.length() );
const entity *e = Perfect_Hash::kde_findEntity( raw, raw.length() );
if(!e)
{
......
/* ANSI-C code produced by gperf version 3.0.3 */
/* Command-line: gperf -a -L ANSI-C -E -C -c -o -t -k '*' -Nkde_findEntity -D -Hhash_Entity -Wwordlist_Entity -s 2 kentities.gperf */
/* C++ code produced by gperf version 3.0.4 */
/* Command-line: gperf -a -L C++ -E -C -c -o -t -k '*' -Nkde_findEntity -D -Hhash_Entity -Wwordlist_Entity -s 2 kentities.gperf */
#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
&& ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
......@@ -63,15 +63,16 @@ struct entity {
};
/* maximum key range = 1134, duplicates = 0 */
#ifdef __GNUC__
__inline
#else
#ifdef __cplusplus
inline
#endif
#endif
static unsigned int
hash_Entity (register const char *str, register unsigned int len)
class Perfect_Hash
{
private:
static inline unsigned int hash_Entity (const char *str, unsigned int len);
public:
static const struct entity *kde_findEntity (const char *str, unsigned int len);
};
inline unsigned int
Perfect_Hash::hash_Entity (register const char *str, register unsigned int len)
{
static const unsigned short asso_values[] =
{
......@@ -134,14 +135,8 @@ hash_Entity (register const char *str, register unsigned int len)
return hval;
}
#ifdef __GNUC__
__inline
#ifdef __GNUC_STDC_INLINE__
__attribute__ ((__gnu_inline__))
#endif
#endif
const struct entity *
kde_findEntity (register const char *str, register unsigned int len)
Perfect_Hash::kde_findEntity (register const char *str, register unsigned int len)
{
enum
{
......
......@@ -22,7 +22,7 @@
kentities.gperf: input file to generate a hash table for entities
kentities.c: DO NOT EDIT! generated by the command
"gperf -a -L ANSI-C -E -C -c -o -t -k '*' -Nkde_findEntity -D -Hhash_Entity -Wwordlist_Entity -s 2 kentities.gperf > kentities.c"
"gperf -a -L C++ -E -C -c -o -t -k '*' -Nkde_findEntity -D -Hhash_Entity -Wwordlist_Entity -s 2 kentities.gperf > kentities.cc"
from kentities.gperf
*/
%}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment