Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Jean-Francois Dockes
upmpdcli
Commits
f2ca9a08
Commit
f2ca9a08
authored
Nov 06, 2020
by
Jean-Francois Dockes
Browse files
shared
parent
49adc0fe
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/mediaserver/cdplugins/pycommon/cmdtalk.py
View file @
f2ca9a08
...
@@ -33,12 +33,16 @@ PY3 = sys.version > '3'
...
@@ -33,12 +33,16 @@ PY3 = sys.version > '3'
if
PY3
:
if
PY3
:
def
makebytes
(
data
):
def
makebytes
(
data
):
if
data
is
None
:
return
b
""
if
isinstance
(
data
,
bytes
):
if
isinstance
(
data
,
bytes
):
return
data
return
data
else
:
else
:
return
data
.
encode
(
"UTF-8"
)
return
data
.
encode
(
"UTF-8"
)
else
:
else
:
def
makebytes
(
data
):
def
makebytes
(
data
):
if
data
is
None
:
return
""
if
isinstance
(
data
,
unicode
):
if
isinstance
(
data
,
unicode
):
return
data
.
encode
(
"UTF-8"
)
return
data
.
encode
(
"UTF-8"
)
else
:
else
:
...
...
src/smallut.cpp
View file @
f2ca9a08
...
@@ -88,13 +88,9 @@ int stringicmp(const string& s1, const string& s2)
...
@@ -88,13 +88,9 @@ int stringicmp(const string& s1, const string& s2)
}
}
void
stringtolower
(
string
&
io
)
void
stringtolower
(
string
&
io
)
{
{
string
::
iterator
it
=
io
.
begin
();
std
::
transform
(
io
.
begin
(),
io
.
end
(),
io
.
begin
(),
[](
unsigned
char
c
)
{
return
std
::
tolower
(
c
);
});
string
::
iterator
ite
=
io
.
end
();
while
(
it
!=
ite
)
{
*
it
=
::
tolower
(
*
it
);
it
++
;
}
}
}
string
stringtolower
(
const
string
&
i
)
string
stringtolower
(
const
string
&
i
)
{
{
string
o
=
i
;
string
o
=
i
;
...
@@ -104,13 +100,9 @@ string stringtolower(const string& i)
...
@@ -104,13 +100,9 @@ string stringtolower(const string& i)
void
stringtoupper
(
string
&
io
)
void
stringtoupper
(
string
&
io
)
{
{
string
::
iterator
it
=
io
.
begin
();
std
::
transform
(
io
.
begin
(),
io
.
end
(),
io
.
begin
(),
[](
unsigned
char
c
)
{
return
std
::
toupper
(
c
);
});
string
::
iterator
ite
=
io
.
end
();
while
(
it
!=
ite
)
{
*
it
=
::
toupper
(
*
it
);
it
++
;
}
}
}
string
stringtoupper
(
const
string
&
i
)
string
stringtoupper
(
const
string
&
i
)
{
{
string
o
=
i
;
string
o
=
i
;
...
@@ -961,10 +953,9 @@ static void cerrdip(const string& s, DateInterval *dip)
...
@@ -961,10 +953,9 @@ static void cerrdip(const string& s, DateInterval *dip)
// back
// back
static
bool
addperiod
(
DateInterval
*
dp
,
DateInterval
*
pp
)
static
bool
addperiod
(
DateInterval
*
dp
,
DateInterval
*
pp
)
{
{
struct
tm
tm
;
// Create a struct tm with possibly non normalized fields and let
// Create a struct tm with possibly non normalized fields and let
// timegm sort it out
// timegm sort it out
memset
(
&
tm
,
0
,
sizeof
(
tm
))
;
struct
tm
tm
=
{}
;
tm
.
tm_year
=
dp
->
y1
-
1900
+
pp
->
y1
;
tm
.
tm_year
=
dp
->
y1
-
1900
+
pp
->
y1
;
tm
.
tm_mon
=
dp
->
m1
+
pp
->
m1
-
1
;
tm
.
tm_mon
=
dp
->
m1
+
pp
->
m1
-
1
;
tm
.
tm_mday
=
dp
->
d1
+
pp
->
d1
;
tm
.
tm_mday
=
dp
->
d1
+
pp
->
d1
;
...
@@ -1360,7 +1351,7 @@ string flagsToString(const vector<CharFlags>& flags, unsigned int val)
...
@@ -1360,7 +1351,7 @@ string flagsToString(const vector<CharFlags>& flags, unsigned int val)
{
{
const
char
*
s
;
const
char
*
s
;
string
out
;
string
out
;
for
(
auto
&
flag
:
flags
)
{
for
(
const
auto
&
flag
:
flags
)
{
if
((
val
&
flag
.
value
)
==
flag
.
value
)
{
if
((
val
&
flag
.
value
)
==
flag
.
value
)
{
s
=
flag
.
yesname
;
s
=
flag
.
yesname
;
}
else
{
}
else
{
...
@@ -1381,7 +1372,7 @@ string flagsToString(const vector<CharFlags>& flags, unsigned int val)
...
@@ -1381,7 +1372,7 @@ string flagsToString(const vector<CharFlags>& flags, unsigned int val)
string
valToString
(
const
vector
<
CharFlags
>&
flags
,
unsigned
int
val
)
string
valToString
(
const
vector
<
CharFlags
>&
flags
,
unsigned
int
val
)
{
{
string
out
;
string
out
;
for
(
auto
&
flag
:
flags
)
{
for
(
const
auto
&
flag
:
flags
)
{
if
(
flag
.
value
==
val
)
{
if
(
flag
.
value
==
val
)
{
out
=
flag
.
yesname
;
out
=
flag
.
yesname
;
return
out
;
return
out
;
...
...
Write
Preview
Supports
Markdown
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