]> source.dussan.org Git - rspamd.git/commitdiff
Pack fuzzy commands.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 22 Dec 2014 13:25:12 +0000 (13:25 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 22 Dec 2014 13:25:12 +0000 (13:25 +0000)
config.h.in
src/fuzzy_storage.h

index 158140c9cc23ca0d756b487cc51b03df7872fa91..a699739de0f0655cf44c1617168767ef007786ba 100644 (file)
  # error "Undefined or unknown BYTE_ORDER"
  #endif
  
+#ifdef _MSC_VER
+# define RSPAMD_PACKED(name) \
+    __pragma(pack(push, 1)) struct name __pragma(pack(pop))
+#elif defined(__GNUC__)
+# define RSPAMD_PACKED(name) struct __attribute__((packed)) name
+#else
+# define RSPAMD_PACKED(name)
+#endif
 
 
 #cmakedefine HAVE_SYS_QUEUE_H    1
index 1d1b05edbd0387efcb1d3e421e3c42b279520d45..93488914d461349eebcccd3f8061ac65ffe903d5 100644 (file)
@@ -21,24 +21,26 @@ struct legacy_fuzzy_cmd {
        u_char hash[FUZZY_HASHLEN];
 };
 
-struct rspamd_fuzzy_cmd {
+RSPAMD_PACKED(rspamd_fuzzy_cmd) {
        guint8 version;
        guint8 cmd;
        guint8 shingles_count;
        guint8 flag;
        gint32 value;
+       guint32 tag;
        gchar digest[64];
 };
 
-struct rspamd_fuzzy_shingle_cmd {
+RSPAMD_PACKED(rspamd_fuzzy_shingle_cmd) {
        struct rspamd_fuzzy_cmd basic;
        struct rspamd_shingle sgl;
 };
 
-struct rspamd_fuzzy_reply {
+RSPAMD_PACKED(rspamd_fuzzy_reply) {
        guint32 value;
        guint32 flag;
-       gdouble prob;
+       guint32 tag;
+       float prob;
 };
 
 #endif