Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libloc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
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
nexedi
libloc
Commits
546c0ac0
Commit
546c0ac0
authored
Aug 23, 2022
by
Michael Tremer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
database: Refactor checking magic
Signed-off-by:
Michael Tremer
<
michael.tremer@ipfire.org
>
parent
1642ccea
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
src/database.c
src/database.c
+3
-3
No files found.
src/database.c
View file @
546c0ac0
...
...
@@ -166,7 +166,7 @@ static void* __loc_database_read_object(struct loc_database* db, void* buffer,
return
buffer
;
}
static
int
loc_database_
read
_magic
(
struct
loc_database
*
db
)
{
static
int
loc_database_
check
_magic
(
struct
loc_database
*
db
)
{
struct
loc_database_magic
magic
;
// Read from file
...
...
@@ -180,7 +180,7 @@ static int loc_database_read_magic(struct loc_database* db) {
}
// Compare magic bytes
if
(
memcmp
(
LOC_DATABASE_MAGIC
,
magic
.
magic
,
strlen
(
LOC_DATABASE_MAGIC
))
==
0
)
{
if
(
memcmp
(
magic
.
magic
,
LOC_DATABASE_MAGIC
,
sizeof
(
magic
.
magic
))
==
0
)
{
DEBUG
(
db
->
ctx
,
"Magic value matches
\n
"
);
// Parse version
...
...
@@ -404,7 +404,7 @@ static int loc_database_open(struct loc_database* db, FILE* f) {
return
r
;
// Read magic bytes
r
=
loc_database_
read
_magic
(
db
);
r
=
loc_database_
check
_magic
(
db
);
if
(
r
)
return
r
;
...
...
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