Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc68c788

Browse files
committed
enums for get_crc32
1 parentc5f1eea commitc68c788

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

‎src/utils/file.c‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1355,6 +1355,11 @@ fio_sync(char const* path, fio_location location)
13551355
}
13561356
}
13571357

1358+
enum {
1359+
GET_CRC32_DECOMPRESS=1,
1360+
GET_CRC32_MISSING_OK=2
1361+
};
1362+
13581363
/* Get crc32 of file */
13591364
pg_crc32
13601365
fio_get_crc32(constchar*file_path,fio_locationlocation,
@@ -1371,9 +1376,9 @@ fio_get_crc32(const char *file_path, fio_location location,
13711376
hdr.arg=0;
13721377

13731378
if (decompress)
1374-
hdr.arg=1;
1379+
hdr.arg=GET_CRC32_DECOMPRESS;
13751380
if (missing_ok)
1376-
hdr.arg |=2;
1381+
hdr.arg |=GET_CRC32_MISSING_OK;
13771382

13781383
IO_CHECK(fio_write_all(fio_stdout,&hdr,sizeof(hdr)),sizeof(hdr));
13791384
IO_CHECK(fio_write_all(fio_stdout,file_path,path_len),path_len);
@@ -3383,10 +3388,10 @@ fio_communicate(int in, int out)
33833388
break;
33843389
caseFIO_GET_CRC32:
33853390
/* calculate crc32 for a file */
3386-
if ((hdr.arg&1))
3387-
crc=pgFileGetCRCgz(buf, true, (hdr.arg&2)!=0);
3391+
if ((hdr.arg&GET_CRC32_DECOMPRESS))
3392+
crc=pgFileGetCRCgz(buf, true, (hdr.arg&GET_CRC32_MISSING_OK)!=0);
33883393
else
3389-
crc=pgFileGetCRC(buf, true, (hdr.arg&2)!=0);
3394+
crc=pgFileGetCRC(buf, true, (hdr.arg&GET_CRC32_MISSING_OK)!=0);
33903395
IO_CHECK(fio_write_all(out,&crc,sizeof(crc)),sizeof(crc));
33913396
break;
33923397
caseFIO_GET_CHECKSUM_MAP:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp