Re: [PATCH 1/4] staging: keucr: Use strncmp() instead of custom StringCmp() and some style cleanups

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Dec 31, 2010 at 10:19:21AM +0100, Javier Martinez Canillas wrote:
>  //----- Check_D_CISdata() ----------------------------------------------
>  int Check_D_CISdata(BYTE *buf, BYTE *redundant)
>  {
> -    BYTE cis[]={0x01,0x03,0xD9,0x01,0xFF,0x18,0x02,0xDF,0x01,0x20};
> +	BYTE cis[] = {0x01, 0x03, 0xD9, 0x01, 0xFF, 0x18, 0x02,
> +		      0xDF, 0x01, 0x20};
>  
> -    if (!IsSSFDCCompliance && !IsXDCompliance)
> -        return(SUCCESS);             // ¥Øe¬°±j¨îUCCESS [Arnold 02-08-23] SSFDC ´ú¤£¯à¨îUCCESS
> +	if (!IsSSFDCCompliance && !IsXDCompliance)
> +		return SUCCESS;
>  
> -    if (!StringCmp((char *)(redundant+0x0D),(char *)EccBuf,3))
> -        return(StringCmp((char *)buf,(char *)cis,10));
> +	if (!strncmp((char *)(redundant+0x0D), (char *)EccBuf, 3))
> +		return strncmp((char *)buf, (char *)cis, 10);


"cis" isn't a string.  I suspect none of these are.  Use memcmp()
instead of strncmp().  With memcmp() you can get rid of the cast.  Also
use sizeof(cis) instead of hardcoding it to 10.

Eventually we should also put all the 0x0D magic variables in defines as
well.

regards,
dan carpenter

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux