Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
7b30cc3a
Commit
7b30cc3a
authored
Aug 31, 2010
by
Pieter Noordhuis
Browse files
Fix issue 300 by upgrading variable types to 64-bit
parent
fb92ecec
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/redis-check-dump.c
View file @
7b30cc3a
...
...
@@ -65,8 +65,8 @@
/* data type to hold offset in file and size */
typedef
struct
{
void
*
data
;
u
nsigned
long
size
;
u
nsigned
long
offset
;
u
int64_t
size
;
u
int64_t
offset
;
}
pos
;
static
unsigned
char
level
=
0
;
...
...
@@ -77,8 +77,8 @@ static pos positions[16];
/* Hold a stack of errors */
typedef
struct
{
char
error
[
16
][
1024
];
u
nsigned
long
offset
[
16
];
u
nsigned
in
t
level
;
u
int64_t
offset
[
16
];
u
int32_
t
level
;
}
errors_t
;
static
errors_t
errors
;
...
...
@@ -494,15 +494,15 @@ void printCentered(int indent, int width, char* body) {
printf
(
"%s %s %s
\n
"
,
head
,
body
,
tail
);
}
void
printValid
(
int
ops
,
int
bytes
)
{
void
printValid
(
u
int
64_t
ops
,
u
int
64_t
bytes
)
{
char
body
[
80
];
sprintf
(
body
,
"Processed %
d
valid opcodes (in %
d
bytes)"
,
ops
,
bytes
);
sprintf
(
body
,
"Processed %
llu
valid opcodes (in %
llu
bytes)"
,
ops
,
bytes
);
printCentered
(
4
,
80
,
body
);
}
void
printSkipped
(
int
bytes
,
int
offset
)
{
void
printSkipped
(
u
int
64_t
bytes
,
u
int
64_t
offset
)
{
char
body
[
80
];
sprintf
(
body
,
"Skipped %
d
bytes (resuming at 0x%08x)"
,
bytes
,
offset
);
sprintf
(
body
,
"Skipped %
llu
bytes (resuming at 0x%08
ll
x)"
,
bytes
,
offset
);
printCentered
(
4
,
80
,
body
);
}
...
...
@@ -536,12 +536,12 @@ void printErrorStack(entry *e) {
/* display error stack */
for
(
i
=
0
;
i
<
errors
.
level
;
i
++
)
{
printf
(
"0x%08lx - %s
\n
"
,
errors
.
offset
[
i
],
errors
.
error
[
i
]);
printf
(
"0x%08l
l
x - %s
\n
"
,
errors
.
offset
[
i
],
errors
.
error
[
i
]);
}
}
void
process
()
{
int
i
,
num_errors
=
0
,
num_valid_ops
=
0
,
num_valid_bytes
=
0
;
u
int
64_t
num_errors
=
0
,
num_valid_ops
=
0
,
num_valid_bytes
=
0
;
entry
entry
;
processHeader
();
...
...
@@ -558,7 +558,9 @@ void process() {
num_valid_bytes
=
0
;
/* search for next valid entry */
unsigned
long
offset
=
positions
[
0
].
offset
+
1
;
uint64_t
offset
=
positions
[
0
].
offset
+
1
;
int
i
=
0
;
while
(
!
entry
.
success
&&
offset
<
positions
[
0
].
size
)
{
positions
[
1
].
offset
=
offset
;
...
...
@@ -606,9 +608,9 @@ void process() {
}
/* print summary on errors */
if
(
num_errors
>
0
)
{
if
(
num_errors
)
{
printf
(
"
\n
"
);
printf
(
"Total unprocessable opcodes: %
d
\n
"
,
num_errors
);
printf
(
"Total unprocessable opcodes: %
llu
\n
"
,
num_errors
);
}
}
...
...
@@ -620,7 +622,7 @@ int main(int argc, char **argv) {
}
int
fd
;
unsigned
long
size
;
size_t
size
;
struct
stat
stat
;
void
*
data
;
...
...
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