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. #include <string.h>
  9.  
  10. #include <hubbub/errors.h>
  11.  
  12. /**
  13.  * Convert a hubbub error code to a string
  14.  *
  15.  * \param error  The error code to convert
  16.  * \return Pointer to string representation of error, or NULL if unknown.
  17.  */
  18. const char *hubbub_error_to_string(hubbub_error error)
  19. {
  20.         const char *result = NULL;
  21.  
  22.         switch (error) {
  23.         case HUBBUB_OK:
  24.                 result = "No error";
  25.                 break;
  26.         case HUBBUB_REPROCESS:
  27.                 result = "Internal (reprocess token)";
  28.                 break;
  29.         case HUBBUB_ENCODINGCHANGE:
  30.                 result = "Encoding of document has changed";
  31.                 break;
  32.         case HUBBUB_PAUSED:
  33.                 result = "Parser is paused";
  34.                 break;
  35.         case HUBBUB_NOMEM:
  36.                 result = "Insufficient memory";
  37.                 break;
  38.         case HUBBUB_BADPARM:
  39.                 result = "Bad parameter";
  40.                 break;
  41.         case HUBBUB_INVALID:
  42.                 result = "Invalid input";
  43.                 break;
  44.         case HUBBUB_FILENOTFOUND:
  45.                 result = "File not found";
  46.                 break;
  47.         case HUBBUB_NEEDDATA:
  48.                 result = "Insufficient data";
  49.                 break;
  50.         case HUBBUB_BADENCODING:
  51.                 result = "Unsupported charset";
  52.                 break;
  53.         case HUBBUB_UNKNOWN:
  54.                 result = "Unknown error";
  55.                 break;
  56.         }
  57.  
  58.         return result;
  59. }
  60.  
  61.