From 8c2e5bfc2065d2d320109c0bbd749cd608e4bf6a Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Sat, 12 Aug 2017 10:43:21 +0200 Subject: [PATCH] Mythes: fix -Wsign-compare warning Will also urge to get this into upstream --- 3rdparty/mythes/1.2.5/mythes.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/3rdparty/mythes/1.2.5/mythes.cxx b/3rdparty/mythes/1.2.5/mythes.cxx index ecf526edf5..b03799f6ea 100644 --- a/3rdparty/mythes/1.2.5/mythes.cxx +++ b/3rdparty/mythes/1.2.5/mythes.cxx @@ -48,7 +48,8 @@ int MyThes::thInitialize(const char* idxpath, const char* datpath) readLine(pifile,wrd,MAX_WD_LEN); int idxsz = atoi(wrd); - if (idxsz <= 0 || idxsz > std::numeric_limits::max() / sizeof(char*)) { + // spitz: fix -Wsign-compare warning + if (idxsz <= 0 || static_cast(idxsz) > std::numeric_limits::max() / sizeof(char*)) { fprintf(stderr,"Error - bad index %d\n", idxsz); fclose(pifile); return 0; @@ -176,7 +177,8 @@ int MyThes::Lookup(const char * pText, int len, mentry** pme) return 0; } int nmeanings = atoi(buf+np+1); - if (nmeanings < 0 || nmeanings > std::numeric_limits::max() / sizeof(mentry)) + // spitz: fix -Wsign-compare warning + if (nmeanings < 0 || static_cast(nmeanings) > std::numeric_limits::max() / sizeof(mentry)) nmeanings = 0; *pme = (mentry*)(nmeanings ? malloc(nmeanings * sizeof(mentry)) : NULL); if (!(*pme)) {