On 25-7-2015 15:08, Vlad Khorsun wrote:
> 25.07.2015 15:45, Mark Rotteveel wrote:
>   >
>> How would I go about that if none of the errors in that facility are
>> defined inside Firebird,
>
>     We could define and reserve facility code for Jaybird and let you know it.

That would be great.

>> and how can I know/calculate the range of error
>> codes I can use (a quick glance at the code seems to suggest that each
>> facility has 24 bits for error codes)?
>
>     Look at src\common\msg_encode.h :
>
> const ISC_STATUS ISC_MASK     = 0x14000000;   // Defines the code as a valid 
> ISC code
> const ISC_STATUS FAC_MASK     = 0x00FF0000;   // Specifies the facility where 
> the code is located
> const ISC_STATUS CODE_MASK    = 0x0000FFFF;   // Specifies the code in the 
> message file
> const ISC_STATUS CLASS_MASK   = 0xF0000000;   // Defines the code as warning, 
> error, info, or other
>

Looking at the code in msg_encode.h, I notice that the above masks don't 
align with the definition of ENCODE_ISC_MSG:

return ((ISC_STATUS(facility & 0x1F) << 16) | (code & 0x3FFF) | ISC_MASK);

Shouldn't that be:

return ISC_STATUS(((facility << 16) & FAC_MASK) | (code & CODE_MASK) | 
ISC_MASK);

Or is there a reason to ignore those higher bits for the facility and code?

CLASS_MASK seems to not be used anywhere, or at least I can't remember 
ever having seen an error code with the bit 30 (warning) or 31 (info) 
set. Or is it used somewhere internally as an in-band channel?

Mark
-- 
Mark Rotteveel

------------------------------------------------------------------------------
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to