From 02f84c6bd0c06c3dacc93d6413d6645367f42744 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 16 Apr 2002 10:40:23 +0000 Subject: i forgot to commit these parts of the string handling patch earlier. Sorry. (This used to be commit bac0093a9713416b1679d1bc167b70f02b06ef78) --- source3/include/smb_macros.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'source3/include') diff --git a/source3/include/smb_macros.h b/source3/include/smb_macros.h index c19be784a1..27a5961651 100644 --- a/source3/include/smb_macros.h +++ b/source3/include/smb_macros.h @@ -169,9 +169,12 @@ #define SMB_ROUNDUP_ALLOCATION(s) ((s) ? (SMB_ROUNDUP((SMB_OFF_T)((s)+1), ((SMB_OFF_T)SMB_ROUNDUP_ALLOCATION_SIZE))) : 0 ) /* Extra macros added by Ying Chen at IBM - speed increase by inlining. */ -#define smb_buf(buf) (buf + smb_size + CVAL(buf,smb_wct)*2) +#define smb_buf(buf) ((buf) + smb_size + CVAL(buf,smb_wct)*2) #define smb_buflen(buf) (SVAL(buf,smb_vwv0 + (int)CVAL(buf, smb_wct)*2)) +/* the remaining number of bytes in smb buffer 'buf' from pointer 'p'. */ +#define smb_bufrem(buf, p) (smb_buflen(buf)-PTR_DIFF(p, smb_buf(buf))) + /* Note that chain_size must be available as an extern int to this macro. */ #define smb_offset(p,buf) (PTR_DIFF(p,buf+4) + chain_size) -- cgit