mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-05 00:46:16 +01:00
761424465a
2008-06-21 Johan Dahlin <jdahlin@async.com.br> * *.[ch]: Include "config.h" instead of <config.h> Command used: find -name \*.[ch]|xargs perl -p -i -e 's/^#include <config.h>/#include "config.h"/g' Rubberstamped by Mitch svn path=/trunk/; revision=7092
179 lines
3.3 KiB
C
179 lines
3.3 KiB
C
/* GIO - GLib Input, Output and Streaming Library
|
|
*
|
|
* Copyright (C) 2006-2007 Red Hat, Inc.
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General
|
|
* Public License along with this library; if not, write to the
|
|
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
|
* Boston, MA 02111-1307, USA.
|
|
*
|
|
* Author: Alexander Larsson <alexl@redhat.com>
|
|
*/
|
|
|
|
#include "config.h"
|
|
#include <errno.h>
|
|
#include "gioerror.h"
|
|
|
|
#include "gioalias.h"
|
|
|
|
/**
|
|
* SECTION:gioerror
|
|
* @short_description: Error helper functions
|
|
* @include: gio/gio.h
|
|
*
|
|
* Contains helper functions for reporting errors to the user.
|
|
**/
|
|
|
|
/**
|
|
* g_io_error_quark:
|
|
*
|
|
* Gets the GIO Error Quark.
|
|
*
|
|
* Return value: a #GQuark.
|
|
**/
|
|
GQuark
|
|
g_io_error_quark (void)
|
|
{
|
|
return g_quark_from_static_string ("g-io-error-quark");
|
|
}
|
|
|
|
/**
|
|
* g_io_error_from_errno:
|
|
* @err_no: Error number as defined in errno.h.
|
|
*
|
|
* Converts errno.h error codes into GIO error codes.
|
|
*
|
|
* Returns: #GIOErrorEnum value for the given errno.h error number.
|
|
**/
|
|
GIOErrorEnum
|
|
g_io_error_from_errno (gint err_no)
|
|
{
|
|
switch (err_no)
|
|
{
|
|
#ifdef EEXIST
|
|
case EEXIST:
|
|
return G_IO_ERROR_EXISTS;
|
|
break;
|
|
#endif
|
|
|
|
#ifdef EISDIR
|
|
case EISDIR:
|
|
return G_IO_ERROR_IS_DIRECTORY;
|
|
break;
|
|
#endif
|
|
|
|
#ifdef EACCES
|
|
case EACCES:
|
|
return G_IO_ERROR_PERMISSION_DENIED;
|
|
break;
|
|
#endif
|
|
|
|
#ifdef ENAMETOOLONG
|
|
case ENAMETOOLONG:
|
|
return G_IO_ERROR_FILENAME_TOO_LONG;
|
|
break;
|
|
#endif
|
|
|
|
#ifdef ENOENT
|
|
case ENOENT:
|
|
return G_IO_ERROR_NOT_FOUND;
|
|
break;
|
|
#endif
|
|
|
|
#ifdef ENOTDIR
|
|
case ENOTDIR:
|
|
return G_IO_ERROR_NOT_DIRECTORY;
|
|
break;
|
|
#endif
|
|
|
|
#ifdef EROFS
|
|
case EROFS:
|
|
return G_IO_ERROR_READ_ONLY;
|
|
break;
|
|
#endif
|
|
|
|
#ifdef ELOOP
|
|
case ELOOP:
|
|
return G_IO_ERROR_TOO_MANY_LINKS;
|
|
break;
|
|
#endif
|
|
|
|
#ifdef ENOSPC
|
|
case ENOSPC:
|
|
return G_IO_ERROR_NO_SPACE;
|
|
break;
|
|
#endif
|
|
|
|
#ifdef ENOMEM
|
|
case ENOMEM:
|
|
return G_IO_ERROR_NO_SPACE;
|
|
break;
|
|
#endif
|
|
|
|
#ifdef EINVAL
|
|
case EINVAL:
|
|
return G_IO_ERROR_INVALID_ARGUMENT;
|
|
break;
|
|
#endif
|
|
|
|
#ifdef EPERM
|
|
case EPERM:
|
|
return G_IO_ERROR_PERMISSION_DENIED;
|
|
break;
|
|
#endif
|
|
|
|
#ifdef ECANCELED
|
|
case ECANCELED:
|
|
return G_IO_ERROR_CANCELLED;
|
|
break;
|
|
#endif
|
|
|
|
#ifdef ENOTEMPTY
|
|
case ENOTEMPTY:
|
|
return G_IO_ERROR_NOT_EMPTY;
|
|
break;
|
|
#endif
|
|
|
|
#ifdef ENOTSUP
|
|
case ENOTSUP:
|
|
return G_IO_ERROR_NOT_SUPPORTED;
|
|
break;
|
|
#endif
|
|
|
|
#ifdef ETIMEDOUT
|
|
case ETIMEDOUT:
|
|
return G_IO_ERROR_TIMED_OUT;
|
|
break;
|
|
#endif
|
|
|
|
#ifdef EBUSY
|
|
case EBUSY:
|
|
return G_IO_ERROR_BUSY;
|
|
break;
|
|
#endif
|
|
|
|
#ifdef EWOULDBLOCK
|
|
case EWOULDBLOCK:
|
|
return G_IO_ERROR_WOULD_BLOCK;
|
|
break;
|
|
#endif
|
|
|
|
default:
|
|
return G_IO_ERROR_FAILED;
|
|
break;
|
|
}
|
|
}
|
|
|
|
#define __G_IO_ERROR_C__
|
|
#include "gioaliasdef.c"
|