diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index a564577..4d9e98f 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -86,6 +86,10 @@ add_library(chiaki-lib ${HEADER_FILES} ${SOURCE_FILES} ${CHIAKI_LIB_PROTO_SOURCE configure_file(config.h.in include/chiaki/config.h) target_include_directories(chiaki-lib PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/include") +if(CMAKE_C_COMPILER_ID STREQUAL GNU OR CMAKE_C_COMPILER_ID STREQUAL Clang) + target_compile_options(chiaki-lib PRIVATE -Wall) +endif() + add_dependencies(chiaki-lib chiaki-pb) set_target_properties(chiaki-lib PROPERTIES OUTPUT_NAME chiaki) diff --git a/lib/src/base64.c b/lib/src/base64.c index 297eb3e..5882ff8 100644 --- a/lib/src/base64.c +++ b/lib/src/base64.c @@ -110,7 +110,7 @@ CHIAKI_EXPORT ChiakiErrorCode chiaki_base64_decode(const char *in, size_t in_siz while (in < end) { - unsigned char c = d[*in++]; + unsigned char c = d[(size_t)(*in++)]; switch(c) { @@ -153,4 +153,4 @@ CHIAKI_EXPORT ChiakiErrorCode chiaki_base64_decode(const char *in, size_t in_siz *out_size = len; return CHIAKI_ERR_SUCCESS; -} \ No newline at end of file +} diff --git a/lib/src/ctrl.c b/lib/src/ctrl.c index 4fc768c..b410741 100644 --- a/lib/src/ctrl.c +++ b/lib/src/ctrl.c @@ -157,6 +157,7 @@ CHIAKI_EXPORT ChiakiErrorCode chiaki_ctrl_send_message(ChiakiCtrl *ctrl, uint16_ } chiaki_mutex_unlock(&ctrl->notif_mutex); chiaki_stop_pipe_stop(&ctrl->notif_pipe); + return CHIAKI_ERR_SUCCESS; } CHIAKI_EXPORT void chiaki_ctrl_set_login_pin(ChiakiCtrl *ctrl, const uint8_t *pin, size_t pin_size) diff --git a/lib/src/pb_utils.h b/lib/src/pb_utils.h index d01b204..70ecd5a 100644 --- a/lib/src/pb_utils.h +++ b/lib/src/pb_utils.h @@ -6,7 +6,7 @@ #include #include -static bool chiaki_pb_encode_string(pb_ostream_t *stream, const pb_field_t *field, void *const *arg) +static inline bool chiaki_pb_encode_string(pb_ostream_t *stream, const pb_field_t *field, void *const *arg) { char *str = *arg; @@ -22,7 +22,7 @@ typedef struct chiaki_pb_buf_t uint8_t *buf; } ChiakiPBBuf; -static bool chiaki_pb_encode_buf(pb_ostream_t *stream, const pb_field_t *field, void *const *arg) +static inline bool chiaki_pb_encode_buf(pb_ostream_t *stream, const pb_field_t *field, void *const *arg) { ChiakiPBBuf *buf = *arg; @@ -40,7 +40,7 @@ typedef struct chiaki_pb_decode_buf_t uint8_t *buf; } ChiakiPBDecodeBuf; -static bool chiaki_pb_decode_buf(pb_istream_t *stream, const pb_field_t *field, void **arg) +static inline bool chiaki_pb_decode_buf(pb_istream_t *stream, const pb_field_t *field, void **arg) { ChiakiPBDecodeBuf *buf = *arg; if(stream->bytes_left > buf->max_size) @@ -63,7 +63,7 @@ typedef struct chiaki_pb_decode_buf_alloc_t uint8_t *buf; } ChiakiPBDecodeBufAlloc; -static bool chiaki_pb_decode_buf_alloc(pb_istream_t *stream, const pb_field_t *field, void **arg) +static inline bool chiaki_pb_decode_buf_alloc(pb_istream_t *stream, const pb_field_t *field, void **arg) { ChiakiPBDecodeBufAlloc *buf = *arg; buf->size = stream->bytes_left; diff --git a/lib/src/session.c b/lib/src/session.c index c0850d8..fd1411d 100644 --- a/lib/src/session.c +++ b/lib/src/session.c @@ -334,14 +334,6 @@ static bool session_check_state_pred_pin(void *user) || session->login_pin_entered; } -static bool session_check_state_pred_session_id(void *user) -{ - ChiakiSession *session = user; - return session->should_stop - || session->ctrl_failed - || session->ctrl_session_id_received; -} - #define ENABLE_SENKUSHA static void *session_thread_func(void *arg) diff --git a/lib/src/takion.c b/lib/src/takion.c index 36374f8..dcb26f2 100644 --- a/lib/src/takion.c +++ b/lib/src/takion.c @@ -1273,7 +1273,7 @@ CHIAKI_EXPORT ChiakiErrorCode chiaki_takion_v9_av_packet_parse(ChiakiTakionAVPac uint32_t key_pos_low = ntohl(*((chiaki_unaligned_uint32_t *)(av + 0xd))); packet->key_pos = chiaki_key_state_request_pos(key_state, key_pos_low, true); - uint8_t unknown_1 = av[0x11]; + uint8_t unknown_1 = av[0x11]; (void)unknown_1; av += 0x11; av_size -= 0x11;