1
/* $Id: os_error_symbian.cpp 3553 2011-05-05 06:14:19Z nanang $ */
3
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
4
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
#include <pj/assert.h>
22
#include <pj/compat/stdarg.h>
23
#include <pj/unicode.h>
24
#include <pj/string.h>
30
#if defined(PJ_HAS_ERROR_STRING) && (PJ_HAS_ERROR_STRING!=0)
36
* Generic error -1 to -46
38
PJ_BUILD_ERR( KErrNotFound, "Unable to find the specified object"),
39
PJ_BUILD_ERR( KErrGeneral, "General (unspecified) error"),
40
PJ_BUILD_ERR( KErrCancel, "The operation was cancelled"),
41
PJ_BUILD_ERR( KErrNoMemory, "Not enough memory"),
42
PJ_BUILD_ERR( KErrNotSupported, "The operation requested is not supported"),
43
PJ_BUILD_ERR( KErrArgument, "Bad request"),
44
PJ_BUILD_ERR( KErrTotalLossOfPrecision, "Total loss of precision"),
45
PJ_BUILD_ERR( KErrBadHandle, "Bad object"),
46
PJ_BUILD_ERR( KErrOverflow, "Overflow"),
47
PJ_BUILD_ERR( KErrUnderflow, "Underflow"),
48
PJ_BUILD_ERR( KErrAlreadyExists,"Already exists"),
49
PJ_BUILD_ERR( KErrPathNotFound, "Unable to find the specified folder"),
50
PJ_BUILD_ERR( KErrDied, "Closed"),
51
PJ_BUILD_ERR( KErrInUse, "The specified object is currently in use by another program"),
52
PJ_BUILD_ERR( KErrServerTerminated, "Server has closed"),
53
PJ_BUILD_ERR( KErrServerBusy, "Server busy"),
54
PJ_BUILD_ERR( KErrCompletion, "Completion error"),
55
PJ_BUILD_ERR( KErrNotReady, "Not ready"),
56
PJ_BUILD_ERR( KErrUnknown, "Unknown error"),
57
PJ_BUILD_ERR( KErrCorrupt, "Corrupt"),
58
PJ_BUILD_ERR( KErrAccessDenied, "Access denied"),
59
PJ_BUILD_ERR( KErrLocked, "Locked"),
60
PJ_BUILD_ERR( KErrWrite, "Failed to write"),
61
PJ_BUILD_ERR( KErrDisMounted, "Wrong disk present"),
62
PJ_BUILD_ERR( KErrEof, "Unexpected end of file"),
63
PJ_BUILD_ERR( KErrDiskFull, "Disk full"),
64
PJ_BUILD_ERR( KErrBadDriver, "Bad device driver"),
65
PJ_BUILD_ERR( KErrBadName, "Bad name"),
66
PJ_BUILD_ERR( KErrCommsLineFail,"Comms line failed"),
67
PJ_BUILD_ERR( KErrCommsFrame, "Comms frame error"),
68
PJ_BUILD_ERR( KErrCommsOverrun, "Comms overrun error"),
69
PJ_BUILD_ERR( KErrCommsParity, "Comms parity error"),
70
PJ_BUILD_ERR( KErrTimedOut, "Timed out"),
71
PJ_BUILD_ERR( KErrCouldNotConnect, "Failed to connect"),
72
PJ_BUILD_ERR( KErrCouldNotDisconnect, "Failed to disconnect"),
73
PJ_BUILD_ERR( KErrDisconnected, "Disconnected"),
74
PJ_BUILD_ERR( KErrBadLibraryEntryPoint, "Bad library entry point"),
75
PJ_BUILD_ERR( KErrBadDescriptor,"Bad descriptor"),
76
PJ_BUILD_ERR( KErrAbort, "Interrupted"),
77
PJ_BUILD_ERR( KErrTooBig, "Too big"),
78
PJ_BUILD_ERR( KErrDivideByZero, "Divide by zero"),
79
PJ_BUILD_ERR( KErrBadPower, "Batteries too low"),
80
PJ_BUILD_ERR( KErrDirFull, "Folder full"),
81
PJ_BUILD_ERR( KErrHardwareNotAvailable, ""),
82
PJ_BUILD_ERR( KErrSessionClosed, ""),
83
PJ_BUILD_ERR( KErrPermissionDenied, ""),
86
* Socket errors (-190 - -1000)
88
PJ_BUILD_ERR( KErrNetUnreach, "Could not connect to the network. Currently unreachable"),
89
PJ_BUILD_ERR( KErrHostUnreach, "Could not connect to the specified server"),
90
PJ_BUILD_ERR( KErrNoProtocolOpt,"The specified server refuses the selected protocol"),
91
PJ_BUILD_ERR( KErrUrgentData, ""),
92
PJ_BUILD_ERR( KErrWouldBlock, "Conflicts with KErrExtended, but cannot occur in practice"),
97
#endif /* PJ_HAS_ERROR_STRING */
100
PJ_DEF(pj_status_t) pj_get_os_error(void)
105
PJ_DEF(void) pj_set_os_error(pj_status_t code)
110
PJ_DEF(pj_status_t) pj_get_netos_error(void)
115
PJ_DEF(void) pj_set_netos_error(pj_status_t code)
122
PJ_DECL(int) platform_strerror( pj_os_err_type os_errcode,
123
char *buf, pj_size_t bufsize);
127
* platform_strerror()
129
* Platform specific error message. This file is called by pj_strerror()
132
PJ_DEF(int) platform_strerror( pj_os_err_type os_errcode,
133
char *buf, pj_size_t bufsize)
137
pj_assert(buf != NULL);
138
pj_assert(bufsize >= 0);
141
* MUST NOT check stack here.
142
* This function might be called from PJ_CHECK_STACK() itself!
147
#if defined(PJ_HAS_ERROR_STRING) && (PJ_HAS_ERROR_STRING!=0)
149
for (i = 0; gaErrorList[i].msg; ++i) {
150
if (gaErrorList[i].code == os_errcode) {
151
len = strlen(gaErrorList[i].msg);
152
if ((pj_size_t)len >= bufsize) {
155
pj_memcpy(buf, gaErrorList[i].msg, len);
160
#endif /* PJ_HAS_ERROR_STRING */
165
len = pj_ansi_snprintf( buf, bufsize, "Symbian native error %d",