Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
99cb4886
Commit
99cb4886
authored
May 12, 2011
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use native types for plugins mtime and size
64-bits timestamp is useless if the OS only provides 32-bits.
parent
8164d69b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
36 deletions
+31
-36
src/modules/cache.c
src/modules/cache.c
+17
-21
src/modules/modules.c
src/modules/modules.c
+10
-11
src/modules/modules.h
src/modules/modules.h
+4
-4
No files found.
src/modules/cache.c
View file @
99cb4886
...
...
@@ -58,7 +58,7 @@ static int CacheLoadConfig ( module_t *, FILE * );
/* Sub-version number
* (only used to avoid breakage in dev version when cache structure changes) */
#define CACHE_SUBVERSION_NUM 1
3
#define CACHE_SUBVERSION_NUM 1
4
/* Cache filename */
#define CACHE_NAME "plugins.dat"
...
...
@@ -235,9 +235,9 @@ void CacheLoad( vlc_object_t *p_this, module_bank_t *p_bank, const char *dir )
pp_cache
[
i
]
=
xmalloc
(
sizeof
(
module_cache_t
)
);
/* Load common info */
LOAD_STRING
(
pp_cache
[
i
]
->
p
sz_file
);
LOAD_IMMEDIATE
(
pp_cache
[
i
]
->
i_
time
);
LOAD_IMMEDIATE
(
pp_cache
[
i
]
->
i_
size
);
LOAD_STRING
(
pp_cache
[
i
]
->
p
ath
);
LOAD_IMMEDIATE
(
pp_cache
[
i
]
->
m
time
);
LOAD_IMMEDIATE
(
pp_cache
[
i
]
->
size
);
pp_cache
[
i
]
->
p_module
=
vlc_module_create
();
...
...
@@ -528,9 +528,9 @@ static int CacheSaveBank (FILE *file, module_cache_t *const *pp_cache,
uint32_t
i_submodule
;
/* Save common info */
SAVE_STRING
(
pp_cache
[
i
]
->
p
sz_file
);
SAVE_IMMEDIATE
(
pp_cache
[
i
]
->
i_
time
);
SAVE_IMMEDIATE
(
pp_cache
[
i
]
->
i_
size
);
SAVE_STRING
(
pp_cache
[
i
]
->
p
ath
);
SAVE_IMMEDIATE
(
pp_cache
[
i
]
->
m
time
);
SAVE_IMMEDIATE
(
pp_cache
[
i
]
->
size
);
/* Save additional infos */
SAVE_STRING
(
pp_cache
[
i
]
->
p_module
->
psz_object_name
);
...
...
@@ -678,21 +678,17 @@ void CacheMerge( vlc_object_t *p_this, module_t *p_cache, module_t *p_module )
/*****************************************************************************
* CacheFind: finds the cache entry corresponding to a file
*****************************************************************************/
module_cache_t
*
CacheFind
(
module_bank_t
*
p_bank
,
const
char
*
psz_file
,
int64_t
i_time
,
int64_t
i_
size
)
module_cache_t
*
CacheFind
(
module_bank_t
*
p_bank
,
const
char
*
path
,
time_t
mtime
,
off_t
size
)
{
module_cache_t
**
pp_cache
;
int
i_cache
,
i
;
pp_cache
=
p_bank
->
pp_loaded_cache
;
i_cache
=
p_bank
->
i_loaded_cache
;
for
(
i
=
0
;
i
<
i_cache
;
i
++
)
{
if
(
!
strcmp
(
pp_cache
[
i
]
->
psz_file
,
psz_file
)
&&
pp_cache
[
i
]
->
i_time
==
i_time
&&
pp_cache
[
i
]
->
i_size
==
i_size
)
return
pp_cache
[
i
];
}
module_cache_t
**
cache
=
p_bank
->
pp_loaded_cache
;
size_t
n
=
p_bank
->
i_loaded_cache
;
for
(
size_t
i
=
0
;
i
<
n
;
i
++
)
if
(
!
strcmp
(
cache
[
i
]
->
path
,
path
)
&&
cache
[
i
]
->
mtime
==
mtime
&&
cache
[
i
]
->
size
==
size
)
return
cache
[
i
];
return
NULL
;
}
...
...
src/modules/modules.c
View file @
99cb4886
...
...
@@ -73,7 +73,7 @@ static void AllocatePluginPath( vlc_object_t *, module_bank_t *, const char *,
static
void
AllocatePluginDir
(
vlc_object_t
*
,
module_bank_t
*
,
const
char
*
,
unsigned
);
static
int
AllocatePluginFile
(
vlc_object_t
*
,
module_bank_t
*
,
const
char
*
,
int64_t
,
int64
_t
);
time_t
,
off
_t
);
static
module_t
*
AllocatePlugin
(
vlc_object_t
*
,
const
char
*
);
#endif
static
int
AllocateBuiltinModule
(
vlc_object_t
*
,
int
(
*
)
(
module_t
*
)
);
...
...
@@ -170,14 +170,14 @@ void module_EndBank( vlc_object_t *p_this, bool b_plugins )
{
DeleteModule
(
p_bank
,
p_bank
->
pp_loaded_cache
[
p_bank
->
i_loaded_cache
]
->
p_module
);
free
(
p_bank
->
pp_loaded_cache
[
p_bank
->
i_loaded_cache
]
->
p
sz_file
);
free
(
p_bank
->
pp_loaded_cache
[
p_bank
->
i_loaded_cache
]
->
p
ath
);
free
(
p_bank
->
pp_loaded_cache
[
p_bank
->
i_loaded_cache
]
);
}
}
free
(
p_bank
->
pp_loaded_cache
);
while
(
p_bank
->
i_cache
--
)
{
free
(
p_bank
->
pp_cache
[
p_bank
->
i_cache
]
->
p
sz_file
);
free
(
p_bank
->
pp_cache
[
p_bank
->
i_cache
]
->
p
ath
);
free
(
p_bank
->
pp_cache
[
p_bank
->
i_cache
]
);
}
free
(
p_bank
->
pp_cache
);
...
...
@@ -937,8 +937,7 @@ static void AllocatePluginDir( vlc_object_t *p_this, module_bank_t *p_bank,
* and module_unneed. It can be removed by DeleteModule.
*****************************************************************************/
static
int
AllocatePluginFile
(
vlc_object_t
*
p_this
,
module_bank_t
*
p_bank
,
const
char
*
psz_file
,
int64_t
i_file_time
,
int64_t
i_file_size
)
const
char
*
path
,
time_t
mtime
,
off_t
size
)
{
module_t
*
p_module
=
NULL
;
module_cache_t
*
p_cache_entry
=
NULL
;
...
...
@@ -946,10 +945,10 @@ static int AllocatePluginFile( vlc_object_t * p_this, module_bank_t *p_bank,
/*
* Check our plugins cache first then load plugin if needed
*/
p_cache_entry
=
CacheFind
(
p_bank
,
p
sz_file
,
i_file_time
,
i_file_
size
);
p_cache_entry
=
CacheFind
(
p_bank
,
p
ath
,
mtime
,
size
);
if
(
!
p_cache_entry
)
{
p_module
=
AllocatePlugin
(
p_this
,
p
sz_file
);
p_module
=
AllocatePlugin
(
p_this
,
p
ath
);
}
else
{
...
...
@@ -970,7 +969,7 @@ static int AllocatePluginFile( vlc_object_t * p_this, module_bank_t *p_bank,
{
if
(
p_item
->
i_action
)
{
p_module
=
AllocatePlugin
(
p_this
,
p
sz_file
);
p_module
=
AllocatePlugin
(
p_this
,
p
ath
);
break
;
}
}
...
...
@@ -1004,9 +1003,9 @@ static int AllocatePluginFile( vlc_object_t * p_this, module_bank_t *p_bank,
pp_cache
[
p_bank
->
i_cache
]
=
malloc
(
sizeof
(
module_cache_t
)
);
if
(
pp_cache
[
p_bank
->
i_cache
]
==
NULL
)
return
-
1
;
pp_cache
[
p_bank
->
i_cache
]
->
p
sz_file
=
strdup
(
psz_file
);
pp_cache
[
p_bank
->
i_cache
]
->
i_time
=
i_file_
time
;
pp_cache
[
p_bank
->
i_cache
]
->
i_size
=
i_file_
size
;
pp_cache
[
p_bank
->
i_cache
]
->
p
ath
=
strdup
(
path
);
pp_cache
[
p_bank
->
i_cache
]
->
mtime
=
m
time
;
pp_cache
[
p_bank
->
i_cache
]
->
size
=
size
;
pp_cache
[
p_bank
->
i_cache
]
->
p_module
=
p_module
;
p_bank
->
pp_cache
=
pp_cache
;
p_bank
->
i_cache
++
;
...
...
src/modules/modules.h
View file @
99cb4886
...
...
@@ -54,9 +54,9 @@ typedef struct module_bank_t
struct
module_cache_t
{
/* Mandatory cache entry header */
char
*
psz_file
;
int64_t
i_
time
;
int64_t
i_
size
;
char
*
path
;
time_t
m
time
;
off_t
size
;
/* Optional extra data */
module_t
*
p_module
;
...
...
@@ -155,6 +155,6 @@ void CacheMerge (vlc_object_t *, module_t *, module_t *);
void
CacheDelete
(
vlc_object_t
*
,
const
char
*
);
void
CacheLoad
(
vlc_object_t
*
,
module_bank_t
*
,
const
char
*
);
void
CacheSave
(
vlc_object_t
*
,
const
char
*
,
module_cache_t
*
const
*
,
size_t
);
module_cache_t
*
CacheFind
(
module_bank_t
*
,
const
char
*
,
int64_t
,
int64
_t
);
module_cache_t
*
CacheFind
(
module_bank_t
*
,
const
char
*
,
time_t
,
off
_t
);
#endif
/* !LIBVLC_MODULES_H */
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