OSDN Git Service

patch for arib_std_b25-0.2.5 to suit for linux
[rec10/rec10-git.git] / tstools / arib_std_b25 / arib_std_b25-0.2.5-w2l.patch
1 diff -crN 025win/Makefile 025linux/Makefile
2 *** 025win/Makefile     1970-01-01 09:00:00.000000000 +0900
3 --- 025linux/Makefile   2012-02-19 03:21:03.082870623 +0900
4 ***************
5 *** 0 ****
6 --- 1,25 ----
7 + # PC/SC Lite libraries and headers.
8 + PCSC_CFLAGS ?= `pkg-config libpcsclite --cflags`
9 + PCSC_LDLIBS ?= `pkg-config libpcsclite --libs`
10
11 + CC     = gcc
12 + CFLAGS = -Wall -O2 -g $(PCSC_CFLAGS) -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
13 + LDLIBS = $(PCSC_LDLIBS) -lm -lrt
14 +  
15 + TARGET = b25
16 + OBJS   = arib_std_b25.o b_cas_card.o multi2.o td.o ts_section_parser.o
17
18 + all: $(TARGET)
19
20 + arib_std_b25.o: arib_std_b25.c arib_std_b25.h portable.h b_cas_card.h arib_std_b25_error_code.h multi2.h ts_section_parser.h ts_common_types.h
21 + b_cas_card.o: b_cas_card.c b_cas_card.h portable.h b_cas_card_error_code.h 
22 + multi2.o: multi2.c multi2.h portable.h multi2_error_code.h 
23 + td.o: td.c arib_std_b25.h portable.h b_cas_card.h 
24 + ts_section_parser.o: ts_section_parser.c ts_section_parser.h ts_common_types.h portable.h ts_section_parser_error_code.h
25
26 + $(TARGET): $(OBJS)
27 +       $(CC) $(LDLIBS) -o $(TARGET) $(OBJS)
28
29 + clean:
30 +       rm -f *.o
31 +       rm -f $(TARGET)
32 diff -crN 025win/arib_std_b25.c 025linux/arib_std_b25.c
33 *** 025win/arib_std_b25.c       2012-02-13 02:14:17.000000000 +0900
34 --- 025linux/arib_std_b25.c     2012-02-19 02:57:04.000000000 +0900
35 ***************
36 *** 409,416 ****
37   static uint8_t *resync(uint8_t *head, uint8_t *tail, int32_t unit);\r
38   static uint8_t *resync_force(uint8_t *head, uint8_t *tail, int32_t unit);\r
39   \r
40 - static uint32_t crc32(uint8_t *head, uint8_t *tail);\r
41\r
42   /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
43    interface method implementation\r
44    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/\r
45 --- 409,414 ----
46 diff -crN 025win/b_cas_card.c 025linux/b_cas_card.c
47 *** 025win/b_cas_card.c 2008-12-29 14:11:48.000000000 +0900
48 --- 025linux/b_cas_card.c       2012-02-19 02:57:39.000000000 +0900
49 ***************
50 *** 6,12 ****
51   \r
52   #include <math.h>\r
53   \r
54 ! #include <windows.h>\r
55   #include <winscard.h>\r
56   \r
57   /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
58 --- 6,14 ----
59   \r
60   #include <math.h>\r
61   \r
62 ! #if defined(WIN32)\r
63 !       #include <windows.h>\r
64 ! #endif\r
65   #include <winscard.h>\r
66   \r
67   /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
68 diff -crN 025win/portable.h 025linux/portable.h
69 *** 025win/portable.h   2007-11-09 00:58:40.000000000 +0900
70 --- 025linux/portable.h 2012-02-19 02:58:23.000000000 +0900
71 ***************
72 *** 1,7 ****
73   #ifndef PORTABLE_H\r
74   #define PORTABLE_H\r
75   \r
76 ! #if (MSC_VER < 1300) \r
77   \r
78   typedef unsigned char     uint8_t;\r
79   typedef   signed char      int8_t;\r
80 --- 1,7 ----
81   #ifndef PORTABLE_H\r
82   #define PORTABLE_H\r
83   \r
84 ! #if (defined(WIN32) && MSC_VER < 1300) \r
85   \r
86   typedef unsigned char     uint8_t;\r
87   typedef   signed char      int8_t;\r
88 ***************
89 *** 18,21 ****
90 --- 18,38 ----
91   \r
92   #endif\r
93   \r
94 + #if !defined(WIN32)\r
95 +       #define _open  open\r
96 +       #define _close close\r
97 +       #define _read  read\r
98 +       #define _write write\r
99 +       #define _lseeki64 lseek\r
100 +       #define _telli64(fd)  (lseek(fd,0,SEEK_CUR))\r
101 +       #define _O_BINARY     (0)\r
102 +       #define _O_RDONLY     (O_RDONLY)\r
103 +       #define _O_WRONLY     (O_WRONLY)\r
104 +       #define _O_SEQUENTIAL (0)\r
105 +       #define _O_CREAT      (O_CREAT)\r
106 +       #define _O_TRUNC      (O_TRUNC)\r
107 +       #define _S_IREAD      (S_IRUSR|S_IRGRP|S_IROTH)\r
108 +       #define _S_IWRITE     (S_IWUSR|S_IWGRP|S_IWOTH)\r
109 + #endif\r
110\r
111   #endif /* PORTABLE_H */\r
112 diff -crN 025win/td.c 025linux/td.c
113 *** 025win/td.c 2012-02-13 02:15:19.000000000 +0900
114 --- 025linux/td.c       2012-02-19 14:12:30.583733648 +0900
115 ***************
116 *** 2,14 ****
117   #include <stdio.h>\r
118   #include <string.h>\r
119   \r
120 - #include <io.h>\r
121   #include <fcntl.h>\r
122   #include <sys/stat.h>\r
123   #include <sys/types.h>\r
124   \r
125 ! #include <windows.h>\r
126 ! #include <crtdbg.h>\r
127   \r
128   #include "arib_std_b25.h"\r
129   #include "b_cas_card.h"\r
130 --- 2,28 ----
131   #include <stdio.h>\r
132   #include <string.h>\r
133   \r
134   #include <fcntl.h>\r
135   #include <sys/stat.h>\r
136   #include <sys/types.h>\r
137   \r
138 ! #if defined(WIN32)\r
139 !       #include <io.h>\r
140 !       #include <windows.h>\r
141 !       #include <crtdbg.h>\r
142 ! #else\r
143 !       #define __STDC_FORMAT_MACROS\r
144 !       #include <inttypes.h>\r
145 !       #include <unistd.h>\r
146 !       #include <time.h>\r
147 !       unsigned long GetTickCount(void) \r
148 !       {\r
149 !               struct timespec now;\r
150 !               if (clock_gettime(CLOCK_MONOTONIC, &now))\r
151 !                       return 0;\r
152 !               return now.tv_sec * 1000.0 + now.tv_nsec / 1000000.0;\r
153 !       }\r
154 ! #endif\r
155   \r
156   #include "arib_std_b25.h"\r
157   #include "b_cas_card.h"\r
158 ***************
159 *** 31,36 ****
160 --- 45,51 ----
161         int n;\r
162         OPTION opt;\r
163         \r
164 +       #if defined(WIN32)\r
165         _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE );\r
166         _CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDOUT );\r
167         _CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE );\r
168 ***************
169 *** 38,43 ****
170 --- 53,59 ----
171         _CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE );\r
172         _CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDOUT );\r
173         _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF|_CRTDBG_DELAY_FREE_MEM_DF|_CRTDBG_CHECK_ALWAYS_DF|_CRTDBG_LEAK_CHECK_DF);\r
174 +       #endif\r
175   \r
176         n = parse_arg(&opt, argc, argv);\r
177         if(n+2 > argc){\r
178 ***************
179 *** 49,55 ****
180 --- 65,73 ----
181                 test_arib_std_b25(argv[n+0], argv[n+1], &opt);\r
182         }\r
183         \r
184 +       #if defined(WIN32)\r
185         _CrtDumpMemoryLeaks();\r
186 +       #endif\r
187   \r
188         return EXIT_SUCCESS;\r
189   }\r
190 ***************
191 *** 311,318 ****
192 --- 329,341 ----
193                         fprintf(stderr, "  channel:               %d\n", pgrm.program_number);\r
194                         fprintf(stderr, "  unpurchased ECM count: %d\n", pgrm.ecm_unpurchased_count);\r
195                         fprintf(stderr, "  last ECM error code:   %04x\n", pgrm.last_ecm_error_code);\r
196 +                       #if defined(WIN32)\r
197                         fprintf(stderr, "  undecrypted TS packet: %d\n", pgrm.undecrypted_packet_count);\r
198                         fprintf(stderr, "  total TS packet:       %d\n", pgrm.total_packet_count);\r
199 +                       #else\r
200 +                       fprintf(stderr, "  undecrypted TS packet: %"PRId64"\n", pgrm.undecrypted_packet_count);\r
201 +                       fprintf(stderr, "  total TS packet:       %"PRId64"\n", pgrm.total_packet_count);\r
202 +                       #endif\r
203                 }\r
204         }\r
205   \r