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 oslFileError
oslTranslateFileError(sal_Bool bIsError
, int Errno
)
26 oslFileError osl_error
= osl_File_E_invalidError
;
28 OSL_ENSURE((bIsError
&& (0 != Errno
)) || (!bIsError
&& (0 == Errno
)), "oslTranslateFileError strange input combination!");
30 /* Have a look at file_error_transl.h for
31 the reason that we do this here */
32 if (bIsError
&& (0 == Errno
))
38 osl_error
= osl_File_E_None
;
42 osl_error
= osl_File_E_PERM
;
46 osl_error
= osl_File_E_NOENT
;
50 osl_error
= osl_File_E_SRCH
;
54 osl_error
= osl_File_E_INTR
;
58 osl_error
= osl_File_E_IO
;
62 osl_error
= osl_File_E_IO
;
66 osl_error
= osl_File_E_2BIG
;
70 osl_error
= osl_File_E_NOEXEC
;
74 osl_error
= osl_File_E_BADF
;
78 osl_error
= osl_File_E_CHILD
;
82 osl_error
= osl_File_E_AGAIN
;
86 osl_error
= osl_File_E_NOMEM
;
90 osl_error
= osl_File_E_ACCES
;
94 osl_error
= osl_File_E_FAULT
;
98 osl_error
= osl_File_E_BUSY
;
102 osl_error
= osl_File_E_EXIST
;
106 osl_error
= osl_File_E_XDEV
;
110 osl_error
= osl_File_E_NODEV
;
114 osl_error
= osl_File_E_NOTDIR
;
118 osl_error
= osl_File_E_ISDIR
;
122 osl_error
= osl_File_E_INVAL
;
126 osl_error
= osl_File_E_NFILE
;
130 osl_error
= osl_File_E_MFILE
;
134 osl_error
= osl_File_E_NOTTY
;
138 osl_error
= osl_File_E_FBIG
;
142 osl_error
= osl_File_E_NOSPC
;
146 osl_error
= osl_File_E_SPIPE
;
150 osl_error
= osl_File_E_ROFS
;
154 osl_error
= osl_File_E_MLINK
;
158 osl_error
= osl_File_E_PIPE
;
162 osl_error
= osl_File_E_DOM
;
166 osl_error
= osl_File_E_RANGE
;
170 osl_error
= osl_File_E_DEADLK
;
174 osl_error
= osl_File_E_NAMETOOLONG
;
178 osl_error
= osl_File_E_NOLCK
;
182 osl_error
= osl_File_E_NOSYS
;
185 #if !defined(AIX) || !(defined(_ALL_SOURCE) && !defined(_LINUX_SOURCE_COMPAT))
187 osl_error
= osl_File_E_NOTEMPTY
;
192 osl_error
= osl_File_E_LOOP
;
195 #if !(defined(MACOSX) || defined(NETBSD) || defined(FREEBSD) || defined(OPENBSD) || defined(DRAGONFLY))
197 osl_error
= osl_File_E_ILSEQ
;
201 osl_error
= osl_File_E_NOLINK
;
205 osl_error
= osl_File_E_MULTIHOP
;
210 osl_error
= osl_File_E_USERS
;
214 osl_error
= osl_File_E_OVERFLOW
;
218 osl_error
= osl_File_E_TIMEDOUT
;
222 /* FIXME translateFileError: is this alright? Or add a new one: osl_File_E_Unknown? */
223 osl_error
= osl_File_E_invalidError
;
231 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */