Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
f71b33de
Commit
f71b33de
authored
Jan 27, 2013
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modules: do not use non-portable union to store item flags in cache
Pointed-out-by:
Mario Speiß
<
1034-135@online.de
>
parent
d4f540aa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
18 deletions
+37
-18
include/vlc_configuration.h
include/vlc_configuration.h
+8
-14
src/modules/cache.c
src/modules/cache.c
+29
-4
No files found.
include/vlc_configuration.h
View file @
f71b33de
...
...
@@ -59,20 +59,14 @@ typedef int (*vlc_integer_list_cb)(vlc_object_t *, const char *,
struct
module_config_t
{
union
{
struct
{
uint8_t
i_type
;
/* Configuration type */
char
i_short
;
/* Optional short option name */
unsigned
b_advanced
:
1
;
/* Advanced option */
unsigned
b_internal
:
1
;
/* Hidden from prefs and help */
unsigned
b_unsaveable
:
1
;
/* Not stored in configuration */
unsigned
b_safe
:
1
;
/* Safe in web plugins and playlists */
unsigned
b_removed
:
1
;
/* Deprecated */
};
uint32_t
flags
;
};
uint8_t
i_type
;
/* Configuration type */
char
i_short
;
/* Optional short option name */
unsigned
b_advanced
:
1
;
/* Advanced option */
unsigned
b_internal
:
1
;
/* Hidden from prefs and help */
unsigned
b_unsaveable
:
1
;
/* Not stored in configuration */
unsigned
b_safe
:
1
;
/* Safe in web plugins and playlists */
unsigned
b_removed
:
1
;
/* Deprecated */
char
*
psz_type
;
/* Configuration subtype */
char
*
psz_name
;
/* Option name */
char
*
psz_text
;
/* Short comment on the configuration option */
...
...
src/modules/cache.c
View file @
f71b33de
...
...
@@ -57,7 +57,7 @@
#ifdef HAVE_DYNAMIC_PLUGINS
/* Sub-version number
* (only used to avoid breakage in dev version when cache structure changes) */
#define CACHE_SUBVERSION_NUM 2
1
#define CACHE_SUBVERSION_NUM 2
2
/* Cache filename */
#define CACHE_NAME "plugins.dat"
...
...
@@ -80,7 +80,15 @@ void CacheDelete( vlc_object_t *obj, const char *dir )
#define LOAD_IMMEDIATE(a) \
if (fread (&(a), sizeof (char), sizeof (a), file) != sizeof (a)) \
goto error
goto error
#define LOAD_FLAG(a) \
do { \
unsigned char b; \
LOAD_IMMEDIATE(b); \
if (b > 1) \
goto error; \
(a) = b; \
} while (0)
static
int
CacheLoadString
(
char
**
p
,
FILE
*
file
)
{
...
...
@@ -115,7 +123,13 @@ error:
static
int
CacheLoadConfig
(
module_config_t
*
cfg
,
FILE
*
file
)
{
LOAD_IMMEDIATE
(
cfg
->
flags
);
LOAD_IMMEDIATE
(
cfg
->
i_type
);
LOAD_IMMEDIATE
(
cfg
->
i_short
);
LOAD_FLAG
(
cfg
->
b_advanced
);
LOAD_FLAG
(
cfg
->
b_internal
);
LOAD_FLAG
(
cfg
->
b_unsaveable
);
LOAD_FLAG
(
cfg
->
b_safe
);
LOAD_FLAG
(
cfg
->
b_removed
);
LOAD_STRING
(
cfg
->
psz_type
);
LOAD_STRING
(
cfg
->
psz_name
);
LOAD_STRING
(
cfg
->
psz_text
);
...
...
@@ -383,6 +397,11 @@ error:
#define SAVE_IMMEDIATE( a ) \
if (fwrite (&(a), sizeof(a), 1, file) != 1) \
goto error
#define SAVE_FLAG(a) \
do { \
char b = (a); \
LOAD_IMMEDIATE(b); \
} while (0)
static
int
CacheSaveString
(
FILE
*
file
,
const
char
*
str
)
{
...
...
@@ -403,7 +422,13 @@ error:
static
int
CacheSaveConfig
(
FILE
*
file
,
const
module_config_t
*
cfg
)
{
SAVE_IMMEDIATE
(
cfg
->
flags
);
SAVE_IMMEDIATE
(
cfg
->
i_type
);
SAVE_IMMEDIATE
(
cfg
->
i_short
);
SAVE_FLAG
(
cfg
->
b_advanced
);
SAVE_FLAG
(
cfg
->
b_internal
);
SAVE_FLAG
(
cfg
->
b_unsaveable
);
SAVE_FLAG
(
cfg
->
b_safe
);
SAVE_FLAG
(
cfg
->
b_removed
);
SAVE_STRING
(
cfg
->
psz_type
);
SAVE_STRING
(
cfg
->
psz_name
);
SAVE_STRING
(
cfg
->
psz_text
);
...
...
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