mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-02-17 16:50:18 +08:00
Coverity: 1229128 corrected.
This commit is contained in:
parent
85e8e7e945
commit
a8009ba312
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user