* [TRIVIAL PATCH 2.5.48] Use min_t() instead of min() in fs/cifs/cifssmb.c
@ 2002-11-21 22:28 Bob Miller
2002-12-02 5:06 ` Rusty Russell
0 siblings, 1 reply; 2+ messages in thread
From: Bob Miller @ 2002-11-21 22:28 UTC (permalink / raw)
To: trivial; +Cc: linux-kernel
This change removes "duplicate 'const'" compiler warnings.
diff -Nru a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
--- a/fs/cifs/cifssmb.c Thu Nov 21 13:51:25 2002
+++ b/fs/cifs/cifssmb.c Thu Nov 21 13:51:26 2002
@@ -483,9 +483,10 @@
pSMB->OffsetLow = cpu_to_le32(lseek & 0xFFFFFFFF);
pSMB->OffsetHigh = cpu_to_le32(lseek >> 32);
pSMB->Remaining = 0;
- pSMB->MaxCount = cpu_to_le16(min(count,
- (tcon->ses->maxBuf -
- MAX_CIFS_HDR_SIZE) & 0xFFFFFF00));
+ pSMB->MaxCount = cpu_to_le16(min_t(const unsigned int,
+ count,
+ (tcon->ses->maxBuf -
+ MAX_CIFS_HDR_SIZE) & 0xFFFFFF00));
pSMB->MaxCountHigh = 0;
pSMB->ByteCount = 0; /* no need to do le conversion since it is 0 */
@@ -1023,9 +1024,10 @@
Protocol +
pSMBr->
DataOffset),
- min(buflen,
- (int) pSMBr->
- DataCount) / 2);
+ min_t(const int,
+ buflen,
+ (int) pSMBr->
+ DataCount) / 2);
cifs_strfromUCS_le(symlinkinfo,
(wchar_t *) ((char *)
&pSMBr->
@@ -1037,9 +1039,10 @@
} else {
strncpy(symlinkinfo,
(char *) &pSMBr->hdr.Protocol +
- pSMBr->DataOffset, min(buflen, (int)
- pSMBr->
- DataCount));
+ pSMBr->DataOffset, min_t(const int,
+ buflen,
+ pSMBr->
+ DataCount));
}
symlinkinfo[buflen] = 0; /* just in case so the calling code does not go off the end of the buffer */
}
--
Bob Miller Email: rem@osdl.org
Open Source Development Lab Phone: 503.626.2455 Ext. 17
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [TRIVIAL PATCH 2.5.48] Use min_t() instead of min() in fs/cifs/cifssmb.c
2002-11-21 22:28 [TRIVIAL PATCH 2.5.48] Use min_t() instead of min() in fs/cifs/cifssmb.c Bob Miller
@ 2002-12-02 5:06 ` Rusty Russell
0 siblings, 0 replies; 2+ messages in thread
From: Rusty Russell @ 2002-12-02 5:06 UTC (permalink / raw)
To: Bob Miller; +Cc: linux-kernel
In message <20021121222838.GA1431@doc.pdx.osdl.net> you write:
>
> This change removes "duplicate 'const'" compiler warnings.
Um, might want to remove the const from min() and max(), which would
be much nicer. It was only there because it worked fine with older
compilers, and I don't think it will effect code generation one bit.
Someone wanna test before and after?
Thanks,
Rusty.
> diff -Nru a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
> --- a/fs/cifs/cifssmb.c Thu Nov 21 13:51:25 2002
> +++ b/fs/cifs/cifssmb.c Thu Nov 21 13:51:26 2002
> @@ -483,9 +483,10 @@
> pSMB->OffsetLow = cpu_to_le32(lseek & 0xFFFFFFFF);
> pSMB->OffsetHigh = cpu_to_le32(lseek >> 32);
> pSMB->Remaining = 0;
> - pSMB->MaxCount = cpu_to_le16(min(count,
> - (tcon->ses->maxBuf -
> - MAX_CIFS_HDR_SIZE) & 0xFFFFFF00));
> + pSMB->MaxCount = cpu_to_le16(min_t(const unsigned int,
> + count,
> + (tcon->ses->maxBuf -
> + MAX_CIFS_HDR_SIZE) & 0xFFFFFF00));
> pSMB->MaxCountHigh = 0;
> pSMB->ByteCount = 0; /* no need to do le conversion since it is 0 */
>
> @@ -1023,9 +1024,10 @@
> Protocol +
> pSMBr->
> DataOffset),
> - min(buflen,
> - (int) pSMBr->
> - DataCount) / 2);
> + min_t(const int,
> + buflen,
> + (int) pSMBr->
> + DataCount) / 2);
> cifs_strfromUCS_le(symlinkinfo,
> (wchar_t *) ((char *)
> &pSMBr->
> @@ -1037,9 +1039,10 @@
> } else {
> strncpy(symlinkinfo,
> (char *) &pSMBr->hdr.Protocol +
> - pSMBr->DataOffset, min(buflen, (int)
> - pSMBr->
> - DataCount));
> + pSMBr->DataOffset, min_t(const int,
> + buflen,
> + pSMBr->
> + DataCount));
> }
> symlinkinfo[buflen] = 0; /* just in case so the
calling code does not go off the end of the buffer */
> }
> --
> Bob Miller Email: rem@osdl.org
> Open Source Development Lab Phone: 503.626.2455 Ext. 17
>
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-12-02 5:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-21 22:28 [TRIVIAL PATCH 2.5.48] Use min_t() instead of min() in fs/cifs/cifssmb.c Bob Miller
2002-12-02 5:06 ` Rusty Russell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome