Refactored code to compile without warnings. Also changed buffering strategy.
Modified the getConstant function to now return a generic pointer, to reduce the number of type casts being used.