Browse Source

Compile with -Wstrict-prototypes and -std=c99

Georgi Chorbadzhiyski 12 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
 CC = $(CROSS)$(TARGET)gcc
1
 CC = $(CROSS)$(TARGET)gcc
2
 LINK = $(CROSS)$(TARGET)ld -o
2
 LINK = $(CROSS)$(TARGET)ld -o
3
 LIBRARY_LINK_OPTS =  -L. -r
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
 RM = /bin/rm -f
6
 RM = /bin/rm -f
6
 Q=@
7
 Q=@
7
 
8
 

+ 1
- 1
crc.c View File

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

+ 13
- 13
tsfuncs.h View File

120
 
120
 
121
 int ts_section_is_same(struct ts_section_header *s1, struct ts_section_header *s2);
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
 void						ts_section_data_clear			(struct ts_section_header *sec);
127
 void						ts_section_data_clear			(struct ts_section_header *sec);
128
 void						ts_section_data_free			(struct ts_section_header **ts_section_header);
128
 void						ts_section_data_free			(struct ts_section_header **ts_section_header);
129
 
129
 
136
 
136
 
137
 
137
 
138
 // PAT
138
 // PAT
139
-struct ts_pat *	ts_pat_alloc		();
139
+struct ts_pat *	ts_pat_alloc		(void);
140
 struct ts_pat * ts_pat_alloc_init	(uint16_t transport_stream_id);
140
 struct ts_pat * ts_pat_alloc_init	(uint16_t transport_stream_id);
141
 struct ts_pat *	ts_pat_push_packet	(struct ts_pat *pat, uint8_t *ts_packet);
141
 struct ts_pat *	ts_pat_push_packet	(struct ts_pat *pat, uint8_t *ts_packet);
142
 void            ts_pat_clear		(struct ts_pat *pat);
142
 void            ts_pat_clear		(struct ts_pat *pat);
154
 int				ts_pat_is_same		(struct ts_pat *pat1, struct ts_pat *pat2);
154
 int				ts_pat_is_same		(struct ts_pat *pat1, struct ts_pat *pat2);
155
 
155
 
156
 // CAT
156
 // CAT
157
-struct ts_cat *	ts_cat_alloc		();
157
+struct ts_cat *	ts_cat_alloc		(void);
158
 struct ts_cat *	ts_cat_push_packet	(struct ts_cat *cat, uint8_t *ts_packet);
158
 struct ts_cat *	ts_cat_push_packet	(struct ts_cat *cat, uint8_t *ts_packet);
159
 void            ts_cat_clear		(struct ts_cat *cat);
159
 void            ts_cat_clear		(struct ts_cat *cat);
160
 void            ts_cat_free			(struct ts_cat **cat);
160
 void            ts_cat_free			(struct ts_cat **cat);
176
 int				ts_get_ecm_info_by_pid	(struct ts_pmt *pmt, uint16_t *caid, uint16_t ca_pid);
176
 int				ts_get_ecm_info_by_pid	(struct ts_pmt *pmt, uint16_t *caid, uint16_t ca_pid);
177
 
177
 
178
 // PMT
178
 // PMT
179
-struct ts_pmt *	ts_pmt_alloc		();
179
+struct ts_pmt *	ts_pmt_alloc		(void);
180
 struct ts_pmt * ts_pmt_alloc_init	(uint16_t org_network_id, uint16_t transport_stream_id);
180
 struct ts_pmt * ts_pmt_alloc_init	(uint16_t org_network_id, uint16_t transport_stream_id);
181
 struct ts_pmt *	ts_pmt_push_packet	(struct ts_pmt *pmt, uint8_t *ts_packet);
181
 struct ts_pmt *	ts_pmt_push_packet	(struct ts_pmt *pmt, uint8_t *ts_packet);
182
 void            ts_pmt_clear		(struct ts_pmt *pmt);
182
 void            ts_pmt_clear		(struct ts_pmt *pmt);
191
 int				ts_pmt_is_same		(struct ts_pmt *pmt1, struct ts_pmt *pmt2);
191
 int				ts_pmt_is_same		(struct ts_pmt *pmt1, struct ts_pmt *pmt2);
192
 
192
 
193
 // NIT
193
 // NIT
194
-struct ts_nit * ts_nit_alloc		();
194
+struct ts_nit * ts_nit_alloc		(void);
195
 struct ts_nit * ts_nit_alloc_init	(uint16_t network_id);
195
 struct ts_nit * ts_nit_alloc_init	(uint16_t network_id);
196
 struct ts_nit *	ts_nit_push_packet	(struct ts_nit *nit, uint8_t *ts_packet);
196
 struct ts_nit *	ts_nit_push_packet	(struct ts_nit *nit, uint8_t *ts_packet);
197
 void			ts_nit_clear		(struct ts_nit *nit);
197
 void			ts_nit_clear		(struct ts_nit *nit);
209
 int				ts_nit_is_same		(struct ts_nit *nit1, struct ts_nit *nit2);
209
 int				ts_nit_is_same		(struct ts_nit *nit1, struct ts_nit *nit2);
210
 
210
 
211
 // SDT
211
 // SDT
212
-struct ts_sdt *	ts_sdt_alloc		();
212
+struct ts_sdt *	ts_sdt_alloc		(void);
213
 struct ts_sdt * ts_sdt_alloc_init	(uint16_t org_network_id, uint16_t transport_stream_id);
213
 struct ts_sdt * ts_sdt_alloc_init	(uint16_t org_network_id, uint16_t transport_stream_id);
214
 struct ts_sdt *	ts_sdt_push_packet	(struct ts_sdt *sdt, uint8_t *ts_packet);
214
 struct ts_sdt *	ts_sdt_push_packet	(struct ts_sdt *sdt, uint8_t *ts_packet);
215
 void            ts_sdt_clear		(struct ts_sdt *sdt);
215
 void            ts_sdt_clear		(struct ts_sdt *sdt);
224
 int				ts_sdt_is_same		(struct ts_sdt *sdt1, struct ts_sdt *sdt2);
224
 int				ts_sdt_is_same		(struct ts_sdt *sdt1, struct ts_sdt *sdt2);
225
 
225
 
226
 // EIT
226
 // EIT
227
-struct ts_eit * ts_eit_alloc				();
227
+struct ts_eit * ts_eit_alloc				(void);
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);
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
 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
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
 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
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
 int				ts_eit_is_same		(struct ts_eit *eit1, struct ts_eit *eit2);
246
 int				ts_eit_is_same		(struct ts_eit *eit1, struct ts_eit *eit2);
247
 
247
 
248
 // TDT
248
 // TDT
249
-struct ts_tdt *	ts_tdt_alloc();
249
+struct ts_tdt *	ts_tdt_alloc(void);
250
 struct ts_tdt *	ts_tdt_alloc_init	(time_t ts);
250
 struct ts_tdt *	ts_tdt_alloc_init	(time_t ts);
251
 struct ts_tdt *	ts_tot_alloc_init	(time_t ts);
251
 struct ts_tdt *	ts_tot_alloc_init	(time_t ts);
252
 void			ts_tdt_clear		(struct ts_tdt *tdt);
252
 void			ts_tdt_clear		(struct ts_tdt *tdt);
266
 int				ts_tdt_is_same		(struct ts_tdt *tdt1, struct ts_tdt *tdt2);
266
 int				ts_tdt_is_same		(struct ts_tdt *tdt1, struct ts_tdt *tdt2);
267
 
267
 
268
 // Private section
268
 // Private section
269
-struct ts_privsec *	ts_privsec_alloc();
269
+struct ts_privsec *	ts_privsec_alloc(void);
270
 void				ts_privsec_clear		(struct ts_privsec *pprivsec);
270
 void				ts_privsec_clear		(struct ts_privsec *pprivsec);
271
 void				ts_privsec_free			(struct ts_privsec **pprivsec);
271
 void				ts_privsec_free			(struct ts_privsec **pprivsec);
272
 
272
 
292
 char *			h222_stream_id_desc		(uint8_t stream_id);
292
 char *			h222_stream_id_desc		(uint8_t stream_id);
293
 
293
 
294
 // PES
294
 // PES
295
-struct ts_pes *		ts_pes_alloc			();
295
+struct ts_pes *		ts_pes_alloc			(void);
296
 void				ts_pes_clear			(struct ts_pes *pes);
296
 void				ts_pes_clear			(struct ts_pes *pes);
297
 void				ts_pes_free				(struct ts_pes **pes);
297
 void				ts_pes_free				(struct ts_pes **pes);
298
 
298
 
303
 int					ts_pes_parse			(struct ts_pes *pes);
303
 int					ts_pes_parse			(struct ts_pes *pes);
304
 void				ts_pes_dump				(struct ts_pes *pes);
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
 void					pes_array_dump			(struct pes_array *pa);
307
 void					pes_array_dump			(struct pes_array *pa);
308
 void					pes_array_free			(struct pes_array **ppa);
308
 void					pes_array_free			(struct pes_array **ppa);
309
 
309
 

+ 6
- 6
tstest.c View File

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

Loading…
Cancel
Save