diff --git a/Core/include/CompressionJob.h b/Core/include/CompressionJob.h index d3b56a4..0c8e6a7 100755 --- a/Core/include/CompressionJob.h +++ b/Core/include/CompressionJob.h @@ -126,9 +126,6 @@ struct CompressionJobList { const CompressionJob *GetJob(uint32 idx) const; uint32 *GetFinishedFlag(uint32 idx) const; - ALIGN(32) uint32 m_CurrentBlockIndex; - ALIGN(32) uint32 m_CurrentJobIndex; - private: CompressionJob *m_Jobs; uint32 m_NumJobs; @@ -137,6 +134,10 @@ struct CompressionJobList { struct FinishedFlag{ ALIGN(32) uint32 m_flag; } *m_FinishedFlags; + + public: + ALIGN(32) uint32 m_CurrentJobIndex; + ALIGN(32) uint32 m_CurrentBlockIndex; }; -#endif // __COMPRESSION_JOBS_H__ \ No newline at end of file +#endif // __COMPRESSION_JOBS_H__ diff --git a/Core/src/CompressionJob.cpp b/Core/src/CompressionJob.cpp index 81324ce..1c90b46 100755 --- a/Core/src/CompressionJob.cpp +++ b/Core/src/CompressionJob.cpp @@ -53,6 +53,8 @@ CompressionJobList::CompressionJobList(const uint32 nJobs) : m_NumJobs(0) , m_TotalNumJobs(nJobs) + , m_CurrentJobIndex(0) + , m_CurrentBlockIndex(0) { m_FinishedFlags = new FinishedFlag[nJobs]; memset(m_FinishedFlags, 0, nJobs * sizeof(m_FinishedFlags[0])); @@ -69,6 +71,8 @@ CompressionJobList::~CompressionJobList() { CompressionJobList::CompressionJobList(const CompressionJobList &other) : m_NumJobs(other.m_NumJobs) , m_TotalNumJobs(other.m_TotalNumJobs) + , m_CurrentJobIndex(other.m_CurrentJobIndex) + , m_CurrentBlockIndex(other.m_CurrentBlockIndex) { uint32 arraySz = m_TotalNumJobs * sizeof(m_Jobs[0]); m_Jobs = (CompressionJob *)malloc(arraySz); @@ -82,6 +86,8 @@ CompressionJobList &CompressionJobList::operator =(const CompressionJobList &oth assert(m_TotalNumJobs == other.m_TotalNumJobs); m_NumJobs = other.m_NumJobs; + m_CurrentJobIndex = other.m_CurrentJobIndex; + m_CurrentBlockIndex = other.m_CurrentBlockIndex; // Get rid of old variables... free(m_Jobs); @@ -108,7 +114,7 @@ bool CompressionJobList::AddJob(const CompressionJob &cj) { } const CompressionJob *CompressionJobList::GetJob(uint32 idx) const { - if(idx <= m_NumJobs) { + if(idx >= m_NumJobs) { return NULL; } @@ -116,9 +122,9 @@ const CompressionJob *CompressionJobList::GetJob(uint32 idx) const { } uint32 *CompressionJobList::GetFinishedFlag(uint32 idx) const { - if(idx <= m_NumJobs) { + if(idx >= m_NumJobs) { return NULL; } return &(m_FinishedFlags[idx].m_flag); -} \ No newline at end of file +}