"Dmitry Timoshkov" dmitry@baikal.ru writes:
"Marcus Meissner" marcus@jet.franken.de wrote:
/***
- This implements the IUnknown method AddRef for this
- class
- */
+static ULONG WINAPI HGLOBALStreamImpl_AddRef(
- IStream* iface)
+{
- HGLOBALStreamImpl* const This=(HGLOBALStreamImpl*)iface;
- return InterlockedIncrement(&This->ref);
+}
I understand that this is an existing code, but calling InterlockedIncrement for a 'const' pointer looks very suspicious. Same for HGLOBALStreamImpl_Release, HGLOBALStreamImpl_Read and other interfaces which actually change the pointed data.
The pointer itself is const, not the data being pointed to. The const in that case simply means that This will not to be changed to point to something else.