]> git.lyx.org Git - lyx.git/commitdiff
Mythes: fix -Wsign-compare warning
authorJuergen Spitzmueller <spitz@lyx.org>
Sat, 12 Aug 2017 08:43:21 +0000 (10:43 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Sat, 12 Aug 2017 08:43:21 +0000 (10:43 +0200)
Will also urge to get this into upstream

3rdparty/mythes/1.2.5/mythes.cxx

index ecf526edf5c09078d4fe5639425c549a5cce2fb8..b03799f6ea4e2b7f6e94620a69b9021cc86fcc3c 100644 (file)
@@ -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<int>::max() / sizeof(char*)) {
+    // spitz: fix -Wsign-compare warning
+    if (idxsz <= 0 || static_cast<unsigned int>(idxsz) > std::numeric_limits<int>::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<int>::max() / sizeof(mentry))
+    // spitz: fix -Wsign-compare warning
+    if (nmeanings < 0 || static_cast<unsigned int>(nmeanings) > std::numeric_limits<int>::max() / sizeof(mentry))
         nmeanings = 0;
     *pme = (mentry*)(nmeanings ? malloc(nmeanings * sizeof(mentry)) : NULL);
     if (!(*pme)) {