commit 642a7f9: [Minor] Fix some compile issues

Vsevolod Stakhov vsevolod at highsecure.ru
Tue May 26 13:07:07 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-05-26 14:02:29 +0100
URL: https://github.com/rspamd/rspamd/commit/642a7f9a075c5f683d5b62c729317c30b2f5fc83 (HEAD -> master)

[Minor] Fix some compile issues

---
 contrib/google-ced/CMakeLists.txt                     |  7 ++-----
 contrib/google-ced/compact_enc_det.cc                 | 12 ++++++------
 contrib/google-ced/compact_enc_det_generated_tables.h |  2 +-
 src/libmime/mime_encoding.c                           |  1 -
 4 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/contrib/google-ced/CMakeLists.txt b/contrib/google-ced/CMakeLists.txt
index 7fa698da9..668c6352c 100644
--- a/contrib/google-ced/CMakeLists.txt
+++ b/contrib/google-ced/CMakeLists.txt
@@ -10,11 +10,8 @@ set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS 1 CACHE INTERNAL "No dev warnings")
 
 option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
 
-if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-narrowing")
-elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-c++11-narrowing")
-endif()
+
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-narrowing")
 
 include_directories(${CMAKE_CURRENT_SOURCE_DIR})
 
diff --git a/contrib/google-ced/compact_enc_det.cc b/contrib/google-ced/compact_enc_det.cc
index 9f9c3a840..c962b43f2 100644
--- a/contrib/google-ced/compact_enc_det.cc
+++ b/contrib/google-ced/compact_enc_det.cc
@@ -1620,7 +1620,7 @@ int ApplyTldHint(const char* url_tld_hint, int weight,
                            normalized_tld.c_str());
   if (n >= 0) {
     // TLD is four bytes, probability table is ~12 bytes
-    int best_sub = ApplyCompressedProb(&kTLDHintProbs[n].key_prob[kMaxTldKey],
+    int best_sub = ApplyCompressedProb((const char *)&kTLDHintProbs[n].key_prob[kMaxTldKey],
                                        kMaxTldVector, weight, destatep);
     // Never boost ASCII7; do CP1252 instead
     if (best_sub == F_ASCII_7_bit) {best_sub = F_CP1252;}
@@ -1647,7 +1647,7 @@ int ApplyCharsetHint(const char* charset_hint, int weight,
                            normalized_charset.c_str());
   if (n >= 0) {
     // Charset is eight bytes, probability table is ~eight bytes
-    int best_sub = ApplyCompressedProb(&kCharsetHintProbs[n].key_prob[kMaxCharsetKey],
+    int best_sub = ApplyCompressedProb((const char *)&kCharsetHintProbs[n].key_prob[kMaxCharsetKey],
                                        kMaxCharsetVector, weight, destatep);
     // Never boost ASCII7; do CP1252 instead
     if (best_sub == F_ASCII_7_bit) {best_sub = F_CP1252;}
@@ -1858,7 +1858,7 @@ int ApplyUILanguageHint(const Language language_hint,
                            normalized_lang.c_str());
   if (n >= 0) {
     // Language is eight bytes, probability table is ~eight bytes
-    int best_sub = ApplyCompressedProb(&kLangHintProbs[n].key_prob[kMaxLangKey],
+    int best_sub = ApplyCompressedProb((const char *)&kLangHintProbs[n].key_prob[kMaxLangKey],
                                        kMaxLangVector, weight, destatep);
     // Never boost ASCII7; do CP1252 instead
     if (best_sub == F_ASCII_7_bit) {best_sub = F_CP1252;}
@@ -5681,7 +5681,7 @@ Encoding CompactEncDet::TopEncodingOfLangHint(const char* name) {
 
   // Charset is eight bytes, probability table is eight bytes
   int toprankenc =
-    TopCompressedProb(&kLangHintProbs[n].key_prob[kMaxLangKey],
+    TopCompressedProb((const char *)&kLangHintProbs[n].key_prob[kMaxLangKey],
                       kMaxLangVector);
   return kMapToEncoding[toprankenc];
 }
@@ -5695,7 +5695,7 @@ Encoding CompactEncDet::TopEncodingOfTLDHint(const char* name) {
 
   // TLD is four bytes, probability table is 12 bytes
   int toprankenc =
-    TopCompressedProb(&kTLDHintProbs[n].key_prob[kMaxTldKey],
+    TopCompressedProb((const char *)&kTLDHintProbs[n].key_prob[kMaxTldKey],
                       kMaxTldVector);
   return kMapToEncoding[toprankenc];
 }
@@ -5709,7 +5709,7 @@ Encoding CompactEncDet::TopEncodingOfCharsetHint(const char* name) {
 
   // Charset is eight bytes, probability table is eight bytes
   int toprankenc =
-    TopCompressedProb(&kCharsetHintProbs[n].key_prob[kMaxCharsetKey],
+    TopCompressedProb((const char *)&kCharsetHintProbs[n].key_prob[kMaxCharsetKey],
                       kMaxCharsetVector);
   return kMapToEncoding[toprankenc];
 }
diff --git a/contrib/google-ced/compact_enc_det_generated_tables.h b/contrib/google-ced/compact_enc_det_generated_tables.h
index bd5317a0d..d2174a1b6 100644
--- a/contrib/google-ced/compact_enc_det_generated_tables.h
+++ b/contrib/google-ced/compact_enc_det_generated_tables.h
@@ -165,7 +165,7 @@ static const Encoding kMapToEncoding[NUM_RANKEDENCODING] = {
 
 // Massaged TLD or charset, followed by packed encoding probs
 typedef struct {
-  char key_prob[20];
+  unsigned char key_prob[20];
 } HintEntry;
 
 static const HintEntry kLangHintProbs[] = {	// MaxRange 192
diff --git a/src/libmime/mime_encoding.c b/src/libmime/mime_encoding.c
index 8e7e54356..e97c390b8 100644
--- a/src/libmime/mime_encoding.c
+++ b/src/libmime/mime_encoding.c
@@ -25,7 +25,6 @@
 #include "contrib/fastutf8/fastutf8.h"
 #include "contrib/google-ced/ced_c.h"
 #include <unicode/ucnv.h>
-#include <unicode/ucsdet.h>
 #if U_ICU_VERSION_MAJOR_NUM >= 44
 #include <unicode/unorm2.h>
 #endif


More information about the Commits mailing list