for a friend. I isolated the code that triggers the bug down to one function.
The function does nothing special.. and i already have another version of it
that i posted some time ago here as a slightly optimized version.
Please take a look.. maybe i am looking to hard.. but i realy have no clue whats going on...
Using java Syntax Highlighting
- package de.test;
- import java.io.DataInputStream;
- import java.io.IOException;
- import android.app.Activity;
- import android.os.Bundle;
- public class compilertest extends Activity {
- private final static int FRAME_MAX_LENGTH = 40000;
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
- }
- public int test(DataInputStream in, byte[] sequence) throws IOException {
- byte c;
- int seqIndex = 0, len = sequence.length, i;
- for(i=0; i < FRAME_MAX_LENGTH && seqIndex < len; i++) {
- c = (byte) in.readUnsignedByte();
- seqIndex = (c == sequence[seqIndex]) ? seqIndex++ : 0;
- }
- return (seqIndex == len) ? i+1 : -1;
- }
- public int test2(DataInputStream in, byte[] sequence) throws IOException {
- int seqIndex = 0;
- byte c;
- for(int i=0; i < FRAME_MAX_LENGTH; i++) {
- c = (byte) in.readUnsignedByte();
- if(c == sequence[seqIndex]) {
- seqIndex++;
- if(seqIndex == sequence.length) return i + 1;
- } else seqIndex = 0;
- }
- return -1;
- }
- }
Parsed in 0.036 seconds, using GeSHi 1.0.8.4
Add this activity to a project and try to compile.
For me it throws "Conversion to Dalvik format failed with error 2".
If you comment out the function "test" and just leave test2 you can compile.
So the bug lies within function "test".
Note: Both functions do the same.. just slightly different.
If someone has a clue .. please enlighten me
Greets
Padde
--- Edit ---
I tested version 1.5 and 1.6 of android so far

