Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nx-libs
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dimbor
nx-libs
Commits
9d5c83e2
Commit
9d5c83e2
authored
Dec 08, 2017
by
Ulrich Sibiller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Font.c: shorten string handling
parent
2836c72f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
18 deletions
+7
-18
Font.c
nx-X11/programs/Xserver/hw/nxagent/Font.c
+7
-18
No files found.
nx-X11/programs/Xserver/hw/nxagent/Font.c
View file @
9d5c83e2
...
@@ -1452,9 +1452,11 @@ void nxagentVerifyDefaultFontPath(void)
...
@@ -1452,9 +1452,11 @@ void nxagentVerifyDefaultFontPath(void)
fprintf
(
stderr
,
"nxagentVerifyDefaultFontPath: Going to search for one or more valid font paths.
\n
"
);
fprintf
(
stderr
,
"nxagentVerifyDefaultFontPath: Going to search for one or more valid font paths.
\n
"
);
#endif
#endif
fontPath
=
malloc
(
strlen
(
defaultFontPath
)
+
1
);
/*
* Set the default font path as the first choice.
*/
if
(
fontPath
==
NULL
)
if
(
(
fontPath
=
strdup
(
defaultFontPath
))
==
NULL
)
{
{
#ifdef WARNING
#ifdef WARNING
fprintf
(
stderr
,
"nxagentVerifyDefaultFontPath: WARNING! Unable to allocate memory for a new font path. "
fprintf
(
stderr
,
"nxagentVerifyDefaultFontPath: WARNING! Unable to allocate memory for a new font path. "
...
@@ -1464,12 +1466,6 @@ void nxagentVerifyDefaultFontPath(void)
...
@@ -1464,12 +1466,6 @@ void nxagentVerifyDefaultFontPath(void)
return
;
return
;
}
}
/*
* Set the default font path as the first choice.
*/
strcpy
(
fontPath
,
defaultFontPath
);
if
(
stat
(
NXAGENT_DEFAULT_FONT_DIR
,
&
dirStat
)
==
0
&&
if
(
stat
(
NXAGENT_DEFAULT_FONT_DIR
,
&
dirStat
)
==
0
&&
S_ISDIR
(
dirStat
.
st_mode
)
!=
0
)
S_ISDIR
(
dirStat
.
st_mode
)
!=
0
)
{
{
...
@@ -1741,9 +1737,7 @@ int nxagentSplitString(char *string, char *fields[], int nfields, char *sep)
...
@@ -1741,9 +1737,7 @@ int nxagentSplitString(char *string, char *fields[], int nfields, char *sep)
if
(
i
<
nfields
)
if
(
i
<
nfields
)
{
{
fields
[
i
]
=
(
char
*
)
malloc
(
fieldlen
+
1
);
fields
[
i
]
=
strndup
(
current
,
fieldlen
);
strncpy
(
fields
[
i
],
current
,
fieldlen
);
*
(
fields
[
i
]
+
fieldlen
)
=
0
;
}
}
else
else
{
{
...
@@ -1767,14 +1761,9 @@ char *nxagentMakeScalableFontName(const char *fontName, int scalableResolution)
...
@@ -1767,14 +1761,9 @@ char *nxagentMakeScalableFontName(const char *fontName, int scalableResolution)
{
{
char
*
scalableFontName
;
char
*
scalableFontName
;
const
char
*
s
;
const
char
*
s
;
int
len
;
int
field
;
int
field
;
len
=
strlen
(
fontName
)
+
1
;
if
((
scalableFontName
=
malloc
(
strlen
(
fontName
)
+
1
))
==
NULL
)
scalableFontName
=
malloc
(
len
);
if
(
scalableFontName
==
NULL
)
{
{
#ifdef PANIC
#ifdef PANIC
fprintf
(
stderr
,
"nxagentMakeScalableFontName: PANIC! malloc() failed.
\n
"
);
fprintf
(
stderr
,
"nxagentMakeScalableFontName: PANIC! malloc() failed.
\n
"
);
...
@@ -1783,7 +1772,7 @@ char *nxagentMakeScalableFontName(const char *fontName, int scalableResolution)
...
@@ -1783,7 +1772,7 @@ char *nxagentMakeScalableFontName(const char *fontName, int scalableResolution)
return
NULL
;
return
NULL
;
}
}
scalableFontName
[
0
]
=
0
;
scalableFontName
[
0
]
=
'\0'
;
if
(
*
fontName
!=
'-'
)
if
(
*
fontName
!=
'-'
)
{
{
...
...
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