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
Show 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 * );
...
@@ -58,7 +58,7 @@ static int CacheLoadConfig ( module_t *, FILE * );
/* Sub-version number
/* Sub-version number
* (only used to avoid breakage in dev version when cache structure changes) */
* (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 */
/* Cache filename */
#define CACHE_NAME "plugins.dat"
#define CACHE_NAME "plugins.dat"
...
@@ -235,9 +235,9 @@ void CacheLoad( vlc_object_t *p_this, module_bank_t *p_bank, const char *dir )
...
@@ -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
)
);
pp_cache
[
i
]
=
xmalloc
(
sizeof
(
module_cache_t
)
);
/* Load common info */
/* Load common info */
LOAD_STRING
(
pp_cache
[
i
]
->
p
sz_file
);
LOAD_STRING
(
pp_cache
[
i
]
->
p
ath
);
LOAD_IMMEDIATE
(
pp_cache
[
i
]
->
i_
time
);
LOAD_IMMEDIATE
(
pp_cache
[
i
]
->
m
time
);
LOAD_IMMEDIATE
(
pp_cache
[
i
]
->
i_
size
);
LOAD_IMMEDIATE
(
pp_cache
[
i
]
->
size
);
pp_cache
[
i
]
->
p_module
=
vlc_module_create
();
pp_cache
[
i
]
->
p_module
=
vlc_module_create
();
...
@@ -528,9 +528,9 @@ static int CacheSaveBank (FILE *file, module_cache_t *const *pp_cache,
...
@@ -528,9 +528,9 @@ static int CacheSaveBank (FILE *file, module_cache_t *const *pp_cache,
uint32_t
i_submodule
;
uint32_t
i_submodule
;
/* Save common info */
/* Save common info */
SAVE_STRING
(
pp_cache
[
i
]
->
p
sz_file
);
SAVE_STRING
(
pp_cache
[
i
]
->
p
ath
);
SAVE_IMMEDIATE
(
pp_cache
[
i
]
->
i_
time
);
SAVE_IMMEDIATE
(
pp_cache
[
i
]
->
m
time
);
SAVE_IMMEDIATE
(
pp_cache
[
i
]
->
i_
size
);
SAVE_IMMEDIATE
(
pp_cache
[
i
]
->
size
);
/* Save additional infos */
/* Save additional infos */
SAVE_STRING
(
pp_cache
[
i
]
->
p_module
->
psz_object_name
);
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 )
...
@@ -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
* CacheFind: finds the cache entry corresponding to a file
*****************************************************************************/
*****************************************************************************/
module_cache_t
*
CacheFind
(
module_bank_t
*
p_bank
,
const
char
*
psz_file
,
module_cache_t
*
CacheFind
(
module_bank_t
*
p_bank
,
int64_t
i_time
,
int64_t
i_
size
)
const
char
*
path
,
time_t
mtime
,
off_t
size
)
{
{
module_cache_t
**
pp_cache
;
module_cache_t
**
cache
=
p_bank
->
pp_loaded_cache
;
int
i_cache
,
i
;
size_t
n
=
p_bank
->
i_loaded_cache
;
pp_cache
=
p_bank
->
pp_loaded_cache
;
for
(
size_t
i
=
0
;
i
<
n
;
i
++
)
i_cache
=
p_bank
->
i_loaded_cache
;
if
(
!
strcmp
(
cache
[
i
]
->
path
,
path
)
&&
cache
[
i
]
->
mtime
==
mtime
&&
for
(
i
=
0
;
i
<
i_cache
;
i
++
)
cache
[
i
]
->
size
==
size
)
{
return
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
];
}
return
NULL
;
return
NULL
;
}
}
...
...
src/modules/modules.c
View file @
99cb4886
...
@@ -73,7 +73,7 @@ static void AllocatePluginPath( vlc_object_t *, module_bank_t *, const char *,
...
@@ -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
*
,
static
void
AllocatePluginDir
(
vlc_object_t
*
,
module_bank_t
*
,
const
char
*
,
unsigned
);
unsigned
);
static
int
AllocatePluginFile
(
vlc_object_t
*
,
module_bank_t
*
,
const
char
*
,
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
*
);
static
module_t
*
AllocatePlugin
(
vlc_object_t
*
,
const
char
*
);
#endif
#endif
static
int
AllocateBuiltinModule
(
vlc_object_t
*
,
int
(
*
)
(
module_t
*
)
);
static
int
AllocateBuiltinModule
(
vlc_object_t
*
,
int
(
*
)
(
module_t
*
)
);
...
@@ -170,14 +170,14 @@ void module_EndBank( vlc_object_t *p_this, bool b_plugins )
...
@@ -170,14 +170,14 @@ void module_EndBank( vlc_object_t *p_this, bool b_plugins )
{
{
DeleteModule
(
p_bank
,
DeleteModule
(
p_bank
,
p_bank
->
pp_loaded_cache
[
p_bank
->
i_loaded_cache
]
->
p_module
);
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
[
p_bank
->
i_loaded_cache
]
);
}
}
}
}
free
(
p_bank
->
pp_loaded_cache
);
free
(
p_bank
->
pp_loaded_cache
);
while
(
p_bank
->
i_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
[
p_bank
->
i_cache
]
);
}
}
free
(
p_bank
->
pp_cache
);
free
(
p_bank
->
pp_cache
);
...
@@ -937,8 +937,7 @@ static void AllocatePluginDir( vlc_object_t *p_this, module_bank_t *p_bank,
...
@@ -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.
* and module_unneed. It can be removed by DeleteModule.
*****************************************************************************/
*****************************************************************************/
static
int
AllocatePluginFile
(
vlc_object_t
*
p_this
,
module_bank_t
*
p_bank
,
static
int
AllocatePluginFile
(
vlc_object_t
*
p_this
,
module_bank_t
*
p_bank
,
const
char
*
psz_file
,
const
char
*
path
,
time_t
mtime
,
off_t
size
)
int64_t
i_file_time
,
int64_t
i_file_size
)
{
{
module_t
*
p_module
=
NULL
;
module_t
*
p_module
=
NULL
;
module_cache_t
*
p_cache_entry
=
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,
...
@@ -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
* 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
)
if
(
!
p_cache_entry
)
{
{
p_module
=
AllocatePlugin
(
p_this
,
p
sz_file
);
p_module
=
AllocatePlugin
(
p_this
,
p
ath
);
}
}
else
else
{
{
...
@@ -970,7 +969,7 @@ static int AllocatePluginFile( vlc_object_t * p_this, module_bank_t *p_bank,
...
@@ -970,7 +969,7 @@ static int AllocatePluginFile( vlc_object_t * p_this, module_bank_t *p_bank,
{
{
if
(
p_item
->
i_action
)
if
(
p_item
->
i_action
)
{
{
p_module
=
AllocatePlugin
(
p_this
,
p
sz_file
);
p_module
=
AllocatePlugin
(
p_this
,
p
ath
);
break
;
break
;
}
}
}
}
...
@@ -1004,9 +1003,9 @@ static int AllocatePluginFile( vlc_object_t * p_this, module_bank_t *p_bank,
...
@@ -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
)
);
pp_cache
[
p_bank
->
i_cache
]
=
malloc
(
sizeof
(
module_cache_t
)
);
if
(
pp_cache
[
p_bank
->
i_cache
]
==
NULL
)
if
(
pp_cache
[
p_bank
->
i_cache
]
==
NULL
)
return
-
1
;
return
-
1
;
pp_cache
[
p_bank
->
i_cache
]
->
p
sz_file
=
strdup
(
psz_file
);
pp_cache
[
p_bank
->
i_cache
]
->
p
ath
=
strdup
(
path
);
pp_cache
[
p_bank
->
i_cache
]
->
i_time
=
i_file_
time
;
pp_cache
[
p_bank
->
i_cache
]
->
mtime
=
m
time
;
pp_cache
[
p_bank
->
i_cache
]
->
i_size
=
i_file_
size
;
pp_cache
[
p_bank
->
i_cache
]
->
size
=
size
;
pp_cache
[
p_bank
->
i_cache
]
->
p_module
=
p_module
;
pp_cache
[
p_bank
->
i_cache
]
->
p_module
=
p_module
;
p_bank
->
pp_cache
=
pp_cache
;
p_bank
->
pp_cache
=
pp_cache
;
p_bank
->
i_cache
++
;
p_bank
->
i_cache
++
;
...
...
src/modules/modules.h
View file @
99cb4886
...
@@ -54,9 +54,9 @@ typedef struct module_bank_t
...
@@ -54,9 +54,9 @@ typedef struct module_bank_t
struct
module_cache_t
struct
module_cache_t
{
{
/* Mandatory cache entry header */
/* Mandatory cache entry header */
char
*
psz_file
;
char
*
path
;
int64_t
i_
time
;
time_t
m
time
;
int64_t
i_
size
;
off_t
size
;
/* Optional extra data */
/* Optional extra data */
module_t
*
p_module
;
module_t
*
p_module
;
...
@@ -155,6 +155,6 @@ void CacheMerge (vlc_object_t *, module_t *, module_t *);
...
@@ -155,6 +155,6 @@ void CacheMerge (vlc_object_t *, module_t *, module_t *);
void
CacheDelete
(
vlc_object_t
*
,
const
char
*
);
void
CacheDelete
(
vlc_object_t
*
,
const
char
*
);
void
CacheLoad
(
vlc_object_t
*
,
module_bank_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
);
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 */
#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