[cfe-commits] r56242 - /cfe/trunk/lib/Rewrite/RewriteRope.cpp
Zhongxing Xu
xuzhongxing at gmail.com
Tue Sep 16 00:58:21 PDT 2008
Author: zhongxingxu
Date: Tue Sep 16 02:58:21 2008
New Revision: 56242
URL: http://llvm.org/viewvc/llvm-project?rev=56242&view=rev
Log:
Fixed an offset calculation error.
Modified:
cfe/trunk/lib/Rewrite/RewriteRope.cpp
Modified: cfe/trunk/lib/Rewrite/RewriteRope.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/RewriteRope.cpp?rev=56242&r1=56241&r2=56242&view=diff
==============================================================================
--- cfe/trunk/lib/Rewrite/RewriteRope.cpp (original)
+++ cfe/trunk/lib/Rewrite/RewriteRope.cpp Tue Sep 16 02:58:21 2008
@@ -792,7 +792,7 @@
if (AllocBuffer && --AllocBuffer->RefCount == 0)
delete [] (char*)AllocBuffer;
- unsigned AllocSize = sizeof(RopeRefCountString)-1+AllocChunkSize;
+ unsigned AllocSize = offsetof(RopeRefCountString, Data) + AllocChunkSize;
AllocBuffer = reinterpret_cast<RopeRefCountString *>(new char[AllocSize]);
AllocBuffer->RefCount = 0;
memcpy(AllocBuffer->Data, Start, Len);
More information about the cfe-commits
mailing list