Skip to content

Commit

Permalink
cleanup unused parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcsparker committed Sep 30, 2015
1 parent 1dc1065 commit 94fc567
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 15 deletions.
5 changes: 4 additions & 1 deletion configure.ac
Expand Up @@ -54,7 +54,10 @@ AC_SUBST(MW_SO_OS_FLAGS)
AC_ARG_ENABLE(debug,
[ --enable-debug compile with debugging support],
AC_DEFINE(DEBUG, 1, [Define if debugging is enabled.]), )

if test "$enable_debug" = "yes" ; then
CFLAGS="$CFLAGS -g -O0 -Wall -Wno-uninitialized -Wextra -Werror"
CXXFLAGS="$CXXFLAGS -g -O0 -Wall -Wno-uninitialized -Wextra -Werror"
fi


# debugging output urging people to send mail
Expand Down
6 changes: 1 addition & 5 deletions samples/Makefile.am
@@ -1,5 +1,3 @@


SAMPLES_SRC = \
logging_proxy.c \
login_server.c \
Expand All @@ -10,7 +8,6 @@ SAMPLES_SRC = \

SAMPLES = $(SAMPLES_SRC:.c=)


sample_SCRIPTS = \
build

Expand All @@ -21,12 +18,11 @@ sample_DATA = \

sampledir = $(datadir)/doc/@PACKAGE@-doc-@VERSION@/samples


EXTRA_DIST = $(sample_DATA) $(sample_SCRIPTS)


$(SAMPLES): %: %.c
$(CC) $< -o $@ $(GLIB_CFLAGS) $(GLIB_LIBS) `PKG_CONFIG_PATH="$(prefix)/lib/pkgconfig" $(PKG_CONFIG) --cflags --libs meanwhile`
$(CC) $< -o $@ $(GLIB_CFLAGS) $(GLIB_LIBS) `PKG_CONFIG_PATH="../:$(prefix)/lib/pkgconfig" $(PKG_CONFIG) --cflags --libs meanwhile`


clean-local:
Expand Down
3 changes: 3 additions & 0 deletions src/channel.c
Expand Up @@ -904,6 +904,9 @@ void mwChannel_addSupportedCipherInstance(struct mwChannel *chan,


static void collect(gpointer a, gpointer b, gpointer c) {
// `a` isn't used
(void)a;

GList **list = c;
*list = g_list_append(*list, b);
}
Expand Down
9 changes: 8 additions & 1 deletion src/cipher.c
Expand Up @@ -336,7 +336,7 @@ void mwEncryptExpanded(const int *ekey, guchar *iv,

/* copy in to out, and write padding bytes */
for(x = i_len; x--; o[x] = i[x]);
for(x = i_len; x < o_len; o[x++] = y);
for(x = i_len; x < (int)o_len; o[x++] = y);
/* memcpy(o, i, i_len);
memset(o + i_len, y, y); */

Expand Down Expand Up @@ -555,6 +555,10 @@ new_instance_RC2_40(struct mwCipher *cipher,


static struct mwEncryptItem *new_item_RC2_40(struct mwCipherInstance *ci) {

// `ci` unused
(void)ci;

struct mwEncryptItem *e;

e = g_new0(struct mwEncryptItem, 1);
Expand All @@ -572,6 +576,9 @@ offer_RC2_40(struct mwCipherInstance *ci) {
static void accepted_RC2_40(struct mwCipherInstance *ci,
struct mwEncryptItem *item) {

// `item` unused
(void)item;

struct mwCipherInstance_RC2_40 *cir;
struct mwLoginInfo *info;

Expand Down
13 changes: 12 additions & 1 deletion src/message.c
Expand Up @@ -106,6 +106,8 @@ static void HANDSHAKE_get(struct mwGetBuffer *b, struct mwMsgHandshake *msg) {


static void HANDSHAKE_clear(struct mwMsgHandshake *msg) {
// `msg` unused
(void)msg;
; /* nothing to clean up */
}

Expand Down Expand Up @@ -210,18 +212,25 @@ static void LOGIN_ACK_clear(struct mwMsgLoginAck *msg) {
static void LOGIN_CONTINUE_put(struct mwPutBuffer *b,
struct mwMsgLoginContinue *msg) {

// `b` and `msg` unused
(void)b;
(void)msg;
; /* nothing but a message header */
}


static void LOGIN_CONTINUE_get(struct mwGetBuffer *b,
struct mwMsgLoginContinue *msg) {

// `b` and `msg` unused
(void)b;
(void)msg;
; /* nothing but a message header */
}


static void LOGIN_CONTINUE_clear(struct mwMsgLoginContinue *msg) {
// `msg` unused
(void)msg;
; /* this is a very simple message */
}

Expand Down Expand Up @@ -582,6 +591,8 @@ static void SENSE_SERVICE_get(struct mwGetBuffer *b,


static void SENSE_SERVICE_clear(struct mwMsgSenseService *msg) {
// `msg` unused
(void)msg;
;
}

Expand Down
14 changes: 7 additions & 7 deletions src/mpi/mpi.c
Expand Up @@ -1286,7 +1286,7 @@ mw_mp_err mw_mp_expt(mw_mp_int *a, mw_mp_int *b, mw_mp_int *c)
goto X;

/* Loop over low-order digits in ascending order */
for(dig = 0; dig < (USED(b) - 1); dig++) {
for(dig = 0; dig < (int)(USED(b) - 1); dig++) {
d = DIGIT(b, dig);

/* Loop over bits of each non-maximal digit */
Expand Down Expand Up @@ -1664,7 +1664,7 @@ mw_mp_err mw_mp_exptmod(mw_mp_int *a, mw_mp_int *b, mw_mp_int *m, mw_mp_int *c)
goto CLEANUP;

/* Loop over digits of b in ascending order, except highest order */
for(dig = 0; dig < (ub - 1); dig++) {
for(dig = 0; dig < (int)(ub - 1); dig++) {
d = *db++;

/* Loop over the bits of the lower-order digits */
Expand Down Expand Up @@ -2400,7 +2400,7 @@ mw_mp_err mw_mp_to_unsigned_bin(mw_mp_int *mp, unsigned char *str)
int ix;

d = *dp;
for(ix = 0; ix < sizeof(mw_mp_digit); ++ix) {
for(ix = 0; ix < (int)sizeof(mw_mp_digit); ++ix) {
*spos = d & UCHAR_MAX;
d >>= CHAR_BIT;
++spos;
Expand Down Expand Up @@ -2846,7 +2846,7 @@ mw_mp_err s_mw_mp_lshd(mw_mp_int *mp, mw_mp_size p)
dp[ix + p] = dp[ix];

/* Fill the bottom digits with zeroes */
for(ix = 0; ix < p; ix++)
for(ix = 0; ix < (int)p; ix++)
dp[ix] = 0;

return MP_OKAY;
Expand Down Expand Up @@ -2916,7 +2916,7 @@ mw_mp_err s_mw_mp_mul_2(mw_mp_int *mp)
mw_mp_err res;

/* Shift digits leftward by 1 bit */
for(ix = 0; ix < USED(mp); ix++) {
for(ix = 0; ix < (int)USED(mp); ix++) {
kout = (dp[ix] >> (DIGIT_BIT - 1)) & 1;
dp[ix] = (dp[ix] << 1) | kin;

Expand All @@ -2925,7 +2925,7 @@ mw_mp_err s_mw_mp_mul_2(mw_mp_int *mp)

/* Deal with rollover from last digit */
if(kin) {
if(ix >= ALLOC(mp)) {
if(ix >= (int)ALLOC(mp)) {
if((res = s_mw_mp_grow(mp, ALLOC(mp) + 1)) != MP_OKAY)
return res;
dp = DIGITS(mp);
Expand Down Expand Up @@ -3003,7 +3003,7 @@ mw_mp_err s_mw_mp_mul_2d(mw_mp_int *mp, mw_mp_digit d)

/* Do the shifting... */
save = 0;
for(ix = 0; ix < used; ix++) {
for(ix = 0; ix < (int)used; ix++) {
next = (dp[ix] >> (DIGIT_BIT - d)) & mask;
dp[ix] = (dp[ix] << d) | save;
save = next;
Expand Down

0 comments on commit 94fc567

Please sign in to comment.