[PATCH 4/4] widl: Compute uuids for parameterized types.

Rémi Bernon rbernon at codeweavers.com
Thu Feb 18 04:34:42 CST 2021


On 2/18/21 11:27 AM, Jacek Caban wrote:
> Hi Rémi,
> 
> 
> On 18/02/2021 10:39, Rémi Bernon wrote:
>> +/* SHA1 algorithm
>> + *
>> + * Based on public domain SHA code by Steve Reid<steve at edmweb.com>
>> + */
> 
> 
> A bit more adaptation of the code would be nice, bellow are a few 
> suggestions.
> 
> 
>> +
>> +/****************************************************************************** 
>>
>> + * A_SHAInit (ntdll.@)
> 
> 
> It looks like a copy&paste typo. There are a few more 'ntdll's in the 
> patch. (And as a side note, the whole comment does not feel more 
> informative to me than the function name itself, especially if you 
> renamed it to something like sha1_init).
> 
> 
>> + *
>> + * Initialize a SHA context structure.
>> + *
>> + * PARAMS
>> + *  Context [O] SHA context
>> + *
>> + * RETURNS
>> + *  Nothing
>> + */
> 
> 
> (...)
> 
> 
>> +}
>> +
>> +/****************************************************************************** 
>>
>> + * A_SHAUpdate (ntdll.@)
>> + *
>> + * Update a SHA context with a hashed data from supplied buffer.
>> + *
>> + * PARAMS
>> + *  Context    [O] SHA context
>> + *  Buffer     [I] hashed data
>> + *  BufferSize [I] hashed data size
>> + *
>> + * RETURNS
>> + *  Nothing
>> + */
>> +void A_SHAUpdate(SHA_CTX *Context, const unsigned char *Buffer, UINT 
>> BufferSize)
>> +{
>> +   ULONG BufferContentSize;
>> +
>> +   BufferContentSize = Context->Count[1] & 63;
>> +   Context->Count[1] += BufferSize;
>> +   if (Context->Count[1] < BufferSize)
>> +      Context->Count[0]++;
>> +   Context->Count[0] += (BufferSize >> 29);
>> +
>> +   if (BufferContentSize + BufferSize < 64)
>> +   {
>> +      RtlCopyMemory(&Context->Buffer[BufferContentSize], Buffer,
>> +                    BufferSize);
> 
> 
> memcpy() would be more consistent with the rest of widl.
> 
> 
> Thanks,
> 
> Jacek
> 

Ah yes, I just blindly copied everything from ntdll source and never 
thought about it again.

There's probably not going to be much maintenance to this code, but is 
it alright then to completely rewrite it to make it more consistent with 
widl source, or should we still keep it close to the original code to 
make greps more likely to match both?

Cheers,
-- 
Rémi Bernon <rbernon at codeweavers.com>



More information about the wine-devel mailing list