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 LibCSS.
  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 <libcss/errors.h>
  11.  
  12. /**
  13.  * Convert a LibCSS 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 *css_error_to_string(css_error error)
  19. {
  20.         const char *result = NULL;
  21.  
  22.         switch (error) {
  23.         case CSS_OK:
  24.                 result = "No error";
  25.                 break;
  26.         case CSS_NOMEM:
  27.                 result = "Insufficient memory";
  28.                 break;
  29.         case CSS_BADPARM:
  30.                 result = "Bad parameter";
  31.                 break;
  32.         case CSS_INVALID:
  33.                 result = "Invalid input";
  34.                 break;
  35.         case CSS_FILENOTFOUND:
  36.                 result = "File not found";
  37.                 break;
  38.         case CSS_NEEDDATA:
  39.                 result = "Insufficient data";
  40.                 break;
  41.         case CSS_BADCHARSET:
  42.                 result = "BOM and @charset mismatch";
  43.                 break;
  44.         case CSS_EOF:
  45.                 result = "EOF encountered";
  46.                 break;
  47.         case CSS_IMPORTS_PENDING:
  48.                 result = "Imports pending";
  49.                 break;
  50.         case CSS_PROPERTY_NOT_SET:
  51.                 result = "Property not set";
  52.                 break;
  53.         }
  54.  
  55.         return result;
  56. }
  57.