- printf("p_Buffer->tail=%d\n",p_Buffer->tail);
- printf("p_Buffer->head=%d\n",p_Buffer->head);
- if (p_Buffer->head >=BUFFER_SIZE) {
- printf("buffer overflow\n");
- p_Buffer->head -= BUFFER_SIZE; /*wrap the head around the buffer*/
- printf("new p_Buffer->head=%d\n",p_Buffer->head);
-
+// printf("p_Buffer->tail=%d\n",p_Buffer->tail);
+// printf("p_Buffer->head=%d\n",p_Buffer->head);
+ if (p_Buffer->head >=BUFFER_SIZE-1) {
+// printf("buffer overflow\n");
+ p_Buffer->head -= (BUFFER_SIZE-1); /*wrap the head around the buffer*/
+// printf("new p_Buffer->head=%d\n",p_Buffer->head);
+ }