1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
32 #ifndef _FILE_ERROR_TRANSL_H_
33 #include "file_error_transl.h"
36 #ifndef _OSL_DIAGNOSE_H_
37 #include <osl/diagnose.h>
41 /********************************************
42 * oslTranslateFileError
43 *******************************************/
45 oslFileError
oslTranslateFileError(sal_Bool bIsError
, int Errno
)
47 oslFileError osl_error
= osl_File_E_invalidError
;
49 OSL_ENSURE((bIsError
&& (0 != Errno
)) || (!bIsError
&& (0 == Errno
)), "oslTranslateFileError strange input combination!");
51 /* Have a look at file_error_transl.h for
52 the reason that we do this here */
53 if (bIsError
&& (0 == Errno
))
59 osl_error
= osl_File_E_None
;
63 osl_error
= osl_File_E_PERM
;
67 osl_error
= osl_File_E_NOENT
;
71 osl_error
= osl_File_E_SRCH
;
75 osl_error
= osl_File_E_INTR
;
79 osl_error
= osl_File_E_IO
;
83 osl_error
= osl_File_E_IO
;
87 osl_error
= osl_File_E_2BIG
;
91 osl_error
= osl_File_E_NOEXEC
;
95 osl_error
= osl_File_E_BADF
;
99 osl_error
= osl_File_E_CHILD
;
103 osl_error
= osl_File_E_AGAIN
;
107 osl_error
= osl_File_E_NOMEM
;
111 osl_error
= osl_File_E_ACCES
;
115 osl_error
= osl_File_E_FAULT
;
119 osl_error
= osl_File_E_BUSY
;
123 osl_error
= osl_File_E_EXIST
;
127 osl_error
= osl_File_E_XDEV
;
131 osl_error
= osl_File_E_NODEV
;
135 osl_error
= osl_File_E_NOTDIR
;
139 osl_error
= osl_File_E_ISDIR
;
143 osl_error
= osl_File_E_INVAL
;
147 osl_error
= osl_File_E_NFILE
;
151 osl_error
= osl_File_E_MFILE
;
155 osl_error
= osl_File_E_NOTTY
;
159 osl_error
= osl_File_E_FBIG
;
163 osl_error
= osl_File_E_NOSPC
;
167 osl_error
= osl_File_E_SPIPE
;
171 osl_error
= osl_File_E_ROFS
;
175 osl_error
= osl_File_E_MLINK
;
179 osl_error
= osl_File_E_PIPE
;
183 osl_error
= osl_File_E_DOM
;
187 osl_error
= osl_File_E_RANGE
;
191 osl_error
= osl_File_E_DEADLK
;
195 osl_error
= osl_File_E_NAMETOOLONG
;
199 osl_error
= osl_File_E_NOLCK
;
203 osl_error
= osl_File_E_NOSYS
;
207 osl_error
= osl_File_E_NOTEMPTY
;
211 osl_error
= osl_File_E_LOOP
;
214 #if !(defined(MACOSX) || defined(NETBSD) || defined(FREEBSD))
216 osl_error
= osl_File_E_ILSEQ
;
220 #if !(defined(MACOSX) || defined(NETBSD) || defined(FREEBSD) || defined(OS2))
222 osl_error
= osl_File_E_NOLINK
;
226 #if !(defined(MACOSX) || defined(NETBSD) || defined(FREEBSD) || defined(OS2))
228 osl_error
= osl_File_E_MULTIHOP
;
233 osl_error
= osl_File_E_USERS
;
237 osl_error
= osl_File_E_OVERFLOW
;
241 osl_error
= osl_File_E_TIMEDOUT
;
245 /* FIXME translateFileError: is this alright? Or add a new one: osl_File_E_Unknown? */
246 osl_error
= osl_File_E_invalidError
;