Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix clang++ compile warnings #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

RTM_CPPFLAGS = @RTM_CPPFLAGS@
AM_CPPFLAGS=$(RTM_CPPFLAGS)

lib_LIBRARIES = librtm.a
librtm_a_SOURCES = \
core/src/rtm.c \
core/src/rtm_posix.c \
core/src/rtm_json.c \
easy/rtm_easy.c

if ENABLE_APPLE_SSL
librtm_a_SOURCES += \
core/src/rtm_apple_ssl.c
endif

if ENABLE_OPEN_SSL
librtm_a_SOURCES += \
core/src/rtm_openssl.c
endif
30 changes: 30 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

AC_INIT([librtm], [1.0], [[email protected]])
AM_INIT_AUTOMAKE([-Wall foreign subdir-objects])

AC_PROG_CC
AC_PROG_RANLIB
AM_PROG_AR

AC_ARG_ENABLE(apple-ssl,
[ --enable-apple-ssl Use Apple SSL],
[ enable_apple_ssl=yes])
AM_CONDITIONAL([ENABLE_APPLE_SSL], [test $enable_apple_ssl = yes])

AC_ARG_ENABLE(open-ssl,
[ --enable-open-ssl Use OpenSSL],
[ enable_open_ssl=yes])
AM_CONDITIONAL([ENABLE_OPEN_SSL], [test $enable_open_ssl = yes])

dnl C flags
RTM_CPPFLAGS="-Ivendor -Icore/src -Ieasy"
test $enable_apple_ssl = yes && {
RTM_CPPFLAGS="${RTM_CPPFLAGS} -DUSE_APPLE_SSL=ON"
}
test $enable_open_ssl = yes && {
RTM_CPPFLAGS="${RTM_CPPFLAGS} -DUSE_OPENSSL=ON"
}
AC_SUBST(RTM_CPPFLAGS)

AC_CONFIG_FILES([Makefile])
AC_OUTPUT
7 changes: 5 additions & 2 deletions core/src/rtm.c
Original file line number Diff line number Diff line change
Expand Up @@ -528,15 +528,18 @@ static rtm_status parse_endpoint(rtm_client_t *rtm, const char *endpoint, char *
ASSERT_NOT_NULL(path_out);
ASSERT_NOT_NULL(use_tls_out);

const char port80[] = "80";
const char port443[] = "443";

char *auto_port = NULL;
const char *hostname_start = NULL;

if (strncmp(endpoint, WS_PREFIX, sizeof(WS_PREFIX) - 1) == 0) {
auto_port = "80";
auto_port = port80;
hostname_start = endpoint + sizeof(WS_PREFIX) - 1;
*use_tls_out = NO;
} else if (strncmp(endpoint, WSS_PREFIX, sizeof(WSS_PREFIX) - 1) == 0) {
auto_port = "443";
auto_port = port443;
hostname_start = endpoint + sizeof(WSS_PREFIX) - 1;
*use_tls_out = YES;
} else {
Expand Down