From 4746f79d50d804b0e9d5d5cc0d4796dee54d052c Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 14 Oct 2008 01:59:36 +0200 Subject: Use {u,}int64_t instead of SMB_BIG_{U,}INT. --- source3/libsmb/clifile.c | 12 ++++++------ source3/libsmb/cliquota.c | 40 ++++++++++++++++++---------------------- source3/libsmb/clireadwrite.c | 6 +++--- 3 files changed, 27 insertions(+), 31 deletions(-) (limited to 'source3/libsmb') diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c index d3819af4448..1c525363f76 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -1234,7 +1234,7 @@ bool cli_unlock(struct cli_state *cli, int fnum, uint32 offset, uint32 len) ****************************************************************************/ bool cli_lock64(struct cli_state *cli, int fnum, - SMB_BIG_UINT offset, SMB_BIG_UINT len, int timeout, enum brl_type lock_type) + uint64_t offset, uint64_t len, int timeout, enum brl_type lock_type) { char *p; int saved_timeout = cli->timeout; @@ -1294,7 +1294,7 @@ bool cli_lock64(struct cli_state *cli, int fnum, Unlock a file with 64 bit offsets. ****************************************************************************/ -bool cli_unlock64(struct cli_state *cli, int fnum, SMB_BIG_UINT offset, SMB_BIG_UINT len) +bool cli_unlock64(struct cli_state *cli, int fnum, uint64_t offset, uint64_t len) { char *p; @@ -1341,7 +1341,7 @@ bool cli_unlock64(struct cli_state *cli, int fnum, SMB_BIG_UINT offset, SMB_BIG_ ****************************************************************************/ static bool cli_posix_lock_internal(struct cli_state *cli, int fnum, - SMB_BIG_UINT offset, SMB_BIG_UINT len, bool wait_lock, enum brl_type lock_type) + uint64_t offset, uint64_t len, bool wait_lock, enum brl_type lock_type) { unsigned int param_len = 4; unsigned int data_len = POSIX_LOCK_DATA_SIZE; @@ -1412,7 +1412,7 @@ static bool cli_posix_lock_internal(struct cli_state *cli, int fnum, ****************************************************************************/ bool cli_posix_lock(struct cli_state *cli, int fnum, - SMB_BIG_UINT offset, SMB_BIG_UINT len, + uint64_t offset, uint64_t len, bool wait_lock, enum brl_type lock_type) { if (lock_type != READ_LOCK && lock_type != WRITE_LOCK) { @@ -1425,7 +1425,7 @@ bool cli_posix_lock(struct cli_state *cli, int fnum, POSIX Unlock a file. ****************************************************************************/ -bool cli_posix_unlock(struct cli_state *cli, int fnum, SMB_BIG_UINT offset, SMB_BIG_UINT len) +bool cli_posix_unlock(struct cli_state *cli, int fnum, uint64_t offset, uint64_t len) { return cli_posix_lock_internal(cli, fnum, offset, len, False, UNLOCK_LOCK); } @@ -1434,7 +1434,7 @@ bool cli_posix_unlock(struct cli_state *cli, int fnum, SMB_BIG_UINT offset, SMB_ POSIX Get any lock covering a file. ****************************************************************************/ -bool cli_posix_getlock(struct cli_state *cli, int fnum, SMB_BIG_UINT *poffset, SMB_BIG_UINT *plen) +bool cli_posix_getlock(struct cli_state *cli, int fnum, uint64_t *poffset, uint64_t *plen) { return True; } diff --git a/source3/libsmb/cliquota.c b/source3/libsmb/cliquota.c index dcdfec241d9..1462aa7a6ab 100644 --- a/source3/libsmb/cliquota.c +++ b/source3/libsmb/cliquota.c @@ -78,10 +78,10 @@ static bool parse_user_quota_record(const char *rdata, unsigned int rdata_count, * maybe its the change time in NTTIME */ - /* the used space 8 bytes (SMB_BIG_UINT)*/ - qt.usedspace = (SMB_BIG_UINT)IVAL(rdata,16); + /* the used space 8 bytes (uint64_t)*/ + qt.usedspace = (uint64_t)IVAL(rdata,16); #ifdef LARGE_SMB_OFF_T - qt.usedspace |= (((SMB_BIG_UINT)IVAL(rdata,20)) << 32); + qt.usedspace |= (((uint64_t)IVAL(rdata,20)) << 32); #else /* LARGE_SMB_OFF_T */ if ((IVAL(rdata,20) != 0)&& ((qt.usedspace != 0xFFFFFFFF)|| @@ -91,10 +91,10 @@ static bool parse_user_quota_record(const char *rdata, unsigned int rdata_count, } #endif /* LARGE_SMB_OFF_T */ - /* the soft quotas 8 bytes (SMB_BIG_UINT)*/ - qt.softlim = (SMB_BIG_UINT)IVAL(rdata,24); + /* the soft quotas 8 bytes (uint64_t)*/ + qt.softlim = (uint64_t)IVAL(rdata,24); #ifdef LARGE_SMB_OFF_T - qt.softlim |= (((SMB_BIG_UINT)IVAL(rdata,28)) << 32); + qt.softlim |= (((uint64_t)IVAL(rdata,28)) << 32); #else /* LARGE_SMB_OFF_T */ if ((IVAL(rdata,28) != 0)&& ((qt.softlim != 0xFFFFFFFF)|| @@ -104,10 +104,10 @@ static bool parse_user_quota_record(const char *rdata, unsigned int rdata_count, } #endif /* LARGE_SMB_OFF_T */ - /* the hard quotas 8 bytes (SMB_BIG_UINT)*/ - qt.hardlim = (SMB_BIG_UINT)IVAL(rdata,32); + /* the hard quotas 8 bytes (uint64_t)*/ + qt.hardlim = (uint64_t)IVAL(rdata,32); #ifdef LARGE_SMB_OFF_T - qt.hardlim |= (((SMB_BIG_UINT)IVAL(rdata,36)) << 32); + qt.hardlim |= (((uint64_t)IVAL(rdata,36)) << 32); #else /* LARGE_SMB_OFF_T */ if ((IVAL(rdata,36) != 0)&& ((qt.hardlim != 0xFFFFFFFF)|| @@ -216,7 +216,7 @@ bool cli_set_user_quota(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUC sid_len = ndr_size_dom_sid(&pqt->sid, 0); SIVAL(data,0,0); SIVAL(data,4,sid_len); - SBIG_UINT(data, 8,(SMB_BIG_UINT)0); + SBIG_UINT(data, 8,(uint64_t)0); SBIG_UINT(data,16,pqt->usedspace); SBIG_UINT(data,24,pqt->softlim); SBIG_UINT(data,32,pqt->hardlim); @@ -458,10 +458,10 @@ bool cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_ST /* unknown_1 24 NULL bytes in pdata*/ - /* the soft quotas 8 bytes (SMB_BIG_UINT)*/ - qt.softlim = (SMB_BIG_UINT)IVAL(rdata,24); + /* the soft quotas 8 bytes (uint64_t)*/ + qt.softlim = (uint64_t)IVAL(rdata,24); #ifdef LARGE_SMB_OFF_T - qt.softlim |= (((SMB_BIG_UINT)IVAL(rdata,28)) << 32); + qt.softlim |= (((uint64_t)IVAL(rdata,28)) << 32); #else /* LARGE_SMB_OFF_T */ if ((IVAL(rdata,28) != 0)&& ((qt.softlim != 0xFFFFFFFF)|| @@ -471,10 +471,10 @@ bool cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_ST } #endif /* LARGE_SMB_OFF_T */ - /* the hard quotas 8 bytes (SMB_BIG_UINT)*/ - qt.hardlim = (SMB_BIG_UINT)IVAL(rdata,32); + /* the hard quotas 8 bytes (uint64_t)*/ + qt.hardlim = (uint64_t)IVAL(rdata,32); #ifdef LARGE_SMB_OFF_T - qt.hardlim |= (((SMB_BIG_UINT)IVAL(rdata,36)) << 32); + qt.hardlim |= (((uint64_t)IVAL(rdata,36)) << 32); #else /* LARGE_SMB_OFF_T */ if ((IVAL(rdata,36) != 0)&& ((qt.hardlim != 0xFFFFFFFF)|| @@ -562,18 +562,14 @@ cleanup: return ret; } -static const char *quota_str_static(SMB_BIG_UINT val, bool special, bool _numeric) +static const char *quota_str_static(uint64_t val, bool special, bool _numeric) { const char *result; if (!_numeric&&special&&(val == SMB_NTQUOTAS_NO_LIMIT)) { return "NO LIMIT"; } -#if defined(HAVE_LONGLONG) - result = talloc_asprintf(talloc_tos(), "%llu", val); -#else - result = talloc_asprintf(talloc_tos(), "%lu", val); -#endif + result = talloc_asprintf(talloc_tos(), "%"PRIu64, val); SMB_ASSERT(result != NULL); return result; } diff --git a/source3/libsmb/clireadwrite.c b/source3/libsmb/clireadwrite.c index ec632816303..cc982683d08 100644 --- a/source3/libsmb/clireadwrite.c +++ b/source3/libsmb/clireadwrite.c @@ -70,10 +70,10 @@ struct async_req *cli_read_andx_send(TALLOC_CTX *mem_ctx, SSVAL(vwv + 8, 0, 0); SSVAL(vwv + 9, 0, 0); - if ((SMB_BIG_UINT)offset >> 32) { + if ((uint64_t)offset >> 32) { bigoffset = True; SIVAL(vwv + 10, 0, - (((SMB_BIG_UINT)offset)>>32) & 0xffffffff); + (((uint64_t)offset)>>32) & 0xffffffff); wct += 2; } @@ -543,7 +543,7 @@ static bool cli_issue_write(struct cli_state *cli, smb_buf(cli->outbuf) - smb_base(cli->outbuf) + 1); if (large_writex) { - SIVAL(cli->outbuf,smb_vwv12,(((SMB_BIG_UINT)offset)>>32) & 0xffffffff); + SIVAL(cli->outbuf,smb_vwv12,(((uint64_t)offset)>>32) & 0xffffffff); } p = smb_base(cli->outbuf) + SVAL(cli->outbuf,smb_vwv11) -1; -- cgit