Comments (4)
It does appear that this logic does not support 64-bit values at all. Changing the toString is only one small part of it; note that NumberField.longValue also calls intValue and upcasts it to a long. It's unclear to me if we can just switch all of these classes to actually treat the contained value as a long.
Thoughts?
from jnr-ffi.
AFAICT, NumberField.longValue is always overridden in the places that matter, e.g. IntegerAlias, Signed64, Unsigned64, SignedLong, UnsignedLong. Perhaps you could make all those methods abstract to avoid confusion?
from jnr-ffi.
And calling longValue() will still be wrong if the number is a float. Looks like it's more correct to make the method abstract.
from jnr-ffi.
The shortest fix seems to be to copy over the toString() method of Signed64 / Unsigned64 / SignedLong / UnsignedLong into IntegerAlias and Unsigned32. The delicate series of overrides of longValue() and toString() in derived classes seems to handle every other case.
Alternately we can make longValue() and toString() abstract so that the code is easier to read but lengthier.
from jnr-ffi.
Related Issues (20)
- UnsatisfiedLinkError when loading 3 dependent libraries HOT 11
- Unsatisfied link when used in conjunction with jnr-posix HOT 5
- Investigate failing Pointer Boolean tests on Darwin (macOS)
- LibraryLoader.search() path not taken into consideration unless also in LD_LIBRARY_PATH HOT 3
- What's the mapping Java type of C type FILE *?
- [feature request] HOT 1
- Erorr : jnr.ffi.provider.jffi.Provider
- Native Object filling "not working"
- Native C calling Java method HOT 1
- Cannot pass a struct to 'c' function by value
- Multi-dimensional arrays as struct members HOT 1
- Load the static link library HOT 1
- Release new version of jnr-ffi HOT 1
- Why use JNR over JNA HOT 1
- support convert pointer to struct
- String parameter of a callback function gets messed when passed from DLL (Rust) to Java HOT 2
- Android and bytecode
- document build procedures
- JVM crash invoking some SDL Library function
- Bad dates in jnr/jnr-ffi commits HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jnr-ffi.