Skip to content

Commit ff7307a

Browse files
committed
Fix warnings
1 parent 94960d2 commit ff7307a

File tree

4 files changed

+27
-25
lines changed

4 files changed

+27
-25
lines changed

src/tigr_inflate.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,23 +65,23 @@ static void copy(State* s, const unsigned char* src, int len) {
6565
*dest++ = *src++;
6666
}
6767

68-
static int build(State* s, unsigned* tree, unsigned char* lens, int symcount) {
69-
unsigned n, codes[16], first[16], counts[16] = { 0 };
68+
static int build(State* s, unsigned* tree, unsigned char* lens, unsigned int symcount) {
69+
unsigned int codes[16], first[16], counts[16] = { 0 };
7070

7171
// Frequency count.
72-
for (n = 0; n < symcount; n++)
72+
for (unsigned int n = 0; n < symcount; n++)
7373
counts[lens[n]]++;
7474

7575
// Distribute codes.
7676
counts[0] = codes[0] = first[0] = 0;
77-
for (n = 1; n <= 15; n++) {
77+
for (unsigned int n = 1; n <= 15; n++) {
7878
codes[n] = (codes[n - 1] + counts[n - 1]) << 1;
7979
first[n] = first[n - 1] + counts[n - 1];
8080
}
8181
CHECK(first[15] + counts[15] <= symcount);
8282

8383
// Insert keys into the tree for each symbol.
84-
for (n = 0; n < symcount; n++) {
84+
for (unsigned int n = 0; n < symcount; n++) {
8585
int len = lens[n];
8686
if (len != 0) {
8787
unsigned code = codes[len]++, slot = first[len]++;

src/tigr_osx.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,10 @@ enum {
3939
NSKeyDownMask = 1 << NSKeyDown,
4040
NSKeyUp = 11,
4141
NSKeyUpMask = 1 << NSKeyUp,
42-
NSAllEventMask = NSUIntegerMax,
4342
};
4443

44+
NSUInteger NSAllEventMask = NSUIntegerMax;
45+
4546
extern id NSApp;
4647
extern id const NSDefaultRunLoopMode;
4748

@@ -52,7 +53,7 @@ bool terminated = false;
5253

5354
static uint64_t tigrTimestamp = 0;
5455

55-
void _tigrResetTime() {
56+
void _tigrResetTime(void) {
5657
tigrTimestamp = mach_absolute_time();
5758
}
5859

@@ -70,7 +71,7 @@ TigrInternal* _tigrInternalCocoa(id window) {
7071
}
7172

7273
// we gonna construct objective-c class by hand in runtime, so wow, so hacker!
73-
NSUInteger applicationShouldTerminate(id self, SEL _sel, id sender) {
74+
NSUInteger applicationShouldTerminate(id self, SEL sel, id sender) {
7475
terminated = true;
7576
return 0;
7677
}
@@ -163,7 +164,7 @@ static void _showPools(const char* context) {
163164
#define showPools(x)
164165
#endif
165166

166-
static id pushPool() {
167+
static id pushPool(void) {
167168
id pool = objc_msgSend_id(class("NSAutoreleasePool"), sel("alloc"));
168169
return objc_msgSend_id(pool, sel("init"));
169170
}
@@ -172,12 +173,12 @@ static void popPool(id pool) {
172173
objc_msgSend_void(pool, sel("drain"));
173174
}
174175

175-
void _tigrCleanupOSX() {
176+
void _tigrCleanupOSX(void) {
176177
showPools("cleanup");
177178
popPool(autoreleasePool);
178179
}
179180

180-
void tigrInitOSX() {
181+
void tigrInitOSX(void) {
181182
if (tigrOSXInited)
182183
return;
183184

@@ -1034,7 +1035,7 @@ int tigrReadChar(Tigr* bmp) {
10341035
return c;
10351036
}
10361037

1037-
float tigrTime() {
1038+
float tigrTime(void) {
10381039
static mach_timebase_info_data_t timebaseInfo;
10391040

10401041
if (timebaseInfo.denom == 0) {

tigr.c

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1210,23 +1210,23 @@ static void copy(State* s, const unsigned char* src, int len) {
12101210
*dest++ = *src++;
12111211
}
12121212

1213-
static int build(State* s, unsigned* tree, unsigned char* lens, int symcount) {
1214-
unsigned n, codes[16], first[16], counts[16] = { 0 };
1213+
static int build(State* s, unsigned* tree, unsigned char* lens, unsigned int symcount) {
1214+
unsigned int codes[16], first[16], counts[16] = { 0 };
12151215

12161216
// Frequency count.
1217-
for (n = 0; n < symcount; n++)
1217+
for (unsigned int n = 0; n < symcount; n++)
12181218
counts[lens[n]]++;
12191219

12201220
// Distribute codes.
12211221
counts[0] = codes[0] = first[0] = 0;
1222-
for (n = 1; n <= 15; n++) {
1222+
for (unsigned int n = 1; n <= 15; n++) {
12231223
codes[n] = (codes[n - 1] + counts[n - 1]) << 1;
12241224
first[n] = first[n - 1] + counts[n - 1];
12251225
}
12261226
CHECK(first[15] + counts[15] <= symcount);
12271227

12281228
// Insert keys into the tree for each symbol.
1229-
for (n = 0; n < symcount; n++) {
1229+
for (unsigned int n = 0; n < symcount; n++) {
12301230
int len = lens[n];
12311231
if (len != 0) {
12321232
unsigned code = codes[len]++, slot = first[len]++;
@@ -2826,9 +2826,10 @@ enum {
28262826
NSKeyDownMask = 1 << NSKeyDown,
28272827
NSKeyUp = 11,
28282828
NSKeyUpMask = 1 << NSKeyUp,
2829-
NSAllEventMask = NSUIntegerMax,
28302829
};
28312830

2831+
NSUInteger NSAllEventMask = NSUIntegerMax;
2832+
28322833
extern id NSApp;
28332834
extern id const NSDefaultRunLoopMode;
28342835

@@ -2839,7 +2840,7 @@ bool terminated = false;
28392840

28402841
static uint64_t tigrTimestamp = 0;
28412842

2842-
void _tigrResetTime() {
2843+
void _tigrResetTime(void) {
28432844
tigrTimestamp = mach_absolute_time();
28442845
}
28452846

@@ -2857,7 +2858,7 @@ TigrInternal* _tigrInternalCocoa(id window) {
28572858
}
28582859

28592860
// we gonna construct objective-c class by hand in runtime, so wow, so hacker!
2860-
NSUInteger applicationShouldTerminate(id self, SEL _sel, id sender) {
2861+
NSUInteger applicationShouldTerminate(id self, SEL sel, id sender) {
28612862
terminated = true;
28622863
return 0;
28632864
}
@@ -2950,7 +2951,7 @@ static void _showPools(const char* context) {
29502951
#define showPools(x)
29512952
#endif
29522953

2953-
static id pushPool() {
2954+
static id pushPool(void) {
29542955
id pool = objc_msgSend_id(class("NSAutoreleasePool"), sel("alloc"));
29552956
return objc_msgSend_id(pool, sel("init"));
29562957
}
@@ -2959,12 +2960,12 @@ static void popPool(id pool) {
29592960
objc_msgSend_void(pool, sel("drain"));
29602961
}
29612962

2962-
void _tigrCleanupOSX() {
2963+
void _tigrCleanupOSX(void) {
29632964
showPools("cleanup");
29642965
popPool(autoreleasePool);
29652966
}
29662967

2967-
void tigrInitOSX() {
2968+
void tigrInitOSX(void) {
29682969
if (tigrOSXInited)
29692970
return;
29702971

@@ -3821,7 +3822,7 @@ int tigrReadChar(Tigr* bmp) {
38213822
return c;
38223823
}
38233824

3824-
float tigrTime() {
3825+
float tigrTime(void) {
38253826
static mach_timebase_info_data_t timebaseInfo;
38263827

38273828
if (timebaseInfo.denom == 0) {

tigr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ int tigrSaveImage(const char *fileName, Tigr *bmp);
328328

329329
// Returns the amount of time elapsed since tigrTime was last called,
330330
// or zero on the first call.
331-
float tigrTime();
331+
float tigrTime(void);
332332

333333
// Displays an error message and quits. (UTF-8)
334334
// 'bmp' can be NULL.

0 commit comments

Comments
 (0)