Import upstream version 2.4.0+git20210320.1.92a12d8
Debian Janitor
2 years ago
0 | # This workflow will build a Java project with Maven | |
1 | # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven | |
2 | ||
3 | name: juniversalchardet CI | |
4 | on: | |
5 | push: | |
6 | branches: [ '*' ] | |
7 | pull_request: | |
8 | branches: [ '*' ] | |
9 | ||
10 | jobs: | |
11 | build: | |
12 | runs-on: ubuntu-latest | |
13 | strategy: | |
14 | matrix: | |
15 | java: [ 8, 11, 15 ] | |
16 | name: Java ${{matrix.java}} | |
17 | steps: | |
18 | - uses: actions/checkout@v2 | |
19 | - name: Setup java | |
20 | uses: actions/setup-java@v1 | |
21 | with: | |
22 | java-version: ${{matrix.java}} | |
23 | - name: Build with Maven | |
24 | run: mvn -B -Dgpg.skip=true -Dmaven.javadoc.skip=true clean package verify |
0 | language: java | |
1 | ||
2 | dist: trusty | |
3 | ||
4 | install: mvn install -DskipTests=true -Dgpg.skip=true -Dmaven.javadoc.skip=true | |
5 | ||
6 | jdk: | |
7 | - openjdk7 | |
8 | - openjdk8 | |
9 | - openjdk9 | |
10 | - openjdk10 | |
11 | - openjdk11 |
3 | 3 | <modelVersion>4.0.0</modelVersion> |
4 | 4 | <groupId>com.github.albfernandez</groupId> |
5 | 5 | <artifactId>juniversalchardet</artifactId> |
6 | <version>2.4.0</version> | |
6 | <version>2.4.1-SNAPSHOT</version> | |
7 | 7 | <url>https://github.com/albfernandez/juniversalchardet</url> |
8 | 8 | <packaging>jar</packaging> |
9 | 9 | <name>juniversalchardet</name> |
152 | 152 | |
153 | 153 | <profiles> |
154 | 154 | <profile> |
155 | <id>jdk7on</id> | |
155 | <id>jdk7</id> | |
156 | 156 | <activation> |
157 | <jdk>(,1.8]</jdk> | |
157 | <jdk>(,1.7]</jdk> | |
158 | 158 | </activation> |
159 | 159 | <build> |
160 | 160 | <plugins> |
188 | 188 | </build> |
189 | 189 | </profile> |
190 | 190 | <profile> |
191 | <id>jdk9on</id> | |
191 | <id>jdk8</id> | |
192 | 192 | <activation> |
193 | <jdk>[9,)</jdk> | |
193 | <jdk>1.8</jdk> | |
194 | 194 | </activation> |
195 | 195 | <build> |
196 | 196 | <plugins> |
197 | 197 | <plugin> |
198 | 198 | <groupId>org.apache.maven.plugins</groupId> |
199 | 199 | <artifactId>maven-compiler-plugin</artifactId> |
200 | <version>3.8.1</version> | |
201 | <executions> | |
202 | <execution> | |
203 | <id>default-compile</id> | |
204 | <configuration> | |
205 | <release>${compiler.module.level}</release> | |
206 | </configuration> | |
207 | </execution> | |
208 | <execution> | |
209 | <id>base-compile</id> | |
210 | <goals> | |
211 | <goal>compile</goal> | |
212 | </goals> | |
213 | <configuration> | |
214 | <excludes> | |
215 | <exclude>module-info.java</exclude> | |
216 | </excludes> | |
217 | </configuration> | |
218 | </execution> | |
219 | </executions> | |
220 | <configuration> | |
200 | <version>3.7.0</version> | |
201 | <configuration> | |
202 | <excludes> | |
203 | <exclude>module-info.java</exclude> | |
204 | </excludes> | |
221 | 205 | <source>${compiler.level}</source> |
222 | 206 | <target>${compiler.level}</target> |
223 | 207 | </configuration> |
257 | 241 | </plugins> |
258 | 242 | </build> |
259 | 243 | </profile> |
244 | <profile> | |
245 | <id>jdk9on</id> | |
246 | <activation> | |
247 | <jdk>[9,)</jdk> | |
248 | </activation> | |
249 | <build> | |
250 | <plugins> | |
251 | <plugin> | |
252 | <groupId>org.apache.maven.plugins</groupId> | |
253 | <artifactId>maven-compiler-plugin</artifactId> | |
254 | <version>3.8.1</version> | |
255 | <executions> | |
256 | <execution> | |
257 | <id>default-compile</id> | |
258 | <configuration> | |
259 | <release>${compiler.module.level}</release> | |
260 | </configuration> | |
261 | </execution> | |
262 | <execution> | |
263 | <id>base-compile</id> | |
264 | <goals> | |
265 | <goal>compile</goal> | |
266 | </goals> | |
267 | <configuration> | |
268 | <excludes> | |
269 | <exclude>module-info.java</exclude> | |
270 | </excludes> | |
271 | </configuration> | |
272 | </execution> | |
273 | </executions> | |
274 | <configuration> | |
275 | <source>${compiler.level}</source> | |
276 | <target>${compiler.level}</target> | |
277 | </configuration> | |
278 | </plugin> | |
279 | <plugin> | |
280 | <groupId>com.github.spotbugs</groupId> | |
281 | <artifactId>spotbugs-maven-plugin</artifactId> | |
282 | <version>${version.spotbugs-maven-plugin}</version> | |
283 | <configuration> | |
284 | <effort>Max</effort> | |
285 | <threshold>Medium</threshold> | |
286 | <includeTests>false</includeTests> | |
287 | <failOnError>false</failOnError> | |
288 | <plugins> | |
289 | <plugin> | |
290 | <groupId>com.h3xstream.findsecbugs</groupId> | |
291 | <artifactId>findsecbugs-plugin</artifactId> | |
292 | <version>${version.findsecbugs-plugin}</version> | |
293 | </plugin> | |
294 | <plugin> | |
295 | <groupId>com.mebigfatguy.sb-contrib</groupId> | |
296 | <artifactId>sb-contrib</artifactId> | |
297 | <version>${version.sb-contrib}</version> | |
298 | </plugin> | |
299 | </plugins> | |
300 | </configuration> | |
301 | <executions> | |
302 | <execution> | |
303 | <id>spotbugs-check</id> | |
304 | <phase>verify</phase> | |
305 | <goals> | |
306 | <goal>check</goal> | |
307 | </goals> | |
308 | </execution> | |
309 | </executions> | |
310 | </plugin> | |
311 | </plugins> | |
312 | </build> | |
313 | </profile> | |
260 | 314 | |
261 | 315 | </profiles> |
262 | 316 |
+3
-6
36 | 36 | |
37 | 37 | package org.mozilla.universalchardet.prober.distributionanalysis; |
38 | 38 | |
39 | public class EUCKRDistributionAnalysis extends CharDistributionAnalysis | |
40 | { | |
39 | public class EUCKRDistributionAnalysis extends CharDistributionAnalysis { | |
41 | 40 | //////////////////////////////////////////////////////////////// |
42 | 41 | // constants |
43 | 42 | //////////////////////////////////////////////////////////////// |
51 | 50 | //////////////////////////////////////////////////////////////// |
52 | 51 | // methods |
53 | 52 | //////////////////////////////////////////////////////////////// |
54 | public EUCKRDistributionAnalysis() | |
55 | { | |
53 | public EUCKRDistributionAnalysis() { | |
56 | 54 | super(); |
57 | 55 | this.typicalDistributionRatio = EUCKR_TYPICAL_DISTRIBUTION_RATIO; |
58 | 56 | this.charToFreqOrder = euckrCharToFreqOrder; |
59 | 57 | } |
60 | 58 | |
61 | 59 | @Override |
62 | protected int getOrder(final byte[] buf, int offset) | |
63 | { | |
60 | protected int getOrder(final byte[] buf, int offset) { | |
64 | 61 | int highbyte = buf[offset] & 0xFF; |
65 | 62 | if (highbyte >= HIGHBYTE_BEGIN) { |
66 | 63 | int lowbyte = buf[offset+1] & 0xFF; |
36 | 36 | |
37 | 37 | package org.mozilla.universalchardet.prober.sequence; |
38 | 38 | |
39 | public class CyrillicModel extends SequenceModel | |
40 | { | |
39 | public class CyrillicModel extends SequenceModel { | |
41 | 40 | //////////////////////////////////////////////////////////////// |
42 | 41 | // constants |
43 | 42 | //////////////////////////////////////////////////////////////// |
47 | 46 | //////////////////////////////////////////////////////////////// |
48 | 47 | // methods |
49 | 48 | //////////////////////////////////////////////////////////////// |
50 | public CyrillicModel(short[] charToOrderMap, String name) | |
51 | { | |
49 | public CyrillicModel(short[] charToOrderMap, String name) { | |
52 | 50 | super( |
53 | 51 | charToOrderMap, |
54 | 52 | russianLangModel, |
53 | 53 | //////////////////////////////////////////////////////////////// |
54 | 54 | // methods |
55 | 55 | //////////////////////////////////////////////////////////////// |
56 | public Big5SMModel() | |
57 | { | |
56 | public Big5SMModel() { | |
58 | 57 | super( |
59 | 58 | new PkgInt(INDEX_SHIFT_4BITS, SHIFT_MASK_4BITS, BIT_SHIFT_4BITS, UNIT_MASK_4BITS, big5ClassTable), |
60 | 59 | BIG5_CLASS_FACTOR, |
+6
-12
36 | 36 | |
37 | 37 | package org.mozilla.universalchardet.prober.statemachine; |
38 | 38 | |
39 | public class CodingStateMachine | |
40 | { | |
39 | public class CodingStateMachine { | |
41 | 40 | protected SMModel model; |
42 | 41 | protected int currentState; |
43 | 42 | protected int currentCharLen; |
44 | 43 | protected int currentBytePos; |
45 | 44 | |
46 | public CodingStateMachine(SMModel model) | |
47 | { | |
45 | public CodingStateMachine(SMModel model) { | |
48 | 46 | this.model = model; |
49 | 47 | this.currentState = SMModel.START; |
50 | 48 | } |
51 | 49 | |
52 | public int nextState(byte c) | |
53 | { | |
50 | public int nextState(byte c) { | |
54 | 51 | int byteCls = this.model.getClass(c); |
55 | 52 | if (this.currentState == SMModel.START) { |
56 | 53 | this.currentBytePos = 0; |
63 | 60 | return this.currentState; |
64 | 61 | } |
65 | 62 | |
66 | public int getCurrentCharLen() | |
67 | { | |
63 | public int getCurrentCharLen() { | |
68 | 64 | return this.currentCharLen; |
69 | 65 | } |
70 | 66 | |
71 | public void reset() | |
72 | { | |
67 | public void reset() { | |
73 | 68 | this.currentState = SMModel.START; |
74 | 69 | } |
75 | 70 | |
76 | public String getCodingStateMachine() | |
77 | { | |
71 | public String getCodingStateMachine() { | |
78 | 72 | return this.model.getName(); |
79 | 73 | } |
80 | 74 | } |