~ubuntu-branches/ubuntu/precise/kompozer/precise

« back to all changes in this revision

Viewing changes to mozilla/nsprpub/pr/src/md/windows/w16error.c

  • Committer: Bazaar Package Importer
  • Author(s): Anthony Yarusso
  • Date: 2007-08-27 01:11:03 UTC
  • Revision ID: james.westby@ubuntu.com-20070827011103-2jgf4s6532gqu2ka
Tags: upstream-0.7.10
ImportĀ upstreamĀ versionĀ 0.7.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 
2
/* 
 
3
 * The contents of this file are subject to the Mozilla Public
 
4
 * License Version 1.1 (the "License"); you may not use this file
 
5
 * except in compliance with the License. You may obtain a copy of
 
6
 * the License at http://www.mozilla.org/MPL/
 
7
 * 
 
8
 * Software distributed under the License is distributed on an "AS
 
9
 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
 
10
 * implied. See the License for the specific language governing
 
11
 * rights and limitations under the License.
 
12
 * 
 
13
 * The Original Code is the Netscape Portable Runtime (NSPR).
 
14
 * 
 
15
 * The Initial Developer of the Original Code is Netscape
 
16
 * Communications Corporation.  Portions created by Netscape are 
 
17
 * Copyright (C) 1998-2000 Netscape Communications Corporation.  All
 
18
 * Rights Reserved.
 
19
 * 
 
20
 * Contributor(s):
 
21
 * 
 
22
 * Alternatively, the contents of this file may be used under the
 
23
 * terms of the GNU General Public License Version 2 or later (the
 
24
 * "GPL"), in which case the provisions of the GPL are applicable 
 
25
 * instead of those above.  If you wish to allow use of your 
 
26
 * version of this file only under the terms of the GPL and not to
 
27
 * allow others to use your version of this file under the MPL,
 
28
 * indicate your decision by deleting the provisions above and
 
29
 * replace them with the notice and other provisions required by
 
30
 * the GPL.  If you do not delete the provisions above, a recipient
 
31
 * may use your version of this file under either the MPL or the
 
32
 * GPL.
 
33
 */
 
34
 
 
35
/*
 
36
** Note: A single error mapping function is provided.
 
37
**
 
38
*/ 
 
39
#include "prerror.h"
 
40
#include <errno.h>
 
41
#include <winsock.h>
 
42
 
 
43
 
 
44
void _PR_MD_map_error( int err )
 
