Skip to content

Commit ff352ea

Browse files
committed
Merge pull request troydhanson#38 from njwhite/master
Fix -Wextra Warnings
2 parents abdc29e + 8467853 commit ff352ea

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

opt/bundle/src/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ OBJS=libut.a
22
all: $(OBJS)
33
INCDIR=../include
44
CFLAGS=-I$(INCDIR)
5-
CFLAGS+=-Wall
5+
CFLAGS+=-Wall -Wextra
66
CFLAGS+=-g
77

88
libut.a: libut.o utvector.o

opt/bundle/tests/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ PROGS=test1 test2 test3 test4 test5 test6 test7 test8 test9 test10 test11 test12
22
test13 test14 test15
33
OBJS=$(patsubst %,%.o,$(PROGS))
44

5-
CFLAGS = -I../include -L../src
5+
CFLAGS = -I../include
66
CFLAGS += -g
7-
CFLAGS += -Wall
8-
LDFLAGS=-lut
7+
CFLAGS += -Wall -Wextra
8+
LDFLAGS=-lut -L../src
99

1010
TEST_TARGET=run_tests
1111
TESTS=./do_tests

src/utstring.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,15 +164,15 @@ _UNUSED_ static void _utstring_BuildTable(
164164
i = 0;
165165
j = i - 1;
166166
P_KMP_Table[i] = j;
167-
while (i < P_NeedleLen)
167+
while (i < (long) P_NeedleLen)
168168
{
169169
while ( (j > -1) && (P_Needle[i] != P_Needle[j]) )
170170
{
171171
j = P_KMP_Table[j];
172172
}
173173
i++;
174174
j++;
175-
if (i < P_NeedleLen)
175+
if (i < (long) P_NeedleLen)
176176
{
177177
if (P_Needle[i] == P_Needle[j])
178178
{
@@ -206,7 +206,7 @@ _UNUSED_ static void _utstring_BuildTableR(
206206
P_KMP_Table[i + 1] = j;
207207
while (i >= 0)
208208
{
209-
while ( (j < P_NeedleLen) && (P_Needle[i] != P_Needle[j]) )
209+
while ( (j < (long) P_NeedleLen) && (P_Needle[i] != P_Needle[j]) )
210210
{
211211
j = P_KMP_Table[j + 1];
212212
}
@@ -321,7 +321,7 @@ _UNUSED_ static long utstring_find(
321321
V_StartPosition = P_StartPosition;
322322
}
323323
V_HaystackLen = s->i - V_StartPosition;
324-
if ( (V_HaystackLen >= P_NeedleLen) && (P_NeedleLen > 0) )
324+
if ( (V_HaystackLen >= (long) P_NeedleLen) && (P_NeedleLen > 0) )
325325
{
326326
V_KMP_Table = (long *)malloc(sizeof(long) * (P_NeedleLen + 1));
327327
if (V_KMP_Table != NULL)
@@ -367,7 +367,7 @@ _UNUSED_ static long utstring_findR(
367367
V_StartPosition = P_StartPosition;
368368
}
369369
V_HaystackLen = V_StartPosition + 1;
370-
if ( (V_HaystackLen >= P_NeedleLen) && (P_NeedleLen > 0) )
370+
if ( (V_HaystackLen >= (long) P_NeedleLen) && (P_NeedleLen > 0) )
371371
{
372372
V_KMP_Table = (long *)malloc(sizeof(long) * (P_NeedleLen + 1));
373373
if (V_KMP_Table != NULL)

0 commit comments

Comments
 (0)