Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-gpu
Commits
9312c3dc
Commit
9312c3dc
authored
Apr 06, 2009
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Really fix the vlm_MessageNew NULL warning
parent
04d23bd3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
65 additions
and
59 deletions
+65
-59
include/vlc_vlm.h
include/vlc_vlm.h
+1
-0
modules/control/telnet.c
modules/control/telnet.c
+4
-5
src/input/vlmshell.c
src/input/vlmshell.c
+59
-54
src/libvlccore.sym
src/libvlccore.sym
+1
-0
No files found.
include/vlc_vlm.h
View file @
9312c3dc
...
...
@@ -187,6 +187,7 @@ VLC_EXPORT( void, vlm_Delete, ( vlm_t * ) );
VLC_EXPORT
(
int
,
vlm_ExecuteCommand
,
(
vlm_t
*
,
const
char
*
,
vlm_message_t
**
)
);
VLC_EXPORT
(
int
,
vlm_Control
,
(
vlm_t
*
p_vlm
,
int
i_query
,
...
)
);
VLC_EXPORT
(
vlm_message_t
*
,
vlm_MessageSimpleNew
,
(
const
char
*
)
);
VLC_EXPORT
(
vlm_message_t
*
,
vlm_MessageNew
,
(
const
char
*
,
const
char
*
,
...
)
LIBVLC_FORMAT
(
2
,
3
)
);
VLC_EXPORT
(
vlm_message_t
*
,
vlm_MessageAdd
,
(
vlm_message_t
*
,
vlm_message_t
*
)
);
VLC_EXPORT
(
void
,
vlm_MessageDelete
,
(
vlm_message_t
*
)
);
...
...
modules/control/telnet.c
View file @
9312c3dc
...
...
@@ -474,14 +474,13 @@ static void Run( intf_thread_t *p_intf )
if
(
!
strncmp
(
cl
->
buffer_read
,
"help"
,
4
)
)
{
vlm_message_t
*
p_my_help
=
vlm_Message
New
(
"Telnet Specific Commands:"
,
NULL
);
vlm_Message
SimpleNew
(
"Telnet Specific Commands:"
);
vlm_MessageAdd
(
p_my_help
,
vlm_Message
New
(
"logout, quit, exit"
,
NULL
)
);
vlm_Message
SimpleNew
(
"logout, quit, exit"
)
);
vlm_MessageAdd
(
p_my_help
,
vlm_Message
New
(
"shutdown"
,
NULL
)
);
vlm_Message
SimpleNew
(
"shutdown"
)
);
vlm_MessageAdd
(
p_my_help
,
vlm_MessageNew
(
"@moduleinstance command argument"
,
NULL
)
);
vlm_MessageSimpleNew
(
"@moduleinstance command argument"
)
);
vlm_MessageAdd
(
message
,
p_my_help
);
}
Write_message
(
cl
,
message
,
NULL
,
WRITE_MODE_CMD
);
...
...
src/input/vlmshell.c
View file @
9312c3dc
...
...
@@ -63,10 +63,6 @@
* Local prototypes.
*****************************************************************************/
/* ugly kludge to avoid "null format string" warnings,
* even if we handle NULL format string in vlm_MessageNew() */
static
const
char
*
vlm_NULL
=
NULL
;
/* */
static
vlm_message_t
*
vlm_Show
(
vlm_t
*
,
vlm_media_sys_t
*
,
vlm_schedule_sys_t
*
,
const
char
*
);
...
...
@@ -275,7 +271,7 @@ static int ExecuteDel( vlm_t *p_vlm, const char *psz_name, vlm_message_t **pp_st
return
VLC_EGENERIC
;
}
*
pp_status
=
vlm_Message
New
(
"del"
,
vlm_NULL
);
*
pp_status
=
vlm_Message
SimpleNew
(
"del"
);
return
VLC_SUCCESS
;
}
...
...
@@ -308,11 +304,11 @@ static int ExecuteHelp( vlm_message_t **pp_status )
vlm_message_t
*
message_child
;
#define MessageAdd( a ) \
vlm_MessageAdd( *pp_status, vlm_Message
New( a, vlm_NULL
) );
vlm_MessageAdd( *pp_status, vlm_Message
SimpleNew( a
) );
#define MessageAddChild( a ) \
vlm_MessageAdd( message_child, vlm_Message
New( a, vlm_NULL
) );
vlm_MessageAdd( message_child, vlm_Message
SimpleNew( a
) );
*
pp_status
=
vlm_Message
New
(
"help"
,
vlm_NULL
);
*
pp_status
=
vlm_Message
SimpleNew
(
"help"
);
message_child
=
MessageAdd
(
"Commands Syntax:"
);
MessageAddChild
(
"new (name) vod|broadcast|schedule [properties]"
);
...
...
@@ -525,7 +521,7 @@ static int ExecuteControl( vlm_t *p_vlm, const char *psz_name, const int i_arg,
*
pp_status
=
vlm_MessageNew
(
"control"
,
"unknown error"
);
return
VLC_SUCCESS
;
}
*
pp_status
=
vlm_Message
New
(
"control"
,
vlm_NULL
);
*
pp_status
=
vlm_Message
SimpleNew
(
"control"
);
return
VLC_SUCCESS
;
}
...
...
@@ -559,7 +555,7 @@ static int ExecuteSave( vlm_t *p_vlm, const char *psz_file, vlm_message_t **pp_s
free
(
psz_save
);
*
pp_status
=
vlm_Message
New
(
"save"
,
vlm_NULL
);
*
pp_status
=
vlm_Message
SimpleNew
(
"save"
);
return
VLC_SUCCESS
;
error:
...
...
@@ -617,7 +613,7 @@ static int ExecuteLoad( vlm_t *p_vlm, const char *psz_url, vlm_message_t **pp_st
free
(
psz_buffer
);
*
pp_status
=
vlm_Message
New
(
"load"
,
vlm_NULL
);
*
pp_status
=
vlm_Message
SimpleNew
(
"load"
);
return
VLC_SUCCESS
;
}
...
...
@@ -671,7 +667,7 @@ static int ExecuteScheduleProperty( vlm_t *p_vlm, vlm_schedule_sys_t *p_schedule
i
++
;
}
}
*
pp_status
=
vlm_Message
New
(
psz_cmd
,
vlm_NULL
);
*
pp_status
=
vlm_Message
SimpleNew
(
psz_cmd
);
return
VLC_SUCCESS
;
error:
...
...
@@ -797,7 +793,7 @@ static int ExecuteMediaProperty( vlm_t *p_vlm, int64_t id, bool b_new,
i_result
=
vlm_ControlInternal
(
p_vlm
,
VLM_CHANGE_MEDIA
,
p_cfg
);
vlm_media_Delete
(
p_cfg
);
*
pp_status
=
vlm_Message
New
(
psz_cmd
,
vlm_NULL
);
*
pp_status
=
vlm_Message
SimpleNew
(
psz_cmd
);
return
i_result
;
error:
...
...
@@ -901,7 +897,7 @@ int ExecuteCommand( vlm_t *p_vlm, const char *psz_command,
/* support for comments */
if
(
i_command
==
0
&&
*
psz_command
==
'#'
)
{
p_message
=
vlm_Message
New
(
""
,
vlm_NULL
);
p_message
=
vlm_Message
SimpleNew
(
""
);
goto
success
;
}
...
...
@@ -935,7 +931,7 @@ int ExecuteCommand( vlm_t *p_vlm, const char *psz_command,
#define IF_EXECUTE( name, check, cmd ) if( !strcmp(ppsz_command[0], name ) ) { if( (check) ) goto syntax_error; if( (cmd) ) goto error; goto success; }
if
(
i_command
==
0
)
{
p_message
=
vlm_Message
New
(
""
,
vlm_NULL
);
p_message
=
vlm_Message
SimpleNew
(
""
);
goto
success
;
}
else
IF_EXECUTE
(
"del"
,
(
i_command
!=
2
),
ExecuteDel
(
p_vlm
,
ppsz_command
[
1
],
&
p_message
)
)
...
...
@@ -1227,41 +1223,50 @@ static int vlm_ScheduleSetup( vlm_schedule_sys_t *schedule, const char *psz_cmd,
/*****************************************************************************
* Message handling functions
*****************************************************************************/
vlm_message_t
*
vlm_MessageNew
(
const
char
*
psz_name
,
const
char
*
psz_format
,
...
)
vlm_message_t
*
vlm_MessageSimpleNew
(
const
char
*
psz_name
)
{
vlm_message_t
*
p_message
;
va_list
args
;
if
(
!
psz_name
)
return
NULL
;
p_message
=
malloc
(
sizeof
(
vlm_message_t
)
);
if
(
!
p_message
)
{
vlm_message_t
*
p_message
=
malloc
(
sizeof
(
*
p_message
)
);
if
(
!
p_message
)
return
NULL
;
}
p_message
->
psz_value
=
0
;
if
(
psz_format
)
p_message
->
psz_name
=
strdup
(
psz_name
);
if
(
!
p_message
->
psz_name
)
{
va_start
(
args
,
psz_format
);
if
(
vasprintf
(
&
p_message
->
psz_value
,
psz_format
,
args
)
==
-
1
)
{
va_end
(
args
);
free
(
p_message
);
return
NULL
;
}
va_end
(
args
);
free
(
p_message
);
return
NULL
;
}
p_message
->
psz_name
=
strdup
(
psz_name
);
p_message
->
psz_value
=
NULL
;
p_message
->
i_child
=
0
;
p_message
->
child
=
NULL
;
return
p_message
;
}
vlm_message_t
*
vlm_MessageNew
(
const
char
*
psz_name
,
const
char
*
psz_format
,
...
)
{
vlm_message_t
*
p_message
=
vlm_MessageSimpleNew
(
psz_name
);
va_list
args
;
if
(
!
p_message
)
return
NULL
;
assert
(
psz_format
);
va_start
(
args
,
psz_format
);
if
(
vasprintf
(
&
p_message
->
psz_value
,
psz_format
,
args
)
==
-
1
)
p_message
->
psz_value
=
NULL
;
va_end
(
args
);
if
(
!
p_message
->
psz_value
)
{
vlm_MessageDelete
(
p_message
);
return
NULL
;
}
return
p_message
;
}
void
vlm_MessageDelete
(
vlm_message_t
*
p_message
)
{
free
(
p_message
->
psz_name
);
...
...
@@ -1296,7 +1301,7 @@ static vlm_message_t *vlm_ShowMedia( vlm_media_sys_t *p_media )
vlm_message_t
*
p_msg_sub
;
int
i
;
p_msg
=
vlm_Message
New
(
p_cfg
->
psz_name
,
vlm_NULL
);
p_msg
=
vlm_Message
SimpleNew
(
p_cfg
->
psz_name
);
vlm_MessageAdd
(
p_msg
,
vlm_MessageNew
(
"type"
,
p_cfg
->
b_vod
?
"vod"
:
"broadcast"
)
);
vlm_MessageAdd
(
p_msg
,
...
...
@@ -1309,14 +1314,14 @@ static vlm_message_t *vlm_ShowMedia( vlm_media_sys_t *p_media )
vlm_MessageAdd
(
p_msg
,
vlm_MessageNew
(
"loop"
,
p_cfg
->
broadcast
.
b_loop
?
"yes"
:
"no"
)
);
p_msg_sub
=
vlm_MessageAdd
(
p_msg
,
vlm_Message
New
(
"inputs"
,
vlm_NULL
)
);
p_msg_sub
=
vlm_MessageAdd
(
p_msg
,
vlm_Message
SimpleNew
(
"inputs"
)
);
for
(
i
=
0
;
i
<
p_cfg
->
i_input
;
i
++
)
{
char
*
psz_tmp
;
if
(
asprintf
(
&
psz_tmp
,
"%d"
,
i
+
1
)
!=
-
1
)
{
vlm_MessageAdd
(
p_msg_sub
,
vlm_MessageNew
(
psz_tmp
,
"%s"
,
p_cfg
->
ppsz_input
[
i
]
)
);
vlm_MessageNew
(
psz_tmp
,
"%s"
,
p_cfg
->
ppsz_input
[
i
]
)
);
free
(
psz_tmp
);
}
}
...
...
@@ -1324,11 +1329,11 @@ static vlm_message_t *vlm_ShowMedia( vlm_media_sys_t *p_media )
vlm_MessageAdd
(
p_msg
,
vlm_MessageNew
(
"output"
,
"%s"
,
p_cfg
->
psz_output
?
p_cfg
->
psz_output
:
""
)
);
p_msg_sub
=
vlm_MessageAdd
(
p_msg
,
vlm_Message
New
(
"options"
,
vlm_NULL
)
);
p_msg_sub
=
vlm_MessageAdd
(
p_msg
,
vlm_Message
SimpleNew
(
"options"
)
);
for
(
i
=
0
;
i
<
p_cfg
->
i_option
;
i
++
)
vlm_MessageAdd
(
p_msg_sub
,
vlm_Message
New
(
p_cfg
->
ppsz_option
[
i
],
vlm_NULL
)
);
vlm_MessageAdd
(
p_msg_sub
,
vlm_Message
SimpleNew
(
p_cfg
->
ppsz_option
[
i
]
)
);
p_msg_sub
=
vlm_MessageAdd
(
p_msg
,
vlm_Message
New
(
"instances"
,
vlm_NULL
)
);
p_msg_sub
=
vlm_MessageAdd
(
p_msg
,
vlm_Message
SimpleNew
(
"instances"
)
);
for
(
i
=
0
;
i
<
p_media
->
i_instance
;
i
++
)
{
vlm_media_instance_sys_t
*
p_instance
=
p_media
->
instance
[
i
];
...
...
@@ -1340,7 +1345,7 @@ static vlm_message_t *vlm_ShowMedia( vlm_media_sys_t *p_media )
if
(
p_instance
->
p_input
)
var_Get
(
p_instance
->
p_input
,
"state"
,
&
val
);
p_msg_instance
=
vlm_MessageAdd
(
p_msg_sub
,
vlm_Message
New
(
"instance"
,
vlm_NULL
)
);
p_msg_instance
=
vlm_MessageAdd
(
p_msg_sub
,
vlm_Message
SimpleNew
(
"instance"
)
);
vlm_MessageAdd
(
p_msg_instance
,
vlm_MessageNew
(
"name"
,
"%s"
,
p_instance
->
psz_name
?
p_instance
->
psz_name
:
"default"
)
);
...
...
@@ -1386,7 +1391,7 @@ static vlm_message_t *vlm_Show( vlm_t *vlm, vlm_media_sys_t *media,
{
if
(
media
!=
NULL
)
{
vlm_message_t
*
p_msg
=
vlm_Message
New
(
"show"
,
vlm_NULL
);
vlm_message_t
*
p_msg
=
vlm_Message
SimpleNew
(
"show"
);
if
(
p_msg
)
vlm_MessageAdd
(
p_msg
,
vlm_ShowMedia
(
media
)
);
return
p_msg
;
...
...
@@ -1400,9 +1405,9 @@ static vlm_message_t *vlm_Show( vlm_t *vlm, vlm_media_sys_t *media,
vlm_message_t
*
msg_child
;
char
buffer
[
100
];
msg
=
vlm_Message
New
(
"show"
,
vlm_NULL
);
msg
=
vlm_Message
SimpleNew
(
"show"
);
msg_schedule
=
vlm_MessageAdd
(
msg
,
vlm_Message
New
(
schedule
->
psz_name
,
vlm_NULL
)
);
vlm_MessageAdd
(
msg
,
vlm_Message
SimpleNew
(
schedule
->
psz_name
)
);
vlm_MessageAdd
(
msg_schedule
,
vlm_MessageNew
(
"type"
,
"schedule"
)
);
...
...
@@ -1459,12 +1464,12 @@ static vlm_message_t *vlm_Show( vlm_t *vlm, vlm_media_sys_t *media,
vlm_MessageAdd
(
msg_schedule
,
vlm_MessageNew
(
"repeat"
,
"%s"
,
buffer
)
);
msg_child
=
vlm_MessageAdd
(
msg_schedule
,
vlm_Message
New
(
"commands"
,
vlm_NULL
)
);
vlm_MessageAdd
(
msg_schedule
,
vlm_Message
SimpleNew
(
"commands"
)
);
for
(
i
=
0
;
i
<
schedule
->
i_command
;
i
++
)
{
vlm_MessageAdd
(
msg_child
,
vlm_Message
New
(
schedule
->
command
[
i
],
vlm_NULL
)
);
vlm_Message
SimpleNew
(
schedule
->
command
[
i
]
)
);
}
return
msg
;
...
...
@@ -1490,7 +1495,7 @@ static vlm_message_t *vlm_Show( vlm_t *vlm, vlm_media_sys_t *media,
if
(
asprintf
(
&
psz_count
,
"( %d broadcast - %d vod )"
,
i_broadcast
,
i_vod
)
==
-
1
)
return
NULL
;
p_msg
=
vlm_Message
New
(
"show"
,
vlm_NULL
);
p_msg
=
vlm_Message
SimpleNew
(
"show"
);
p_msg_child
=
vlm_MessageAdd
(
p_msg
,
vlm_MessageNew
(
"media"
,
"%s"
,
psz_count
)
);
free
(
psz_count
);
...
...
@@ -1507,8 +1512,8 @@ static vlm_message_t *vlm_Show( vlm_t *vlm, vlm_media_sys_t *media,
vlm_message_t
*
msg
;
vlm_message_t
*
msg_child
;
msg
=
vlm_Message
New
(
"show"
,
vlm_NULL
);
msg_child
=
vlm_MessageAdd
(
msg
,
vlm_Message
New
(
"schedule"
,
vlm_NULL
)
);
msg
=
vlm_Message
SimpleNew
(
"show"
);
msg_child
=
vlm_MessageAdd
(
msg
,
vlm_Message
SimpleNew
(
"schedule"
)
);
for
(
i
=
0
;
i
<
vlm
->
i_schedule
;
i
++
)
{
...
...
@@ -1517,7 +1522,7 @@ static vlm_message_t *vlm_Show( vlm_t *vlm, vlm_media_sys_t *media,
mtime_t
i_time
,
i_next_date
;
msg_schedule
=
vlm_MessageAdd
(
msg_child
,
vlm_Message
New
(
s
->
psz_name
,
vlm_NULL
)
);
vlm_Message
SimpleNew
(
s
->
psz_name
)
);
vlm_MessageAdd
(
msg_schedule
,
vlm_MessageNew
(
"enabled"
,
s
->
b_enabled
?
"yes"
:
"no"
)
);
...
...
@@ -1576,7 +1581,7 @@ static vlm_message_t *vlm_Show( vlm_t *vlm, vlm_media_sys_t *media,
else
{
return
vlm_Message
New
(
"show"
,
vlm_NULL
);
return
vlm_Message
SimpleNew
(
"show"
);
}
}
...
...
src/libvlccore.sym
View file @
9312c3dc
...
...
@@ -503,6 +503,7 @@ vlm_ExecuteCommand
vlm_MessageAdd
vlm_MessageDelete
vlm_MessageNew
vlm_MessageSimpleNew
__vlm_New
__vout_AllocatePicture
vout_ChromaCmp
...
...
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