Debian Codegraph @

mednafen/error.cpp

raw symbols SCIP
1 /* Mednafen - Multi-system Emulator
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 */
17
18 #include "mednafen.h"cxx . . $ `<file>/mednafen/mednafen.h`/
19 #include "error.h"cxx . . $ `<file>/mednafen/error.h`/
20 #include <string.h>
21 #include <stdarg.h>
22 #include "../libretro.h"cxx . . $ `<file>/libretro.h`/
23
24 extern retro_log_printf_t log_cbcxx . . $ log_cb.;
25
26 MDFN_Errorcxx . . $ MDFN_Error#::MDFN_Errorcxx . . $ MDFN_Error#MDFN_Error(ced63f7c635d850d).() throw()
27 {
28 abortcxx . . $ abort(15d318a79ddce9e0).();
29 }
30
31 MDFN_Errorcxx . . $ MDFN_Error#::MDFN_Errorcxx . . $ MDFN_Error#MDFN_Error(3021f9d48bee4f7).(int errno_code_new, const char *format, ...) throw()
32 {
33 errno_codecxx . . $ MDFN_Error#errno_code. = errno_code_new;
34
35 va_listcxx . . $ va_list# ap;
36 va_startcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stdarg.h:50:9`!(ap, format);
37 vsnprintf(error_messagecxx . . $ MDFN_Error#error_message., 4096, format, ap);
38 va_endcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stdarg.h:52:9`!(ap);
39
40 if (log_cbcxx . . $ log_cb.)
41 log_cbcxx . . $ log_cb.(RETRO_LOG_ERROR, "%s\n", error_messagecxx . . $ MDFN_Error#error_message.);
42 }
43
44
45 MDFN_Errorcxx . . $ MDFN_Error#::MDFN_Errorcxx . . $ MDFN_Error#MDFN_Error(1d024006da5d3327).(const ErrnoHoldercxx . . $ ErrnoHolder# &enh)
46 {
47 errno_codecxx . . $ MDFN_Error#errno_code. = enh.Errnocxx . . $ ErrnoHolder#Errno(455f465bc33b4cdf).();
48
49 error_messagecxx . . $ MDFN_Error#error_message. = strdup(enh.StrErrorcxx . . $ ErrnoHolder#StrError(a9f41ea0e82d88cf).());
50 }
51
52
53 MDFN_Errorcxx . . $ MDFN_Error#::~cxx . . $ MDFN_Error#`~MDFN_Error`(ced63f7c635d850d).MDFN_Errorcxx . . $ MDFN_Error#() throw()
54 {
55 if(error_messagecxx . . $ MDFN_Error#error_message.)
56 {
57 freecxx . . $ free(bd21765a0afc8e3c).(error_messagecxx . . $ MDFN_Error#error_message.);
58 error_messagecxx . . $ MDFN_Error#error_message. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
59 }
60 }
61
62 MDFN_Errorcxx . . $ MDFN_Error#::MDFN_Errorcxx . . $ MDFN_Error#MDFN_Error(1abb5669f35c92b1).(const MDFN_Errorcxx . . $ MDFN_Error# &ze_error) throw()
63 {
64 if(ze_error.error_messagecxx . . $ MDFN_Error#error_message.)
65 error_messagecxx . . $ MDFN_Error#error_message. = strdup(ze_error.error_messagecxx . . $ MDFN_Error#error_message.);
66 else
67 error_messagecxx . . $ MDFN_Error#error_message. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
68
69 errno_codecxx . . $ MDFN_Error#errno_code. = ze_error.errno_codecxx . . $ MDFN_Error#errno_code.;
70 }
71
72 MDFN_Errorcxx . . $ MDFN_Error#& MDFN_Errorcxx . . $ MDFN_Error#::operatorcxx . . $ MDFN_Error#`operator=`(5e177ef31629b4c5).=(const MDFN_Errorcxx . . $ MDFN_Error# &ze_error) throw()
73 {
74 char *new_error_message = ze_error.error_messagecxx . . $ MDFN_Error#error_message. ? strdup(ze_error.error_messagecxx . . $ MDFN_Error#error_message.) : NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
75 int new_errno_code = ze_error.errno_codecxx . . $ MDFN_Error#errno_code.;
76
77 if(error_messagecxx . . $ MDFN_Error#error_message.)
78 freecxx . . $ free(bd21765a0afc8e3c).(error_messagecxx . . $ MDFN_Error#error_message.);
79
80 error_messagecxx . . $ MDFN_Error#error_message. = new_error_message;
81 errno_codecxx . . $ MDFN_Error#errno_code. = new_errno_code;
82
83 return(*this);
84 }
85
86
87 const char * MDFN_Errorcxx . . $ MDFN_Error#::whatcxx . . $ MDFN_Error#what(ba32b354807b2b81).(void) const throw()
88 {
89 if(!error_messagecxx . . $ MDFN_Error#error_message.)
90 return("Error allocating memory for the error message!");
91
92 return(error_messagecxx . . $ MDFN_Error#error_message.);
93 }
94
95 int MDFN_Errorcxx . . $ MDFN_Error#::GetErrnocxx . . $ MDFN_Error#GetErrno(ea6fe5115c70a13f).(void) const throw()
96 {
97 return(errno_codecxx . . $ MDFN_Error#errno_code.);
98 }
99
100 static const char *srr_wrapcxx . . $ srr_wrap(75c700d7e7a896fe).(int ret, const char *local_strerror)
101 {
102 if(ret == -1)
103 return("ERROR IN strerror_r()!!!");
104
105 return(local_strerror);
106 }
107
108 static const char *srr_wrapcxx . . $ srr_wrap(1320557f0feba62c).(const char *ret, const char *local_strerror)
109 {
110 if(ret == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)
111 return("ERROR IN strerror_r()!!!");
112
113 return(ret);
114 }
115
116 void ErrnoHoldercxx . . $ ErrnoHolder#::SetErrnocxx . . $ ErrnoHolder#SetErrno(d4f767463ce0a6b3).(int the_errno)
117 {
118 local_errnocxx . . $ ErrnoHolder#local_errno. = the_errno;
119
120 if(the_errno == 0)
121 local_strerrorcxx . . $ ErrnoHolder#local_strerror.[0] = 0;
122 else
123 {
124 strncpy(local_strerrorcxx . . $ ErrnoHolder#local_strerror., strerror(the_errno), 255);
125
126 local_strerrorcxx . . $ ErrnoHolder#local_strerror.[255] = 0;
127 }
128 }
129