[Olsr-dev] [PATCH v1 02/12] Makefile: WARNINGS: add -Wdouble-promotion

Henning Rogge (spam-protected)
Tue May 29 21:19:43 CEST 2012


Who the hell decided that printf() should not support float? crazy...

With this fact, the patch makes sense.

Henning

On Tue, May 29, 2012 at 9:16 PM, Ferry Huberts <(spam-protected)> wrote:
>
>
> On 29-05-12 20:58, Henning Rogge wrote:
>>
>> Why not convert all constants into float instead of converting the
>> variables to double?
>
>
> I did so, but printf (and alike) functions treat float as double
>
>>
>> Henning
>>
>> On Tue, May 29, 2012 at 3:59 PM, Ferry Huberts<(spam-protected)>  wrote:
>>>
>>> From: Ferry Huberts<(spam-protected)>
>>>
>>> -Wdouble-promotion (C, C++, Objective-C and Objective-C++ only)
>>>   Give a warning when a value of type "float" is implicitly promoted to
>>>   "double".  CPUs with a 32-bit "single-precision" floating-point unit
>>>   implement "float" in hardware, but emulate "double" in software.  On
>>>   such a machine, doing computations using "double" values is much more
>>>   expensive because of the overhead required for software emulation.
>>>
>>>   It is easy to accidentally do computations with "double" because
>>>   floating-point literals are implicitly of type "double".
>>>   For example, in:
>>>
>>>           float area(float radius)
>>>           {
>>>              return 3.14159 * radius * radius;
>>>           }
>>>
>>>   the compiler will perform the entire computation with "double"
>>>   because the floating-point literal is a "double".
>>>
>>> Signed-off-by: Ferry Huberts<(spam-protected)>
>>> ---
>>>  Makefile.inc                       |    1 +
>>>  lib/bmf/src/NetworkInterfaces.c    |    2 +-
>>>  lib/httpinfo/src/admin_interface.c |   10 ++--
>>>  lib/httpinfo/src/olsrd_httpinfo.c  |   14 +++---
>>>  lib/jsoninfo/src/olsrd_jsoninfo.c  |    2 +-
>>>  lib/nameservice/src/mapwrite.c     |    2 +-
>>>  lib/nameservice/src/nameservice.c  |    8 ++--
>>>  lib/tas/src/plugin.c               |    4 +-
>>>  src/cfgparser/cfgfile_gen.c        |   46 +++++++++---------
>>>  src/cfgparser/olsrd_conf.c         |   88
>>> ++++++++++++++++++------------------
>>>  src/cfgparser/oparse.y             |   34 +++++++-------
>>>  src/hysteresis.c                   |    4 +-
>>>  src/link_set.c                     |    4 +-
>>>  src/lq_plugin_default_ffeth.c      |    2 +-
>>>  src/lq_plugin_default_float.c      |   16 +++---
>>>  src/lq_plugin_default_fpm.c        |    6 +-
>>>  src/main.c                         |   12 +++---
>>>  src/scheduler.c                    |    2 +-
>>>  18 files changed, 129 insertions(+), 128 deletions(-)
>>>
>>> diff --git a/Makefile.inc b/Makefile.inc
>>> index b45b4f7..eb0f4d9 100644
>>> --- a/Makefile.inc
>>> +++ b/Makefile.inc
>>> @@ -89,6 +89,7 @@ WARNINGS +=   -Wshadow
>>>  WARNINGS +=    -Wformat
>>>  WARNINGS +=    -Wsequence-point
>>>  WARNINGS +=    -Wcast-align
>>> +WARNINGS +=    -Wdouble-promotion
>>>  # the following 2 do not work yet and need more work on it
>>>  #WARNINGS +=   -Wconversion
>>>  #WARNINGS +=   -Wredundant-decls
>>> diff --git a/lib/bmf/src/NetworkInterfaces.c
>>> b/lib/bmf/src/NetworkInterfaces.c
>>> index 937862f..548c0f7 100644
>>> --- a/lib/bmf/src/NetworkInterfaces.c
>>> +++ b/lib/bmf/src/NetworkInterfaces.c
>>> @@ -804,7 +804,7 @@ void FindNeighbors(
>>>         "%s: ---->  forwarding pkt to %s will cost ETX %5.2f\n",
>>>         PLUGIN_NAME_SHORT,
>>>         olsr_ip_to_string(&buf,&walker->neighbor_iface_addr),
>>>
>>> -        currEtx);
>>> +        (double)currEtx);
>>>
>>>       /* If the candidate neighbor is best reached via another interface,
>>> then skip
>>>        * the candidate neighbor; the candidate neighbor has been / will
>>> be selected via that
>>> diff --git a/lib/httpinfo/src/admin_interface.c
>>> b/lib/httpinfo/src/admin_interface.c
>>> index abd55f5..dd88fe2 100644
>>> --- a/lib/httpinfo/src/admin_interface.c
>>> +++ b/lib/httpinfo/src/admin_interface.c
>>> @@ -93,7 +93,7 @@ build_admin_body(char *buf, uint32_t bufsize
>>> __attribute__ ((unused)))
>>>   size += snprintf(&buf[size], bufsize - size, "<tr>\n");
>>>
>>>   size += snprintf(&buf[size], bufsize - size, admin_basic_setting_int,
>>> "Debug level:", "debug_level", 2, olsr_cnf->debug_level);
>>> -  size += snprintf(&buf[size], bufsize - size,
>>> admin_basic_setting_float, "Pollrate:", "pollrate", 4, olsr_cnf->pollrate);
>>> +  size += snprintf(&buf[size], bufsize - size,
>>> admin_basic_setting_float, "Pollrate:", "pollrate", 4,
>>> (double)olsr_cnf->pollrate);
>>>   size += snprintf(&buf[size], bufsize - size,
>>> admin_basic_setting_string, "TOS:", "tos", 6, "TBD");
>>>
>>>   size += snprintf(&buf[size], bufsize - size, "</tr>\n" "<tr>\n");
>>> @@ -108,14 +108,14 @@ build_admin_body(char *buf, uint32_t bufsize
>>> __attribute__ ((unused)))
>>>   if (olsr_cnf->use_hysteresis) {
>>>     size +=
>>>       snprintf(&buf[size], bufsize - size, admin_basic_setting_float,
>>> "Hyst scaling:", "hyst_scaling", 4,
>>> -               olsr_cnf->hysteresis_param.scaling);
>>> +                 (double)olsr_cnf->hysteresis_param.scaling);
>>>
>>>     size +=
>>>       snprintf(&buf[size], bufsize - size, admin_basic_setting_float,
>>> "Lower thr:", "hyst_lower", 4,
>>> -               olsr_cnf->hysteresis_param.thr_low);
>>> +                 (double)olsr_cnf->hysteresis_param.thr_low);
>>>     size +=
>>>       snprintf(&buf[size], bufsize - size, admin_basic_setting_float,
>>> "Upper thr:", "hyst_upper", 4,
>>> -               olsr_cnf->hysteresis_param.thr_high);
>>> +                 (double)olsr_cnf->hysteresis_param.thr_high);
>>>   } else {
>>>     size += snprintf(&buf[size], bufsize - size, "<td>Hysteresis
>>> disabled</td>\n");
>>>   }
>>> @@ -124,7 +124,7 @@ build_admin_body(char *buf, uint32_t bufsize
>>> __attribute__ ((unused)))
>>>
>>>   if (olsr_cnf->lq_level) {
>>>     size += snprintf(&buf[size], bufsize - size, admin_basic_setting_int,
>>> "LQ level:", "lq_level", 1, olsr_cnf->lq_level);
>>> -    size += snprintf(&buf[size], bufsize - size,
>>> admin_basic_setting_float, "LQ aging:", "lq_aging", 2, olsr_cnf->lq_aging);
>>> +    size += snprintf(&buf[size], bufsize - size,
>>> admin_basic_setting_float, "LQ aging:", "lq_aging", 2,
>>> (double)olsr_cnf->lq_aging);
>>>   } else {
>>>     size += snprintf(&buf[size], bufsize - size, "<td>LQ
>>> disabled</td>\n");
>>>   }
>>> diff --git a/lib/httpinfo/src/olsrd_httpinfo.c
>>> b/lib/httpinfo/src/olsrd_httpinfo.c
>>> index c87e1e1..456d533 100644
>>> --- a/lib/httpinfo/src/olsrd_httpinfo.c
>>> +++ b/lib/httpinfo/src/olsrd_httpinfo.c
>>> @@ -865,10 +865,10 @@ build_config_body(struct autobuf *abuf)
>>>
>>>   abuf_puts(abuf, "</tr>\n<tr>\n");
>>>
>>> -  abuf_appendf(abuf, "<td>Pollrate: %0.2f</td>\n", olsr_cnf->pollrate);
>>> +  abuf_appendf(abuf, "<td>Pollrate: %0.2f</td>\n",
>>> (double)olsr_cnf->pollrate);
>>>   abuf_appendf(abuf, "<td>TC redundancy: %d</td>\n",
>>> olsr_cnf->tc_redundancy);
>>>   abuf_appendf(abuf, "<td>MPR coverage: %d</td>\n",
>>> olsr_cnf->mpr_coverage);
>>> -  abuf_appendf(abuf, "<td>NAT threshold: %f</td>\n",
>>> olsr_cnf->lq_nat_thresh);
>>> +  abuf_appendf(abuf, "<td>NAT threshold: %f</td>\n",
>>> (double)olsr_cnf->lq_nat_thresh);
>>>
>>>   abuf_puts(abuf, "</tr>\n<tr>\n");
>>>
>>> @@ -886,9 +886,9 @@ build_config_body(struct autobuf *abuf)
>>>     abuf_appendf(abuf, "</tr>\n<tr>\n" "<td>Hysteresis: %s</td>\n",
>>>                olsr_cnf->use_hysteresis ? "Enabled" : "Disabled");
>>>     if (olsr_cnf->use_hysteresis) {
>>> -      abuf_appendf(abuf, "<td>Hyst scaling: %0.2f</td>\n",
>>> olsr_cnf->hysteresis_param.scaling);
>>> -      abuf_appendf(abuf, "<td>Hyst lower/upper: %0.2f/%0.2f</td>\n",
>>> olsr_cnf->hysteresis_param.thr_low,
>>> -                 olsr_cnf->hysteresis_param.thr_high);
>>> +      abuf_appendf(abuf, "<td>Hyst scaling: %0.2f</td>\n",
>>> (double)olsr_cnf->hysteresis_param.scaling);
>>> +      abuf_appendf(abuf, "<td>Hyst lower/upper: %0.2f/%0.2f</td>\n",
>>> (double)olsr_cnf->hysteresis_param.thr_low,
>>> +                 (double)olsr_cnf->hysteresis_param.thr_high);
>>>     }
>>>   }
>>>
>>> @@ -896,7 +896,7 @@ build_config_body(struct autobuf *abuf)
>>>              olsr_cnf->lq_level ? "Enabled" : "Disabled");
>>>   if (olsr_cnf->lq_level) {
>>>     abuf_appendf(abuf, "<td>LQ level: %d</td>\n" "<td>LQ aging:
>>> %f</td>\n", olsr_cnf->lq_level,
>>> -               olsr_cnf->lq_aging);
>>> +               (double)olsr_cnf->lq_aging);
>>>   }
>>>   abuf_puts(abuf, "</tr></table>\n");
>>>
>>> @@ -978,7 +978,7 @@ build_neigh_body(struct autobuf *abuf)
>>>     abuf_puts(abuf, "<tr>");
>>>     build_ipaddr_with_link(abuf,&the_link->local_iface_addr, -1);
>>>     build_ipaddr_with_link(abuf,&the_link->neighbor_iface_addr, -1);
>>>
>>> -    abuf_appendf(abuf, "<td>%0.2f</td>", the_link->L_link_quality);
>>> +    abuf_appendf(abuf, "<td>%0.2f</td>",
>>> (double)the_link->L_link_quality);
>>>     if (olsr_cnf->lq_level>  0) {
>>>       struct lqtextbuffer lqbuffer1, lqbuffer2;
>>>       abuf_appendf(abuf, "<td>(%s) %s</td>",
>>> get_link_entry_text(the_link, '/',&lqbuffer1),
>>> diff --git a/lib/jsoninfo/src/olsrd_jsoninfo.c
>>> b/lib/jsoninfo/src/olsrd_jsoninfo.c
>>> index 243d1c5..0234082 100644
>>> --- a/lib/jsoninfo/src/olsrd_jsoninfo.c
>>> +++ b/lib/jsoninfo/src/olsrd_jsoninfo.c
>>> @@ -239,7 +239,7 @@ abuf_json_float(struct autobuf *abuf, const char*
>>> key, float value)
>>>     abuf_appendf(abuf, ",\n");
>>>   else
>>>     abuf_appendf(abuf, "\n");
>>> -  abuf_appendf(abuf, "\t\"%s\": %.03f", key, value);
>>> +  abuf_appendf(abuf, "\t\"%s\": %.03f", key, (double)value);
>>>   entrynumber++;
>>>  }
>>>
>>> diff --git a/lib/nameservice/src/mapwrite.c
>>> b/lib/nameservice/src/mapwrite.c
>>> index ce1d069..5cca810 100644
>>> --- a/lib/nameservice/src/mapwrite.c
>>> +++ b/lib/nameservice/src/mapwrite.c
>>> @@ -129,7 +129,7 @@ mapwrite_work(FILE * fmap)
>>>     }
>>>   }
>>>   lookup_defhna_latlon(&ip);
>>> -  sprintf(my_latlon_str, "%f,%f,%d", my_lat, my_lon,
>>> get_isdefhna_latlon());
>>> +  sprintf(my_latlon_str, "%f,%f,%d", (double)my_lat, (double)my_lon,
>>> get_isdefhna_latlon());
>>>   if (0>
>>>       fprintf(fmap, "Self('%s',%s,'%s','%s');\n",
>>> olsr_ip_to_string(&strbuf1,&olsr_cnf->main_addr), my_latlon_str,
>>>               olsr_ip_to_string(&strbuf2,&ip), my_names->name)) {
>>>
>>> diff --git a/lib/nameservice/src/nameservice.c
>>> b/lib/nameservice/src/nameservice.c
>>> index d309c87..cc09646 100644
>>> --- a/lib/nameservice/src/nameservice.c
>>> +++ b/lib/nameservice/src/nameservice.c
>>> @@ -245,7 +245,7 @@ set_nameservice_float(const char *value, void *data,
>>> set_plugin_parameter_addon
>>>  {
>>>   if (data != NULL) {
>>>     sscanf(value, "%f", (float *)data);
>>> -    OLSR_PRINTF(1, "%s float %f\n", "Got", *(float *)data);
>>> +    OLSR_PRINTF(1, "%s float %f\n", "Got", (double)(*(float *)data));
>>>   } else {
>>>     OLSR_PRINTF(0, "%s float %s\n", "Ignored", value);
>>>   }
>>> @@ -746,11 +746,11 @@ encap_namemsg(struct namemsg *msg)
>>>       OLSR_PRINTF(0, "NAME PLUGIN: cant read latlon in file %s\n",
>>> latlon_in_file);
>>>     }
>>>   }
>>> -  if (0.0 != my_lat&&  0.0 != my_lon) {
>>> +  if (0.0f != my_lat&&  0.0f != my_lon) {
>>>
>>>     char s[64];
>>>     struct name_entry e;
>>>     memset(&e, 0, sizeof(e));
>>> -    sprintf(s, "%f,%f,%d", my_lat, my_lon, get_isdefhna_latlon());
>>> +    sprintf(s, "%f,%f,%d", (double)my_lat, (double)my_lon,
>>> get_isdefhna_latlon());
>>>     e.len = strlen(s);
>>>     e.type = NAME_LATLON;
>>>     e.name = s;
>>> @@ -1569,7 +1569,7 @@ is_latlon_wellformed(const char *latlon_line)
>>>   int hna = -1;
>>>   float a = 0.0, b = 0.0;
>>>   sscanf(latlon_line, "%f,%f,%d",&a,&b,&hna);
>>> -  return (a != 0.0&&  b != 0.0&&  -1 != hna);
>>> +  return (a != 0.0f&&  b != 0.0f&&  -1 != hna);
>>>
>>>  }
>>>
>>>  /**
>>> diff --git a/lib/tas/src/plugin.c b/lib/tas/src/plugin.c
>>> index c211cc0..3c7c2e0 100644
>>> --- a/lib/tas/src/plugin.c
>>> +++ b/lib/tas/src/plugin.c
>>> @@ -116,7 +116,7 @@ iterLinkTabNext(char *buff, int len)
>>>   snprintf(buff, len,
>>> "local~%s~remote~%s~main~%s~hysteresis~%f~cost~%s~",
>>>            rawIpAddrToString(&iterLinkTab->local_iface_addr, ipAddrLen),
>>> rawIpAddrToString(&iterLinkTab->neighbor_iface_addr,
>>>
>>>                  ipAddrLen),
>>> -           rawIpAddrToString(&iterLinkTab->neighbor->neighbor_main_addr,
>>> ipAddrLen), iterLinkTab->L_link_quality,
>>> +           rawIpAddrToString(&iterLinkTab->neighbor->neighbor_main_addr,
>>> ipAddrLen), (double)iterLinkTab->L_link_quality,
>>>            get_linkcost_text(iterLinkTab->linkcost, false,&lqbuffer));
>>>
>>>   link_node = iterLinkTab->link_list.next;
>>> @@ -434,7 +434,7 @@ serviceFunc(void *context __attribute__ ((unused)))
>>>   }
>>>
>>>   if (up != 0)
>>> -    httpService((int)(1.0 / config->pollrate));
>>> +    httpService((int)(1.0f / config->pollrate));
>>>  }
>>>
>>>  int
>>> diff --git a/src/cfgparser/cfgfile_gen.c b/src/cfgparser/cfgfile_gen.c
>>> index dd58dc5..c5a6ef2 100644
>>> --- a/src/cfgparser/cfgfile_gen.c
>>> +++ b/src/cfgparser/cfgfile_gen.c
>>> @@ -162,28 +162,28 @@ static void olsrd_write_if_autobuf(struct autobuf
>>> *out, struct if_config_options
>>>     "    \n");
>>>   if_appendf(out, comments, "    %sHelloInterval       %3.1f\n",
>>>       cnfi->hello_params.emission_interval == HELLO_INTERVAL ? "# " : "",
>>> -      cnfi->hello_params.emission_interval);
>>> +      (double)cnfi->hello_params.emission_interval);
>>>   if_appendf(out, comments, "    %sHelloValidityTime   %3.1f\n",
>>>       cnfi->hello_params.validity_time == NEIGHB_HOLD_TIME ? "# " : "",
>>> -      cnfi->hello_params.validity_time);
>>> +      (double)cnfi->hello_params.validity_time);
>>>   if_appendf(out, comments, "    %sTcInterval          %3.1f\n",
>>>       cnfi->tc_params.emission_interval == TC_INTERVAL ? "# " : "",
>>> -      cnfi->tc_params.emission_interval);
>>> +      (double)cnfi->tc_params.emission_interval);
>>>   if_appendf(out, comments, "    %sTcValidityTime      %3.1f\n",
>>>       cnfi->tc_params.validity_time == TOP_HOLD_TIME ? "# " : "",
>>> -      cnfi->tc_params.validity_time);
>>> +      (double)cnfi->tc_params.validity_time);
>>>   if_appendf(out, comments, "    %sMidInterval         %3.1f\n",
>>>       cnfi->mid_params.emission_interval == MID_INTERVAL ? "# " : "",
>>> -      cnfi->mid_params.emission_interval);
>>> +      (double)cnfi->mid_params.emission_interval);
>>>   if_appendf(out, comments, "    %sMidValidityTime     %3.1f\n",
>>>       cnfi->mid_params.validity_time == MID_HOLD_TIME ? "# " : "",
>>> -      cnfi->mid_params.validity_time);
>>> +      (double)cnfi->mid_params.validity_time);
>>>   if_appendf(out, comments, "    %sHnaInterval         %3.1f\n",
>>>       cnfi->hna_params.emission_interval == HNA_INTERVAL ? "# " : "",
>>> -      cnfi->hna_params.emission_interval);
>>> +      (double)cnfi->hna_params.emission_interval);
>>>   if_appendf(out, comments, "    %sHnaValidityTime     %3.1f\n",
>>>       cnfi->hna_params.validity_time == HNA_HOLD_TIME ? "# " : "",
>>> -      cnfi->hna_params.validity_time);
>>> +      (double)cnfi->hna_params.validity_time);
>>>   if (comments) abuf_puts(out,
>>>     "    \n"
>>>     "    # When multiple links exist between hosts\n"
>>> @@ -222,7 +222,7 @@ static void olsrd_write_if_autobuf(struct autobuf
>>> *out, struct if_config_options
>>>     while (mult != NULL) {
>>>       if_appendf(out, comments, "    LinkQualityMult    %s %0.2f\n",
>>>           olsr_ip_to_string(&ipbuf,&mult->addr),
>>>
>>> -          (float)(mult->value) / 65536.0);
>>> +          (double)((float)(mult->value) / 65536.0f));
>>>       mult = mult->next;
>>>     }
>>>   }
>>> @@ -317,8 +317,8 @@ void olsrd_write_cnf_autobuf(struct autobuf *out,
>>> struct olsrd_config *cnf) {
>>>     "# (Default is 0.05)\n"
>>>     "\n");
>>>   abuf_appendf(out, "%sPollrate  %.2f\n",
>>> -      cnf->pollrate == DEF_POLLRATE ? "# " : "",
>>> -      cnf->pollrate);
>>> +      cnf->pollrate == (float)DEF_POLLRATE ? "# " : "",
>>> +      (double)cnf->pollrate);
>>>   abuf_puts(out,
>>>     "\n"
>>>     "# Interval to poll network interfaces for configuration changes (in
>>> seconds).\n"
>>> @@ -326,8 +326,8 @@ void olsrd_write_cnf_autobuf(struct autobuf *out,
>>> struct olsrd_config *cnf) {
>>>     "# (Defaults is 2.5)\n"
>>>     "\n");
>>>   abuf_appendf(out, "%sNicChgsPollInt  %.1f\n",
>>> -      cnf->nic_chgs_pollrate == DEF_NICCHGPOLLRT ? "# " : "",
>>> -      cnf->nic_chgs_pollrate);
>>> +      cnf->nic_chgs_pollrate == (float)DEF_NICCHGPOLLRT ? "# " : "",
>>> +      (double)cnf->nic_chgs_pollrate);
>>>   abuf_puts(out,
>>>     "\n"
>>>     "# TOS(type of service) value for the IP header of control
>>> traffic.\n"
>>> @@ -580,14 +580,14 @@ void olsrd_write_cnf_autobuf(struct autobuf *out,
>>> struct olsrd_config *cnf) {
>>>     "# (default is 0.5/0.8/0.3)\n"
>>>     "\n");
>>>   abuf_appendf(out, "%sHystScaling  %.2f\n",
>>> -      cnf->hysteresis_param.scaling == HYST_SCALING ? "# " : "",
>>> -      cnf->hysteresis_param.scaling);
>>> +      cnf->hysteresis_param.scaling == (float)HYST_SCALING ? "# " : "",
>>> +      (double)cnf->hysteresis_param.scaling);
>>>   abuf_appendf(out, "%sHystThrHigh  %.2f\n",
>>> -      cnf->hysteresis_param.thr_high == HYST_THRESHOLD_HIGH ? "# " : "",
>>> -      cnf->hysteresis_param.thr_high);
>>> +      cnf->hysteresis_param.thr_high == (float)HYST_THRESHOLD_HIGH ? "#
>>> " : "",
>>> +      (double)cnf->hysteresis_param.thr_high);
>>>   abuf_appendf(out, "%sHystThrLow  %.2f\n",
>>> -      cnf->hysteresis_param.thr_low == HYST_THRESHOLD_LOW ? "# " : "",
>>> -      cnf->hysteresis_param.thr_low);
>>> +      cnf->hysteresis_param.thr_low == (float)HYST_THRESHOLD_LOW ? "# "
>>> : "",
>>> +      (double)cnf->hysteresis_param.thr_low);
>>>   abuf_puts(out,
>>>     "\n"
>>>     "# TC redundancy\n"
>>> @@ -652,8 +652,8 @@ void olsrd_write_cnf_autobuf(struct autobuf *out,
>>> struct olsrd_config *cnf) {
>>>     "# (default is 0.05)\n"
>>>     "\n");
>>>   abuf_appendf(out, "%sLinkQualityAging %.2f\n",
>>> -      cnf->lq_aging == DEF_LQ_AGING ? "# " : "",
>>> -      cnf->lq_aging);
>>> +      cnf->lq_aging == (float)DEF_LQ_AGING ? "# " : "",
>>> +      (double)cnf->lq_aging);
>>>   abuf_puts(out,
>>>     "\n"
>>>     "# Fisheye mechanism for TCs (0 meansoff, 1 means on)\n"
>>> @@ -679,8 +679,8 @@ void olsrd_write_cnf_autobuf(struct autobuf *out,
>>> struct olsrd_config *cnf) {
>>>     "# (defaults to 1.0)\n"
>>>     "\n");
>>>   abuf_appendf(out, "%sNatThreshold  %.1f\n",
>>> -      cnf->lq_nat_thresh == DEF_LQ_NAT_THRESH ? "# " : "",
>>> -      cnf->lq_nat_thresh);
>>> +      cnf->lq_nat_thresh == (float)DEF_LQ_NAT_THRESH ? "# " : "",
>>> +      (double)cnf->lq_nat_thresh);
>>>
>>>   abuf_puts(out,
>>>     "\n"
>>> diff --git a/src/cfgparser/olsrd_conf.c b/src/cfgparser/olsrd_conf.c
>>> index 60df1f5..663caa3 100644
>>> --- a/src/cfgparser/olsrd_conf.c
>>> +++ b/src/cfgparser/olsrd_conf.c
>>> @@ -192,19 +192,19 @@ olsrd_print_interface_cnf(struct if_config_options
>>> *cnf, struct if_config_option
>>>
>>>   printf("\tIPv6 multicast           : %s%s\n",
>>> inet_ntop(AF_INET6,&cnf->ipv6_multicast.v6, ipv6_buf,
>>> sizeof(ipv6_buf)),DEFAULT_STR(ipv6_multicast.v6));
>>>
>>>
>>> -  printf("\tHELLO emission/validity  : %0.2f%s/%0.2f%s\n",
>>> cnf->hello_params.emission_interval,
>>> DEFAULT_STR(hello_params.emission_interval),
>>> -
>>> cnf->hello_params.validity_time,DEFAULT_STR(hello_params.validity_time));
>>> -  printf("\tTC emission/validity     : %0.2f%s/%0.2f%s\n",
>>> cnf->tc_params.emission_interval, DEFAULT_STR(tc_params.emission_interval),
>>> -
>>> cnf->tc_params.validity_time,DEFAULT_STR(tc_params.validity_time));
>>> -  printf("\tMID emission/validity    : %0.2f%s/%0.2f%s\n",
>>> cnf->mid_params.emission_interval,
>>> DEFAULT_STR(mid_params.emission_interval),
>>> -
>>> cnf->mid_params.validity_time,DEFAULT_STR(mid_params.validity_time));
>>> -  printf("\tHNA emission/validity    : %0.2f%s/%0.2f%s\n",
>>> cnf->hna_params.emission_interval,
>>> DEFAULT_STR(hna_params.emission_interval),
>>> -
>>> cnf->hna_params.validity_time,DEFAULT_STR(hna_params.validity_time));
>>> +  printf("\tHELLO emission/validity  : %0.2f%s/%0.2f%s\n",
>>> (double)cnf->hello_params.emission_interval,
>>> DEFAULT_STR(hello_params.emission_interval),
>>> +
>>> (double)cnf->hello_params.validity_time,DEFAULT_STR(hello_params.validity_time));
>>> +  printf("\tTC emission/validity     : %0.2f%s/%0.2f%s\n",
>>> (double)cnf->tc_params.emission_interval,
>>> DEFAULT_STR(tc_params.emission_interval),
>>> +
>>> (double)cnf->tc_params.validity_time,DEFAULT_STR(tc_params.validity_time));
>>> +  printf("\tMID emission/validity    : %0.2f%s/%0.2f%s\n",
>>> (double)cnf->mid_params.emission_interval,
>>> DEFAULT_STR(mid_params.emission_interval),
>>> +
>>> (double)cnf->mid_params.validity_time,DEFAULT_STR(mid_params.validity_time));
>>> +  printf("\tHNA emission/validity    : %0.2f%s/%0.2f%s\n",
>>> (double)cnf->hna_params.emission_interval,
>>> DEFAULT_STR(hna_params.emission_interval),
>>> +
>>> (double)cnf->hna_params.validity_time,DEFAULT_STR(hna_params.validity_time));
>>>
>>>   for (mult = cnf->lq_mult; mult != NULL; mult = mult->next) {
>>>     lq_mult_cnt++;
>>>     printf("\tLinkQualityMult          : %s %0.2f %s\n",
>>> inet_ntop(olsr_cnf->ip_version,&mult->addr, ipv6_buf, sizeof(ipv6_buf)),
>>>
>>> -      (float)(mult->value) / 65536.0, ((lq_mult_cnt>
>>>  cnf->orig_lq_mult_cnt)?" (d)":""));
>>> +      (double)(mult->value) / (double)65536.0, ((lq_mult_cnt>
>>>  cnf->orig_lq_mult_cnt)?" (d)":""));
>>>   }
>>>
>>>   printf("\tAutodetect changes       : %s%s\n", cnf->autodetect_chg ?
>>> "yes" : "no",DEFAULT_STR(autodetect_chg));
>>> @@ -355,7 +355,7 @@ int olsrd_sanity_check_interface_cnf(struct
>>> if_config_options * io, struct olsrd
>>>
>>>   /* HELLO interval */
>>>
>>> -  if (io->hello_params.validity_time<  0.0) {
>>> +  if (io->hello_params.validity_time<  0.0f) {
>>>     if (cnf->lq_level == 0)
>>>       io->hello_params.validity_time = NEIGHB_HOLD_TIME;
>>>
>>> @@ -364,33 +364,33 @@ int olsrd_sanity_check_interface_cnf(struct
>>> if_config_options * io, struct olsrd
>>>   }
>>>
>>>   if (io->hello_params.emission_interval<  cnf->pollrate ||
>>> io->hello_params.emission_interval>  io->hello_params.validity_time) {
>>> -    fprintf(stderr, "Bad HELLO parameters! (em: %0.2f, vt: %0.2f) for
>>> dev %s\n", io->hello_params.emission_interval,
>>> -            io->hello_params.validity_time, name);
>>> +    fprintf(stderr, "Bad HELLO parameters! (em: %0.2f, vt: %0.2f) for
>>> dev %s\n", (double)io->hello_params.emission_interval,
>>> +               (double)io->hello_params.validity_time, name);
>>>     return -1;
>>>   }
>>>
>>>   /* TC interval */
>>>   if (io->tc_params.emission_interval<  cnf->pollrate ||
>>> io->tc_params.emission_interval>  io->tc_params.validity_time) {
>>> -    fprintf(stderr, "Bad TC parameters! (em: %0.2f, vt: %0.2f) for dev
>>> %s\n", io->tc_params.emission_interval,
>>> -        io->tc_params.validity_time, name);
>>> +    fprintf(stderr, "Bad TC parameters! (em: %0.2f, vt: %0.2f) for dev
>>> %s\n", (double)io->tc_params.emission_interval,
>>> +               (double)io->tc_params.validity_time, name);
>>>     return -1;
>>>   }
>>>
>>> -  if (cnf->min_tc_vtime>  0.0&&  (io->tc_params.validity_time /
>>> io->tc_params.emission_interval)<  128) {
>>> +  if (cnf->min_tc_vtime>  0.0f&&  (io->tc_params.validity_time /
>>> io->tc_params.emission_interval)<  128.0f) {
>>>
>>>     fprintf(stderr, "Please use a tc vtime at least 128 times the
>>> emission interval while using the min_tc_vtime hack.\n");
>>>     return -1;
>>>   }
>>>   /* MID interval */
>>>   if (io->mid_params.emission_interval<  cnf->pollrate ||
>>> io->mid_params.emission_interval>  io->mid_params.validity_time) {
>>> -    fprintf(stderr, "Bad MID parameters! (em: %0.2f, vt: %0.2f) for dev
>>> %s\n", io->mid_params.emission_interval,
>>> -            io->mid_params.validity_time, name);
>>> +    fprintf(stderr, "Bad MID parameters! (em: %0.2f, vt: %0.2f) for dev
>>> %s\n", (double)io->mid_params.emission_interval,
>>> +               (double)io->mid_params.validity_time, name);
>>>     return -1;
>>>   }
>>>
>>>   /* HNA interval */
>>>   if (io->hna_params.emission_interval<  cnf->pollrate ||
>>> io->hna_params.emission_interval>  io->hna_params.validity_time) {
>>> -    fprintf(stderr, "Bad HNA parameters! (em: %0.2f, vt: %0.2f) for dev
>>> %s\n", io->hna_params.emission_interval,
>>> -            io->hna_params.validity_time, name);
>>> +    fprintf(stderr, "Bad HNA parameters! (em: %0.2f, vt: %0.2f) for dev
>>> %s\n", (double)io->hna_params.emission_interval,
>>> +               (double)io->hna_params.validity_time, name);
>>>     return -1;
>>>   }
>>>
>>> @@ -399,7 +399,7 @@ int olsrd_sanity_check_interface_cnf(struct
>>> if_config_options * io, struct olsrd
>>>       struct ipaddr_str buf;
>>>
>>>       fprintf(stderr, "Bad Linkquality multiplier ('%s' on IP %s:
>>> %0.2f)\n",
>>> -          name, olsr_ip_to_string(&buf,&mult->addr), (float)mult->value
>>> / (float)LINK_LOSS_MULTIPLIER);
>>> +          name, olsr_ip_to_string(&buf,&mult->addr), (double)mult->value
>>> / (double)LINK_LOSS_MULTIPLIER);
>>>
>>>       return -1;
>>>     }
>>>   }
>>> @@ -444,38 +444,38 @@ olsrd_sanity_check_cnf(struct olsrd_config *cnf)
>>>
>>>   /* Hysteresis */
>>>   if (cnf->use_hysteresis == true) {
>>> -    if (cnf->hysteresis_param.scaling<  MIN_HYST_PARAM ||
>>> cnf->hysteresis_param.scaling>  MAX_HYST_PARAM) {
>>> -      fprintf(stderr, "Hyst scaling %0.2f is not allowed\n",
>>> cnf->hysteresis_param.scaling);
>>> +    if (cnf->hysteresis_param.scaling<  (float)MIN_HYST_PARAM ||
>>> cnf->hysteresis_param.scaling>  (float)MAX_HYST_PARAM) {
>>> +      fprintf(stderr, "Hyst scaling %0.2f is not allowed\n",
>>> (double)cnf->hysteresis_param.scaling);
>>>       return -1;
>>>     }
>>>
>>>     if (cnf->hysteresis_param.thr_high<= cnf->hysteresis_param.thr_low) {
>>> -      fprintf(stderr, "Hyst upper(%0.2f) thr must be bigger than
>>> lower(%0.2f) threshold!\n", cnf->hysteresis_param.thr_high,
>>> -              cnf->hysteresis_param.thr_low);
>>> +      fprintf(stderr, "Hyst upper(%0.2f) thr must be bigger than
>>> lower(%0.2f) threshold!\n", (double)cnf->hysteresis_param.thr_high,
>>> +                 (double)cnf->hysteresis_param.thr_low);
>>>       return -1;
>>>     }
>>>
>>> -    if (cnf->hysteresis_param.thr_high<  MIN_HYST_PARAM ||
>>> cnf->hysteresis_param.thr_high>  MAX_HYST_PARAM) {
>>> -      fprintf(stderr, "Hyst upper thr %0.2f is not allowed\n",
>>> cnf->hysteresis_param.thr_high);
>>> +    if (cnf->hysteresis_param.thr_high<  (float)MIN_HYST_PARAM ||
>>> cnf->hysteresis_param.thr_high>  (float)MAX_HYST_PARAM) {
>>> +      fprintf(stderr, "Hyst upper thr %0.2f is not allowed\n",
>>> (double)cnf->hysteresis_param.thr_high);
>>>       return -1;
>>>     }
>>>
>>> -    if (cnf->hysteresis_param.thr_low<  MIN_HYST_PARAM ||
>>> cnf->hysteresis_param.thr_low>  MAX_HYST_PARAM) {
>>> -      fprintf(stderr, "Hyst lower thr %0.2f is not allowed\n",
>>> cnf->hysteresis_param.thr_low);
>>> +    if (cnf->hysteresis_param.thr_low<  (float)MIN_HYST_PARAM ||
>>> cnf->hysteresis_param.thr_low>  (float)MAX_HYST_PARAM) {
>>> +      fprintf(stderr, "Hyst lower thr %0.2f is not allowed\n",
>>> (double)cnf->hysteresis_param.thr_low);
>>>       return -1;
>>>     }
>>>   }
>>>
>>>   /* Pollrate */
>>> -  if (cnf->pollrate<  MIN_POLLRATE || cnf->pollrate>  MAX_POLLRATE) {
>>> -    fprintf(stderr, "Pollrate %0.2f is not allowed\n", cnf->pollrate);
>>> +  if (cnf->pollrate<  (float)MIN_POLLRATE || cnf->pollrate>
>>>  (float)MAX_POLLRATE) {
>>> +    fprintf(stderr, "Pollrate %0.2f is not allowed\n",
>>> (double)cnf->pollrate);
>>>     return -1;
>>>   }
>>>
>>>   /* NIC Changes Pollrate */
>>>
>>> -  if (cnf->nic_chgs_pollrate<  MIN_NICCHGPOLLRT ||
>>> cnf->nic_chgs_pollrate>  MAX_NICCHGPOLLRT) {
>>> -    fprintf(stderr, "NIC Changes Pollrate %0.2f is not allowed\n",
>>> cnf->nic_chgs_pollrate);
>>> +  if (cnf->nic_chgs_pollrate<  (float)MIN_NICCHGPOLLRT ||
>>> cnf->nic_chgs_pollrate>  (float)MAX_NICCHGPOLLRT) {
>>> +    fprintf(stderr, "NIC Changes Pollrate %0.2f is not allowed\n",
>>> (double)cnf->nic_chgs_pollrate);
>>>     return -1;
>>>   }
>>>
>>> @@ -510,14 +510,14 @@ olsrd_sanity_check_cnf(struct olsrd_config *cnf)
>>>   }
>>>
>>>   /* Link quality window size */
>>> -  if (cnf->lq_level&&  (cnf->lq_aging<  MIN_LQ_AGING || cnf->lq_aging>
>>>  MAX_LQ_AGING)) {
>>>
>>> -    fprintf(stderr, "LQ aging factor %f is not allowed\n",
>>> cnf->lq_aging);
>>> +  if (cnf->lq_level&&  (cnf->lq_aging<  (float)MIN_LQ_AGING ||
>>> cnf->lq_aging>  (float)MAX_LQ_AGING)) {
>>>
>>> +    fprintf(stderr, "LQ aging factor %f is not allowed\n",
>>> (double)cnf->lq_aging);
>>>     return -1;
>>>   }
>>>
>>>   /* NAT threshold value */
>>> -  if (cnf->lq_level&&  (cnf->lq_nat_thresh<  0.1 || cnf->lq_nat_thresh>
>>>  1.0)) {
>>>
>>> -    fprintf(stderr, "NAT threshold %f is not allowed\n",
>>> cnf->lq_nat_thresh);
>>> +  if (cnf->lq_level&&  (cnf->lq_nat_thresh<  0.1f || cnf->lq_nat_thresh>
>>>  1.0f)) {
>>>
>>> +    fprintf(stderr, "NAT threshold %f is not allowed\n",
>>> (double)cnf->lq_nat_thresh);
>>>     return -1;
>>>   }
>>>
>>> @@ -541,11 +541,11 @@ olsrd_sanity_check_cnf(struct olsrd_config *cnf)
>>>     return -1;
>>>   }
>>>
>>> -  if (cnf->min_tc_vtime<  0.0) {
>>> +  if (cnf->min_tc_vtime<  0.0f) {
>>>     fprintf(stderr, "Error, negative minimal tc time not allowed.\n");
>>>     return -1;
>>>   }
>>> -  if (cnf->min_tc_vtime>  0.0) {
>>> +  if (cnf->min_tc_vtime>  0.0f) {
>>>          fprintf(stderr, "Warning, you are using the min_tc_vtime hack.
>>> We hope you know what you are doing... contact olsr.org otherwise.\n");
>>>   }
>>>
>>> @@ -873,9 +873,9 @@ olsrd_print_cnf(struct olsrd_config *cnf)
>>>     ie = ie->next;
>>>   }
>>>
>>> -  printf("Pollrate         : %0.2f\n", cnf->pollrate);
>>> +  printf("Pollrate         : %0.2f\n", (double)cnf->pollrate);
>>>
>>> -  printf("NIC ChangPollrate: %0.2f\n", cnf->nic_chgs_pollrate);
>>> +  printf("NIC ChangPollrate: %0.2f\n", (double)cnf->nic_chgs_pollrate);
>>>
>>>   printf("TC redundancy    : %d\n", cnf->tc_redundancy);
>>>
>>> @@ -885,11 +885,11 @@ olsrd_print_cnf(struct olsrd_config *cnf)
>>>
>>>   printf("LQ fish eye      : %d\n", cnf->lq_fish);
>>>
>>> -  printf("LQ aging factor  : %f\n", cnf->lq_aging);
>>> +  printf("LQ aging factor  : %f\n", (double)cnf->lq_aging);
>>>
>>>   printf("LQ algorithm name: %s\n", cnf->lq_algorithm ? cnf->lq_algorithm
>>> : "default");
>>>
>>> -  printf("NAT threshold    : %f\n", cnf->lq_nat_thresh);
>>> +  printf("NAT threshold    : %f\n", (double)cnf->lq_nat_thresh);
>>>
>>>   printf("Clear screen     : %s\n", cnf->clear_screen ? "yes" : "no");
>>>
>>> @@ -950,8 +950,8 @@ olsrd_print_cnf(struct olsrd_config *cnf)
>>>   /* Hysteresis */
>>>   if (cnf->use_hysteresis) {
>>>     printf("Using hysteresis:\n");
>>> -    printf("\tScaling      : %0.2f\n", cnf->hysteresis_param.scaling);
>>> -    printf("\tThr high/low : %0.2f/%0.2f\n",
>>> cnf->hysteresis_param.thr_high, cnf->hysteresis_param.thr_low);
>>> +    printf("\tScaling      : %0.2f\n",
>>> (double)cnf->hysteresis_param.scaling);
>>> +    printf("\tThr high/low : %0.2f/%0.2f\n",
>>> (double)cnf->hysteresis_param.thr_high,
>>> (double)cnf->hysteresis_param.thr_low);
>>>   } else {
>>>     printf("Not using hysteresis\n");
>>>   }
>>> diff --git a/src/cfgparser/oparse.y b/src/cfgparser/oparse.y
>>> index d260e58..0aed134 100644
>>> --- a/src/cfgparser/oparse.y
>>> +++ b/src/cfgparser/oparse.y
>>> @@ -90,7 +90,7 @@ static int lq_mult_helper(YYSTYPE ip_addr_arg, YYSTYPE
>>> mult_arg)
>>>  #if PARSER_DEBUG>  0
>>>   printf("\tLinkQualityMult %s %0.2f\n",
>>>          (ip_addr_arg != NULL) ? ip_addr_arg->string : "any",
>>> -         mult_arg->floating);
>>> +         (double)mult_arg->floating);
>>>  #endif
>>>
>>>   memset(&addr, 0, sizeof(addr));
>>> @@ -656,7 +656,7 @@ isethelloint: TOK_HELLOINT TOK_FLOAT
>>>   int ifcnt = ifs_in_curr_cfg;
>>>   struct olsr_if *ifs = olsr_cnf->interfaces;
>>>
>>> -  PARSER_DEBUG_PRINTF("\tHELLO interval: %0.2f\n", $2->floating);
>>> +  PARSER_DEBUG_PRINTF("\tHELLO interval: %0.2f\n",
>>> (double)$2->floating);
>>>
>>>        SET_IFS_CONF(ifs, ifcnt, hello_params.emission_interval,
>>> $2->floating);
>>>
>>> @@ -668,7 +668,7 @@ isethelloval: TOK_HELLOVAL TOK_FLOAT
>>>   int ifcnt = ifs_in_curr_cfg;
>>>   struct olsr_if *ifs = olsr_cnf->interfaces;
>>>
>>> -  PARSER_DEBUG_PRINTF("\tHELLO validity: %0.2f\n", $2->floating);
>>> +  PARSER_DEBUG_PRINTF("\tHELLO validity: %0.2f\n",
>>> (double)$2->floating);
>>>
>>>        SET_IFS_CONF(ifs, ifcnt, hello_params.validity_time,
>>> $2->floating);
>>>
>>> @@ -680,7 +680,7 @@ isettcint: TOK_TCINT TOK_FLOAT
>>>   int ifcnt = ifs_in_curr_cfg;
>>>   struct olsr_if *ifs = olsr_cnf->interfaces;
>>>
>>> -  PARSER_DEBUG_PRINTF("\tTC interval: %0.2f\n", $2->floating);
>>> +  PARSER_DEBUG_PRINTF("\tTC interval: %0.2f\n", (double)$2->floating);
>>>
>>>        SET_IFS_CONF(ifs, ifcnt, tc_params.emission_interval,
>>> $2->floating);
>>>
>>> @@ -692,7 +692,7 @@ isettcval: TOK_TCVAL TOK_FLOAT
>>>   int ifcnt = ifs_in_curr_cfg;
>>>   struct olsr_if *ifs = olsr_cnf->interfaces;
>>>
>>> -  PARSER_DEBUG_PRINTF("\tTC validity: %0.2f\n", $2->floating);
>>> +  PARSER_DEBUG_PRINTF("\tTC validity: %0.2f\n", (double)$2->floating);
>>>
>>>  SET_IFS_CONF(ifs, ifcnt, tc_params.validity_time, $2->floating);
>>>
>>> @@ -705,7 +705,7 @@ isetmidint: TOK_MIDINT TOK_FLOAT
>>>   struct olsr_if *ifs = olsr_cnf->interfaces;
>>>
>>>
>>> -  PARSER_DEBUG_PRINTF("\tMID interval: %0.2f\n", $2->floating);
>>> +  PARSER_DEBUG_PRINTF("\tMID interval: %0.2f\n", (double)$2->floating);
>>>
>>>   SET_IFS_CONF(ifs, ifcnt, mid_params.emission_interval, $2->floating);
>>>
>>> @@ -717,7 +717,7 @@ isetmidval: TOK_MIDVAL TOK_FLOAT
>>>   int ifcnt = ifs_in_curr_cfg;
>>>   struct olsr_if *ifs = olsr_cnf->interfaces;
>>>
>>> -  PARSER_DEBUG_PRINTF("\tMID validity: %0.2f\n", $2->floating);
>>> +  PARSER_DEBUG_PRINTF("\tMID validity: %0.2f\n", (double)$2->floating);
>>>
>>>   SET_IFS_CONF(ifs, ifcnt, mid_params.validity_time, $2->floating);
>>>
>>> @@ -729,7 +729,7 @@ isethnaint: TOK_HNAINT TOK_FLOAT
>>>   int ifcnt = ifs_in_curr_cfg;
>>>   struct olsr_if *ifs = olsr_cnf->interfaces;
>>>
>>> -  PARSER_DEBUG_PRINTF("\tHNA interval: %0.2f\n", $2->floating);
>>> +  PARSER_DEBUG_PRINTF("\tHNA interval: %0.2f\n", (double)$2->floating);
>>>
>>>   SET_IFS_CONF(ifs, ifcnt, hna_params.emission_interval, $2->floating);
>>>
>>> @@ -741,7 +741,7 @@ isethnaval: TOK_HNAVAL TOK_FLOAT
>>>   int ifcnt = ifs_in_curr_cfg;
>>>   struct olsr_if *ifs = olsr_cnf->interfaces;
>>>
>>> -  PARSER_DEBUG_PRINTF("\tHNA validity: %0.2f\n", $2->floating);
>>> +  PARSER_DEBUG_PRINTF("\tHNA validity: %0.2f\n", (double)$2->floating);
>>>
>>>   SET_IFS_CONF(ifs, ifcnt, hna_params.validity_time, $2->floating);
>>>
>>> @@ -1154,7 +1154,7 @@ busehyst: TOK_USEHYST TOK_BOOLEAN
>>>  fhystscale: TOK_HYSTSCALE TOK_FLOAT
>>>  {
>>>   olsr_cnf->hysteresis_param.scaling = $2->floating;
>>> -  PARSER_DEBUG_PRINTF("Hysteresis Scaling: %0.2f\n", $2->floating);
>>> +  PARSER_DEBUG_PRINTF("Hysteresis Scaling: %0.2f\n",
>>> (double)$2->floating);
>>>   free($2);
>>>  }
>>>  ;
>>> @@ -1162,7 +1162,7 @@ fhystscale: TOK_HYSTSCALE TOK_FLOAT
>>>  fhystupper: TOK_HYSTUPPER TOK_FLOAT
>>>  {
>>>   olsr_cnf->hysteresis_param.thr_high = $2->floating;
>>> -  PARSER_DEBUG_PRINTF("Hysteresis UpperThr: %0.2f\n", $2->floating);
>>> +  PARSER_DEBUG_PRINTF("Hysteresis UpperThr: %0.2f\n",
>>> (double)$2->floating);
>>>   free($2);
>>>  }
>>>  ;
>>> @@ -1170,14 +1170,14 @@ fhystupper: TOK_HYSTUPPER TOK_FLOAT
>>>  fhystlower: TOK_HYSTLOWER TOK_FLOAT
>>>  {
>>>   olsr_cnf->hysteresis_param.thr_low = $2->floating;
>>> -  PARSER_DEBUG_PRINTF("Hysteresis LowerThr: %0.2f\n", $2->floating);
>>> +  PARSER_DEBUG_PRINTF("Hysteresis LowerThr: %0.2f\n",
>>> (double)$2->floating);
>>>   free($2);
>>>  }
>>>  ;
>>>
>>>  fpollrate: TOK_POLLRATE TOK_FLOAT
>>>  {
>>> -  PARSER_DEBUG_PRINTF("Pollrate %0.2f\n", $2->floating);
>>> +  PARSER_DEBUG_PRINTF("Pollrate %0.2f\n", (double)$2->floating);
>>>   olsr_cnf->pollrate = $2->floating;
>>>   free($2);
>>>  }
>>> @@ -1185,7 +1185,7 @@ fpollrate: TOK_POLLRATE TOK_FLOAT
>>>
>>>  fnicchgspollrt: TOK_NICCHGSPOLLRT TOK_FLOAT
>>>  {
>>> -  PARSER_DEBUG_PRINTF("NIC Changes Pollrate %0.2f\n", $2->floating);
>>> +  PARSER_DEBUG_PRINTF("NIC Changes Pollrate %0.2f\n",
>>> (double)$2->floating);
>>>   olsr_cnf->nic_chgs_pollrate = $2->floating;
>>>   free($2);
>>>  }
>>> @@ -1225,7 +1225,7 @@ alq_fish: TOK_LQ_FISH TOK_INTEGER
>>>
>>>  alq_aging: TOK_LQ_AGING TOK_FLOAT
>>>  {
>>> -  PARSER_DEBUG_PRINTF("Link quality aging factor %f\n", $2->floating);
>>> +  PARSER_DEBUG_PRINTF("Link quality aging factor %f\n",
>>> (double)$2->floating);
>>>   olsr_cnf->lq_aging = $2->floating;
>>>   free($2);
>>>  }
>>> @@ -1233,7 +1233,7 @@ alq_aging: TOK_LQ_AGING TOK_FLOAT
>>>
>>>  amin_tc_vtime: TOK_MIN_TC_VTIME TOK_FLOAT
>>>  {
>>> -  PARSER_DEBUG_PRINTF("Minimum TC validity time %f\n", $2->floating);
>>> +  PARSER_DEBUG_PRINTF("Minimum TC validity time %f\n",
>>> (double)$2->floating);
>>>   olsr_cnf->min_tc_vtime = $2->floating;
>>>   free($2);
>>>  }
>>> @@ -1256,7 +1256,7 @@ alq_plugin: TOK_LQ_PLUGIN TOK_STRING
>>>
>>>  anat_thresh: TOK_LQ_NAT_THRESH TOK_FLOAT
>>>  {
>>> -  PARSER_DEBUG_PRINTF("NAT threshold %0.2f\n", $2->floating);
>>> +  PARSER_DEBUG_PRINTF("NAT threshold %0.2f\n", (double)$2->floating);
>>>   olsr_cnf->lq_nat_thresh = $2->floating;
>>>   free($2);
>>>  }
>>> diff --git a/src/hysteresis.c b/src/hysteresis.c
>>> index 7388ff3..d4c3799 100644
>>> --- a/src/hysteresis.c
>>> +++ b/src/hysteresis.c
>>> @@ -155,7 +155,7 @@ update_hysteresis_incoming(union olsr_ip_addr
>>> *remote, struct interface *local,
>>>  #endif
>>>     lnk->L_link_quality = olsr_hyst_calc_stability(lnk->L_link_quality);
>>>  #ifdef DEBUG
>>> -    OLSR_PRINTF(3, "HYST[%s]: %f\n", olsr_ip_to_string(&buf, remote),
>>> lnk->L_link_quality);
>>> +    OLSR_PRINTF(3, "HYST[%s]: %f\n", olsr_ip_to_string(&buf, remote),
>>> (double)lnk->L_link_quality);
>>>  #endif
>>>
>>>     /*
>>> @@ -169,7 +169,7 @@ update_hysteresis_incoming(union olsr_ip_addr
>>> *remote, struct interface *local,
>>>       while (lnk->olsr_seqno != seqno) {
>>>         lnk->L_link_quality =
>>> olsr_hyst_calc_instability(lnk->L_link_quality);
>>>  #ifdef DEBUG
>>> -        OLSR_PRINTF(5, "HYST[%s] PACKET LOSS! %f\n",
>>> olsr_ip_to_string(&buf, remote), lnk->L_link_quality);
>>> +        OLSR_PRINTF(5, "HYST[%s] PACKET LOSS! %f\n",
>>> olsr_ip_to_string(&buf, remote), (double)lnk->L_link_quality);
>>>  #endif
>>>         if (lnk->L_link_quality<  olsr_cnf->hysteresis_param.thr_low)
>>>           break;
>>> diff --git a/src/link_set.c b/src/link_set.c
>>> index 1a0af50..c1b8414 100644
>>> --- a/src/link_set.c
>>> +++ b/src/link_set.c
>>> @@ -465,7 +465,7 @@ olsr_expire_link_hello_timer(void *context)
>>>
>>>   link->L_link_quality =
>>> olsr_hyst_calc_instability(link->L_link_quality);
>>>
>>> -  OLSR_PRINTF(1, "HYST[%s] HELLO timeout %f\n",
>>> olsr_ip_to_string(&buf,&link->neighbor_iface_addr), link->L_link_quality);
>>> +  OLSR_PRINTF(1, "HYST[%s] HELLO timeout %f\n",
>>> olsr_ip_to_string(&buf,&link->neighbor_iface_addr),
>>> (double)link->L_link_quality);
>>>
>>>
>>>   /* Update hello_timeout - NO SLACK THIS TIME */
>>>   olsr_change_timer(link->link_hello_timer, link->last_htime,
>>> OLSR_LINK_JITTER, OLSR_TIMER_PERIODIC);
>>> @@ -814,7 +814,7 @@ olsr_print_link_set(void)
>>>     struct ipaddr_str buf;
>>>     struct lqtextbuffer lqbuffer1, lqbuffer2;
>>>     OLSR_PRINTF(1, "%-*s  %5.3f  %-14s %s\n", addrsize,
>>> olsr_ip_to_string(&buf,&walker->neighbor_iface_addr),
>>> -                walker->L_link_quality, get_link_entry_text(walker,
>>> '/',&lqbuffer1), get_linkcost_text(walker->linkcost,
>>>
>>> +               (double)walker->L_link_quality,
>>> get_link_entry_text(walker, '/',&lqbuffer1),
>>> get_linkcost_text(walker->linkcost,
>>>
>>>                               false,&lqbuffer2));
>>>   } OLSR_FOR_ALL_LINK_ENTRIES_END(walker);
>>>  #endif
>>> diff --git a/src/lq_plugin_default_ffeth.c
>>> b/src/lq_plugin_default_ffeth.c
>>> index 4849a21..63405f0 100644
>>> --- a/src/lq_plugin_default_ffeth.c
>>> +++ b/src/lq_plugin_default_ffeth.c
>>> @@ -289,7 +289,7 @@ default_lq_ffeth_timer(void __attribute__ ((unused))
>>> * context)
>>>  static void
>>>  default_lq_initialize_ffeth(void)
>>>  {
>>> -  if (olsr_cnf->lq_nat_thresh<  1.0) {
>>> +  if (olsr_cnf->lq_nat_thresh<  1.0f) {
>>>     fprintf(stderr, "Warning, nat_treshold<  1.0 is more likely to
>>> produce loops with etx_ffeth\n");
>>>   }
>>>   olsr_packetparser_add_function(&default_lq_parser_ffeth);
>>> diff --git a/src/lq_plugin_default_float.c
>>> b/src/lq_plugin_default_float.c
>>> index ef39563..fe5f586 100644
>>> --- a/src/lq_plugin_default_float.c
>>> +++ b/src/lq_plugin_default_float.c
>>> @@ -102,11 +102,11 @@ default_lq_calc_cost_float(const void *ptr)
>>>   const struct default_lq_float *lq = ptr;
>>>   olsr_linkcost cost;
>>>
>>> -  if (lq->lq<  MINIMAL_USEFUL_LQ || lq->nlq<  MINIMAL_USEFUL_LQ) {
>>> +  if (lq->lq<  (float)MINIMAL_USEFUL_LQ || lq->nlq<
>>>  (float)MINIMAL_USEFUL_LQ) {
>>>     return LINK_COST_BROKEN;
>>>   }
>>>
>>> -  cost = (olsr_linkcost) (1.0 / (lq->lq * lq->nlq) *
>>> LQ_PLUGIN_LC_MULTIPLIER);
>>> +  cost = (olsr_linkcost) (1.0f / (lq->lq * lq->nlq) *
>>> (float)LQ_PLUGIN_LC_MULTIPLIER);
>>>
>>>   if (cost>  LINK_COST_BROKEN)
>>>     return LINK_COST_BROKEN;
>>> @@ -139,8 +139,8 @@ default_lq_deserialize_hello_lq_pair_float(const
>>> uint8_t ** curr, void *ptr)
>>>   pkt_get_u8(curr,&nlq_value);
>>>   pkt_ignore_u16(curr);
>>>
>>> -  lq->lq = (float)lq_value / 255.0;
>>> -  lq->nlq = (float)nlq_value / 255.0;
>>> +  lq->lq = (float)lq_value / 255.0f;
>>> +  lq->nlq = (float)nlq_value / 255.0f;
>>>  }
>>>
>>>  static int
>>> @@ -166,8 +166,8 @@ default_lq_deserialize_tc_lq_pair_float(const uint8_t
>>> ** curr, void *ptr)
>>>   pkt_get_u8(curr,&nlq_value);
>>>   pkt_ignore_u16(curr);
>>>
>>> -  lq->lq = (float)lq_value / 255.0;
>>> -  lq->nlq = (float)nlq_value / 255.0;
>>> +  lq->lq = (float)lq_value / 255.0f;
>>> +  lq->nlq = (float)nlq_value / 255.0f;
>>>  }
>>>
>>>  static void
>>> @@ -219,14 +219,14 @@ default_lq_print_float(void *ptr, char separator,
>>> struct lqtextbuffer *buffer)
>>>  {
>>>   struct default_lq_float *lq = ptr;
>>>
>>> -  snprintf(buffer->buf, sizeof(struct lqtextbuffer), "%2.3f%c%2.3f",
>>> lq->lq, separator, lq->nlq);
>>> +  snprintf(buffer->buf, sizeof(struct lqtextbuffer), "%2.3f%c%2.3f",
>>> (double)lq->lq, separator, (double)lq->nlq);
>>>   return buffer->buf;
>>>  }
>>>
>>>  static const char *
>>>  default_lq_print_cost_float(olsr_linkcost cost, struct lqtextbuffer
>>> *buffer)
>>>  {
>>> -  snprintf(buffer->buf, sizeof(struct lqtextbuffer), "%2.3f",
>>> ((float)cost) / LQ_PLUGIN_LC_MULTIPLIER);
>>> +  snprintf(buffer->buf, sizeof(struct lqtextbuffer), "%2.3f",
>>> (double)(((float)cost) / (float)LQ_PLUGIN_LC_MULTIPLIER));
>>>
>>>   return buffer->buf;
>>>  }
>>> diff --git a/src/lq_plugin_default_fpm.c b/src/lq_plugin_default_fpm.c
>>> index 5ff8671..c07903d 100644
>>> --- a/src/lq_plugin_default_fpm.c
>>> +++ b/src/lq_plugin_default_fpm.c
>>> @@ -230,15 +230,15 @@ default_lq_print_fpm(void *ptr, char separator,
>>> struct lqtextbuffer *buffer)
>>>  {
>>>   struct default_lq_fpm *lq = ptr;
>>>
>>> -  snprintf(buffer->buf, sizeof(buffer->buf), "%0.3f%c%0.3f",
>>> (float)(lq->valueLq) / 255.0, separator,
>>> -           (float)(lq->valueNlq) / 255.0);
>>> +  snprintf(buffer->buf, sizeof(buffer->buf), "%0.3f%c%0.3f",
>>> (double)(lq->valueLq) / (double)255.0, separator,
>>> +                 (double)(lq->valueNlq) / (double)255.0);
>>>   return buffer->buf;
>>>  }
>>>
>>>  static const char *
>>>  default_lq_print_cost_fpm(olsr_linkcost cost, struct lqtextbuffer
>>> *buffer)
>>>  {
>>> -  snprintf(buffer->buf, sizeof(buffer->buf), "%.3f", (float)(cost) /
>>> LQ_FPM_LINKCOST_MULTIPLIER);
>>> +  snprintf(buffer->buf, sizeof(buffer->buf), "%.3f", (double)(cost) /
>>> (double)LQ_FPM_LINKCOST_MULTIPLIER);
>>>   return buffer->buf;
>>>  }
>>>
>>> diff --git a/src/main.c b/src/main.c
>>> index 9aae84f..4a41740 100644
>>> --- a/src/main.c
>>> +++ b/src/main.c
>>> @@ -495,7 +495,7 @@ int main(int argc, char *argv[]) {
>>>     } else {
>>>       olsr_cnf->willingness = olsr_calculate_willingness();
>>>
>>> -      OLSR_PRINTF(1, "Willingness set to %d - next update in %.1f
>>> secs\n", olsr_cnf->willingness, olsr_cnf->will_int);
>>> +      OLSR_PRINTF(1, "Willingness set to %d - next update in %.1f
>>> secs\n", olsr_cnf->willingness, (double)olsr_cnf->will_int);
>>>     }
>>>   }
>>>
>>> @@ -954,9 +954,9 @@ static int olsr_process_arguments(int argc, char
>>> *argv[],
>>>
>>>       sscanf(*argv, "%f",&tmp_lq_aging);
>>>
>>> -      if (tmp_lq_aging<  MIN_LQ_AGING || tmp_lq_aging>  MAX_LQ_AGING) {
>>> -        printf("LQ aging factor %f not allowed. Range [%f-%f]\n",
>>> tmp_lq_aging,
>>> -            MIN_LQ_AGING, MAX_LQ_AGING);
>>> +      if (tmp_lq_aging<  (float)MIN_LQ_AGING || tmp_lq_aging>
>>>  (float)MAX_LQ_AGING) {
>>> +        printf("LQ aging factor %f not allowed. Range [%f-%f]\n",
>>> (double)tmp_lq_aging,
>>> +                       (double)MIN_LQ_AGING, (double)MAX_LQ_AGING);
>>>         olsr_exit(__func__, EXIT_FAILURE);
>>>       }
>>>       olsr_cnf->lq_aging = tmp_lq_aging;
>>> @@ -973,9 +973,9 @@ static int olsr_process_arguments(int argc, char
>>> *argv[],
>>>
>>>       sscanf(*argv, "%f",&tmp_lq_nat_thresh);
>>>
>>> -      if (tmp_lq_nat_thresh<  0.1 || tmp_lq_nat_thresh>  1.0) {
>>> +      if (tmp_lq_nat_thresh<  0.1f || tmp_lq_nat_thresh>  1.0f) {
>>>         printf("NAT threshold %f not allowed. Range [%f-%f]\n",
>>> -            tmp_lq_nat_thresh, 0.1, 1.0);
>>> +                       (double)tmp_lq_nat_thresh, (double)0.1,
>>> (double)1.0);
>>>         olsr_exit(__func__, EXIT_FAILURE);
>>>       }
>>>       olsr_cnf->lq_nat_thresh = tmp_lq_nat_thresh;
>>> diff --git a/src/scheduler.c b/src/scheduler.c
>>> index 4932efc..abff281 100644
>>> --- a/src/scheduler.c
>>> +++ b/src/scheduler.c
>>> @@ -459,7 +459,7 @@ handle_fds(uint32_t next_interval)
>>>  void __attribute__ ((noreturn))
>>>  olsr_scheduler(void)
>>>  {
>>> -  OLSR_PRINTF(1, "Scheduler started - polling every %f ms\n",
>>> olsr_cnf->pollrate);
>>> +  OLSR_PRINTF(1, "Scheduler started - polling every %f ms\n",
>>> (double)olsr_cnf->pollrate);
>>>
>>>   /* Main scheduler loop */
>>>   while (true) {
>>> --
>>> 1.7.7.6
>>>
>>>
>>> --
>>> Olsr-dev mailing list
>>> (spam-protected)
>>> https://lists.olsr.org/mailman/listinfo/olsr-dev
>>
>>
>>
>>
>
> --
> Ferry Huberts



-- 
Steven Hawkings about cosmic inflation: "An increase of billions of
billions of percent in a tiny fraction of a second. Of course, that
was before the present government."




More information about the Olsr-dev mailing list