albfernandez / javadbf

Java library for reading and writing Xbase (dBase/DBF) files.
GNU Lesser General Public License v3.0
224 stars 98 forks source link

supportsFieldFlags is always false for F5 and FB #94

Closed ztyzbb closed 3 years ago

ztyzbb commented 3 years ago

com.linuxense.javadbf.DBFHeader#supportsFieldFlags

private boolean supportsFieldFlags() {
    return this.signature == 0x2 || this.signature == 0x30 || this.signature == 0x31 || this.signature == 0xF5 || this.signature == 0xFB;
}

Left operand is in {-128..1, 3..47, 50..127}

May cause problem when reading an F5 FB file, each field's reserv2 will lost.

albfernandez commented 3 years ago

I'm not sure what do you mean. Can you provide a sample code or file?

ztyzbb commented 3 years ago

Sorry reply late, I'm too busy these days. Code here In java, byte range is 127 to -128, so it's always false when signature compared to 0xF5 and 0xFB. Test code, dbase_f5,dbf located in test resource, b1 is always false.

public static void main(String[] args) throws IOException {
    DataInputStream dataInputStream = new DataInputStream(Test1.class.getResourceAsStream("/dbase_f5.dbf"));
    byte b = dataInputStream.readByte();
    boolean b1 = b == 0xF5;
}
albfernandez commented 3 years ago

Thanks for your detailed info. I'm releasing a fixed version