mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2025-01-03 13:07:24 +00:00
Fix junk_data for 32-bit platforms (#2245)
Previously this had a mismatch between size_t and unsigned long long.
This commit is contained in:
parent
b5c3fc0a08
commit
b14758baff
@ -21,6 +21,7 @@
|
|||||||
// Generate junk data at high speed. An alternative to dd if=/dev/urandom.
|
// Generate junk data at high speed. An alternative to dd if=/dev/urandom.
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
int main(int argc, const char *argv[])
|
int main(int argc, const char *argv[])
|
||||||
@ -28,11 +29,11 @@ int main(int argc, const char *argv[])
|
|||||||
if (argc != 2) {
|
if (argc != 2) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
unsigned long long count = strtoull(argv[1], nullptr, 10);
|
uint64_t count = strtoull(argv[1], nullptr, 10);
|
||||||
char buf[128 * 1024];
|
char buf[128 * 1024];
|
||||||
for (size_t i = 0; i < count; i += sizeof(buf)) {
|
for (uint64_t i = 0; i < count; i += sizeof(buf)) {
|
||||||
for (size_t j = 0; j < sizeof(buf) / sizeof(i); ++j) {
|
for (uint64_t j = 0; j < sizeof(buf) / sizeof(i); ++j) {
|
||||||
*(reinterpret_cast<long long *>(buf) + j) = i / sizeof(i) + j;
|
*(reinterpret_cast<uint64_t *>(buf) + j) = i / sizeof(i) + j;
|
||||||
}
|
}
|
||||||
fwrite(buf, 1, sizeof(buf) > count - i ? count - i : sizeof(buf), stdout);
|
fwrite(buf, 1, sizeof(buf) > count - i ? count - i : sizeof(buf), stdout);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user