[devel] [PATCH for apt 2/2] Fix pointer arithmetics

Aleksei Nikiforov darktemplar на altlinux.org
Пн Дек 9 10:09:24 MSK 2019


09.12.2019 2:31, Dmitry V. Levin пишет:
> On Fri, Dec 06, 2019 at 04:16:06PM +0300, Aleksei Nikiforov wrote:
> [...]
>> diff --git a/apt/apt-pkg/rebase_pointer.h b/apt/apt-pkg/rebase_pointer.h
>> new file mode 100644
>> index 0000000..efc4074
>> --- /dev/null
>> +++ b/apt/apt-pkg/rebase_pointer.h
>> @@ -0,0 +1,16 @@
>> +#ifndef PKGLIB_REBASE_POINTER_H
>> +#define PKGLIB_REBASE_POINTER_H
>> +
>> +template <typename T>
>> +static inline T* RebasePointer(T *ptr, const void * const old_base, const void * const new_base)
>> +{
>> +   return reinterpret_cast<T*>(reinterpret_cast<char*>(ptr) + (reinterpret_cast<char const * const>(new_base) - reinterpret_cast<char const * const>(old_base)));
>> +}
>> +
>> +template <typename T>
>> +static inline const T* RebasePointer(const T *ptr, const void * const old_base, const void * const new_base)
>> +{
>> +   return reinterpret_cast<const T*>(reinterpret_cast<const char*>(ptr) + (reinterpret_cast<char const * const>(new_base) - reinterpret_cast<char const * const>(old_base)));
> 
> This line is way too long - about twice longer than a normal line of code.
> Please break long lines.
> 
> My edition of rebase_pointer.h had the maximum length of all lines within
> the traditional 80-symbol limit.
> 
> 

Sure, I'll update this code.

> 
> _______________________________________________
> Devel mailing list
> Devel на lists.altlinux.org
> https://lists.altlinux.org/mailman/listinfo/devel
> 


Подробная информация о списке рассылки Devel