Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libudfread
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
VideoLAN
libudfread
Commits
4a829216
Commit
4a829216
authored
Feb 18, 2015
by
Petri Hintukainen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix build with c++ compiler
parent
0106ee5b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
23 deletions
+23
-23
examples/udfcat.c
examples/udfcat.c
+3
-3
examples/udfls.c
examples/udfls.c
+2
-2
src/default_blockinput.c
src/default_blockinput.c
+1
-1
src/ecma167.c
src/ecma167.c
+3
-3
src/udfread.c
src/udfread.c
+14
-14
No files found.
examples/udfcat.c
View file @
4a829216
...
...
@@ -29,14 +29,14 @@ static void _cat(UDFFILE *fp)
{
uint8_t
buf
[
2048
];
int64_t
got
=
0
;
int64
_t
result
;
ssize
_t
result
;
while
((
result
=
udfread_file_read
(
fp
,
buf
,
sizeof
(
buf
)))
>
0
)
{
fwrite
(
buf
,
1
,
result
,
stdout
);
fwrite
(
buf
,
1
,
(
size_t
)
result
,
stdout
);
got
+=
result
;
}
if
(
go
t
<
0
)
{
if
(
resul
t
<
0
)
{
fprintf
(
stderr
,
"udfread_file_read(offset=%"
PRId64
") failed
\n
"
,
udfread_file_tell
(
fp
));
}
fprintf
(
stderr
,
"wrote %"
PRId64
" bytes of %"
PRId64
"
\n
"
,
got
,
udfread_file_size
(
fp
));
...
...
examples/udfls.c
View file @
4a829216
...
...
@@ -42,12 +42,12 @@ static int _lsdir(udfread *udf, const char *path)
if
(
dirent
.
d_type
==
UDF_DT_DIR
)
{
printf
(
"
\t\t
%s%s
\n
"
,
path
,
dirent
.
d_name
);
char
*
next_dir
=
malloc
(
strlen
(
path
)
+
strlen
(
dirent
.
d_name
)
+
2
);
char
*
next_dir
=
(
char
*
)
malloc
(
strlen
(
path
)
+
strlen
(
dirent
.
d_name
)
+
2
);
sprintf
(
next_dir
,
"%s%s/"
,
path
,
dirent
.
d_name
);
_lsdir
(
udf
,
next_dir
);
free
(
next_dir
);
}
else
{
char
*
file
=
malloc
(
strlen
(
path
)
+
strlen
(
dirent
.
d_name
)
+
1
);
char
*
file
=
(
char
*
)
malloc
(
strlen
(
path
)
+
strlen
(
dirent
.
d_name
)
+
1
);
sprintf
(
file
,
"%s%s"
,
path
,
dirent
.
d_name
);
UDFFILE
*
fp
=
udfread_file_open
(
udf
,
file
);
printf
(
"%16"
PRId64
" %s%s
\n
"
,
udfread_file_size
(
fp
),
path
,
dirent
.
d_name
);
...
...
src/default_blockinput.c
View file @
4a829216
...
...
@@ -126,7 +126,7 @@ static int _def_read(udfread_block_input *p_gen, uint32_t lba, void *buf, uint32
udfread_block_input
*
block_input_new
(
const
char
*
path
)
{
default_block_input
*
p
=
calloc
(
1
,
sizeof
(
default_block_input
));
default_block_input
*
p
=
(
default_block_input
*
)
calloc
(
1
,
sizeof
(
default_block_input
));
if
(
!
p
)
{
return
NULL
;
}
...
...
src/ecma167.c
View file @
4a829216
...
...
@@ -86,7 +86,7 @@ enum tag_identifier decode_descriptor_tag(const uint8_t *buf)
return
ECMA_TAG_NONE
;
}
return
id
;
return
(
enum
tag_identifier
)
id
;
}
/* Primary Volume Descriptor (ECMA 167, 3/10.1) */
...
...
@@ -267,9 +267,9 @@ static struct file_entry *_decode_file_entry(const uint8_t *p, size_t size,
}
if
(
content_inline
)
{
fe
=
calloc
(
1
,
sizeof
(
struct
file_entry
)
+
l_ad
);
fe
=
(
struct
file_entry
*
)
calloc
(
1
,
sizeof
(
struct
file_entry
)
+
l_ad
);
}
else
{
fe
=
calloc
(
1
,
sizeof
(
struct
file_entry
)
+
sizeof
(
struct
long_ad
)
*
(
num_ad
-
1
));
fe
=
(
struct
file_entry
*
)
calloc
(
1
,
sizeof
(
struct
file_entry
)
+
sizeof
(
struct
long_ad
)
*
(
num_ad
-
1
));
}
if
(
!
fe
)
{
...
...
src/udfread.c
View file @
4a829216
...
...
@@ -108,7 +108,7 @@ static int atomic_pointer_compare_and_exchange(void *atomic, void *oldval, void
static
char
*
_str_dup
(
const
char
*
s
)
{
size_t
len
=
strlen
(
s
);
char
*
p
=
malloc
(
len
+
1
);
char
*
p
=
(
char
*
)
malloc
(
len
+
1
);
if
(
p
)
{
memcpy
(
p
,
s
,
len
+
1
);
}
else
{
...
...
@@ -138,7 +138,7 @@ static void *_safe_realloc(void *p, size_t s)
out[out_pos++] = ch; \
} else { \
out_size++; \
out =
_safe_realloc(out, out_size);
\
out =
(uint8_t *)_safe_realloc(out, out_size);
\
if (!out) return NULL; \
\
out[out_pos++] = 0xc0 | (ch >> 6); \
...
...
@@ -152,7 +152,7 @@ static void *_safe_realloc(void *p, size_t s)
utf16lo_to_utf8(out, out_pos, out_size, ch); \
} else { \
out_size += 2; \
out =
_safe_realloc(out, out_size);
\
out =
(uint8_t *)_safe_realloc(out, out_size);
\
if (!out) return NULL; \
\
out[out_pos++] = 0xe0 | (ch >> 12); \
...
...
@@ -168,7 +168,7 @@ static char *_cs0_to_utf8(const uint8_t *cs0, size_t size)
size_t
out_pos
=
0
;
size_t
out_size
=
size
;
size_t
i
;
uint8_t
*
out
=
malloc
(
size
);
uint8_t
*
out
=
(
uint8_t
*
)
malloc
(
size
);
if
(
!
out
)
{
udf_error
(
"out of memory
\n
"
);
...
...
@@ -687,7 +687,7 @@ udfread *udfread_init(void)
enable_log
=
1
;
}
return
calloc
(
1
,
sizeof
(
udfread
));
return
(
udfread
*
)
calloc
(
1
,
sizeof
(
udfread
));
}
/*
...
...
@@ -778,7 +778,7 @@ static struct file_entry *_read_file_entry(udfread *udf,
return
NULL
;
}
buf
=
malloc
(
num_blocks
*
UDF_BLOCK_SIZE
);
buf
=
(
uint8_t
*
)
malloc
(
num_blocks
*
UDF_BLOCK_SIZE
);
if
(
!
buf
)
{
udf_error
(
"out of memory
\n
"
);
return
NULL
;
...
...
@@ -822,7 +822,7 @@ static int _parse_dir(const uint8_t *data, uint32_t length, struct udf_dir *dir)
return
-
1
;
}
dir
->
files
=
_safe_realloc
(
dir
->
files
,
sizeof
(
dir
->
files
[
0
])
*
(
dir
->
num_entries
+
1
));
dir
->
files
=
(
struct
udf_file_identifier
*
)
_safe_realloc
(
dir
->
files
,
sizeof
(
dir
->
files
[
0
])
*
(
dir
->
num_entries
+
1
));
if
(
!
dir
->
files
)
{
return
-
1
;
}
...
...
@@ -859,7 +859,7 @@ static struct udf_dir *_read_dir_file(udfread *udf, const struct long_ad *loc)
return
NULL
;
}
data
=
malloc
(
num_blocks
*
UDF_BLOCK_SIZE
);
data
=
(
uint8_t
*
)
malloc
(
num_blocks
*
UDF_BLOCK_SIZE
);
if
(
!
data
)
{
udf_error
(
"out of memory
\n
"
);
return
NULL
;
...
...
@@ -873,7 +873,7 @@ static struct udf_dir *_read_dir_file(udfread *udf, const struct long_ad *loc)
udf_trace
(
"directory size %u bytes
\n
"
,
loc
->
length
);
dir
=
calloc
(
1
,
sizeof
(
struct
udf_dir
));
dir
=
(
struct
udf_dir
*
)
calloc
(
1
,
sizeof
(
struct
udf_dir
));
if
(
dir
)
{
if
(
_parse_dir
(
data
,
loc
->
length
,
dir
)
<
0
)
{
_free_dir
(
&
dir
);
...
...
@@ -902,7 +902,7 @@ static struct udf_dir *_read_dir(udfread *udf, const struct long_ad *icb)
}
if
(
fe
->
content_inline
)
{
dir
=
calloc
(
1
,
sizeof
(
struct
udf_dir
));
dir
=
(
struct
udf_dir
*
)
calloc
(
1
,
sizeof
(
struct
udf_dir
));
if
(
dir
)
{
if
(
_parse_dir
(
&
fe
->
data
.
content
[
0
],
fe
->
length
,
dir
)
<
0
)
{
udf_error
(
"failed parsing inline directory file
\n
"
);
...
...
@@ -969,7 +969,7 @@ static struct udf_dir *_read_subdir(udfread *udf, struct udf_dir *dir, uint32_t
}
if
(
!
dir
->
subdirs
)
{
struct
udf_dir
**
subdirs
=
calloc
(
sizeof
(
struct
udf_dir
*
),
dir
->
num_entries
);
struct
udf_dir
**
subdirs
=
(
struct
udf_dir
**
)
calloc
(
sizeof
(
struct
udf_dir
*
),
dir
->
num_entries
);
if
(
!
subdirs
)
{
udf_error
(
"out of memory
\n
"
);
return
NULL
;
...
...
@@ -1193,7 +1193,7 @@ UDFDIR *udfread_opendir(udfread *udf, const char *path)
return
NULL
;
}
result
=
calloc
(
1
,
sizeof
(
UDFDIR
));
result
=
(
UDFDIR
*
)
calloc
(
1
,
sizeof
(
UDFDIR
));
if
(
result
)
{
result
->
dir
=
dir
;
}
...
...
@@ -1285,7 +1285,7 @@ UDFFILE *udfread_file_open(udfread *udf, const char *path)
return
NULL
;
}
result
=
calloc
(
1
,
sizeof
(
UDFFILE
));
result
=
(
UDFFILE
*
)
calloc
(
1
,
sizeof
(
UDFFILE
));
if
(
!
result
)
{
free_file_entry
(
&
fe
);
return
NULL
;
...
...
@@ -1427,7 +1427,7 @@ static ssize_t _read(UDFFILE *p, void *buf, size_t bytes)
ssize_t
udfread_file_read
(
UDFFILE
*
p
,
void
*
buf
,
size_t
bytes
)
{
uint8_t
*
bufpt
=
buf
;
uint8_t
*
bufpt
=
(
uint8_t
*
)
buf
;
/* sanity checks */
if
(
!
p
||
!
buf
||
p
->
pos
<
0
)
{
...
...
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