Browse Source

Compile with -Wstrict-prototypes and -std=c99

Georgi Chorbadzhiyski 7 years ago
parent
commit
97def68a01
4 changed files with 22 additions and 21 deletions
  1. 2 1
      Makefile
  2. 1 1
      crc.c
  3. 13 13
      tsfuncs.h
  4. 6 6
      tstest.c

+ 2 - 1
Makefile View File

@@ -1,7 +1,8 @@
1 1
 CC = $(CROSS)$(TARGET)gcc
2 2
 LINK = $(CROSS)$(TARGET)ld -o
3 3
 LIBRARY_LINK_OPTS =  -L. -r
4
-CFLAGS = -ggdb -D_GNU_SOURCE -Wall -Wextra -Wshadow -Wformat-security -O2
4
+CFLAGS = -O2 -ggdb -std=c99 -D_GNU_SOURCE
5
+CFLAGS += -Wall -Wextra -Wshadow -Wformat-security -Wstrict-prototypes
5 6
 RM = /bin/rm -f
6 7
 Q=@
7 8
 

+ 1 - 1
crc.c View File

@@ -14,7 +14,7 @@
14 14
 static int crc_table_initialized = 0;
15 15
 static uint32_t crc32_table[256];
16 16
 
17
-void ts_crc32_init() {
17
+void ts_crc32_init(void) {
18 18
 	int i, j;
19 19
 	uint32_t crc;
20 20
 	if (crc_table_initialized)

+ 13 - 13
tsfuncs.h View File

@@ -120,10 +120,10 @@ void						ts_section_header_set_private_vars	(struct ts_section_header *ts_secti
120 120
 
121 121
 int ts_section_is_same(struct ts_section_header *s1, struct ts_section_header *s2);
122 122
 
123
-uint8_t *					ts_section_data_alloc_section	();
124
-uint8_t *					ts_section_data_alloc_packet	();
123
+uint8_t *					ts_section_data_alloc_section	(void);
124
+uint8_t *					ts_section_data_alloc_packet	(void);
125 125
 
126
-struct ts_section_header *	ts_section_data_alloc			();
126
+struct ts_section_header *	ts_section_data_alloc			(void);
127 127
 void						ts_section_data_clear			(struct ts_section_header *sec);
128 128
 void						ts_section_data_free			(struct ts_section_header **ts_section_header);
129 129
 
@@ -136,7 +136,7 @@ void						ts_section_data_gen_ts_packets	(struct ts_header *ts_header, uint8_t *
136 136
 
137 137
 
138 138
 // PAT
139
-struct ts_pat *	ts_pat_alloc		();
139
+struct ts_pat *	ts_pat_alloc		(void);
140 140
 struct ts_pat * ts_pat_alloc_init	(uint16_t transport_stream_id);
141 141
 struct ts_pat *	ts_pat_push_packet	(struct ts_pat *pat, uint8_t *ts_packet);
142 142
 void            ts_pat_clear		(struct ts_pat *pat);
@@ -154,7 +154,7 @@ int             ts_pat_del_program	(struct ts_pat *pat, uint16_t program);
154 154
 int				ts_pat_is_same		(struct ts_pat *pat1, struct ts_pat *pat2);
155 155
 
156 156
 // CAT
157
-struct ts_cat *	ts_cat_alloc		();
157
+struct ts_cat *	ts_cat_alloc		(void);
158 158
 struct ts_cat *	ts_cat_push_packet	(struct ts_cat *cat, uint8_t *ts_packet);
159 159
 void            ts_cat_clear		(struct ts_cat *cat);
160 160
 void            ts_cat_free			(struct ts_cat **cat);
@@ -176,7 +176,7 @@ int				ts_get_emm_info_by_pid	(struct ts_cat *cat, uint16_t *caid, uint16_t ca_p
176 176
 int				ts_get_ecm_info_by_pid	(struct ts_pmt *pmt, uint16_t *caid, uint16_t ca_pid);
177 177
 
178 178
 // PMT
179
-struct ts_pmt *	ts_pmt_alloc		();
179
+struct ts_pmt *	ts_pmt_alloc		(void);
180 180
 struct ts_pmt * ts_pmt_alloc_init	(uint16_t org_network_id, uint16_t transport_stream_id);
181 181
 struct ts_pmt *	ts_pmt_push_packet	(struct ts_pmt *pmt, uint8_t *ts_packet);
182 182
 void            ts_pmt_clear		(struct ts_pmt *pmt);
@@ -191,7 +191,7 @@ void			ts_pmt_regenerate_packets	(struct ts_pmt *pmt);
191 191
 int				ts_pmt_is_same		(struct ts_pmt *pmt1, struct ts_pmt *pmt2);
192 192
 
193 193
 // NIT
194
-struct ts_nit * ts_nit_alloc		();
194
+struct ts_nit * ts_nit_alloc		(void);
195 195
 struct ts_nit * ts_nit_alloc_init	(uint16_t network_id);
196 196
 struct ts_nit *	ts_nit_push_packet	(struct ts_nit *nit, uint8_t *ts_packet);
197 197
 void			ts_nit_clear		(struct ts_nit *nit);
@@ -209,7 +209,7 @@ struct ts_nit *	ts_nit_copy			(struct ts_nit *nit);
209 209
 int				ts_nit_is_same		(struct ts_nit *nit1, struct ts_nit *nit2);
210 210
 
211 211
 // SDT
212
-struct ts_sdt *	ts_sdt_alloc		();
212
+struct ts_sdt *	ts_sdt_alloc		(void);
213 213
 struct ts_sdt * ts_sdt_alloc_init	(uint16_t org_network_id, uint16_t transport_stream_id);
214 214
 struct ts_sdt *	ts_sdt_push_packet	(struct ts_sdt *sdt, uint8_t *ts_packet);
215 215
 void            ts_sdt_clear		(struct ts_sdt *sdt);
@@ -224,7 +224,7 @@ struct ts_sdt *	ts_sdt_copy			(struct ts_sdt *sdt);
224 224
 int				ts_sdt_is_same		(struct ts_sdt *sdt1, struct ts_sdt *sdt2);
225 225
 
226 226
 // EIT
227
-struct ts_eit * ts_eit_alloc				();
227
+struct ts_eit * ts_eit_alloc				(void);
228 228
 struct ts_eit *	ts_eit_alloc_init			(uint16_t service_id, uint16_t transport_stream_id, uint16_t org_network_id, uint8_t table_id, uint8_t sec_number, uint8_t last_sec_number);
229 229
 struct ts_eit *	ts_eit_alloc_init_pf		(uint16_t service_id, uint16_t transport_stream_id, uint16_t org_network_id, uint8_t sec_number, uint8_t last_sec_number);	// Shortcut using table_id 0x4e
230 230
 struct ts_eit *	ts_eit_alloc_init_schedule	(uint16_t service_id, uint16_t transport_stream_id, uint16_t org_network_id, uint8_t sec_number, uint8_t last_sec_number);	// Shortcut using table_id 0x50
@@ -246,7 +246,7 @@ int				ts_eit_add_extended_event_descriptor(struct ts_eit *eit, uint16_t event_i
246 246
 int				ts_eit_is_same		(struct ts_eit *eit1, struct ts_eit *eit2);
247 247
 
248 248
 // TDT
249
-struct ts_tdt *	ts_tdt_alloc();
249
+struct ts_tdt *	ts_tdt_alloc(void);
250 250
 struct ts_tdt *	ts_tdt_alloc_init	(time_t ts);
251 251
 struct ts_tdt *	ts_tot_alloc_init	(time_t ts);
252 252
 void			ts_tdt_clear		(struct ts_tdt *tdt);
@@ -266,7 +266,7 @@ struct ts_tdt *	ts_tdt_copy			(struct ts_tdt *tdt);
266 266
 int				ts_tdt_is_same		(struct ts_tdt *tdt1, struct ts_tdt *tdt2);
267 267
 
268 268
 // Private section
269
-struct ts_privsec *	ts_privsec_alloc();
269
+struct ts_privsec *	ts_privsec_alloc(void);
270 270
 void				ts_privsec_clear		(struct ts_privsec *pprivsec);
271 271
 void				ts_privsec_free			(struct ts_privsec **pprivsec);
272 272
 
@@ -292,7 +292,7 @@ char *          h222_stream_type_desc   (uint8_t stream_type);
292 292
 char *			h222_stream_id_desc		(uint8_t stream_id);
293 293
 
294 294
 // PES
295
-struct ts_pes *		ts_pes_alloc			();
295
+struct ts_pes *		ts_pes_alloc			(void);
296 296
 void				ts_pes_clear			(struct ts_pes *pes);
297 297
 void				ts_pes_free				(struct ts_pes **pes);
298 298
 
@@ -303,7 +303,7 @@ struct ts_pes *		ts_pes_push_packet		(struct ts_pes *pes, uint8_t *ts_packet, st
303 303
 int					ts_pes_parse			(struct ts_pes *pes);
304 304
 void				ts_pes_dump				(struct ts_pes *pes);
305 305
 
306
-struct pes_array *		pes_array_alloc			();
306
+struct pes_array *		pes_array_alloc			(void);
307 307
 void					pes_array_dump			(struct pes_array *pa);
308 308
 void					pes_array_free			(struct pes_array **ppa);
309 309
 

+ 6 - 6
tstest.c View File

@@ -10,7 +10,7 @@
10 10
 #define NOW 1234567890
11 11
 #define NOW2 1000000000
12 12
 
13
-void ts_pat_test() {
13
+void ts_pat_test(void) {
14 14
 	struct ts_pat *pat = ts_pat_alloc_init(0x7878);
15 15
 
16 16
 	ts_pat_dump(pat);
@@ -35,7 +35,7 @@ void ts_pat_test() {
35 35
 	ts_pat_free(&pat);
36 36
 }
37 37
 
38
-void ts_tdt_test() {
38
+void ts_tdt_test(void) {
39 39
 	struct ts_tdt *tdt = ts_tdt_alloc_init(NOW);
40 40
 	ts_tdt_dump(tdt);
41 41
 	ts_tdt_set_time(tdt, NOW2);
@@ -43,7 +43,7 @@ void ts_tdt_test() {
43 43
 	ts_tdt_free(&tdt);
44 44
 }
45 45
 
46
-void ts_tot_test() {
46
+void ts_tot_test(void) {
47 47
 	struct ts_tdt *tot;
48 48
 
49 49
 	tot = ts_tot_alloc_init(NOW);
@@ -61,7 +61,7 @@ void ts_tot_test() {
61 61
 	ts_tdt_free(&tot);
62 62
 }
63 63
 
64
-int ts_sdt_test() {
64
+int ts_sdt_test(void) {
65 65
 	struct ts_sdt *sdt = ts_sdt_alloc_init(1, 2);
66 66
 
67 67
 	ts_sdt_add_service_descriptor(sdt, 1007, 1, "BULSATCOM", "bTV");
@@ -116,7 +116,7 @@ void ts_eit_test4(struct ts_eit *eit) { // Test almost full PSI packet on the TS
116 116
 	ts_eit_add_short_event_descriptor(eit, 4, 1, NOW, 3600, "aaaaaaaaBBBB", NULL);
117 117
 }
118 118
 
119
-void ts_eit_test() {
119
+void ts_eit_test(void) {
120 120
 	struct ts_eit *eit;
121 121
 
122 122
 	eit = ts_eit_alloc_init(1, 2, 3, 1, 0, 0);
@@ -141,7 +141,7 @@ void ts_eit_test() {
141 141
 //	write(1, eit->section_header->packet_data, eit->section_header->num_packets * TS_PACKET_SIZE);
142 142
 }
143 143
 
144
-int main() {
144
+int main(void) {
145 145
 	ts_pat_test();
146 146
 	ts_tdt_test();
147 147
 	ts_tot_test();