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
28132698
Commit
28132698
authored
Apr 23, 2014
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
STL: simplify and fix memory leak
parent
df363756
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
35 deletions
+16
-35
modules/codec/stl.c
modules/codec/stl.c
+16
-35
No files found.
modules/codec/stl.c
View file @
28132698
...
@@ -78,49 +78,30 @@ static cct_number_t cct_nums[] = { {CCT_ISO_6937_2, "ISO_6937-2"},
...
@@ -78,49 +78,30 @@ static cct_number_t cct_nums[] = { {CCT_ISO_6937_2, "ISO_6937-2"},
{
CCT_ISO_8859_8
,
"ISO_8859-8"
}
};
{
CCT_ISO_8859_8
,
"ISO_8859-8"
}
};
static
char
*
ParseText
(
uint8_t
*
data
,
in
t
size
,
const
char
*
charset
)
static
char
*
ParseText
(
const
uint8_t
*
data
,
size_
t
size
,
const
char
*
charset
)
{
{
char
*
text
=
strdup
(
""
);
char
*
text
=
malloc
(
size
);
int
text_size
=
0
;
if
(
text
==
NULL
)
return
NULL
;
size_t
text_size
=
0
;
for
(
in
t
i
=
0
;
i
<
size
;
i
++
)
{
for
(
size_
t
i
=
0
;
i
<
size
;
i
++
)
{
uint8_t
code
=
data
[
i
];
uint8_t
code
=
data
[
i
];
if
(
code
==
0x8f
)
if
(
code
==
0x8f
)
break
;
break
;
if
(
code
==
0x7f
)
char
tmp
[
16
]
=
""
;
char
*
t
=
tmp
;
if
((
code
>=
0x20
&&
code
<=
0x7e
)
||
(
code
>=
0xa0
)
)
snprintf
(
tmp
,
sizeof
(
tmp
),
"%c"
,
code
);
#if 0
else if (code == 0x80)
snprintf(tmp, sizeof(tmp), "<i>");
else if (code == 0x81)
snprintf(tmp, sizeof(tmp), "</i>");
else if (code == 0x82)
snprintf(tmp, sizeof(tmp), "<u>");
else if (code == 0x83)
snprintf(tmp, sizeof(tmp), "</u>");
#endif
else
if
(
code
==
0x8a
)
snprintf
(
tmp
,
sizeof
(
tmp
),
"
\n
"
);
else
{
t
=
NULL
;
}
if
(
!
t
)
continue
;
size_t
t_size
=
strlen
(
t
);
text
=
realloc_or_free
(
text
,
t_size
+
text_size
+
1
);
if
(
!
text
)
continue
;
continue
;
memcpy
(
&
text
[
text_size
],
t
,
t_size
);
if
(
code
&
0x60
)
text_size
+=
t_size
;
text
[
text_size
++
]
=
code
;
text
[
text_size
]
=
'\0'
;
if
(
code
==
0x8a
)
text
[
text_size
++
]
=
'\n'
;
}
}
return
FromCharset
(
charset
,
text
,
text_size
);
char
*
u8
=
FromCharset
(
charset
,
text
,
text_size
);
free
(
text
);
return
u8
;
}
}
static
subpicture_t
*
Decode
(
decoder_t
*
dec
,
block_t
**
block
)
static
subpicture_t
*
Decode
(
decoder_t
*
dec
,
block_t
**
block
)
...
...
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