Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. /*
  2.  * This file is part of Hubbub.
  3.  * Licensed under the MIT License,
  4.  *                http://www.opensource.org/licenses/mit-license.php
  5.  * Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org>
  6.  */
  7.  
  8. #ifndef hubbub_utils_parserutilserror_h_
  9. #define hubbub_utils_parserutilserror_h_
  10.  
  11. #include <parserutils/errors.h>
  12.  
  13. #include <hubbub/errors.h>
  14.  
  15. /**
  16.  * Convert a ParserUtils error into a Hubbub error
  17.  *
  18.  * \param error  The ParserUtils error to convert
  19.  * \return The corresponding Hubbub error
  20.  */
  21. static inline hubbub_error hubbub_error_from_parserutils_error(
  22.                 parserutils_error error)
  23. {
  24.         if (error == PARSERUTILS_OK)
  25.                 return HUBBUB_OK;
  26.         else if (error == PARSERUTILS_NOMEM)
  27.                 return HUBBUB_NOMEM;
  28.         else if (error == PARSERUTILS_BADPARM)
  29.                 return HUBBUB_BADPARM;
  30.         else if (error == PARSERUTILS_INVALID)
  31.                 return HUBBUB_INVALID;
  32.         else if (error == PARSERUTILS_FILENOTFOUND)
  33.                 return HUBBUB_FILENOTFOUND;
  34.         else if (error == PARSERUTILS_NEEDDATA)
  35.                 return HUBBUB_NEEDDATA;
  36.         else if (error == PARSERUTILS_BADENCODING)
  37.                 return HUBBUB_BADENCODING;
  38.         else if (error == PARSERUTILS_EOF)
  39.                 return HUBBUB_OK;
  40.  
  41.         return HUBBUB_UNKNOWN;
  42. }
  43.  
  44. #endif
  45.  
  46.