Linux fixes

This commit is contained in:
Rich Geldreich
2017-01-09 13:54:05 -08:00
6 changed files with 21 additions and 15 deletions
+2
View File
@@ -0,0 +1,2 @@
*.o
crnlib/crunch
+1 -1
View File
@@ -1305,7 +1305,7 @@ namespace crnlib
*pActualComps = 0; *pActualComps = 0;
if ((req_comps < 1) || (req_comps > 4)) if ((req_comps < 1) || (req_comps > 4))
return false; return NULL;
mipmapped_texture tex; mipmapped_texture tex;
+6 -6
View File
@@ -355,7 +355,7 @@ namespace crnlib
inline T* alloc_group(bool nofail = false) inline T* alloc_group(bool nofail = false)
{ {
T* p = static_cast<T*>(alloc_space(N * sizeof(T))); T* p = static_cast<T*>(this->alloc_space(N * sizeof(T)));
if (!p) if (!p)
{ {
@@ -365,7 +365,7 @@ namespace crnlib
CRNLIB_FAIL("Out of memory"); CRNLIB_FAIL("Out of memory");
} }
construct_group(p); this->construct_group(p);
m_num_active_groups++; m_num_active_groups++;
@@ -379,20 +379,20 @@ namespace crnlib
CRNLIB_ASSERT(m_num_active_groups); CRNLIB_ASSERT(m_num_active_groups);
m_num_active_groups--; m_num_active_groups--;
destruct_group(p); this->destruct_group(p);
free_space(p); this->free_space(p);
} }
} }
inline void init_default() inline void init_default()
{ {
construct_element(reinterpret_cast<T*>(m_default)); this->construct_element(reinterpret_cast<T*>(m_default));
} }
inline void deinit_default() inline void deinit_default()
{ {
destruct_element(reinterpret_cast<T*>(m_default)); this->destruct_element(reinterpret_cast<T*>(m_default));
} }
}; };
+1 -1
View File
@@ -21,7 +21,7 @@ namespace crnlib
if (m_capacity >= min_new_capacity) if (m_capacity >= min_new_capacity)
return true; return true;
size_t new_capacity = min_new_capacity; uint new_capacity = min_new_capacity;
if ((grow_hint) && (!math::is_power_of_2(new_capacity))) if ((grow_hint) && (!math::is_power_of_2(new_capacity)))
new_capacity = math::next_pow2(new_capacity); new_capacity = math::next_pow2(new_capacity);
+3 -3
View File
@@ -172,7 +172,7 @@ void *crn_compress(const crn_comp_params &comp_params, crn_uint32 &compressed_si
if (pActual_bitrate) *pActual_bitrate = 0.0f; if (pActual_bitrate) *pActual_bitrate = 0.0f;
if (!comp_params.check()) if (!comp_params.check())
return false; return NULL;
crnlib::vector<uint8> crn_file_data; crnlib::vector<uint8> crn_file_data;
if (!create_compressed_texture(comp_params, crn_file_data, pActual_quality_level, pActual_bitrate)) if (!create_compressed_texture(comp_params, crn_file_data, pActual_quality_level, pActual_bitrate))
@@ -189,7 +189,7 @@ void *crn_compress(const crn_comp_params &comp_params, const crn_mipmap_params &
if (pActual_bitrate) *pActual_bitrate = 0.0f; if (pActual_bitrate) *pActual_bitrate = 0.0f;
if ((!comp_params.check()) || (!mip_params.check())) if ((!comp_params.check()) || (!mip_params.check()))
return false; return NULL;
crnlib::vector<uint8> crn_file_data; crnlib::vector<uint8> crn_file_data;
if (!create_compressed_texture(comp_params, mip_params, crn_file_data, pActual_quality_level, pActual_bitrate)) if (!create_compressed_texture(comp_params, mip_params, crn_file_data, pActual_quality_level, pActual_bitrate))
@@ -456,4 +456,4 @@ bool crn_decompress_block(const void *pSrc_block, crn_uint32 *pDst_pixels_u32, c
} }
return true; return true;
} }
+8 -4
View File
@@ -377,7 +377,11 @@ namespace crnd
#ifdef _WIN64 #ifdef _WIN64
typedef uint64 ptr_bits; typedef uint64 ptr_bits;
#else #else
typedef uint32 ptr_bits; #ifdef __x86_64__
typedef uint64 ptr_bits;
#else
typedef uint32 ptr_bits;
#endif
#endif #endif
template<typename T> struct int_traits { enum { cMin = crnd::cINT32_MIN, cMax = crnd::cINT32_MAX, cSigned = true }; }; template<typename T> struct int_traits { enum { cMin = crnd::cINT32_MIN, cMax = crnd::cINT32_MAX, cSigned = true }; };
@@ -2819,15 +2823,15 @@ namespace crnd
*pSize = 0; *pSize = 0;
if ((!pData) || (data_size < cCRNHeaderMinSize)) if ((!pData) || (data_size < cCRNHeaderMinSize))
return false; return NULL;
crn_header tmp_header; crn_header tmp_header;
const crn_header* pHeader = crnd_get_header(tmp_header, pData, data_size); const crn_header* pHeader = crnd_get_header(tmp_header, pData, data_size);
if (!pHeader) if (!pHeader)
return false; return NULL;
if (level_index >= pHeader->m_levels) if (level_index >= pHeader->m_levels)
return false; return NULL;
uint32 cur_level_ofs = pHeader->m_level_ofs[level_index]; uint32 cur_level_ofs = pHeader->m_level_ofs[level_index];