This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug manual/10220] New: Fix inverted memmove parameters in glibc manual example 'file_mbsrtowcs'

On section 6.3.5 - "A Complete Multibyte Conversion Example" the example 
describe an algorithm to convert an NUL-terminated multibyte character string at 
into an equivalent wide character string. It does:

1. read from input file to temp buffer
2. convert characters in temp buffer
3. write to output file the converted characters
4. go to step one, but first copy incomplete sequence to start of temp buffer

The pass four is implemented by a memmove(), taking an incomplete at the end of 
the buffer and repositioning it at the start of the buffer.

 The aforementioned memmove() has its parameters inverted, because it`s
 not putting the remaining characters in the beginning of the buffer.

Instead of:
    memmove (inp, buffer, filled);

It should obviously be:
    memmove (buffer, inp, filled);

           Summary: Fix inverted memmove parameters in glibc manual example
           Product: glibc
           Version: 2.11
            Status: NEW
          Severity: normal
          Priority: P2
         Component: manual
        AssignedTo: roland at gnu dot org
        ReportedBy: andre dot goddard at gmail dot com
                CC: glibc-bugs at sources dot redhat dot com

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]