Skip to content
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

helper #defines in ibase.h ADD_SPB_LENGTH and ADD_SPB_NUMERIC does not respect the cpu byte order [CORE2239] #2666

Closed
firebird-automations opened this issue Dec 13, 2008 · 5 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Andrej Pakhutin (kadavris)

Attachments:
spbtest.c

two #⁠defines in the API ibase.h use bit-shift operation without respect to the cpu byte order
currently it will work only on low-endian types

#⁠defines are:
ADD_SPB_LENGTH and ADD_SPB_NUMERIC

The ibase.h was taken from Firebird-2.1.1.17910-0_Win32.zip distribution. So, maybe this is the case for win32 header file.
Also that same code can be seen in the original InterBase.
(At least #⁠defines quoted in the "Using the InterBase services manager" article from http://dn.codegear.com/print/27002)

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

assignee: Alexander Peshkov [ alexpeshkoff ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

Attachment: spbtest.c [ 11956 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @AlexPeshkoff

Andrej, I'm not sure about codegear (and embarcadero) articles, specially taking into an account that link is already invalid. What about defines in firebird code - they are absolutely correct and work correctly for both little- and big-endians. I've added trivial test - on both amd64 and parisc it produces same output:
3412
which is correct and expected.

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Won't Fix [ 2 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

status: Resolved [ 5 ] => Closed [ 6 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants