]> git.sur5r.net Git - openldap/commitdiff
Windows64 32/64 silliness
authorHoward Chu <hyc@openldap.org>
Sun, 17 Nov 2013 01:21:48 +0000 (17:21 -0800)
committerHoward Chu <hyc@openldap.org>
Mon, 23 Jun 2014 15:00:11 +0000 (08:00 -0700)
On Windows64, long is the same size as int. Use size_t when we
need an actual 64 bit unsigned long.

include/lutil_meter.h
libraries/liblutil/meter.c
servers/slapd/config.c
servers/slapd/config.h
servers/slapd/slapadd.c

index 790be73d4af20e94b9e40fae1fe82b54b7afb3d3..66105fa06df89714e04cde566d6adb23882ef083 100644 (file)
@@ -49,8 +49,8 @@ typedef struct {
        void * estimator_data;
        double start_time;
        double last_update;
-       unsigned long goal_value;
-       unsigned long last_position;
+       size_t goal_value;
+       size_t last_position;
 } lutil_meter_t;
 
 extern const lutil_meter_display_t lutil_meter_text_display;
@@ -60,10 +60,10 @@ extern int lutil_meter_open (
        lutil_meter_t *lutil_meter,
        const lutil_meter_display_t *display, 
        const lutil_meter_estimator_t *estimator,
-       unsigned long goal_value);
+       size_t goal_value);
 extern int lutil_meter_update (
        lutil_meter_t *lutil_meter,
-       unsigned long position,
+       size_t position,
        int force);
 extern int lutil_meter_close (lutil_meter_t *lutil_meter);
 
index 2bcaea1dcb666e67fde12a55d9c5d68a19ff265d..7b5543c70012b2d489657a39f0b8f55105e01e6c 100644 (file)
@@ -99,7 +99,7 @@ lutil_meter_open (
        lutil_meter_t *meter,
        const lutil_meter_display_t *display, 
        const lutil_meter_estimator_t *estimator,
-       unsigned long goal_value)
+       size_t goal_value)
 {
        int rc;
 
@@ -132,7 +132,7 @@ lutil_meter_open (
 int
 lutil_meter_update (
        lutil_meter_t *meter,
-       unsigned long position,
+       size_t position,
        int force)
 {
        static const double display_rate = 0.5;
index c74b9fc0896ec8895acb6c51d82281e2f866bb53..de7474951bf4c1c5546b89f0d27819ad8b0a51d1 100644 (file)
@@ -267,7 +267,7 @@ int config_check_vals(ConfigTable *Conf, ConfigArgs *c, int check_only ) {
                                break;
                        case ARG_ULONG:
                                assert( c->argc == 2 );
-                               if ( lutil_atoulx( &ularg, c->argv[1], 0 ) != 0 ) {
+                               if ( lutil_atoullx( &ularg, c->argv[1], 0 ) != 0 ) {
                                        snprintf( c->cr_msg, sizeof( c->cr_msg ),
                                                "<%s> unable to parse \"%s\" as unsigned long",
                                                c->argv[0], c->argv[1] );
@@ -379,7 +379,7 @@ int config_set_vals(ConfigTable *Conf, ConfigArgs *c) {
                        case ARG_INT:           *(int*)ptr = c->value_int;                      break;
                        case ARG_UINT:          *(unsigned*)ptr = c->value_uint;                        break;
                        case ARG_LONG:          *(long*)ptr = c->value_long;                    break;
-                       case ARG_ULONG:         *(unsigned long*)ptr = c->value_ulong;                  break;
+                       case ARG_ULONG:         *(size_t*)ptr = c->value_ulong;                 break;
                        case ARG_BER_LEN_T:     *(ber_len_t*)ptr = c->value_ber_t;                      break;
                        case ARG_STRING: {
                                char *cc = *(char**)ptr;
@@ -471,7 +471,7 @@ config_get_vals(ConfigTable *cf, ConfigArgs *c)
                case ARG_INT:   c->value_int = *(int *)ptr; break;
                case ARG_UINT:  c->value_uint = *(unsigned *)ptr; break;
                case ARG_LONG:  c->value_long = *(long *)ptr; break;
-               case ARG_ULONG: c->value_ulong = *(unsigned long *)ptr; break;
+               case ARG_ULONG: c->value_ulong = *(size_t *)ptr; break;
                case ARG_BER_LEN_T:     c->value_ber_t = *(ber_len_t *)ptr; break;
                case ARG_STRING:
                        if ( *(char **)ptr )
@@ -490,7 +490,7 @@ config_get_vals(ConfigTable *cf, ConfigArgs *c)
                case ARG_INT: bv.bv_len = snprintf(bv.bv_val, sizeof( c->log ), "%d", c->value_int); break;
                case ARG_UINT: bv.bv_len = snprintf(bv.bv_val, sizeof( c->log ), "%u", c->value_uint); break;
                case ARG_LONG: bv.bv_len = snprintf(bv.bv_val, sizeof( c->log ), "%ld", c->value_long); break;
-               case ARG_ULONG: bv.bv_len = snprintf(bv.bv_val, sizeof( c->log ), "%lu", c->value_ulong); break;
+               case ARG_ULONG: bv.bv_len = snprintf(bv.bv_val, sizeof( c->log ), "%llu", c->value_ulong); break;
                case ARG_BER_LEN_T: bv.bv_len = snprintf(bv.bv_val, sizeof( c->log ), "%ld", c->value_ber_t); break;
                case ARG_ON_OFF: bv.bv_len = snprintf(bv.bv_val, sizeof( c->log ), "%s",
                        c->value_int ? "TRUE" : "FALSE"); break;
index fc8b4ea49b1d46c44eec93ea3c5f7b14ef7876d3..932aba33e211d0e949a0790c020f1fb882d4d9b7 100644 (file)
@@ -144,7 +144,7 @@ typedef struct config_args_s {
                int v_int;
                unsigned v_uint;
                long v_long;
-               unsigned long v_ulong;
+               size_t v_ulong;
                ber_len_t v_ber_t;
                char *v_string;
                struct berval v_bv;
index 1fbcffa39d8d4ec6ab7e0e8a30bf589c22ffa963..4e93a55f2239db94325b1188561f8a1d2875a1fd 100644 (file)
@@ -114,7 +114,7 @@ again:
 
                if ( enable_meter )
                        lutil_meter_update( &meter,
-                                        ftell( ldiffp->fp ),
+                                        ftello( ldiffp->fp ),
                                         0);
 
                if( e == NULL ) {
@@ -483,7 +483,7 @@ slapadd( int argc, char **argv )
        bvtext.bv_val[0] = '\0';
 
        if ( enable_meter ) {
-               lutil_meter_update( &meter, ftell( ldiffp->fp ), 1);
+               lutil_meter_update( &meter, ftello( ldiffp->fp ), 1);
                lutil_meter_close( &meter );
        }