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 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sal.hxx"
38 #ifndef _FILE_ERROR_TRANSL_H_
39 #include "file_error_transl.h"
42 #ifndef _OSL_DIAGNOSE_H_
43 #include <osl/diagnose.h>
47 /********************************************
48 * oslTranslateFileError
49 *******************************************/
51 oslFileError
oslTranslateFileError(sal_Bool bIsError
, int Errno
)
53 oslFileError osl_error
= osl_File_E_invalidError
;
55 OSL_ENSURE((bIsError
&& (0 != Errno
)) || (!bIsError
&& (0 == Errno
)), "oslTranslateFileError strange input combination!");
57 /* Have a look at file_error_transl.h for
58 the reason that we do this here */
59 if (bIsError
&& (0 == Errno
))
65 osl_error
= osl_File_E_None
;
69 osl_error
= osl_File_E_PERM
;
73 osl_error
= osl_File_E_NOENT
;
77 osl_error
= osl_File_E_SRCH
;
81 osl_error
= osl_File_E_INTR
;
85 osl_error
= osl_File_E_IO
;
89 osl_error
= osl_File_E_IO
;
93 osl_error
= osl_File_E_2BIG
;
97 osl_error
= osl_File_E_NOEXEC
;
101 osl_error
= osl_File_E_BADF
;
105 osl_error
= osl_File_E_CHILD
;
109 osl_error
= osl_File_E_AGAIN
;
113 osl_error
= osl_File_E_NOMEM
;
117 osl_error
= osl_File_E_ACCES
;
121 osl_error
= osl_File_E_FAULT
;
125 osl_error
= osl_File_E_BUSY
;
129 osl_error
= osl_File_E_EXIST
;
133 osl_error
= osl_File_E_XDEV
;
137 osl_error
= osl_File_E_NODEV
;
141 osl_error
= osl_File_E_NOTDIR
;
145 osl_error
= osl_File_E_ISDIR
;
149 osl_error
= osl_File_E_INVAL
;
153 osl_error
= osl_File_E_NFILE
;
157 osl_error
= osl_File_E_MFILE
;
161 osl_error
= osl_File_E_NOTTY
;
165 osl_error
= osl_File_E_FBIG
;
169 osl_error
= osl_File_E_NOSPC
;
173 osl_error
= osl_File_E_SPIPE
;
177 osl_error
= osl_File_E_ROFS
;
181 osl_error
= osl_File_E_MLINK
;
185 osl_error
= osl_File_E_PIPE
;
189 osl_error
= osl_File_E_DOM
;
193 osl_error
= osl_File_E_RANGE
;
197 osl_error
= osl_File_E_DEADLK
;
201 osl_error
= osl_File_E_NAMETOOLONG
;
205 osl_error
= osl_File_E_NOLCK
;
209 osl_error
= osl_File_E_NOSYS
;
213 osl_error
= osl_File_E_NOTEMPTY
;
217 osl_error
= osl_File_E_LOOP
;
220 #if !(defined(MACOSX) || defined(NETBSD) || defined(FREEBSD))
222 osl_error
= osl_File_E_ILSEQ
;
226 #if !(defined(MACOSX) || defined(NETBSD) || defined(FREEBSD))
228 osl_error
= osl_File_E_NOLINK
;
232 #if !(defined(MACOSX) || defined(NETBSD) || defined(FREEBSD))
234 osl_error
= osl_File_E_MULTIHOP
;
239 osl_error
= osl_File_E_USERS
;
243 osl_error
= osl_File_E_OVERFLOW
;
247 osl_error
= osl_File_E_TIMEDOUT
;
251 /* FIXME translateFileError: is this alright? Or add a new one: osl_File_E_Unknown? */
252 osl_error
= osl_File_E_invalidError
;