Hello,

I am sending a patch for this package.
This was already suggested by vincentbernat upstream.

With this patch package was successfully built on mips, mipsel, i386.

I have changed a type of str_hash in  file src/ha_pinba.cc 

--- pinba-engine-mysql-1.1.0.orig/src/ha_pinba.cc
+++ pinba-engine-mysql-1.1.0/src/ha_pinba.cc
@@ -2680,7 +2680,7 @@ int ha_pinba::read_next_row(unsigned cha
                                PPvoid_t ppvalue;
                                char name[PINBA_MAX_LINE_LEN] = {0};
                                pinba_tag *tag;
-                               uint64_t str_hash;
+                               Word_t str_hash;

                                str_hash = this_index[active_index].ival;

loking at a  pinba-engine-mysql-1.1.0/src/ha_pinba.h one can notice that ival 
is of type size_t:

typedef struct pinba_index_st { /* {{{ */
        union {
                size_t ival;
                struct {
                        unsigned char *val;
                        uint len;
                } str;
        };
        struct {
                unsigned char *val;
                uint len;
        } subindex;
        size_t position;
} pinba_index_st;
/* }}} */

However if we replace "uint64_t str_hash;" with "size_t str_hash;" on 32bit 
archs we have following problem:
ha_pinba.cc:2687:59: error: invalid conversion from 'size_t* {aka unsigned 
int*}' to 'Word_t* {aka long unsigned int*}' [-fpermissive]

Taking a look at a Word_t one can find that:
A Word_t is a typedef unsigned long int in Judy.h and must be the same size as 
sizeof(void *) I.E. a pointer.

Same size as size_t but on 32bit one is "unsigned int" (size_t) and the other 
"long unsigned int" (Word_t)
While on 64bit they are both "long unsigned int".

Taking this into consideration i have proposed a patch that i think it is safer 
than one proposed upstream, which will probably fail during run-time on 
big-endian:
https://github.com/tony2001/pinba_engine/issues/40

Please include this patch.


Regards,
Jurica Stanojkovic





--- pinba-engine-mysql-1.1.0.orig/src/ha_pinba.cc
+++ pinba-engine-mysql-1.1.0/src/ha_pinba.cc
@@ -2680,7 +2680,7 @@ int ha_pinba::read_next_row(unsigned cha
 				PPvoid_t ppvalue;
 				char name[PINBA_MAX_LINE_LEN] = {0};
 				pinba_tag *tag;
-				uint64_t str_hash;
+				Word_t str_hash;
 
 				str_hash = this_index[active_index].ival;
 

Reply via email to