<div dir="ltr">Thanks for putting up with my sloppiness!  :)<div><br></div><div>Can you pull the latest changes and try again?  I think I've made the right fixes.</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">

On Sun, May 11, 2014 at 1:05 AM, Alain-Pierre Perrin <span dir="ltr"><<a href="mailto:apperrin@wanadoo.fr" target="_blank">apperrin@wanadoo.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Hello Juli and all other WANproxy contributors.<br>
<br>
<br>
Building wanproxy from its brand new git repository, I stumbled on some<br>
portability problems between BSD and Linux (or, more precisely, between<br>
their respective default compilers Clang ang gcc). Some of them are<br>
about not standard (enough) string functions and one is about a missing<br>
constant.<br>
<br>
[...]<br>
g++ -I../.. -Wno-deprecated -Wnon-virtual-dtor -include common/common.h -pipe -O -g -W -Wall -Wno-system-headers -Wno-uninitialized -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wcast-align -Wunused-parameter -Wchar-subscripts -Wreorder -DTHREADS -c -o proxy_socks_connection.o proxy_socks_connection.cc<br>


proxy_socks_connection.cc: In member function ‘void ProxySocksConnection::write_complete(Event)’:<br>
proxy_socks_connection.cc:274:34: erreur: ‘strlcpy’ was not declared in this scope<br>
      strlcpy(hex, "0", sizeof hex);<br>
                                  ^<br>
proxy_socks_connection.cc:276:61: erreur: ‘snprintf’ was not declared in this scope<br>
      snprintf(hex, sizeof hex, "%0x%02x", bytes[0], bytes[1]);<br>
                                                             ^<br>
../../common/<a href="http://program.mk:103" target="_blank">program.mk:103</a>: recipe for target 'proxy_socks_connection.o' failed<br>
make: *** [proxy_socks_connection.o] Error 1<br>
<br>
"strlcpy" (plus every "strl*" variant) and "snprintf" seem to raise<br>
portability issues :<br>
<a href="https://en.wikibooks.org/wiki/C_Programming/C_Reference/nonstandard/strlcpy" target="_blank">https://en.wikibooks.org/wiki/C_Programming/C_Reference/nonstandard/strlcpy</a><br>
<a href="https://stackoverflow.com/questions/14519161/how-to-use-strlcpy-in-gs-std-c0x-mode" target="_blank">https://stackoverflow.com/questions/14519161/how-to-use-strlcpy-in-gs-std-c0x-mode</a><br>
<br>
For "snprintf", I solved it by adding this include in<br>
proxy_socks_connection.cc :<br>
#include <cstdio><br>
<a href="https://stackoverflow.com/questions/20149633/how-to-use-snprintf-in-g-std-c11-version-4-8-2" target="_blank">https://stackoverflow.com/questions/20149633/how-to-use-snprintf-in-g-std-c11-version-4-8-2</a><br>
<br>
For "strlcpy" I tried to substitute "strncpy" to it. The compiler accepts it<br>
but it may have adverse effects. :P<br>
<br>
The compilation then stopped on this missing constant :<br>
[...]<br>
g++ -I../.. -Wno-deprecated -Wnon-virtual-dtor -include common/common.h -pipe -O -g -W -Wall -Wno-system-headers -Wno-uninitialized -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wcast-align -Wunused-parameter -Wchar-subscripts -Wreorder -DTHREADS -c -o sleep_queue_posix.o ../../common/thread/sleep_queue_posix.cc<br>


In file included from ../../common/common.h:32:0,<br>
                 from <command-line>:0:<br>
../../common/thread/sleep_queue_posix.h: In member function ‘void SleepQueueState::wait(const NanoTime*)’:<br>
../../common/thread/sleep_queue_posix.h:106:62: erreur: ‘ETIMEDOUT’ was not declared in this scope<br>
    ASSERT("/sleep/queue/posix/state", error == 0 || error == ETIMEDOUT);<br>
                                                              ^<br>
<br>
I added this include in common/thread/sleep_queue_posix.cc :<br>
#include <errno.h><br>
...and then wanproxy built successfully. A cleaner placement could probably<br>
have been to add my includes in common/common.h like this :<br>
#ifndef __clang__<br>
#include <errno.h><br>
#include <cstdio><br>
#endif<br>
<br>
...to keep "non-clang-isms" neatly grouped.<br>
<br>
<br>
Alain-Pierre<br>
_______________________________________________<br>
wanproxy mailing list<br>
<a href="mailto:wanproxy@lists.wanproxy.org">wanproxy@lists.wanproxy.org</a><br>
<a href="http://lists.wanproxy.org/listinfo.cgi/wanproxy-wanproxy.org" target="_blank">http://lists.wanproxy.org/listinfo.cgi/wanproxy-wanproxy.org</a><br>
</blockquote></div><br></div>