1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include "file_error_transl.h"
22 #include <osl/diagnose.h>
24 /********************************************
25 * oslTranslateFileError
26 *******************************************/
28 oslFileError
oslTranslateFileError(sal_Bool bIsError
, int Errno
)
30 oslFileError osl_error
= osl_File_E_invalidError
;
32 OSL_ENSURE((bIsError
&& (0 != Errno
)) || (!bIsError
&& (0 == Errno
)), "oslTranslateFileError strange input combination!");
34 /* Have a look at file_error_transl.h for
35 the reason that we do this here */
36 if (bIsError
&& (0 == Errno
))
42 osl_error
= osl_File_E_None
;
46 osl_error
= osl_File_E_PERM
;
50 osl_error
= osl_File_E_NOENT
;
54 osl_error
= osl_File_E_SRCH
;
58 osl_error
= osl_File_E_INTR
;
62 osl_error
= osl_File_E_IO
;
66 osl_error
= osl_File_E_IO
;
70 osl_error
= osl_File_E_2BIG
;
74 osl_error
= osl_File_E_NOEXEC
;
78 osl_error
= osl_File_E_BADF
;
82 osl_error
= osl_File_E_CHILD
;
86 osl_error
= osl_File_E_AGAIN
;
90 osl_error
= osl_File_E_NOMEM
;
94 osl_error
= osl_File_E_ACCES
;
98 osl_error
= osl_File_E_FAULT
;
102 osl_error
= osl_File_E_BUSY
;
106 osl_error
= osl_File_E_EXIST
;
110 osl_error
= osl_File_E_XDEV
;
114 osl_error
= osl_File_E_NODEV
;
118 osl_error
= osl_File_E_NOTDIR
;
122 osl_error
= osl_File_E_ISDIR
;
126 osl_error
= osl_File_E_INVAL
;
130 osl_error
= osl_File_E_NFILE
;
134 osl_error
= osl_File_E_MFILE
;
138 osl_error
= osl_File_E_NOTTY
;
142 osl_error
= osl_File_E_FBIG
;
146 osl_error
= osl_File_E_NOSPC
;
150 osl_error
= osl_File_E_SPIPE
;
154 osl_error
= osl_File_E_ROFS
;
158 osl_error
= osl_File_E_MLINK
;
162 osl_error
= osl_File_E_PIPE
;
166 osl_error
= osl_File_E_DOM
;
170 osl_error
= osl_File_E_RANGE
;
174 osl_error
= osl_File_E_DEADLK
;
178 osl_error
= osl_File_E_NAMETOOLONG
;
182 osl_error
= osl_File_E_NOLCK
;
186 osl_error
= osl_File_E_NOSYS
;
189 #if !defined(AIX) || !(defined(_ALL_SOURCE) && !defined(_LINUX_SOURCE_COMPAT))
191 osl_error
= osl_File_E_NOTEMPTY
;
196 osl_error
= osl_File_E_LOOP
;
199 #if !(defined(MACOSX) || defined(NETBSD) || defined(FREEBSD) || defined(OPENBSD) || defined(DRAGONFLY))
201 osl_error
= osl_File_E_ILSEQ
;
205 osl_error
= osl_File_E_NOLINK
;
209 osl_error
= osl_File_E_MULTIHOP
;
214 osl_error
= osl_File_E_USERS
;
218 osl_error
= osl_File_E_OVERFLOW
;
222 osl_error
= osl_File_E_TIMEDOUT
;
226 /* FIXME translateFileError: is this alright? Or add a new one: osl_File_E_Unknown? */
227 osl_error
= osl_File_E_invalidError
;
235 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */