Skip to content

Commit

Permalink
STYLE: Remove unnecessary (void *) casts from ByteSwapper
Browse files Browse the repository at this point in the history
  • Loading branch information
N-Dekker authored and hjmjohnson committed May 11, 2022
1 parent 1d827a7 commit 230617a
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions Modules/Core/Common/include/itkByteSwapper.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ ByteSwapper<T>::SwapFromSystemToBigEndian(T * p)
case 1:
return;
case 2:
ByteSwapper<T>::Swap2((void *)p);
ByteSwapper<T>::Swap2(p);
return;
case 4:
ByteSwapper<T>::Swap4((void *)p);
ByteSwapper<T>::Swap4(p);
return;
case 8:
ByteSwapper<T>::Swap8((void *)p);
ByteSwapper<T>::Swap8(p);
return;
default:
itkGenericExceptionMacro(<< "Cannot swap number of bytes requested");
Expand Down Expand Up @@ -118,13 +118,13 @@ ByteSwapper<T>::SwapRangeFromSystemToBigEndian(T * p, BufferSizeType num)
case 1:
return;
case 2:
ByteSwapper<T>::Swap2Range((void *)p, num);
ByteSwapper<T>::Swap2Range(p, num);
return;
case 4:
ByteSwapper<T>::Swap4Range((void *)p, num);
ByteSwapper<T>::Swap4Range(p, num);
return;
case 8:
ByteSwapper<T>::Swap8Range((void *)p, num);
ByteSwapper<T>::Swap8Range(p, num);
return;
default:
itkGenericExceptionMacro(<< "Cannot swap number of bytes requested");
Expand Down Expand Up @@ -152,13 +152,13 @@ ByteSwapper<T>::SwapWriteRangeFromSystemToBigEndian(T * p, int num, OStreamType
case 1:
return;
case 2:
ByteSwapper<T>::SwapWrite2Range((void *)p, num, fp);
ByteSwapper<T>::SwapWrite2Range(p, num, fp);
return;
case 4:
ByteSwapper<T>::SwapWrite4Range((void *)p, num, fp);
ByteSwapper<T>::SwapWrite4Range(p, num, fp);
return;
case 8:
ByteSwapper<T>::SwapWrite8Range((void *)p, num, fp);
ByteSwapper<T>::SwapWrite8Range(p, num, fp);
return;
default:
itkGenericExceptionMacro(<< "Cannot swap number of bytes requested");
Expand All @@ -179,13 +179,13 @@ ByteSwapper<T>::SwapFromSystemToLittleEndian(T * p)
case 1:
return;
case 2:
ByteSwapper<T>::Swap2((void *)p);
ByteSwapper<T>::Swap2(p);
return;
case 4:
ByteSwapper<T>::Swap4((void *)p);
ByteSwapper<T>::Swap4(p);
return;
case 8:
ByteSwapper<T>::Swap8((void *)p);
ByteSwapper<T>::Swap8(p);
return;
default:
itkGenericExceptionMacro(<< "Cannot swap number of bytes requested");
Expand All @@ -209,13 +209,13 @@ ByteSwapper<T>::SwapRangeFromSystemToLittleEndian(T * p, BufferSizeType num)
case 1:
return;
case 2:
ByteSwapper<T>::Swap2Range((void *)p, num);
ByteSwapper<T>::Swap2Range(p, num);
return;
case 4:
ByteSwapper<T>::Swap4Range((void *)p, num);
ByteSwapper<T>::Swap4Range(p, num);
return;
case 8:
ByteSwapper<T>::Swap8Range((void *)p, num);
ByteSwapper<T>::Swap8Range(p, num);
return;
default:
itkGenericExceptionMacro(<< "Cannot swap number of bytes requested");
Expand All @@ -239,13 +239,13 @@ ByteSwapper<T>::SwapWriteRangeFromSystemToLittleEndian(T * p, int num, OStreamTy
case 1:
return;
case 2:
ByteSwapper<T>::SwapWrite2Range((void *)p, num, fp);
ByteSwapper<T>::SwapWrite2Range(p, num, fp);
return;
case 4:
ByteSwapper<T>::SwapWrite4Range((void *)p, num, fp);
ByteSwapper<T>::SwapWrite4Range(p, num, fp);
return;
case 8:
ByteSwapper<T>::SwapWrite8Range((void *)p, num, fp);
ByteSwapper<T>::SwapWrite8Range(p, num, fp);
return;
default:
itkGenericExceptionMacro(<< "Cannot swap number of bytes requested");
Expand Down Expand Up @@ -478,7 +478,7 @@ ByteSwapper<T>::SwapWrite8Range(void * ptr, BufferSizeType num, OStreamType * fp
{
memcpy(cpy, ptr, chunkSize * 8);

ByteSwapper<T>::Swap8Range((void *)cpy, chunkSize);
ByteSwapper<T>::Swap8Range(cpy, chunkSize);

fp->write((char *)cpy, static_cast<std::streamsize>(8 * chunkSize));
ptr = (char *)ptr + chunkSize * 8;
Expand Down

0 comments on commit 230617a

Please sign in to comment.