1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: file_error_transl.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
35 #ifndef _FILE_ERROR_TRANSL_H_
36 #include "file_error_transl.h"
39 #ifndef _OSL_DIAGNOSE_H_
40 #include <osl/diagnose.h>
44 /********************************************
45 * oslTranslateFileError
46 *******************************************/
48 oslFileError
oslTranslateFileError(sal_Bool bIsError
, int Errno
)
50 oslFileError osl_error
= osl_File_E_invalidError
;
52 OSL_ENSURE((bIsError
&& (0 != Errno
)) || (!bIsError
&& (0 == Errno
)), "oslTranslateFileError strange input combination!");
54 /* Have a look at file_error_transl.h for
55 the reason that we do this here */
56 if (bIsError
&& (0 == Errno
))
62 osl_error
= osl_File_E_None
;
66 osl_error
= osl_File_E_PERM
;
70 osl_error
= osl_File_E_NOENT
;
74 osl_error
= osl_File_E_SRCH
;
78 osl_error
= osl_File_E_INTR
;
82 osl_error
= osl_File_E_IO
;
86 osl_error
= osl_File_E_IO
;
90 osl_error
= osl_File_E_2BIG
;
94 osl_error
= osl_File_E_NOEXEC
;
98 osl_error
= osl_File_E_BADF
;
102 osl_error
= osl_File_E_CHILD
;
106 osl_error
= osl_File_E_AGAIN
;
110 osl_error
= osl_File_E_NOMEM
;
114 osl_error
= osl_File_E_ACCES
;
118 osl_error
= osl_File_E_FAULT
;
122 osl_error
= osl_File_E_BUSY
;
126 osl_error
= osl_File_E_EXIST
;
130 osl_error
= osl_File_E_XDEV
;
134 osl_error
= osl_File_E_NODEV
;
138 osl_error
= osl_File_E_NOTDIR
;
142 osl_error
= osl_File_E_ISDIR
;
146 osl_error
= osl_File_E_INVAL
;
150 osl_error
= osl_File_E_NFILE
;
154 osl_error
= osl_File_E_MFILE
;
158 osl_error
= osl_File_E_NOTTY
;
162 osl_error
= osl_File_E_FBIG
;
166 osl_error
= osl_File_E_NOSPC
;
170 osl_error
= osl_File_E_SPIPE
;
174 osl_error
= osl_File_E_ROFS
;
178 osl_error
= osl_File_E_MLINK
;
182 osl_error
= osl_File_E_PIPE
;
186 osl_error
= osl_File_E_DOM
;
190 osl_error
= osl_File_E_RANGE
;
194 osl_error
= osl_File_E_DEADLK
;
198 osl_error
= osl_File_E_NAMETOOLONG
;
202 osl_error
= osl_File_E_NOLCK
;
206 osl_error
= osl_File_E_NOSYS
;
210 osl_error
= osl_File_E_NOTEMPTY
;
214 osl_error
= osl_File_E_LOOP
;
217 #if !(defined(MACOSX) || defined(NETBSD) || defined(FREEBSD))
219 osl_error
= osl_File_E_ILSEQ
;
223 #if !(defined(MACOSX) || defined(NETBSD) || defined(FREEBSD) || defined(OS2))
225 osl_error
= osl_File_E_NOLINK
;
229 #if !(defined(MACOSX) || defined(NETBSD) || defined(FREEBSD) || defined(OS2))
231 osl_error
= osl_File_E_MULTIHOP
;
236 osl_error
= osl_File_E_USERS
;
240 osl_error
= osl_File_E_OVERFLOW
;
244 osl_error
= osl_File_E_TIMEDOUT
;
248 /* FIXME translateFileError: is this alright? Or add a new one: osl_File_E_Unknown? */
249 osl_error
= osl_File_E_invalidError
;