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
c8858f85
Commit
c8858f85
authored
Jul 30, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
util/Error: add method FormatLastError()
parent
d1bc46ff
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
0 deletions
+32
-0
Error.cxx
src/util/Error.cxx
+26
-0
Error.hxx
src/util/Error.hxx
+6
-0
No files found.
src/util/Error.cxx
View file @
c8858f85
...
@@ -145,4 +145,30 @@ Error::SetLastError(const char *prefix)
...
@@ -145,4 +145,30 @@ Error::SetLastError(const char *prefix)
SetLastError
(
GetLastError
(),
prefix
);
SetLastError
(
GetLastError
(),
prefix
);
}
}
void
Error
::
FormatLastError
(
DWORD
_code
,
const
char
*
fmt
,
...)
{
char
buffer
[
1024
];
va_list
ap
;
va_start
(
ap
,
fmt
);
vsnprintf
(
buffer
,
sizeof
(
buffer
),
fmt
,
ap
);
va_end
(
ap
);
SetLastError
(
_code
,
buffer
);
}
void
Error
::
FormatLastError
(
const
char
*
fmt
,
...)
{
DWORD
_code
=
GetLastError
();
char
buffer
[
1024
];
va_list
ap
;
va_start
(
ap
,
fmt
);
vsnprintf
(
buffer
,
sizeof
(
buffer
),
fmt
,
ap
);
va_end
(
ap
);
SetLastError
(
_code
,
buffer
);
}
#endif
#endif
src/util/Error.hxx
View file @
c8858f85
...
@@ -168,6 +168,12 @@ public:
...
@@ -168,6 +168,12 @@ public:
#ifdef WIN32
#ifdef WIN32
void
SetLastError
(
DWORD
_code
,
const
char
*
prefix
);
void
SetLastError
(
DWORD
_code
,
const
char
*
prefix
);
void
SetLastError
(
const
char
*
prefix
);
void
SetLastError
(
const
char
*
prefix
);
gcc_printf
(
3
,
4
)
void
FormatLastError
(
DWORD
code
,
const
char
*
fmt
,
...);
gcc_printf
(
2
,
3
)
void
FormatLastError
(
const
char
*
fmt
,
...);
#endif
#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