cpp: use proper size on prepare