-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integers treated as signed 16-bit values in Serializer #14
Comments
There is also a problem with convertFloat. It assumes at most 12 characters (minus one terminating null byte) in the formatted string. This can easily be exceeded using a sufficiently large Float number. However, the Haskell code must assume any maximum number of characters for allocating a buffer for the formatted number. |
It looks reasonable to get rid of C code. Could you update the PR? Thanks! |
Removed C code. Checked that |
Thanks! It's merged and released https://hackage.haskell.org/package/HPDF-1.6.2 |
I hit a limit of 32768 objects in a large generated PDF. With 32768 objects or more the /Size entry in the trailer becomes negative.
The culprit is
Serializer.cshortToString
.First, the foreign import is wrong because it pretends the number parameter would be
Int
, where in reality the corresponding C type isshort
, thus the Haskell foreign import must useCShort
. But this happens to work by accident on my machine (little endian).Second, the bigger problem is the choice of the
short
type. This is 16 bit on my machine. Why this restriction? Why call C functions at all? Are they significantly faster than the Haskell formatting functions?The text was updated successfully, but these errors were encountered: