Coverity: 1229128 corrected.

This commit is contained in:
Ward Fisher 2014-10-03 12:38:32 -06:00
parent 85e8e7e945
commit a8009ba312

View File

@ -200,14 +200,21 @@ j=5 4 3
return TRUE;
}
int
bbHeadpop(Bytebuffer* bb, char* pelem)
/*! Pop head off of a byte buffer.
*
* @param Bytebuffer bb Pointer to Bytebuffer.
* @param char* pelem pointer to location for head element.
*
* @return Returns TRUE on success.
*/
int bbHeadpop(Bytebuffer* bb, char* pelem)
{
if(bb == NULL) return bbFail();
if(bb->length == 0) return bbFail();
*pelem = bb->content[0];
memcpy((void*)&bb->content[0],(void*)&bb->content[1],
sizeof(char)*(bb->length - 1));
memmove((void*)&bb->content[0],
(void*)&bb->content[1],
sizeof(char)*(bb->length - 1));
bb->length--;
return TRUE;
}