Skip to content

Commit

Permalink
clang format
Browse files Browse the repository at this point in the history
  • Loading branch information
toy committed Feb 18, 2018
1 parent 843f234 commit f4fca20
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions stressdrive.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
#include <unistd.h>

#ifdef __APPLE__
#include <sys/disk.h>
#import <IOKit/pwr_mgt/IOPMLib.h>
#include <sys/disk.h>
#endif

#ifdef __linux__
Expand Down Expand Up @@ -195,8 +195,10 @@ int main(int argc, const char *argv[]) {
printf("writing random data to %s\n", drivePath);
SHA1_Init(&shaContext);
PROGRESS_Init(&progress, blockCount, "writing");
for (uint64_t blockIndex = 0; blockIndex < blockCount; blockIndex += bufferBlocks) {
uint32_t size = (uint32_t) MIN(bufferBlocks, blockCount - blockIndex) * blockSize;
for (uint64_t blockIndex = 0; blockIndex < blockCount;
blockIndex += bufferBlocks) {
uint32_t size =
(uint32_t)MIN(bufferBlocks, blockCount - blockIndex) * blockSize;

int outSize;
if (!EVP_EncryptUpdate(&aes, buffer, &outSize, aesInput, size)) {
Expand Down Expand Up @@ -230,8 +232,10 @@ int main(int argc, const char *argv[]) {
printf("verifying written data\n");
SHA1_Init(&shaContext);
PROGRESS_Init(&progress, blockCount, "reading");
for (uint64_t blockIndex = 0; blockIndex < blockCount; blockIndex += bufferBlocks) {
uint32_t size = (uint32_t) MIN(bufferBlocks, blockCount - blockIndex) * blockSize;
for (uint64_t blockIndex = 0; blockIndex < blockCount;
blockIndex += bufferBlocks) {
uint32_t size =
(uint32_t)MIN(bufferBlocks, blockCount - blockIndex) * blockSize;

if (read(fd, buffer, size) == -1) {
perror("read() failed");
Expand Down

0 comments on commit f4fca20

Please sign in to comment.