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
6d409d27
Commit
6d409d27
authored
8 years ago
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lib/icu: migrate from class Error to C++ exceptions
parent
e9c2885f
sisyphus
0.23.15-alt1
0.23.14-alt1
0.23.13-alt1
0.23.12-alt1
0.23.11-alt1
0.23.8-alt3
0.23.8-alt2
0.23.8-alt1
0.21.24-alt1.1
0.21.24-alt1
0.20.23-alt3
0.20.23-alt2
0.20.23-alt1
0.20.21-alt1
0.20.15-alt1
mpd/0.20.6-alt1
gb-sisyphus-task339776.6100
gb-sisyphus-task337393.100
gb-sisyphus-task337176.300
gb-sisyphus-task334590.100
gb-sisyphus-task333607.100
gb-sisyphus-task331543.2500
gb-sisyphus-task328663.4700
gb-sisyphus-task325064.100
gb-sisyphus-task319111.4000
gb-sisyphus-task313704.100
gb-sisyphus-task312885.100
gb-sisyphus-task308905.3200
gb-sisyphus-task305294.500
gb-sisyphus-task304007.100
gb-sisyphus-task303674.1700
gb-sisyphus-task298681.300
gb-sisyphus-task296051.1000
gb-sisyphus-task274827.100
gb-sisyphus-task269249.2000
gb-sisyphus-task266579.400
gb-sisyphus-task258132.600
gb-sisyphus-task254601.200
gb-sisyphus-task253310.100
gb-sisyphus-task252214.300
gb-sisyphus-task251539.6100
gb-sisyphus-task247988.7000
gb-sisyphus-task238768.6000
gb-sisyphus-task229151.100
gb-sisyphus-task227574.200
gb-sisyphus-task226762.6000
gb-sisyphus-task219546.1700
gb-sisyphus-task213491.100
gb-sisyphus-task198806.100
gb-sisyphus-task181400.100
gb-p9-task277538.2600
gb-c9f2-task327704.1100
No related merge requests found
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
23 additions
and
88 deletions
+23
-88
Makefile.am
Makefile.am
+1
-2
Main.cxx
src/Main.cxx
+1
-4
Collate.cxx
src/lib/icu/Collate.cxx
+6
-12
Collate.hxx
src/lib/icu/Collate.hxx
+5
-2
Error.cxx
src/lib/icu/Error.cxx
+0
-24
Error.hxx
src/lib/icu/Error.hxx
+0
-29
Init.cxx
src/lib/icu/Init.cxx
+7
-10
Init.hxx
src/lib/icu/Init.hxx
+3
-5
No files found.
Makefile.am
View file @
6d409d27
...
...
@@ -508,8 +508,7 @@ libevent_a_SOURCES = \
libicu_a_SOURCES
=
\
src/lib/icu/Collate.cxx src/lib/icu/Collate.hxx
\
src/lib/icu/Converter.cxx src/lib/icu/Converter.hxx
\
src/lib/icu/Error.cxx src/lib/icu/Error.hxx
src/lib/icu/Converter.cxx src/lib/icu/Converter.hxx
if
HAVE_ICU
libicu_a_SOURCES
+=
\
...
...
This diff is collapsed.
Click to expand it.
src/Main.cxx
View file @
6d409d27
...
...
@@ -400,10 +400,7 @@ try {
#endif
#endif
if
(
!
IcuInit
(
error
))
{
LogError
(
error
);
return
EXIT_FAILURE
;
}
IcuInit
();
winsock_init
();
io_thread_init
();
...
...
This diff is collapsed.
Click to expand it.
src/lib/icu/Collate.cxx
View file @
6d409d27
...
...
@@ -23,10 +23,9 @@
#ifdef HAVE_ICU
#include "Util.hxx"
#include "Error.hxx"
#include "util/AllocatedArray.hxx"
#include "util/ConstBuffer.hxx"
#include "util/Error.hxx"
#include "util/
Runtime
Error.hxx"
#include <unicode/ucol.h>
#include <unicode/ustring.h>
...
...
@@ -53,21 +52,16 @@ static UCollator *collator;
#ifdef HAVE_ICU
bool
IcuCollateInit
(
Error
&
error
)
void
IcuCollateInit
()
{
assert
(
collator
==
nullptr
);
assert
(
!
error
.
IsDefined
());
UErrorCode
code
=
U_ZERO_ERROR
;
collator
=
ucol_open
(
""
,
&
code
);
if
(
collator
==
nullptr
)
{
error
.
Format
(
icu_domain
,
int
(
code
),
"ucol_open() failed: %s"
,
u_errorName
(
code
));
return
false
;
}
return
true
;
if
(
collator
==
nullptr
)
throw
FormatRuntimeError
(
"ucol_open() failed: %s"
,
u_errorName
(
code
));
}
void
...
...
This diff is collapsed.
Click to expand it.
src/lib/icu/Collate.hxx
View file @
6d409d27
...
...
@@ -26,8 +26,11 @@
class
Error
;
template
<
typename
T
>
class
AllocatedString
;
bool
IcuCollateInit
(
Error
&
error
);
/**
* Throws #std::runtime_error on error.
*/
void
IcuCollateInit
();
void
IcuCollateFinish
();
...
...
This diff is collapsed.
Click to expand it.
src/lib/icu/Error.cxx
deleted
100644 → 0
View file @
e9c2885f
/*
* Copyright 2003-2016 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "Error.hxx"
#include "util/Domain.hxx"
const
Domain
icu_domain
(
"icu"
);
This diff is collapsed.
Click to expand it.
src/lib/icu/Error.hxx
deleted
100644 → 0
View file @
e9c2885f
/*
* Copyright 2003-2016 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_ICU_ERROR_HXX
#define MPD_ICU_ERROR_HXX
#include "check.h"
class
Domain
;
extern
const
Domain
icu_domain
;
#endif
This diff is collapsed.
Click to expand it.
src/lib/icu/Init.cxx
View file @
6d409d27
...
...
@@ -19,24 +19,21 @@
#include "config.h"
#include "Init.hxx"
#include "Error.hxx"
#include "Collate.hxx"
#include "util/Error.hxx"
#include "util/
Runtime
Error.hxx"
#include <unicode/uclean.h>
bool
IcuInit
(
Error
&
error
)
void
IcuInit
()
{
UErrorCode
code
=
U_ZERO_ERROR
;
u_init
(
&
code
);
if
(
U_FAILURE
(
code
))
{
error
.
Format
(
icu_domain
,
int
(
code
),
"u_init() failed: %s"
,
u_errorName
(
code
));
return
false
;
}
if
(
U_FAILURE
(
code
))
throw
FormatRuntimeError
(
"u_init() failed: %s"
,
u_errorName
(
code
));
return
IcuCollateInit
(
error
);
IcuCollateInit
(
);
}
void
...
...
This diff is collapsed.
Click to expand it.
src/lib/icu/Init.hxx
View file @
6d409d27
...
...
@@ -22,19 +22,17 @@
#include "check.h"
class
Error
;
#ifdef HAVE_ICU
bool
IcuInit
(
Error
&
error
);
void
IcuInit
();
void
IcuFinish
();
#else
static
inline
bool
IcuInit
(
Error
&
)
{
return
true
;
}
static
inline
void
IcuInit
()
{
}
static
inline
void
IcuFinish
()
{}
#endif
...
...
This diff is collapsed.
Click to expand it.
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