Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
f6d74012
Commit
f6d74012
authored
Oct 17, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
util/Error: add method SetLastError()
parent
32dfc11c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
0 deletions
+25
-0
Error.cxx
src/util/Error.cxx
+16
-0
Error.hxx
src/util/Error.hxx
+9
-0
No files found.
src/util/Error.cxx
View file @
f6d74012
...
@@ -29,6 +29,10 @@
...
@@ -29,6 +29,10 @@
const
Domain
errno_domain
(
"errno"
);
const
Domain
errno_domain
(
"errno"
);
#ifdef WIN32
const
Domain
win32_domain
(
"win32"
);
#endif
Error
::~
Error
()
{}
Error
::~
Error
()
{}
void
void
...
@@ -112,3 +116,15 @@ Error::FormatErrno(const char *fmt, ...)
...
@@ -112,3 +116,15 @@ Error::FormatErrno(const char *fmt, ...)
SetErrno
(
e
,
buffer
);
SetErrno
(
e
,
buffer
);
}
}
#ifdef WIN32
void
Error
::
SetLastError
(
const
char
*
prefix
)
{
DWORD
_code
=
GetLastError
();
const
char
*
msg
=
g_win32_error_message
(
_code
);
Format
(
win32_domain
,
int
(
_code
),
"%s: %s"
,
prefix
,
msg
);
}
#endif
src/util/Error.hxx
View file @
f6d74012
...
@@ -36,6 +36,11 @@ extern const Domain errno_domain;
...
@@ -36,6 +36,11 @@ extern const Domain errno_domain;
#include <windows.h>
#include <windows.h>
#define IgnoreError MPDIgnoreError
#define IgnoreError MPDIgnoreError
#undef GetMessage
#undef GetMessage
/**
* Domain for GetLastError().
*/
extern
const
Domain
win32_domain
;
#endif
#endif
/**
/**
...
@@ -143,6 +148,10 @@ public:
...
@@ -143,6 +148,10 @@ public:
void
SetErrno
(
const
char
*
prefix
);
void
SetErrno
(
const
char
*
prefix
);
void
FormatErrno
(
const
char
*
prefix
,
...);
void
FormatErrno
(
const
char
*
prefix
,
...);
void
FormatErrno
(
int
e
,
const
char
*
prefix
,
...);
void
FormatErrno
(
int
e
,
const
char
*
prefix
,
...);
#ifdef WIN32
void
SetLastError
(
const
char
*
prefix
);
#endif
};
};
/**
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment