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
5f9f744c
You need to sign in or sign up before continuing.
Unverified
Commit
5f9f744c
authored
Jan 07, 2018
by
Mihai Moldovan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'uli42-pr/fix_strings' into 3.6.x
Attributes GH PR #567:
https://github.com/ArcticaProject/nx-libs/pull/567
parents
3c818997
23c36c2d
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
182 additions
and
275 deletions
+182
-275
Args.c
nx-X11/programs/Xserver/hw/nxagent/Args.c
+25
-95
Args.h
nx-X11/programs/Xserver/hw/nxagent/Args.h
+11
-5
Dialog.c
nx-X11/programs/Xserver/hw/nxagent/Dialog.c
+8
-14
Dialog.h
nx-X11/programs/Xserver/hw/nxagent/Dialog.h
+4
-2
Display.c
nx-X11/programs/Xserver/hw/nxagent/Display.c
+33
-27
Error.c
nx-X11/programs/Xserver/hw/nxagent/Error.c
+33
-44
Error.h
nx-X11/programs/Xserver/hw/nxagent/Error.h
+2
-1
Events.c
nx-X11/programs/Xserver/hw/nxagent/Events.c
+1
-0
Font.c
nx-X11/programs/Xserver/hw/nxagent/Font.c
+28
-38
Keyboard.c
nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
+18
-22
Keystroke.c
nx-X11/programs/Xserver/hw/nxagent/Keystroke.c
+1
-3
NXdixfonts.c
nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c
+7
-7
Reconnect.c
nx-X11/programs/Xserver/hw/nxagent/Reconnect.c
+1
-1
Screen.c
nx-X11/programs/Xserver/hw/nxagent/Screen.c
+10
-16
No files found.
nx-X11/programs/Xserver/hw/nxagent/Args.c
View file @
5f9f744c
...
@@ -126,15 +126,15 @@ extern char dispatchExceptionAtReset;
...
@@ -126,15 +126,15 @@ extern char dispatchExceptionAtReset;
extern
const
char
*
__progname
;
extern
const
char
*
__progname
;
char
nxagentDisplayName
[
1024
];
char
nxagentDisplayName
[
NXAGENTDISPLAYNAMELENGTH
];
Bool
nxagentSynchronize
=
False
;
Bool
nxagentSynchronize
=
False
;
Bool
nxagentRealWindowProp
=
False
;
Bool
nxagentRealWindowProp
=
False
;
char
nxagentShadowDisplayName
[
1024
]
=
{
0
};
char
nxagentShadowDisplayName
[
NXAGENTSHADOWDISPLAYNAMELENGTH
]
=
{
0
};
char
nxagentWindowName
[
256
];
char
nxagentWindowName
[
NXAGENTWINDOWNAMELENGTH
];
char
nxagentDialogName
[
256
];
char
nxagentDialogName
[
NXAGENTDIALOGNAMELENGTH
];
char
nxagentSessionId
[
256
]
=
{
0
};
char
nxagentSessionId
[
NXAGENTSESSIONIDLENGTH
]
=
{
0
};
char
*
nxagentOptionsFilenameOrString
;
char
*
nxagentOptionsFilenameOrString
;
Bool
nxagentFullGeneration
=
False
;
Bool
nxagentFullGeneration
=
False
;
...
@@ -215,14 +215,10 @@ int ddxProcessArgument(int argc, char *argv[], int i)
...
@@ -215,14 +215,10 @@ int ddxProcessArgument(int argc, char *argv[], int i)
{
{
if
((
!
strcmp
(
argv
[
j
],
"-display"
))
&&
(
j
+
1
<
argc
))
if
((
!
strcmp
(
argv
[
j
],
"-display"
))
&&
(
j
+
1
<
argc
))
{
{
envOptions
=
malloc
(
strlen
(
argv
[
j
+
1
])
+
1
);
envOptions
=
strdup
(
argv
[
j
+
1
]
);
if
(
envOptions
!=
NULL
)
{
envOptions
=
strcpy
(
envOptions
,
argv
[
j
+
1
]);
}
#ifdef WARNING
#ifdef WARNING
else
if
(
envOptions
==
NULL
)
{
{
fprintf
(
stderr
,
"ddxProcessArgument: WARNING! failed string allocation.
\n
"
);
fprintf
(
stderr
,
"ddxProcessArgument: WARNING! failed string allocation.
\n
"
);
}
}
...
@@ -234,14 +230,10 @@ int ddxProcessArgument(int argc, char *argv[], int i)
...
@@ -234,14 +230,10 @@ int ddxProcessArgument(int argc, char *argv[], int i)
if
((
envOptions
==
NULL
)
&&
(
envDisplay
!=
NULL
))
if
((
envOptions
==
NULL
)
&&
(
envDisplay
!=
NULL
))
{
{
envOptions
=
malloc
(
strlen
(
envDisplay
)
+
1
);
envOptions
=
strdup
(
envDisplay
);
if
(
envOptions
!=
NULL
)
{
envOptions
=
strcpy
(
envOptions
,
envDisplay
);
}
#ifdef WARNING
#ifdef WARNING
else
if
(
envOptions
==
NULL
)
{
{
fprintf
(
stderr
,
"ddxProcessArgument: WARNING! failed string allocation.
\n
"
);
fprintf
(
stderr
,
"ddxProcessArgument: WARNING! failed string allocation.
\n
"
);
}
}
...
@@ -326,10 +318,7 @@ int ddxProcessArgument(int argc, char *argv[], int i)
...
@@ -326,10 +318,7 @@ int ddxProcessArgument(int argc, char *argv[], int i)
{
{
if
(
++
i
<
argc
)
if
(
++
i
<
argc
)
{
{
strncpy
(
nxagentDisplayName
,
argv
[
i
],
1023
);
snprintf
(
nxagentDisplayName
,
NXAGENTDISPLAYNAMELENGTH
,
"%s"
,
argv
[
i
]);
nxagentDisplayName
[
1023
]
=
'\0'
;
return
2
;
return
2
;
}
}
...
@@ -340,10 +329,7 @@ int ddxProcessArgument(int argc, char *argv[], int i)
...
@@ -340,10 +329,7 @@ int ddxProcessArgument(int argc, char *argv[], int i)
{
{
if
(
++
i
<
argc
)
if
(
++
i
<
argc
)
{
{
strncpy
(
nxagentSessionId
,
argv
[
i
],
255
);
snprintf
(
nxagentSessionId
,
NXAGENTSESSIONIDLENGTH
,
"%s"
,
argv
[
i
]);
*
(
nxagentSessionId
+
255
)
=
'\0'
;
return
2
;
return
2
;
}
}
...
@@ -360,35 +346,13 @@ int ddxProcessArgument(int argc, char *argv[], int i)
...
@@ -360,35 +346,13 @@ int ddxProcessArgument(int argc, char *argv[], int i)
{
{
if
(
++
i
<
argc
)
if
(
++
i
<
argc
)
{
{
int
size
;
free
(
nxagentOptionsFilenameOrString
);
free
(
nxagentOptionsFilenameOrString
);
nxagentOptionsFilenameOrString
=
NULL
;
nxagentOptionsFilenameOrString
=
NULL
;
if
((
size
=
strlen
(
argv
[
i
]))
<
1024
)
if
(
-
1
==
asprintf
(
&
nxagentOptionsFilenameOrString
,
"%s"
,
argv
[
i
]))
{
if
((
nxagentOptionsFilenameOrString
=
malloc
(
size
+
1
))
==
NULL
)
{
FatalError
(
"malloc failed"
);
}
strncpy
(
nxagentOptionsFilenameOrString
,
argv
[
i
],
size
);
nxagentOptionsFilenameOrString
[
size
]
=
'\0'
;
}
else
{
{
/*
FatalError
(
"malloc failed"
);
* It is useless to store the file name
* that has just been truncated.
*/
#ifdef WARNING
fprintf
(
stderr
,
"ddxProcessArgument: WARNING! Option file name "
"too long. It will be ignored.
\n
"
);
#endif
}
}
return
2
;
return
2
;
}
}
...
@@ -670,10 +634,7 @@ int ddxProcessArgument(int argc, char *argv[], int i)
...
@@ -670,10 +634,7 @@ int ddxProcessArgument(int argc, char *argv[], int i)
{
{
if
(
++
i
<
argc
)
if
(
++
i
<
argc
)
{
{
strncpy
(
nxagentWindowName
,
argv
[
i
],
255
);
snprintf
(
nxagentWindowName
,
NXAGENTWINDOWNAMELENGTH
,
"%s"
,
argv
[
i
]);
*
(
nxagentWindowName
+
255
)
=
'\0'
;
return
2
;
return
2
;
}
}
...
@@ -727,34 +688,14 @@ int ddxProcessArgument(int argc, char *argv[], int i)
...
@@ -727,34 +688,14 @@ int ddxProcessArgument(int argc, char *argv[], int i)
{
{
if
(
++
i
<
argc
)
if
(
++
i
<
argc
)
{
{
int
size
;
free
(
nxagentKeyboard
);
free
(
nxagentKeyboard
);
nxagentKeyboard
=
NULL
;
nxagentKeyboard
=
NULL
;
if
((
size
=
strlen
(
argv
[
i
]))
<
256
)
nxagentKeyboard
=
strdup
(
argv
[
i
]);
{
if
(
nxagentKeyboard
==
NULL
)
if
((
nxagentKeyboard
=
malloc
(
size
+
1
))
==
NULL
)
{
FatalError
(
"malloc failed"
);
}
strncpy
(
nxagentKeyboard
,
argv
[
i
],
size
);
nxagentKeyboard
[
size
]
=
'\0'
;
}
#ifdef WARNING
else
{
{
/*
FatalError
(
"malloc failed"
);
* it is useless to remember a kbtype
* option that has just been truncated.
*/
fprintf
(
stderr
,
"ddxProcessArgument: WARNING! Option [%s] too long. "
"It will be ignored.
\n
"
,
argv
[
i
]);
}
}
#endif
return
2
;
return
2
;
}
}
...
@@ -903,15 +844,13 @@ int ddxProcessArgument(int argc, char *argv[], int i)
...
@@ -903,15 +844,13 @@ int ddxProcessArgument(int argc, char *argv[], int i)
{
{
if
(
++
i
<
argc
)
if
(
++
i
<
argc
)
{
{
s
trncpy
(
nxagentShadowDisplayName
,
argv
[
i
],
1023
);
s
nprintf
(
nxagentShadowDisplayName
,
NXAGENTSHADOWDISPLAYNAMELENGTH
,
"%s"
,
argv
[
i
]
);
if
(
strcmp
(
nxagentShadowDisplayName
,
""
)
==
0
)
if
(
strcmp
(
nxagentShadowDisplayName
,
""
)
==
0
)
{
{
FatalError
(
"Invalid shadow display option"
);
FatalError
(
"Invalid shadow display option"
);
}
}
*
(
nxagentShadowDisplayName
+
1023
)
=
'\0'
;
return
2
;
return
2
;
}
}
...
@@ -1315,7 +1254,7 @@ static void nxagentParseOptions(char *name, char *value)
...
@@ -1315,7 +1254,7 @@ static void nxagentParseOptions(char *name, char *value)
}
}
else
if
(
strcmp
(
name
,
"clients"
)
==
0
)
else
if
(
strcmp
(
name
,
"clients"
)
==
0
)
{
{
s
trcpy
(
nxagentClientsLogName
,
value
);
s
nprintf
(
nxagentClientsLogName
,
NXAGENTCLIENTSLOGNAMELENGTH
,
"%s"
,
value
);
return
;
return
;
}
}
...
@@ -1780,9 +1719,7 @@ N/A
...
@@ -1780,9 +1719,7 @@ N/A
if
(
*
nxagentWindowName
==
'\0'
)
if
(
*
nxagentWindowName
==
'\0'
)
{
{
strncpy
(
nxagentWindowName
,
"NX"
,
255
);
snprintf
(
nxagentWindowName
,
NXAGENTWINDOWNAMELENGTH
,
"NX"
);
*
(
nxagentWindowName
+
255
)
=
'\0'
;
}
}
/*
/*
...
@@ -2161,31 +2098,24 @@ void ddxUseMsg()
...
@@ -2161,31 +2098,24 @@ void ddxUseMsg()
static
int
nxagentGetDialogName
()
static
int
nxagentGetDialogName
()
{
{
strcpy
(
nxagentDialogName
,
"NX"
);
*
(
nxagentDialogName
+
255
)
=
'\0'
;
if
(
*
nxagentSessionId
!=
'\0'
)
if
(
*
nxagentSessionId
!=
'\0'
)
{
{
int
length
=
strlen
(
nxagentSessionId
);
int
length
=
strlen
(
nxagentSessionId
);
strcpy
(
nxagentDialogName
,
"NX - "
);
/* if the session id contains an MD5 hash in a well-known format cut it off */
if
(
length
>
(
MD5_LENGTH
*
2
+
1
)
&&
if
(
length
>
(
MD5_LENGTH
*
2
+
1
)
&&
*
(
nxagentSessionId
+
(
length
-
(
MD5_LENGTH
*
2
+
1
)))
==
'-'
)
*
(
nxagentSessionId
+
(
length
-
(
MD5_LENGTH
*
2
+
1
)))
==
'-'
)
{
{
strncat
(
nxagentDialogName
,
nxagentSessionId
,
length
-
(
MD5_LENGTH
*
2
+
1
));
length
-=
(
MD5_LENGTH
*
2
+
1
);
}
else
{
strncat
(
nxagentDialogName
,
nxagentSessionId
,
250
);
}
}
*
(
nxagentSessionId
+
255
)
=
'\0'
;
snprintf
(
nxagentDialogName
,
NXAGENTDIALOGNAMELENGTH
,
"NX - %.*s"
,
length
,
nxagentSessionId
)
;
return
1
;
return
1
;
}
}
snprintf
(
nxagentDialogName
,
NXAGENTDIALOGNAMELENGTH
,
"NX"
);
return
0
;
return
0
;
}
}
...
...
nx-X11/programs/Xserver/hw/nxagent/Args.h
View file @
5f9f744c
...
@@ -52,11 +52,17 @@ struct UserGeometry{
...
@@ -52,11 +52,17 @@ struct UserGeometry{
extern
Bool
nxagentUseNXTrans
;
extern
Bool
nxagentUseNXTrans
;
extern
char
nxagentSessionId
[];
#define NXAGENTSESSIONIDLENGTH 256
extern
char
nxagentDisplayName
[];
#define NXAGENTDISPLAYNAMELENGTH 1024
extern
char
nxagentShadowDisplayName
[];
#define NXAGENTSHADOWDISPLAYNAMELENGTH 1024
extern
char
nxagentWindowName
[];
#define NXAGENTWINDOWNAMELENGTH 256
extern
char
nxagentDialogName
[];
#define NXAGENTDIALOGNAMELENGTH 256
extern
char
nxagentSessionId
[
NXAGENTSESSIONIDLENGTH
];
extern
char
nxagentDisplayName
[
NXAGENTDISPLAYNAMELENGTH
];
extern
char
nxagentShadowDisplayName
[
NXAGENTSHADOWDISPLAYNAMELENGTH
];
extern
char
nxagentWindowName
[
NXAGENTWINDOWNAMELENGTH
];
extern
char
nxagentDialogName
[
NXAGENTDIALOGNAMELENGTH
];
extern
Bool
nxagentSynchronize
;
extern
Bool
nxagentSynchronize
;
extern
Bool
nxagentRealWindowProp
;
extern
Bool
nxagentRealWindowProp
;
...
...
nx-X11/programs/Xserver/hw/nxagent/Dialog.c
View file @
5f9f744c
...
@@ -66,9 +66,9 @@ int nxagentDisableDeferModePid = 0;
...
@@ -66,9 +66,9 @@ int nxagentDisableDeferModePid = 0;
static
int
nxagentFailedReconnectionDialogPid
=
0
;
static
int
nxagentFailedReconnectionDialogPid
=
0
;
char
nxagentPulldownWindow
[
16
];
char
nxagentPulldownWindow
[
NXAGENTPULLDOWNWINDOWLENGTH
];
char
nxagentFailedReconnectionMessage
[
256
];
char
nxagentFailedReconnectionMessage
[
NXAGENTFAILEDRECONNECTIONMESSAGELENGTH
];
void
nxagentResetDialog
(
int
pid
)
void
nxagentResetDialog
(
int
pid
)
{
{
...
@@ -279,16 +279,13 @@ void nxagentLaunchDialog(DialogType dialogType)
...
@@ -279,16 +279,13 @@ void nxagentLaunchDialog(DialogType dialogType)
if
(
dialogType
==
DIALOG_FAILED_RECONNECTION
)
if
(
dialogType
==
DIALOG_FAILED_RECONNECTION
)
{
{
s
trncpy
(
dialogDisplay
,
nxagentDisplayName
,
255
);
s
nprintf
(
dialogDisplay
,
sizeof
(
dialogDisplay
),
"%s"
,
nxagentDisplayName
);
}
}
else
else
{
{
strcpy
(
dialogDisplay
,
":"
);
snprintf
(
dialogDisplay
,
sizeof
(
dialogDisplay
),
":%s"
,
display
);
strncat
(
dialogDisplay
,
display
,
254
);
}
}
*
(
dialogDisplay
+
255
)
=
'\0'
;
/*
/*
* We don't want to receive SIGCHLD
* We don't want to receive SIGCHLD
* before we store the child pid.
* before we store the child pid.
...
@@ -308,7 +305,7 @@ void nxagentLaunchDialog(DialogType dialogType)
...
@@ -308,7 +305,7 @@ void nxagentLaunchDialog(DialogType dialogType)
DECODE_DIALOG_TYPE
(
dialogType
),
*
pid
,
dialogDisplay
);
DECODE_DIALOG_TYPE
(
dialogType
),
*
pid
,
dialogDisplay
);
#endif
#endif
*
dialogDisplay
=
'\0'
;
dialogDisplay
[
0
]
=
'\0'
;
/*
/*
* Restore the previous set of
* Restore the previous set of
...
@@ -320,8 +317,7 @@ void nxagentLaunchDialog(DialogType dialogType)
...
@@ -320,8 +317,7 @@ void nxagentLaunchDialog(DialogType dialogType)
void
nxagentPulldownDialog
(
Window
wid
)
void
nxagentPulldownDialog
(
Window
wid
)
{
{
snprintf
(
nxagentPulldownWindow
,
15
,
"%ld"
,
(
long
int
)
wid
);
snprintf
(
nxagentPulldownWindow
,
NXAGENTPULLDOWNWINDOWLENGTH
,
"%ld"
,
(
long
int
)
wid
);
nxagentPulldownWindow
[
15
]
=
0
;
#ifdef TEST
#ifdef TEST
fprintf
(
stderr
,
"nxagentPulldownDialog: Going to launch pulldown "
fprintf
(
stderr
,
"nxagentPulldownDialog: Going to launch pulldown "
...
@@ -330,7 +326,7 @@ void nxagentPulldownDialog(Window wid)
...
@@ -330,7 +326,7 @@ void nxagentPulldownDialog(Window wid)
nxagentLaunchDialog
(
DIALOG_PULLDOWN
);
nxagentLaunchDialog
(
DIALOG_PULLDOWN
);
nxagentPulldownWindow
[
0
]
=
0
;
nxagentPulldownWindow
[
0
]
=
'\0'
;
}
}
void
nxagentFailedReconnectionDialog
(
int
alert
,
char
*
error
)
void
nxagentFailedReconnectionDialog
(
int
alert
,
char
*
error
)
...
@@ -372,9 +368,7 @@ void nxagentFailedReconnectionDialog(int alert, char *error)
...
@@ -372,9 +368,7 @@ void nxagentFailedReconnectionDialog(int alert, char *error)
int
status
;
int
status
;
int
options
=
0
;
int
options
=
0
;
snprintf
(
nxagentFailedReconnectionMessage
,
255
,
"Reconnection failed: %s"
,
error
);
snprintf
(
nxagentFailedReconnectionMessage
,
NXAGENTFAILEDRECONNECTIONMESSAGELENGTH
,
"Reconnection failed: %s"
,
error
);
*
(
nxagentFailedReconnectionMessage
+
255
)
=
'\0'
;
nxagentLaunchDialog
(
DIALOG_FAILED_RECONNECTION
);
nxagentLaunchDialog
(
DIALOG_FAILED_RECONNECTION
);
...
...
nx-X11/programs/Xserver/hw/nxagent/Dialog.h
View file @
5f9f744c
...
@@ -55,9 +55,11 @@ extern int nxagentDisableRandRModeDialogPid;
...
@@ -55,9 +55,11 @@ extern int nxagentDisableRandRModeDialogPid;
extern
int
nxagentEnableDeferModePid
;
extern
int
nxagentEnableDeferModePid
;
extern
int
nxagentDisableDeferModePid
;
extern
int
nxagentDisableDeferModePid
;
extern
char
nxagentFailedReconnectionMessage
[];
#define NXAGENTFAILEDRECONNECTIONMESSAGELENGTH 256
extern
char
nxagentFailedReconnectionMessage
[
NXAGENTFAILEDRECONNECTIONMESSAGELENGTH
];
extern
char
nxagentPulldownWindow
[];
#define NXAGENTPULLDOWNWINDOWLENGTH 16
extern
char
nxagentPulldownWindow
[
NXAGENTPULLDOWNWINDOWLENGTH
];
extern
void
nxagentLaunchDialog
(
DialogType
type
);
extern
void
nxagentLaunchDialog
(
DialogType
type
);
extern
void
nxagentResetDialog
(
int
pid
);
extern
void
nxagentResetDialog
(
int
pid
);
...
...
nx-X11/programs/Xserver/hw/nxagent/Display.c
View file @
5f9f744c
...
@@ -1150,9 +1150,7 @@ void nxagentOpenDisplay(int argc, char *argv[])
...
@@ -1150,9 +1150,7 @@ void nxagentOpenDisplay(int argc, char *argv[])
if
(
*
nxagentDisplayName
==
'\0'
)
if
(
*
nxagentDisplayName
==
'\0'
)
{
{
strncpy
(
nxagentDisplayName
,
XDisplayName
(
NULL
),
1023
);
snprintf
(
nxagentDisplayName
,
NXAGENTDISPLAYNAMELENGTH
,
"%s"
,
XDisplayName
(
NULL
));
nxagentDisplayName
[
1023
]
=
'\0'
;
}
}
nxagentCloseDisplay
();
nxagentCloseDisplay
();
...
@@ -1817,12 +1815,10 @@ FIXME: Is this needed?
...
@@ -1817,12 +1815,10 @@ FIXME: Is this needed?
}
}
static
FILE
*
nxagentLookForIconFile
(
char
*
iconName
,
const
char
*
permission
,
static
FILE
*
nxagentLookForIconFile
(
char
*
iconName
,
const
char
*
permission
,
char
*
return_path
)
char
*
return_path
,
int
return_path_size
)
{
{
char
*
path
;
char
*
path
;
char
*
end
;
char
singlePath
[
PATH_MAX
];
char
singlePath
[
PATH_MAX
];
int
breakLoop
;
FILE
*
fptr
=
NULL
;
FILE
*
fptr
=
NULL
;
#ifdef WIN32
#ifdef WIN32
...
@@ -1838,43 +1834,53 @@ static FILE *nxagentLookForIconFile(char *iconName, const char *permission,
...
@@ -1838,43 +1834,53 @@ static FILE *nxagentLookForIconFile(char *iconName, const char *permission,
return
NULL
;
return
NULL
;
}
}
for
(
breakLoop
=
0
;
breakLoop
==
0
&&
fptr
==
NULL
;
)
for
(
char
*
end
=
path
;
end
!=
NULL
&&
fptr
==
NULL
;
)
{
{
end
=
strchr
(
path
,
separator
);
end
=
strchr
(
path
,
separator
);
/* separator found */
if
(
end
!=
NULL
)
if
(
end
!=
NULL
)
{
{
strncpy
(
singlePath
,
path
,
(
unsigned
long
)(
end
-
path
));
if
((
end
-
path
)
>
sizeof
(
singlePath
)
-
1
)
{
singlePath
[(
unsigned
long
)(
end
-
path
)]
=
0
;
fprintf
(
stderr
,
"Warning: PATH component too long - ignoring it.
\n
"
);
path
=
end
+
1
;
continue
;
}
snprintf
(
singlePath
,
(
unsigned
long
)(
end
-
path
+
1
),
"%s"
,
path
);
path
=
end
+
1
;
path
=
end
+
1
;
}
}
else
else
{
{
strcpy
(
singlePath
,
path
);
if
(
strlen
(
path
)
>
sizeof
(
singlePath
)
-
1
)
{
fprintf
(
stderr
,
"Warning: PATH component too long - ignoring it.
\n
"
);
return
NULL
;
}
breakLoop
=
1
;
snprintf
(
singlePath
,
sizeof
(
singlePath
),
"%s"
,
path
)
;
}
}
if
(
singlePath
[
strlen
(
singlePath
)
-
1
]
==
slash
[
0
])
/* cut off trailing slashes, if any */
while
(
singlePath
[
strlen
(
singlePath
)
-
1
]
==
slash
[
0
])
{
{
singlePath
[
strlen
(
singlePath
)
-
1
]
=
0
;
singlePath
[
strlen
(
singlePath
)
-
1
]
=
'\0'
;
}
}
if
(
strlen
(
singlePath
)
+
strlen
(
iconName
)
+
1
<
PATH_MAX
)
/* append slash and icon name */
if
(
strlen
(
singlePath
)
+
strlen
(
iconName
)
+
1
<
sizeof
(
singlePath
))
{
{
strncat
(
singlePath
,
slash
,
1
);
snprintf
(
singlePath
+
strlen
(
singlePath
),
sizeof
(
singlePath
),
"%s%s"
,
slash
,
iconName
);
strcat
(
singlePath
,
iconName
);
if
((
fptr
=
fopen
(
singlePath
,
permission
))
!=
NULL
)
if
((
fptr
=
fopen
(
singlePath
,
permission
))
!=
NULL
)
{
{
s
trcpy
(
return_path
,
singlePath
);
s
nprintf
(
return_path
,
return_path_size
,
"%s"
,
singlePath
);
}
}
}
}
else
else
{
{
fprintf
(
stderr
,
"
Error: P
ath too long.
\n
"
);
fprintf
(
stderr
,
"
Warning: Icon p
ath too long.
\n
"
);
}
}
}
}
...
@@ -1898,21 +1904,21 @@ Bool nxagentMakeIcon(Display *display, Pixmap *nxIcon, Pixmap *nxMask)
...
@@ -1898,21 +1904,21 @@ Bool nxagentMakeIcon(Display *display, Pixmap *nxIcon, Pixmap *nxMask)
*/
*/
if
(
nxagentX2go
)
if
(
nxagentX2go
)
{
{
agent_icon_name
=
X2GOAGENT_ICON_NAME
;
agent_icon_name
=
X2GOAGENT_ICON_NAME
;
agentIconData
=
x2goagentIconData
;
agentIconData
=
x2goagentIconData
;
}
}
else
else
{
{
agent_icon_name
=
NXAGENT_ICON_NAME
;
agent_icon_name
=
NXAGENT_ICON_NAME
;
agentIconData
=
nxagentIconData
;
agentIconData
=
nxagentIconData
;
}
}
/* FIXME: use a compile time define here, /usr/NX is a nomachine path */
snprintf
(
default_path
,
PATH_MAX
-
1
,
"/usr/NX/share/images/%s"
,
agent_icon_name
);
snprintf
(
default_path
,
sizeof
(
default_path
)
,
"/usr/NX/share/images/%s"
,
agent_icon_name
);
if
((
icon_fp
=
fopen
(
default_path
,
"r"
))
==
NULL
)
if
((
icon_fp
=
fopen
(
default_path
,
"r"
))
==
NULL
)
{
{
icon_fp
=
nxagentLookForIconFile
(
agent_icon_name
,
"r"
,
icon_path
);
icon_fp
=
nxagentLookForIconFile
(
agent_icon_name
,
"r"
,
icon_path
,
sizeof
(
icon_path
)
);
if
(
icon_fp
!=
NULL
)
if
(
icon_fp
!=
NULL
)
{
{
...
@@ -1924,7 +1930,7 @@ Bool nxagentMakeIcon(Display *display, Pixmap *nxIcon, Pixmap *nxMask)
...
@@ -1924,7 +1930,7 @@ Bool nxagentMakeIcon(Display *display, Pixmap *nxIcon, Pixmap *nxMask)
{
{
fclose
(
icon_fp
);
fclose
(
icon_fp
);
success
=
True
;
success
=
True
;
s
trcpy
(
icon_path
,
default_path
);
s
nprintf
(
icon_path
,
sizeof
(
icon_path
),
"%s"
,
default_path
);
}
}
if
(
success
)
if
(
success
)
...
...
nx-X11/programs/Xserver/hw/nxagent/Error.c
View file @
5f9f744c
...
@@ -78,7 +78,7 @@ static int nxagentClientsLog = -1;
...
@@ -78,7 +78,7 @@ static int nxagentClientsLog = -1;
* Clients log file name.
* Clients log file name.
*/
*/
char
nxagentClientsLogName
[
DEFAULT_STRING_
LENGTH
]
=
{
0
};
char
nxagentClientsLogName
[
NXAGENTCLIENTSLOGNAME
LENGTH
]
=
{
0
};
/*
/*
* User's home.
* User's home.
...
@@ -102,7 +102,7 @@ void nxagentGetClientsPath(void);
...
@@ -102,7 +102,7 @@ void nxagentGetClientsPath(void);
static
int
nxagentPrintError
(
Display
*
dpy
,
XErrorEvent
*
event
,
FILE
*
fp
);
static
int
nxagentPrintError
(
Display
*
dpy
,
XErrorEvent
*
event
,
FILE
*
fp
);
/* declare an error handler that does not exit when an error
/* declare an error handler that does not exit when an error
* event is catched.
* event is catched.
*/
*/
...
@@ -118,6 +118,8 @@ int nxagentErrorHandler(Display *dpy, XErrorEvent *event)
...
@@ -118,6 +118,8 @@ int nxagentErrorHandler(Display *dpy, XErrorEvent *event)
/* copied from XlibInt.c */
/* copied from XlibInt.c */
/* extension stuff roughly commented out */
/* extension stuff roughly commented out */
/* FIXME: why? What's wrong with printing extension stuff?
We could drop this in favour of _XprintDefaultError then! */
static
int
nxagentPrintError
(
dpy
,
event
,
fp
)
static
int
nxagentPrintError
(
dpy
,
event
,
fp
)
Display
*
dpy
;
Display
*
dpy
;
XErrorEvent
*
event
;
XErrorEvent
*
event
;
...
@@ -138,7 +140,7 @@ static int nxagentPrintError(dpy, event, fp)
...
@@ -138,7 +140,7 @@ static int nxagentPrintError(dpy, event, fp)
mesg
,
BUFSIZ
);
mesg
,
BUFSIZ
);
(
void
)
fprintf
(
fp
,
mesg
,
event
->
request_code
);
(
void
)
fprintf
(
fp
,
mesg
,
event
->
request_code
);
if
(
event
->
request_code
<
128
)
{
if
(
event
->
request_code
<
128
)
{
s
printf
(
number
,
"%d"
,
event
->
request_code
);
s
nprintf
(
number
,
sizeof
(
number
)
,
"%d"
,
event
->
request_code
);
XGetErrorDatabaseText
(
dpy
,
"XRequest"
,
number
,
""
,
buffer
,
BUFSIZ
);
XGetErrorDatabaseText
(
dpy
,
"XRequest"
,
number
,
""
,
buffer
,
BUFSIZ
);
}
else
{
}
else
{
/* for (ext = dpy->ext_procs;
/* for (ext = dpy->ext_procs;
...
@@ -146,7 +148,7 @@ static int nxagentPrintError(dpy, event, fp)
...
@@ -146,7 +148,7 @@ static int nxagentPrintError(dpy, event, fp)
ext = ext->next)
ext = ext->next)
;
;
if (ext)
if (ext)
str
cpy(buffer, ext->name
);
str
ncpy(buffer, ext->name, BUFSIZ
);
else
else
*/
*/
buffer
[
0
]
=
'\0'
;
buffer
[
0
]
=
'\0'
;
...
@@ -159,7 +161,7 @@ static int nxagentPrintError(dpy, event, fp)
...
@@ -159,7 +161,7 @@ static int nxagentPrintError(dpy, event, fp)
(
void
)
fprintf
(
fp
,
mesg
,
event
->
minor_code
);
(
void
)
fprintf
(
fp
,
mesg
,
event
->
minor_code
);
/*
/*
if (ext) {
if (ext) {
s
printf(mesg
, "%s.%d", ext->name, event->minor_code);
s
nprintf(mesg, sizeof(mesg)
, "%s.%d", ext->name, event->minor_code);
XGetErrorDatabaseText(dpy, "XRequest", mesg, "", buffer, BUFSIZ);
XGetErrorDatabaseText(dpy, "XRequest", mesg, "", buffer, BUFSIZ);
(void) fprintf(fp, " (%s)", buffer);
(void) fprintf(fp, " (%s)", buffer);
}
}
...
@@ -171,7 +173,7 @@ static int nxagentPrintError(dpy, event, fp)
...
@@ -171,7 +173,7 @@ static int nxagentPrintError(dpy, event, fp)
buffer
[
0
]
=
'\0'
;
buffer
[
0
]
=
'\0'
;
/*
/*
for (ext = dpy->ext_procs; ext; ext = ext->next) {
for (ext = dpy->ext_procs; ext; ext = ext->next) {
if (ext->error_string)
if (ext->error_string)
(*ext->error_string)(dpy, event->error_code, &ext->codes,
(*ext->error_string)(dpy, event->error_code, &ext->codes,
buffer, BUFSIZ);
buffer, BUFSIZ);
if (buffer[0]) {
if (buffer[0]) {
...
@@ -182,9 +184,9 @@ static int nxagentPrintError(dpy, event, fp)
...
@@ -182,9 +184,9 @@ static int nxagentPrintError(dpy, event, fp)
ext->codes.first_error < (int)event->error_code &&
ext->codes.first_error < (int)event->error_code &&
(!bext || ext->codes.first_error > bext->codes.first_error))
(!bext || ext->codes.first_error > bext->codes.first_error))
bext = ext;
bext = ext;
}
}
if (bext)
if (bext)
s
printf(buffer
, "%s.%d", bext->name,
s
nprintf(buffer, sizeof(buffer)
, "%s.%d", bext->name,
event->error_code - bext->codes.first_error);
event->error_code - bext->codes.first_error);
else
else
*/
*/
...
@@ -225,14 +227,14 @@ static int nxagentPrintError(dpy, event, fp)
...
@@ -225,14 +227,14 @@ static int nxagentPrintError(dpy, event, fp)
(
void
)
fprintf
(
fp
,
mesg
,
event
->
resourceid
);
(
void
)
fprintf
(
fp
,
mesg
,
event
->
resourceid
);
fputs
(
"
\n
"
,
fp
);
fputs
(
"
\n
"
,
fp
);
}
}
XGetErrorDatabaseText
(
dpy
,
mtype
,
"ErrorSerial"
,
"Error Serial #%d"
,
XGetErrorDatabaseText
(
dpy
,
mtype
,
"ErrorSerial"
,
"Error Serial #%d"
,
mesg
,
BUFSIZ
);
mesg
,
BUFSIZ
);
fputs
(
" "
,
fp
);
fputs
(
" "
,
fp
);
(
void
)
fprintf
(
fp
,
mesg
,
event
->
serial
);
(
void
)
fprintf
(
fp
,
mesg
,
event
->
serial
);
XGetErrorDatabaseText
(
dpy
,
mtype
,
"CurrentSerial"
,
"Current Serial #%d"
,
/*
XGetErrorDatabaseText(dpy, mtype, "CurrentSerial", "Current Serial #%d",
mesg, BUFSIZ);
mesg, BUFSIZ);
fputs("\n ", fp);
fputs("\n ", fp);
/*
(void) fprintf(fp, mesg, dpy->request); */
(void) fprintf(fp, mesg, dpy->request); */
fputs
(
"
\n
"
,
fp
);
fputs
(
"
\n
"
,
fp
);
if
(
event
->
error_code
==
BadImplementation
)
return
0
;
if
(
event
->
error_code
==
BadImplementation
)
return
0
;
return
1
;
return
1
;
...
@@ -252,7 +254,7 @@ void nxagentOpenClientsLogFile()
...
@@ -252,7 +254,7 @@ void nxagentOpenClientsLogFile()
nxagentGetClientsPath
();
nxagentGetClientsPath
();
}
}
if
(
nxagentClientsLogName
!=
NULL
&&
*
nxagentClientsLogName
!=
'\0'
)
if
(
nxagentClientsLogName
!=
NULL
&&
*
nxagentClientsLogName
!=
'\0'
)
{
{
nxagentClientsLog
=
open
(
nxagentClientsLogName
,
O_RDWR
|
O_CREAT
|
O_APPEND
,
0600
);
nxagentClientsLog
=
open
(
nxagentClientsLogName
,
O_RDWR
|
O_CREAT
|
O_APPEND
,
0600
);
...
@@ -283,12 +285,12 @@ void nxagentStartRedirectToClientsLog(void)
...
@@ -283,12 +285,12 @@ void nxagentStartRedirectToClientsLog(void)
{
{
if
(
nxagentStderrBackup
==
-
1
)
if
(
nxagentStderrBackup
==
-
1
)
{
{
nxagentStderrBackup
=
dup
(
2
);
nxagentStderrBackup
=
dup
(
STDERR_FILENO
);
}
}
if
(
nxagentStderrBackup
!=
-
1
)
if
(
nxagentStderrBackup
!=
-
1
)
{
{
nxagentStderrDup
=
dup2
(
nxagentClientsLog
,
2
);
nxagentStderrDup
=
dup2
(
nxagentClientsLog
,
STDERR_FILENO
);
if
(
nxagentStderrDup
==
-
1
)
if
(
nxagentStderrDup
==
-
1
)
{
{
...
@@ -308,7 +310,7 @@ void nxagentEndRedirectToClientsLog(void)
...
@@ -308,7 +310,7 @@ void nxagentEndRedirectToClientsLog(void)
{
{
if
(
nxagentStderrBackup
!=
-
1
)
if
(
nxagentStderrBackup
!=
-
1
)
{
{
nxagentStderrDup
=
dup2
(
nxagentStderrBackup
,
2
);
nxagentStderrDup
=
dup2
(
nxagentStderrBackup
,
STDERR_FILENO
);
if
(
nxagentStderrDup
==
-
1
)
if
(
nxagentStderrDup
==
-
1
)
{
{
...
@@ -359,14 +361,14 @@ char *nxagentGetHomePath(void)
...
@@ -359,14 +361,14 @@ char *nxagentGetHomePath(void)
#endif
#endif
}
}
s
trncpy
(
nxagentHomeDir
,
homeEnv
,
DEFAULT_STRING_LENGTH
-
1
);
s
nprintf
(
nxagentHomeDir
,
DEFAULT_STRING_LENGTH
,
"%s"
,
homeEnv
);
#ifdef TEST
#ifdef TEST
fprintf
(
stderr
,
"nxagentGetHomePath: Assuming NX user's home directory '%s'.
\n
"
,
nxagentHomeDir
);
fprintf
(
stderr
,
"nxagentGetHomePath: Assuming NX user's home directory '%s'.
\n
"
,
nxagentHomeDir
);
#endif
#endif
}
}
homePath
=
(
char
*
)
malloc
(
strlen
(
nxagentHomeDir
)
+
1
);
homePath
=
strdup
(
nxagentHomeDir
);
if
(
homePath
==
NULL
)
if
(
homePath
==
NULL
)
{
{
...
@@ -377,8 +379,6 @@ char *nxagentGetHomePath(void)
...
@@ -377,8 +379,6 @@ char *nxagentGetHomePath(void)
return
NULL
;
return
NULL
;
}
}
strcpy
(
homePath
,
nxagentHomeDir
);
return
homePath
;
return
homePath
;
}
}
...
@@ -414,10 +414,6 @@ char *nxagentGetRootPath(void)
...
@@ -414,10 +414,6 @@ char *nxagentGetRootPath(void)
if
(
homeEnv
==
NULL
)
if
(
homeEnv
==
NULL
)
{
{
#ifdef PANIC
#endif
return
NULL
;
return
NULL
;
}
}
...
@@ -438,8 +434,7 @@ char *nxagentGetRootPath(void)
...
@@ -438,8 +434,7 @@ char *nxagentGetRootPath(void)
fprintf
(
stderr
,
"nxagentGetRootPath: Assuming NX root directory in '%s'.
\n
"
,
homeEnv
);
fprintf
(
stderr
,
"nxagentGetRootPath: Assuming NX root directory in '%s'.
\n
"
,
homeEnv
);
#endif
#endif
strcpy
(
nxagentRootDir
,
homeEnv
);
snprintf
(
nxagentRootDir
,
DEFAULT_STRING_LENGTH
,
"%s/.nx"
,
homeEnv
);
strcat
(
nxagentRootDir
,
"/.nx"
);
free
(
homeEnv
);
free
(
homeEnv
);
...
@@ -472,17 +467,17 @@ char *nxagentGetRootPath(void)
...
@@ -472,17 +467,17 @@ char *nxagentGetRootPath(void)
return
NULL
;
return
NULL
;
}
}
s
trcpy
(
nxagentRootDir
,
rootEnv
);
s
nprintf
(
nxagentRootDir
,
DEFAULT_STRING_LENGTH
,
"%s"
,
rootEnv
);
}
}
#ifdef TEST
#ifdef TEST
fprintf
(
stderr
,
"nxagentGetRootPath: Assuming NX root directory '%s'.
\n
"
,
fprintf
(
stderr
,
"nxagentGetRootPath: Assuming NX root directory '%s'.
\n
"
,
nxagentRootDir
);
nxagentRootDir
);
#endif
#endif
}
}
rootPath
=
malloc
(
strlen
(
nxagentRootDir
)
+
1
);
rootPath
=
strdup
(
nxagentRootDir
);
if
(
rootPath
==
NULL
)
if
(
rootPath
==
NULL
)
{
{
...
@@ -493,8 +488,6 @@ char *nxagentGetRootPath(void)
...
@@ -493,8 +488,6 @@ char *nxagentGetRootPath(void)
return
NULL
;
return
NULL
;
}
}
strcpy
(
rootPath
,
nxagentRootDir
);
return
rootPath
;
return
rootPath
;
}
}
...
@@ -531,9 +524,8 @@ char *nxagentGetSessionPath(void)
...
@@ -531,9 +524,8 @@ char *nxagentGetSessionPath(void)
return
NULL
;
return
NULL
;
}
}
strcpy
(
nxagentSessionDir
,
rootPath
);
/* FIXME: necessary? */
snprintf
(
nxagentSessionDir
,
DEFAULT_STRING_LENGTH
,
"%s"
,
rootPath
);
free
(
rootPath
);
if
(
strlen
(
nxagentSessionDir
)
+
strlen
(
"/C-"
)
+
strlen
(
nxagentSessionId
)
>
DEFAULT_STRING_LENGTH
-
1
)
if
(
strlen
(
nxagentSessionDir
)
+
strlen
(
"/C-"
)
+
strlen
(
nxagentSessionId
)
>
DEFAULT_STRING_LENGTH
-
1
)
{
{
...
@@ -542,12 +534,14 @@ char *nxagentGetSessionPath(void)
...
@@ -542,12 +534,14 @@ char *nxagentGetSessionPath(void)
nxagentSessionDir
);
nxagentSessionDir
);
#endif
#endif
free
(
rootPath
);
return
NULL
;
return
NULL
;
}
}
s
trcat
(
nxagentSessionDir
,
"/C-"
);
s
nprintf
(
nxagentSessionDir
,
DEFAULT_STRING_LENGTH
,
"%s/C-%s"
,
rootPath
,
nxagentSessionId
);
strcat
(
nxagentSessionDir
,
nxagentSessionId
);
free
(
rootPath
);
if
((
stat
(
nxagentSessionDir
,
&
dirStat
)
==
-
1
)
&&
(
errno
==
ENOENT
))
if
((
stat
(
nxagentSessionDir
,
&
dirStat
)
==
-
1
)
&&
(
errno
==
ENOENT
))
{
{
...
@@ -569,9 +563,9 @@ char *nxagentGetSessionPath(void)
...
@@ -569,9 +563,9 @@ char *nxagentGetSessionPath(void)
}
}
sessionPath
=
malloc
(
strlen
(
nxagentSessionDir
)
+
1
);
sessionPath
=
strdup
(
nxagentSessionDir
);
if
(
sessionPath
==
NULL
)
if
(
sessionPath
==
NULL
)
{
{
#ifdef PANIC
#ifdef PANIC
fprintf
(
stderr
,
"nxagentGetSessionPath:: PANIC! Can't allocate memory for the session path.
\n
"
);
fprintf
(
stderr
,
"nxagentGetSessionPath:: PANIC! Can't allocate memory for the session path.
\n
"
);
...
@@ -580,9 +574,6 @@ char *nxagentGetSessionPath(void)
...
@@ -580,9 +574,6 @@ char *nxagentGetSessionPath(void)
return
NULL
;
return
NULL
;
}
}
strcpy
(
sessionPath
,
nxagentSessionDir
);
return
sessionPath
;
return
sessionPath
;
}
}
...
@@ -598,7 +589,7 @@ void nxagentGetClientsPath()
...
@@ -598,7 +589,7 @@ void nxagentGetClientsPath()
return
;
return
;
}
}
if
(
strlen
(
sessionPath
)
+
strlen
(
"/clients"
)
>
DEFAULT_STRING_
LENGTH
-
1
)
if
(
strlen
(
sessionPath
)
+
strlen
(
"/clients"
)
>
NXAGENTCLIENTSLOGNAME
LENGTH
-
1
)
{
{
#ifdef PANIC
#ifdef PANIC
fprintf
(
stderr
,
"nxagentGetClientsPath: PANIC! Invalid value for the NX clients Log File Path ''.
\n
"
);
fprintf
(
stderr
,
"nxagentGetClientsPath: PANIC! Invalid value for the NX clients Log File Path ''.
\n
"
);
...
@@ -609,9 +600,7 @@ void nxagentGetClientsPath()
...
@@ -609,9 +600,7 @@ void nxagentGetClientsPath()
return
;
return
;
}
}
strcpy
(
nxagentClientsLogName
,
sessionPath
);
snprintf
(
nxagentClientsLogName
,
NXAGENTCLIENTSLOGNAMELENGTH
,
"%s/clients"
,
sessionPath
);
strcat
(
nxagentClientsLogName
,
"/clients"
);
free
(
sessionPath
);
free
(
sessionPath
);
}
}
...
...
nx-X11/programs/Xserver/hw/nxagent/Error.h
View file @
5f9f744c
...
@@ -30,7 +30,8 @@
...
@@ -30,7 +30,8 @@
* Clients log file name.
* Clients log file name.
*/
*/
extern
char
nxagentClientsLogName
[];
#define NXAGENTCLIENTSLOGNAMELENGTH 256
extern
char
nxagentClientsLogName
[
NXAGENTCLIENTSLOGNAMELENGTH
];
extern
char
nxagentVerbose
;
extern
char
nxagentVerbose
;
...
...
nx-X11/programs/Xserver/hw/nxagent/Events.c
View file @
5f9f744c
...
@@ -2198,6 +2198,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was
...
@@ -2198,6 +2198,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was
char
*
kbdargs
[
6
];
char
*
kbdargs
[
6
];
strcpy
(
kbddisplay
,
":"
);
strcpy
(
kbddisplay
,
":"
);
/* FIXME: why limit to 4? */
strncat
(
kbddisplay
,
display
,
4
);
strncat
(
kbddisplay
,
display
,
4
);
kbdargs
[
0
]
=
"nxkbd"
;
kbdargs
[
0
]
=
"nxkbd"
;
...
...
nx-X11/programs/Xserver/hw/nxagent/Font.c
View file @
5f9f744c
...
@@ -109,7 +109,7 @@ static void nxagentFontReconnect(FontPtr, XID, void *);
...
@@ -109,7 +109,7 @@ static void nxagentFontReconnect(FontPtr, XID, void *);
static
XFontStruct
*
nxagentLoadBestQueryFont
(
Display
*
dpy
,
char
*
fontName
,
FontPtr
pFont
);
static
XFontStruct
*
nxagentLoadBestQueryFont
(
Display
*
dpy
,
char
*
fontName
,
FontPtr
pFont
);
static
XFontStruct
*
nxagentLoadQueryFont
(
register
Display
*
dpy
,
char
*
fontName
,
FontPtr
pFont
);
static
XFontStruct
*
nxagentLoadQueryFont
(
register
Display
*
dpy
,
char
*
fontName
,
FontPtr
pFont
);
int
nxagentFreeFont
(
XFontStruct
*
fs
);
int
nxagentFreeFont
(
XFontStruct
*
fs
);
static
Bool
nxagentGetFontServerPath
(
char
*
fontServerPath
);
static
Bool
nxagentGetFontServerPath
(
char
*
fontServerPath
,
int
size
);
static
char
*
nxagentMakeScalableFontName
(
const
char
*
fontName
,
int
scalableResolution
);
static
char
*
nxagentMakeScalableFontName
(
const
char
*
fontName
,
int
scalableResolution
);
...
@@ -334,10 +334,12 @@ void nxagentListRemoteAddName(const char *name, int status)
...
@@ -334,10 +334,12 @@ void nxagentListRemoteAddName(const char *name, int status)
if
((
nxagentRemoteFontList
.
list
[
pos
]
=
malloc
(
sizeof
(
nxagentFontRec
))))
if
((
nxagentRemoteFontList
.
list
[
pos
]
=
malloc
(
sizeof
(
nxagentFontRec
))))
{
{
nxagentRemoteFontList
.
list
[
pos
]
->
name
=
malloc
(
strlen
(
name
)
+
1
);
nxagentRemoteFontList
.
list
[
pos
]
->
name
=
strdup
(
name
);
if
(
nxagentRemoteFontList
.
list
[
pos
]
->
name
==
NULL
)
if
(
nxagentRemoteFontList
.
list
[
pos
]
->
name
==
NULL
)
{
{
fprintf
(
stderr
,
"Font: remote list name memory allocation failed!.
\n
"
);
fprintf
(
stderr
,
"Font: remote list name memory allocation failed!.
\n
"
);
free
(
nxagentRemoteFontList
.
list
[
pos
]);
nxagentRemoteFontList
.
list
[
pos
]
=
NULL
;
return
;
return
;
}
}
}
}
...
@@ -346,7 +348,6 @@ void nxagentListRemoteAddName(const char *name, int status)
...
@@ -346,7 +348,6 @@ void nxagentListRemoteAddName(const char *name, int status)
fprintf
(
stderr
,
"Font: remote list record memory allocation failed!.
\n
"
);
fprintf
(
stderr
,
"Font: remote list record memory allocation failed!.
\n
"
);
return
;
return
;
}
}
strcpy
(
nxagentRemoteFontList
.
list
[
pos
]
->
name
,
name
);
nxagentRemoteFontList
.
list
[
pos
]
->
status
=
status
;
nxagentRemoteFontList
.
list
[
pos
]
->
status
=
status
;
nxagentRemoteFontList
.
length
++
;
nxagentRemoteFontList
.
length
++
;
...
@@ -733,7 +734,7 @@ static XFontStruct *nxagentLoadBestQueryFont(Display* dpy, char *fontName, FontP
...
@@ -733,7 +734,7 @@ static XFontStruct *nxagentLoadBestQueryFont(Display* dpy, char *fontName, FontP
{
{
XFontStruct
*
fontStruct
;
XFontStruct
*
fontStruct
;
char
*
substFontBuf
;
char
substFontBuf
[
512
];
;
/* X Logical Font Description Conventions
/* X Logical Font Description Conventions
* require 14 fields in the font names.
* require 14 fields in the font names.
...
@@ -767,12 +768,9 @@ static XFontStruct *nxagentLoadBestQueryFont(Display* dpy, char *fontName, FontP
...
@@ -767,12 +768,9 @@ static XFontStruct *nxagentLoadBestQueryFont(Display* dpy, char *fontName, FontP
fprintf
(
stderr
,
"nxagentLoadBestQueryFont: Searching font '%s' .
\n
"
,
fontName
);
fprintf
(
stderr
,
"nxagentLoadBestQueryFont: Searching font '%s' .
\n
"
,
fontName
);
#endif
#endif
substFontBuf
=
(
char
*
)
malloc
(
sizeof
(
char
)
*
512
);
numFontFields
=
nxagentSplitString
(
fontName
,
fontNameFields
,
FIELDS
+
1
,
"-"
);
numFontFields
=
nxagentSplitString
(
fontName
,
fontNameFields
,
FIELDS
+
1
,
"-"
);
memcpy
(
substFontBuf
,
"fixed
\0
"
,
strlen
(
"fixed"
)
+
1
);
snprintf
(
substFontBuf
,
sizeof
(
substFontBuf
),
"%s"
,
"fixed"
);
if
(
numFontFields
<=
FIELDS
)
if
(
numFontFields
<=
FIELDS
)
{
{
...
@@ -831,8 +829,7 @@ static XFontStruct *nxagentLoadBestQueryFont(Display* dpy, char *fontName, FontP
...
@@ -831,8 +829,7 @@ static XFontStruct *nxagentLoadBestQueryFont(Display* dpy, char *fontName, FontP
/* Found more accurate font */
/* Found more accurate font */
weight
=
tempWeight
;
weight
=
tempWeight
;
memcpy
(
substFontBuf
,
nxagentRemoteFontList
.
list
[
i
]
->
name
,
strlen
(
nxagentRemoteFontList
.
list
[
i
]
->
name
));
snprintf
(
substFontBuf
,
sizeof
(
substFontBuf
),
"%s"
,
nxagentRemoteFontList
.
list
[
i
]
->
name
);
substFontBuf
[
strlen
(
nxagentRemoteFontList
.
list
[
i
]
->
name
)]
=
'\0'
;
#ifdef NXAGENT_RECONNECT_FONT_DEBUG
#ifdef NXAGENT_RECONNECT_FONT_DEBUG
fprintf
(
stderr
,
"nxagentLoadBestQueryFont: Weight '%d' of more accurate font '%s' .
\n
"
,
weight
,
substFontBuf
);
fprintf
(
stderr
,
"nxagentLoadBestQueryFont: Weight '%d' of more accurate font '%s' .
\n
"
,
weight
,
substFontBuf
);
...
@@ -856,8 +853,6 @@ static XFontStruct *nxagentLoadBestQueryFont(Display* dpy, char *fontName, FontP
...
@@ -856,8 +853,6 @@ static XFontStruct *nxagentLoadBestQueryFont(Display* dpy, char *fontName, FontP
fontStruct
=
nxagentLoadQueryFont
(
dpy
,
substFontBuf
,
pFont
);
fontStruct
=
nxagentLoadQueryFont
(
dpy
,
substFontBuf
,
pFont
);
free
(
substFontBuf
);
for
(
j
=
0
;
j
<
numFontFields
;
j
++
)
for
(
j
=
0
;
j
<
numFontFields
;
j
++
)
{
{
free
(
fontNameFields
[
j
]);
free
(
fontNameFields
[
j
]);
...
@@ -922,6 +917,11 @@ static void nxagentCollectFailedFont(FontPtr fpt, XID id)
...
@@ -922,6 +917,11 @@ static void nxagentCollectFailedFont(FontPtr fpt, XID id)
if
(
nxagentFailedToReconnectFonts
.
font
==
NULL
||
nxagentFailedToReconnectFonts
.
id
==
NULL
)
if
(
nxagentFailedToReconnectFonts
.
font
==
NULL
||
nxagentFailedToReconnectFonts
.
id
==
NULL
)
{
{
free
(
nxagentFailedToReconnectFonts
.
font
);
nxagentFailedToReconnectFonts
.
font
=
NULL
;
free
(
nxagentFailedToReconnectFonts
.
id
);
nxagentFailedToReconnectFonts
.
id
=
NULL
;
FatalError
(
"Font: font not reconnected memory allocation failed!.
\n
"
);
FatalError
(
"Font: font not reconnected memory allocation failed!.
\n
"
);
}
}
...
@@ -1283,7 +1283,7 @@ Bool nxagentReconnectFailedFonts(void *p0)
...
@@ -1283,7 +1283,7 @@ Bool nxagentReconnectFailedFonts(void *p0)
fprintf
(
stderr
,
"nxagentReconnectFailedFonts:
\n
"
);
fprintf
(
stderr
,
"nxagentReconnectFailedFonts:
\n
"
);
#endif
#endif
if
(
nxagentGetFontServerPath
(
fontServerPath
)
==
False
)
if
(
nxagentGetFontServerPath
(
fontServerPath
,
sizeof
(
fontServerPath
)
)
==
False
)
{
{
#ifdef WARNING
#ifdef WARNING
fprintf
(
stderr
,
"nxagentReconnectFailedFonts: WARNING! "
fprintf
(
stderr
,
"nxagentReconnectFailedFonts: WARNING! "
...
@@ -1404,17 +1404,18 @@ Bool nxagentDisconnectAllFonts()
...
@@ -1404,17 +1404,18 @@ Bool nxagentDisconnectAllFonts()
return
True
;
return
True
;
}
}
static
Bool
nxagentGetFontServerPath
(
char
*
fontServerPath
)
static
Bool
nxagentGetFontServerPath
(
char
*
fontServerPath
,
int
size
)
{
{
char
path
[
256
];
char
path
[
256
]
=
{
0
}
;
if
(
NXGetFontParameters
(
nxagentDisplay
,
256
,
path
)
==
True
)
if
(
NXGetFontParameters
(
nxagentDisplay
,
sizeof
(
path
)
,
path
)
==
True
)
{
{
if
(
*
path
!=
'\0'
)
/* the length is stored in the first byte and is therefore limited to 255 */
{
unsigned
int
len
=
*
path
;
strncpy
(
fontServerPath
,
path
+
1
,
*
path
);
*
(
fontServerPath
+
*
path
)
=
'\0'
;
if
(
len
)
{
snprintf
(
fontServerPath
,
MIN
(
size
,
len
+
1
),
"%s"
,
path
+
1
);
#ifdef TEST
#ifdef TEST
fprintf
(
stderr
,
"nxagentGetFontServerPath: Got path [%s].
\n
"
,
fprintf
(
stderr
,
"nxagentGetFontServerPath: Got path [%s].
\n
"
,
...
@@ -1451,9 +1452,11 @@ void nxagentVerifyDefaultFontPath(void)
...
@@ -1451,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. "
...
@@ -1463,12 +1466,6 @@ void nxagentVerifyDefaultFontPath(void)
...
@@ -1463,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
)
{
{
...
@@ -1740,9 +1737,7 @@ int nxagentSplitString(char *string, char *fields[], int nfields, char *sep)
...
@@ -1740,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
{
{
...
@@ -1766,14 +1761,9 @@ char *nxagentMakeScalableFontName(const char *fontName, int scalableResolution)
...
@@ -1766,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
"
);
...
@@ -1782,7 +1772,7 @@ char *nxagentMakeScalableFontName(const char *fontName, int scalableResolution)
...
@@ -1782,7 +1772,7 @@ char *nxagentMakeScalableFontName(const char *fontName, int scalableResolution)
return
NULL
;
return
NULL
;
}
}
scalableFontName
[
0
]
=
0
;
scalableFontName
[
0
]
=
'\0'
;
if
(
*
fontName
!=
'-'
)
if
(
*
fontName
!=
'-'
)
{
{
...
...
nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
View file @
5f9f744c
...
@@ -534,7 +534,6 @@ static void nxagentCheckXkbBaseDirectory(void)
...
@@ -534,7 +534,6 @@ static void nxagentCheckXkbBaseDirectory(void)
static
char
*
nxagentXkbGetRules
()
static
char
*
nxagentXkbGetRules
()
{
{
int
ret
;
int
ret
;
int
size
,
sizeDflt
,
sizeAlt
;
char
*
path
;
char
*
path
;
struct
stat
buf
;
struct
stat
buf
;
...
@@ -543,19 +542,11 @@ static char *nxagentXkbGetRules()
...
@@ -543,19 +542,11 @@ static char *nxagentXkbGetRules()
XkbBaseDirectory
);
XkbBaseDirectory
);
#endif
#endif
sizeDflt
=
strlen
(
XKB_DFLT_RULES_FILE
);
if
(
-
1
==
asprintf
(
&
path
,
"%s/rules/%s"
,
XkbBaseDirectory
,
XKB_DFLT_RULES_FILE
))
sizeAlt
=
strlen
(
XKB_ALTS_RULES_FILE
);
size
=
strlen
(
XkbBaseDirectory
)
+
strlen
(
"/rules/"
);
size
+=
(
sizeDflt
>
sizeAlt
)
?
sizeDflt
:
sizeAlt
;
if
((
path
=
malloc
((
size
+
1
)
*
sizeof
(
char
)))
==
NULL
)
{
{
FatalError
(
"nxagentXkbGetRules: malloc failed."
);
FatalError
(
"nxagentXkbGetRules: malloc failed."
);
}
}
strcpy
(
path
,
XkbBaseDirectory
);
strcat
(
path
,
"/rules/"
);
strcat
(
path
,
XKB_DFLT_RULES_FILE
);
#ifdef TEST
#ifdef TEST
fprintf
(
stderr
,
"nxagentXkbGetRules: checking rules file [%s]
\n
"
,
path
);
fprintf
(
stderr
,
"nxagentXkbGetRules: checking rules file [%s]
\n
"
,
path
);
#endif
#endif
...
@@ -572,11 +563,16 @@ static char *nxagentXkbGetRules()
...
@@ -572,11 +563,16 @@ static char *nxagentXkbGetRules()
#ifdef TEST
#ifdef TEST
fprintf
(
stderr
,
"nxagentXkbGetRules: WARNING! Failed to stat file [%s]: %s.
\n
"
,
path
,
strerror
(
ret
));
fprintf
(
stderr
,
"nxagentXkbGetRules: WARNING! Failed to stat file [%s]: %s.
\n
"
,
path
,
strerror
(
ret
));
#endif
#endif
free
(
path
);
path
=
NULL
;
if
(
-
1
==
asprintf
(
&
path
,
"%s/rules/%s"
,
XkbBaseDirectory
,
XKB_ALTS_RULES_FILE
))
{
FatalError
(
"nxagentXkbGetRules: malloc failed."
);
}
strcpy
(
path
,
XkbBaseDirectory
);
strcat
(
path
,
"/rules/"
);
strcat
(
path
,
XKB_ALTS_RULES_FILE
);
#ifdef TEST
#ifdef TEST
fprintf
(
stderr
,
"nxagentXkbGetRules: checking rules file [%s]
\n
"
,
path
);
fprintf
(
stderr
,
"nxagentXkbGetRules: checking rules file [%s]
\n
"
,
path
);
#endif
#endif
...
@@ -1899,16 +1895,16 @@ void nxagentKeycodeConversionSetup(void)
...
@@ -1899,16 +1895,16 @@ void nxagentKeycodeConversionSetup(void)
char
*
sessionpath
=
nxagentGetSessionPath
();
char
*
sessionpath
=
nxagentGetSessionPath
();
if
(
sessionpath
)
if
(
sessionpath
)
{
{
int
keyboard_file_path_size
=
strlen
(
sessionpath
)
+
strlen
(
"/keyboard"
);
char
*
keyboard_file_path
=
NULL
;
char
*
keyboard_file_path
=
malloc
((
keyboard_file_path_size
+
1
)
*
sizeof
(
char
));
FILE
*
keyboard_file
;
FILE
*
keyboard_file
;
if
(
!
keyboard_file_path
)
if
(
(
asprintf
(
&
keyboard_file_path
,
"%s/keyboard"
,
sessionpath
)
==
-
1
)
)
{
{
FatalError
(
"nxagentKeycodeConversionSetup: malloc failed."
);
free
(
sessionpath
);
FatalError
(
"malloc for keyboard file path failed."
);
}
}
strcpy
(
keyboard_file_path
,
sessionpath
);
free
(
sessionpath
);
strcat
(
keyboard_file_path
,
"/keyboard"
);
if
((
keyboard_file
=
fopen
(
keyboard_file_path
,
"w"
)))
if
((
keyboard_file
=
fopen
(
keyboard_file_path
,
"w"
)))
{
{
if
(
drules
)
if
(
drules
)
fprintf
(
keyboard_file
,
"rules=
\"
%s
\"\n
"
,
drules
[
0
]
==
'\0'
?
","
:
drules
);
fprintf
(
keyboard_file
,
"rules=
\"
%s
\"\n
"
,
drules
[
0
]
==
'\0'
?
","
:
drules
);
if
(
dmodel
)
if
(
dmodel
)
...
@@ -1920,7 +1916,7 @@ void nxagentKeycodeConversionSetup(void)
...
@@ -1920,7 +1916,7 @@ void nxagentKeycodeConversionSetup(void)
if
(
doptions
)
if
(
doptions
)
fprintf
(
keyboard_file
,
"options=
\"
%s
\"\n
"
,
doptions
[
0
]
==
'\0'
?
","
:
doptions
);
fprintf
(
keyboard_file
,
"options=
\"
%s
\"\n
"
,
doptions
[
0
]
==
'\0'
?
","
:
doptions
);
fclose
(
keyboard_file
);
fclose
(
keyboard_file
);
fprintf
(
stderr
,
"Info: keyboard file created
\n
"
);
fprintf
(
stderr
,
"Info: keyboard file created
: '%s'
\n
"
,
keyboard_file_path
);
}
}
else
else
{
{
...
...
nx-X11/programs/Xserver/hw/nxagent/Keystroke.c
View file @
5f9f744c
...
@@ -324,13 +324,11 @@ void nxagentInitKeystrokes(Bool force)
...
@@ -324,13 +324,11 @@ void nxagentInitKeystrokes(Bool force)
char
*
homedir
=
getenv
(
"HOME"
);
char
*
homedir
=
getenv
(
"HOME"
);
if
(
homedir
)
if
(
homedir
)
{
{
if
(
!
(
homepath
=
calloc
(
1
,
strlen
(
homedir
)
+
strlen
(
homefile
)
+
1
)
))
if
(
-
1
==
asprintf
(
&
homepath
,
"%s%s"
,
homedir
,
homefile
))
{
{
fprintf
(
stderr
,
"malloc failed"
);
fprintf
(
stderr
,
"malloc failed"
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
strcpy
(
homepath
,
homedir
);
strcpy
(
homepath
+
strlen
(
homedir
),
homefile
);
}
}
/* if any of the files can be read we have our candidate */
/* if any of the files can be read we have our candidate */
...
...
nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c
View file @
5f9f744c
...
@@ -96,7 +96,8 @@ static Bool doListFontsAndAliases(ClientPtr client, LFclosurePtr c);
...
@@ -96,7 +96,8 @@ static Bool doListFontsAndAliases(ClientPtr client, LFclosurePtr c);
#ifdef NX_TRANS_SOCKET
#ifdef NX_TRANS_SOCKET
char
_NXFontPath
[
1024
];
#define NXFONTPATHLENGTH 1024
char
_NXFontPath
[
NXFONTPATHLENGTH
];
/*
/*
* Override the default font path and make
* Override the default font path and make
...
@@ -112,7 +113,7 @@ static const char *_NXGetFontPath(const char *path)
...
@@ -112,7 +113,7 @@ static const char *_NXGetFontPath(const char *path)
* Check the environment only once.
* Check the environment only once.
*/
*/
if
(
*
_NXFontPath
!=
'\0'
)
if
(
_NXFontPath
[
0
]
!=
'\0'
)
{
{
return
_NXFontPath
;
return
_NXFontPath
;
}
}
...
@@ -121,7 +122,7 @@ static const char *_NXGetFontPath(const char *path)
...
@@ -121,7 +122,7 @@ static const char *_NXGetFontPath(const char *path)
if
(
fontEnv
!=
NULL
&&
*
fontEnv
!=
'\0'
)
if
(
fontEnv
!=
NULL
&&
*
fontEnv
!=
'\0'
)
{
{
if
(
strlen
(
fontEnv
)
+
1
>
1024
)
if
(
strlen
(
fontEnv
)
+
1
>
NXFONTPATHLENGTH
)
{
{
#ifdef NX_TRANS_TEST
#ifdef NX_TRANS_TEST
fprintf
(
stderr
,
"_NXGetFontPath: WARNING! Maximum length of font path exceeded.
\n
"
);
fprintf
(
stderr
,
"_NXGetFontPath: WARNING! Maximum length of font path exceeded.
\n
"
);
...
@@ -129,7 +130,7 @@ static const char *_NXGetFontPath(const char *path)
...
@@ -129,7 +130,7 @@ static const char *_NXGetFontPath(const char *path)
goto
_NXGetFontPathError
;
goto
_NXGetFontPathError
;
}
}
s
trcpy
(
_NXFontPath
,
fontEnv
);
s
nprintf
(
_NXFontPath
,
NXFONTPATHLENGTH
,
"%s"
,
fontEnv
);
#ifdef NX_TRANS_TEST
#ifdef NX_TRANS_TEST
fprintf
(
stderr
,
"_NXGetFontPath: Using NX font path [%s].
\n
"
,
_NXFontPath
);
fprintf
(
stderr
,
"_NXGetFontPath: Using NX font path [%s].
\n
"
,
_NXFontPath
);
...
@@ -140,8 +141,7 @@ static const char *_NXGetFontPath(const char *path)
...
@@ -140,8 +141,7 @@ static const char *_NXGetFontPath(const char *path)
_NXGetFontPathError:
_NXGetFontPathError:
strncpy
(
_NXFontPath
,
path
,
1023
);
snprintf
(
_NXFontPath
,
NXFONTPATHLENGTH
,
"%s"
,
path
);
_NXFontPath
[
1023
]
=
'\0'
;
#ifdef NX_TRANS_TEST
#ifdef NX_TRANS_TEST
fprintf
(
stderr
,
"_NXGetFontPath: Using default font path [%s].
\n
"
,
_NXFontPath
);
fprintf
(
stderr
,
"_NXGetFontPath: Using default font path [%s].
\n
"
,
_NXFontPath
);
...
@@ -199,7 +199,7 @@ doOpenFont(ClientPtr client, OFclosurePtr c)
...
@@ -199,7 +199,7 @@ doOpenFont(ClientPtr client, OFclosurePtr c)
BitmapFormatScanlineUnit8
;
BitmapFormatScanlineUnit8
;
nxagentOrigFontNameLen
=
(
c
->
origFontNameLen
<
256
)
?
c
->
origFontNameLen
:
255
;
nxagentOrigFontNameLen
=
(
c
->
origFontNameLen
<
sizeof
(
nxagentOrigFontName
)
?
c
->
origFontNameLen
:
sizeof
(
nxagentOrigFontName
)
-
1
)
;
memcpy
(
nxagentOrigFontName
,
c
->
origFontName
,
nxagentOrigFontNameLen
);
memcpy
(
nxagentOrigFontName
,
c
->
origFontName
,
nxagentOrigFontNameLen
);
...
...
nx-X11/programs/Xserver/hw/nxagent/Reconnect.c
View file @
5f9f744c
...
@@ -139,7 +139,7 @@ char stateFile[PATH_MAX];
...
@@ -139,7 +139,7 @@ char stateFile[PATH_MAX];
void
setStatePath
(
char
*
path
)
void
setStatePath
(
char
*
path
)
{
{
s
trncpy
(
stateFile
,
path
,
PATH_MAX
-
1
);
s
nprintf
(
stateFile
,
PATH_MAX
,
"%s"
,
path
);
}
}
void
saveAgentState
(
char
*
state
)
void
saveAgentState
(
char
*
state
)
...
...
nx-X11/programs/Xserver/hw/nxagent/Screen.c
View file @
5f9f744c
...
@@ -1783,36 +1783,31 @@ N/A
...
@@ -1783,36 +1783,31 @@ N/A
if
(
nxagentX2go
)
if
(
nxagentX2go
)
{
{
#ifdef TEST
#ifdef TEST
fprintf
(
stderr
,
"nxagentOpenScreen: Setting WM_CLASS and WM_NAME for window withid [%ld].
\n
"
,
fprintf
(
stderr
,
"nxagentOpenScreen: Setting WM_CLASS and WM_NAME for window with
id [%ld].
\n
"
,
(
long
int
)
nxagentDefaultWindows
[
pScreen
->
myNum
]);
(
long
int
)
nxagentDefaultWindows
[
pScreen
->
myNum
]);
#endif
#endif
XClassHint
hint
;
XClassHint
hint
;
hint
.
res_name
=
malloc
(
strlen
(
"X2GoAgent"
)
+
1
);
hint
.
res_name
=
strdup
(
"X2GoAgent"
);
hint
.
res_class
=
malloc
(
strlen
(
"X2GoAgent"
)
+
1
);
hint
.
res_class
=
strdup
(
"X2GoAgent"
);
strcpy
(
hint
.
res_name
,
"X2GoAgent"
);
XSetClassHint
(
nxagentDisplay
,
nxagentDefaultWindows
[
pScreen
->
myNum
],
&
hint
);
strcpy
(
hint
.
res_class
,
"X2GoAgent"
);
XSetClassHint
(
nxagentDisplay
,
nxagentDefaultWindows
[
pScreen
->
myNum
],
&
hint
);
free
(
hint
.
res_name
);
free
(
hint
.
res_name
);
free
(
hint
.
res_class
);
free
(
hint
.
res_class
);
}
}
else
else
{
{
#ifdef TEST
#ifdef TEST
fprintf
(
stderr
,
"nxagentOpenScreen: Setting WM_CLASS and WM_NAME for window withid [%ld].
\n
"
,
fprintf
(
stderr
,
"nxagentOpenScreen: Setting WM_CLASS and WM_NAME for window with
id [%ld].
\n
"
,
(
long
int
)
nxagentDefaultWindows
[
pScreen
->
myNum
]);
(
long
int
)
nxagentDefaultWindows
[
pScreen
->
myNum
]);
#endif
#endif
XClassHint
hint
;
XClassHint
hint
;
hint
.
res_name
=
malloc
(
strlen
(
"NXAgent"
)
+
1
);
hint
.
res_name
=
strdup
(
"NXAgent"
);
hint
.
res_class
=
malloc
(
strlen
(
"NXAgent"
)
+
1
);
hint
.
res_class
=
strdup
(
"NXAgent"
);
strcpy
(
hint
.
res_name
,
"NXAgent"
);
XSetClassHint
(
nxagentDisplay
,
nxagentDefaultWindows
[
pScreen
->
myNum
],
&
hint
);
strcpy
(
hint
.
res_class
,
"NXAgent"
);
XSetClassHint
(
nxagentDisplay
,
nxagentDefaultWindows
[
pScreen
->
myNum
],
&
hint
);
free
(
hint
.
res_name
);
free
(
hint
.
res_name
);
free
(
hint
.
res_class
);
free
(
hint
.
res_class
);
}
}
if
(
nxagentOption
(
Fullscreen
))
if
(
nxagentOption
(
Fullscreen
))
{
{
nxagentFullscreenWindow
=
nxagentDefaultWindows
[
pScreen
->
myNum
];
nxagentFullscreenWindow
=
nxagentDefaultWindows
[
pScreen
->
myNum
];
...
@@ -2549,9 +2544,7 @@ int nxagentShadowInit(ScreenPtr pScreen, WindowPtr pWin)
...
@@ -2549,9 +2544,7 @@ int nxagentShadowInit(ScreenPtr pScreen, WindowPtr pWin)
}
}
else
else
{
{
layout
=
malloc
(
strlen
(
&
nxagentKeyboard
[
i
+
1
])
+
1
);
layout
=
strdup
(
&
nxagentKeyboard
[
i
+
1
]);
strcpy
(
layout
,
&
nxagentKeyboard
[
i
+
1
]);
}
}
}
}
...
@@ -3480,6 +3473,7 @@ FIXME: The port information is not used at the moment and produces a
...
@@ -3480,6 +3473,7 @@ FIXME: The port information is not used at the moment and produces a
in
++
;
in
++
;
local_buf
[
in
]
=
pszReturnData
[
i
-
1
];
local_buf
[
in
]
=
pszReturnData
[
i
-
1
];
/* "localhost:" */
strcat
(
local_buf
,
"6c6f63616c686f73743a"
);
strcat
(
local_buf
,
"6c6f63616c686f73743a"
);
in
+=
20
;
in
+=
20
;
...
...
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