On Wed, 2009-08-05 at 11:25 +0000, [email protected] wrote:

> Modified: branches/struggleyb/libdom-events/include/dom/core/exceptions.h
> URL: 
> http://source.netsurf-browser.org/branches/struggleyb/libdom-events/include/dom/core/exceptions.h?rev=9059&r1=9058&r2=9059&view=diff
> ==============================================================================
> --- branches/struggleyb/libdom-events/include/dom/core/exceptions.h (original)
> +++ branches/struggleyb/libdom-events/include/dom/core/exceptions.h Wed Aug  
> 5 06:25:52 2009
> @@ -7,6 +7,9 @@
>  
>  #ifndef dom_core_exceptions_h_
>  #define dom_core_exceptions_h_
> +
> +#define DOM_EVENT_EXCEPTION_OFFSEET 30
> +#define DOM_INTERNAL_ERROR_OFFSET 16
 
Better would be the following:

/**
 * Class of a DOM exception.
 *
 * The top 16 bits of a dom_exception are a bitfield 
 * indicating which class the exception belongs to.
 */
typedef enum {
        DOM_EXCEPTION_CLASS_NORMAL = 0,
        DOM_EXCEPTION_CLASS_EVENT = (1<<30)
        DOM_EXCEPTION_CLASS_INTERNAL = (1<<31),
} dom_exception_class;

>  /* The DOM spec says that this is actually an unsigned short */
>  typedef enum {
> @@ -28,7 +31,11 @@
>       DOM_INVALID_ACCESS_ERR          = 15,
>       DOM_VALIDATION_ERR              = 16,
>       DOM_TYPE_MISMATCH_ERR           = 17,
> -     DOM_NO_MEM_ERR                  = (1<<16) /* our own internal error */
> +     
> +     DOM_NO_MEM_ERR                  = (1<<DOM_INTERNAL_ERROR_OFFSET), /* 
> our own internal error */
> +
> +     DOM_UNSPECIFIED_EVENT_TYPE_ERR = (1<<DOM_EVENT_EXCEPTION_OFFSEET),
> +     DOM_DISPATCH_REQUEST_ERR

The above should be:

        DOM_UNSPECIFIED_EVENT_TYPE_ERR = DOM_EXCEPTION_CLASS_EVENT + 0,
        DOM_DISPATCH_REQUEST_ERR = DOM_EXCEPTION_CLASS_EVENT + 1,

        DOM_NO_MEM_ERR = DOM_EXCEPTION_CLASS_INTERNAL + 0


J.


Reply via email to