Fix error after changes in Memory.h

pull/216/head
castano 14 years ago
parent 25507428c2
commit 2bd7db4244

@ -2,15 +2,14 @@ PROJECT(nvcore)
SET(CORE_SRCS
nvcore.h
Utils.h
Array.h HashMap.h
Array.h
Debug.h Debug.cpp
DefsGnucDarwin.h
DefsGnucLinux.h
DefsGnucWin32.h
DefsVcWin32.h
FileSystem.h FileSystem.cpp
# FileMonitor.h FileMonitor.cpp
HashMap.h
Library.h Library.cpp
Memory.h Memory.cpp
Ptr.h
@ -20,7 +19,8 @@ SET(CORE_SRCS
StdStream.h
TextReader.h TextReader.cpp
TextWriter.h TextWriter.cpp
Timer.h)
Timer.h
Utils.h)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
@ -28,7 +28,7 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
ADD_DEFINITIONS(-DNVCORE_EXPORTS)
IF(UNIX)
SET(LIBS ${LIBS} ${CMAKE_DL_LIBS})
SET(LIBS ${LIBS} ${CMAKE_DL_LIBS})
ENDIF(UNIX)
IF(NVCORE_SHARED)
@ -44,3 +44,5 @@ INSTALL(TARGETS nvcore
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib/static)

@ -503,7 +503,7 @@ namespace nv
new_size = nextPowerOfTwo(new_size);
HashMap<T, U, H, E> new_hash;
new_hash.table = (Entry *) malloc(sizeof(Entry) * new_size);
new_hash.table = malloc<Entry>(new_size);
nvDebugCheck(new_hash.table != NULL);
new_hash.entry_count = 0;

@ -32,17 +32,21 @@ extern "C" {
#endif
// C++ helpers.
template <typename T> T * malloc(size_t count) {
return (T *)::malloc(sizeof(T) * count);
}
namespace nv {
template <typename T> T * realloc(T * ptr, size_t count) {
return (T *)::realloc(ptr, sizeof(T) * count);
}
// C++ helpers.
template <typename T> T * malloc(size_t count) {
return (T *)::malloc(sizeof(T) * count);
}
template <typename T> void free(const T * ptr) {
::free((T *)ptr);
}
template <typename T> T * realloc(T * ptr, size_t count) {
return (T *)::realloc(ptr, sizeof(T) * count);
}
template <typename T> void free(const T * ptr) {
::free((T *)ptr);
}
} // nv namespace
#endif // NV_CORE_MEMORY_H

@ -343,7 +343,7 @@ namespace nv
void allocString(const char * str, int len)
{
const char * ptr = static_cast<const char *>(malloc(2 + len + 1));
const char * ptr = malloc<char>(2 + len + 1);
setData( ptr );
setRefCount( 0 );

Loading…
Cancel
Save