Project

General

Profile

Actions

Bug #2416

closed

Fix for GCC compiler warning

Added by Markus almost 8 years ago. Updated almost 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
-
Start date:
06/09/2016
Due date:
% Done:

100%

Estimated time:

Description

GCC 5.3.1 prints the following compiler warning:

g++ -g -rdynamic -O3 -funroll-loops -Wall -Wextra -Woverloaded-virtual -Wno-parentheses -c -D_GNU_SOURCE  -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D__STDC_CONSTANT_MACROS -D__USE_XOPEN_EXTENDED -I/usr/include/x86_64-linux-gnu markad-standalone.cpp
markad-standalone.cpp: In static member function ‘static void* cOSDMessage::send(void*)’:
markad-standalone.cpp:161:53: warning: argument to ‘sizeof’ in ‘void* memcpy(void*, const void*, size_t)’ call is the same expression as the source; did you mean to provide an explicit length? [-Wsizeof-pointer-memaccess]
     memcpy(&name.sin_addr.s_addr,host->h_addr,sizeof(host->h_addr));
                                                     ^

I believe it should have been host->h_length here instead of the sizeof expression. That said, I'm wondering how robust the gethostbyname-based code is in the IPv6 world. Wouldn't it be better to use getaddrinfo instead?

Actions #1

Updated by Joe_D about 7 years ago

  • Status changed from New to Feedback
  • Assignee set to Joe_D
  • % Done changed from 0 to 90

Added to latest GIT, please check...

Actions #2

Updated by Joe_D almost 7 years ago

  • Status changed from Feedback to Closed
  • % Done changed from 90 to 100

no response -> closed

Actions

Also available in: Atom PDF