45
{
 
46
 
 
47
    switch ( err )
 
48
    {
 
49
        case  ENOENT:   /* No such file or directory */
 
50
                        PR_SetError(PR_FILE_NOT_FOUND_ERROR, err);
 
51
            break;
 
52
        case  E2BIG:    /* Argument list too big */
 
53
            PR_SetError( PR_INVALID_ARGUMENT_ERROR, err );
 
54
            break;
 
55
        case  ENOEXEC:  /* Exec format error */
 
56
            PR_SetError( PR_UNKNOWN_ERROR, err );
 
57
            break;
 
58
        case  EBADF:    /* Bad file number */
 
59
            PR_SetError( PR_BAD_DESCRIPTOR_ERROR, err );
 
60
            break;
 
61
        case  ENOMEM:   /* Not enough Memory */
 
62
            PR_SetError( PR_OUT_OF_MEMORY_ERROR, err );
 
63
            break;
 
64
        case  EACCES:   /* Permission denied */
 
65
            PR_SetError( PR_NO_ACCESS_RIGHTS_ERROR, err );
 
66
            break;
 
67
        case  EEXIST:   /* File exists */
 
68
        
 
69
 /* RESTART here */
 
70
            PR_SetError( PR_UNKNOWN_ERROR, err );
 
71
            break;
 
72
        case  EXDEV:    /* Cross device link */
 
73
            PR_SetError( PR_UNKNOWN_ERROR, err );
 
74
            break;
 
75
        case  EINVAL:   /* Invalid argument */
 
76
            PR_SetError( PR_UNKNOWN_ERROR, err );
 
77
            break;
 
78
        case  ENFILE:   /* File table overflow */
 
79
            PR_SetError( PR_UNKNOWN_ERROR, err );
 
80
            break;
 
81
        case  EMFILE:   /* Too many open files */
 
82
            PR_SetError( PR_UNKNOWN_ERROR, err );
 
83
            break;
 
84
        case  ENOSPC:   /* No space left on device */
 
85
            PR_SetError( PR_UNKNOWN_ERROR, err );
 
86
            break;
 
87
        /* math errors */
 
88
        case  EDOM:     /* Argument too large */
 
89
            PR_SetError( PR_UNKNOWN_ERROR, err );
 
90
            break;
 
91
        case  ERANGE:   /* Result too large */
 
92
            PR_SetError( PR_UNKNOWN_ERROR, err );
 
93
            break;
 
94
        /* file locking error */
 
95
        case  EDEADLK:      /* Resource deadlock would occur */
 
96
            PR_SetError( PR_UNKNOWN_ERROR, err );
 
97
            break;
 
98
        case  EINTR:    /* Interrupt */
 
99
            PR_SetError( PR_UNKNOWN_ERROR, err );
 
100
            break;
 
101
        case  ECHILD:   /* Child does not exist */
 
102
            PR_SetError( PR_UNKNOWN_ERROR, err );
 
103
            break;
 
104
        /* POSIX errors */
 
105
        case  EAGAIN:   /* Resource unavailable, try again */
 
106
            PR_SetError( PR_UNKNOWN_ERROR, err );
 
107
            break;
 
108
        case  EBUSY:    /* Device or Resource is busy */
 
109
            PR_SetError( PR_UNKNOWN_ERROR, err );
 
110
            break;
 
111
        case  EFBIG:    /* File too large */
 
112
            PR_SetError( PR_UNKNOWN_ERROR, err );
 
113
            break;
 
114
        case  EIO:      /* I/O error */
 
115
            PR_SetError( PR_IO_ERROR, err );
 
116
            break;
 
117
        case  EISDIR:   /* Is a directory */
 
118
            PR_SetError( PR_UNKNOWN_ERROR, err );
 
119
            break;
 
120
        case  ENOTDIR:  /* Not a directory */
 
121
            PR_SetError( PR_UNKNOWN_ERROR, err );
 
122
            break;
 
123
        case  EMLINK:   /* Too many links */
 
124
            PR_SetError( PR_UNKNOWN_ERROR, err );
 
125
            break;
 
126
        case  ENOTBLK:  /* Block device required */
 
127
            PR_SetError( PR_UNKNOWN_ERROR, err );
 
128
            break;
 
129
        case  ENOTTY:   /* Not a character device */
 
130
            PR_SetError( PR_UNKNOWN_ERROR, err );
 
131
            break;
 
132
        case  ENXIO:    /* No such device or address */
 
133
            PR_SetError( PR_UNKNOWN_ERROR, err );
 
134
            break;
 
135
        case  EPERM:    /* Not owner */
 
136
            PR_SetError( PR_UNKNOWN_ERROR, err );
 
137
            break;
 
138
        case  EPIPE:    /* Broken pipe */
 
139
            PR_SetError( PR_UNKNOWN_ERROR, err );
 
140
            break;
 
141
        case  EROFS:    /* Read only file system */
 
142
            PR_SetError( PR_UNKNOWN_ERROR, err );
 
143
            break;
 
144
        case  ESPIPE:   /* Illegal seek */
 
145
            PR_SetError( PR_UNKNOWN_ERROR, err );
 
146
            break;
 
147
        case  ESRCH:    /* No such process */
 
148
            PR_SetError( PR_UNKNOWN_ERROR, err );
 
149
            break;
 
150
        case  ETXTBSY:  /* Text file busy */
 
151
            PR_SetError( PR_UNKNOWN_ERROR, err );
 
152
            break;
 
153
        case  EFAULT:   /* Bad address */
 
154
            PR_SetError( PR_UNKNOWN_ERROR, err );
 
155
            break;
 
156
        case  ENAMETOOLONG: /* Name too long */
 
157
            PR_SetError( PR_UNKNOWN_ERROR, err );
 
158
            break;
 
159
        case  ENODEV:   /* No such device */
 
160
            PR_SetError( PR_UNKNOWN_ERROR, err );
 
161
            break;
 
162
        case  ENOLCK:   /* No locks available on system */
 
163
            PR_SetError( PR_UNKNOWN_ERROR, err );
 
164
            break;
 
165
        case  ENOSYS:   /* Unknown system call */
 
166
            PR_SetError( PR_UNKNOWN_ERROR, err );
 
167
            break;
 
168
        case  ENOTEMPTY:    /* Directory not empty */
 
169
        /* Normative Addendum error */
 
170
        case  EILSEQ:   /* Multibyte/widw character encoding error */
 
171
            PR_SetError( PR_UNKNOWN_ERROR, err );
 
172
            break;
 
173
            
 
174
        /* WinSock errors */
 
175
        case WSAEACCES:
 
176
            PR_SetError(PR_NO_ACCESS_RIGHTS_ERROR, err);
 
177
            break;
 
178
        case WSAEADDRINUSE:
 
179
            PR_SetError(PR_ADDRESS_IN_USE_ERROR, err);
 
180
            break;
 
181
        case WSAEADDRNOTAVAIL:
 
182
            PR_SetError(PR_ADDRESS_NOT_AVAILABLE_ERROR, err);
 
183
            break;
 
184
        case WSAEAFNOSUPPORT:
 
185
            PR_SetError(PR_ADDRESS_NOT_SUPPORTED_ERROR, err);
 
186
            break;
 
187
        case WSAEBADF:
 
188
            PR_SetError(PR_BAD_DESCRIPTOR_ERROR, err);
 
189
            break;
 
190
        case WSAECONNREFUSED:
 
191
            PR_SetError(PR_CONNECT_REFUSED_ERROR, err);
 
192
            break;
 
193
        case WSAEFAULT:
 
194
            PR_SetError(PR_ACCESS_FAULT_ERROR, err);
 
195
            break;
 
196
        case WSAEINVAL:
 
197
            PR_SetError(PR_BUFFER_OVERFLOW_ERROR, err);
 
198
            break;
 
199
        case WSAEISCONN:
 
200
            PR_SetError(PR_IS_CONNECTED_ERROR, err);
 
201
            break;
 
202
        case WSAEMFILE:
 
203
            PR_SetError(PR_PROC_DESC_TABLE_FULL_ERROR, err);
 
204
            break;
 
205
        case WSAENETDOWN:
 
206
        case WSAENETUNREACH:
 
207
            PR_SetError(PR_NETWORK_UNREACHABLE_ERROR, err);
 
208
            break;
 
209
        case WSAENOBUFS:
 
210
            PR_SetError(PR_INSUFFICIENT_RESOURCES_ERROR, err);
 
211
            break;
 
212
        case WSAENOPROTOOPT:
 
213
        case WSAEMSGSIZE:
 
214
            PR_SetError(PR_INVALID_ARGUMENT_ERROR, err);
 
215
            break;
 
216
        case WSAENOTCONN:
 
217
            PR_SetError(PR_NOT_CONNECTED_ERROR, err);
 
218
            break;
 
219
        case WSAENOTSOCK:
 
220
            PR_SetError(PR_NOT_SOCKET_ERROR, err);
 
221
            break;
 
222
        case WSAEOPNOTSUPP:
 
223
            PR_SetError(PR_NOT_TCP_SOCKET_ERROR, err);
 
224
            break;
 
225
        case WSAEPROTONOSUPPORT:
 
226
            PR_SetError(PR_PROTOCOL_NOT_SUPPORTED_ERROR, err);
 
227
            break;
 
228
        case WSAETIMEDOUT:
 
229
            PR_SetError(PR_IO_TIMEOUT_ERROR, err);
 
230
            break;
 
231
        case WSAEINTR:
 
232
            PR_SetError(PR_PENDING_INTERRUPT_ERROR, err );
 
233
            break;
 
234
        case WSASYSNOTREADY:
 
235
        case WSAVERNOTSUPPORTED:
 
236
            PR_SetError(PR_PROTOCOL_NOT_SUPPORTED_ERROR, err);
 
237
            break;
 
238
                case WSAEWOULDBLOCK:
 
239
                        PR_SetError(PR_WOULD_BLOCK_ERROR, err);
 
240
                        break;
 
241
            
 
242
        default:
 
243
            PR_SetError( PR_UNKNOWN_ERROR, err );
 
244
            break;
 
245
    }
 
246
    return;
 
247
} /* end _MD_map_win16_error() */
 
248
 
 
249