sachinites / TCPServerLib

Complete Implementation of TCP Server Library in C/C++
GNU General Public License v3.0
14 stars 25 forks source link

isn't there a typo in ByteCircularBuffer.cpp #1

Open nobur opened 2 years ago

nobur commented 2 years ago

At line 110 of ByteCircularBuffer.cpp, is seams that there is a typo if i'm correct. Both "memcpy" lines write at the same address (buffer).

    memcpy(buffer, BCB(bcb, bcb->rear), leading_space);
    memcpy(buffer, BCB(bcb, 0), data_size - leading_space);

shouldn't it be

    memcpy(buffer, BCB(bcb, bcb->rear), leading_space);
    memcpy(buffer + leading_space, BCB(bcb, 0), data_size - leading_space);

instead ?

Regards. Bruno

sachinites commented 1 year ago

yes, IInd line should be

memcpy(buffer + leading_space, BCB(bcb, 0), data_size - leading_space);

I have committed the fix. thanks for pointing it out.

On Fri, Sep 9, 2022 at 6:25 AM nobur @.***> wrote:

At line 110 of ByteCircularBuffer.cpp, is seams that there is a typo if i'm correct. Both "memcpy" lines write at the same address (buffer).

memcpy(buffer, BCB(bcb, bcb->rear), leading_space);
memcpy(buffer, BCB(bcb, 0), data_size - leading_space);

Regards. Bruno

— Reply to this email directly, view it on GitHub https://github.com/sachinites/TCPServerLib/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEHYO3GLLRRUIFMFOG4X2KDV5KDHDANCNFSM6AAAAAAQIHXDSE . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- Thanks & Regards Abhishek Sagar