Firebird appears to pad the short as if it was a full int, thus firebirdsql returns wrong value.

If the stored value was '1' then the old conversion will return '0', as the raw_value array is [0 0 0 1].

I referenced: http://sourceforge.net/p/firebird/code/HEAD/tree/client-java/trunk/src/main/org/firebirdsql/gds/XSQLVAR.java#l171
to see how they parse out a short value.