diff options
| author | Wei Mao <[email protected]> | 2017-03-21 12:59:49 -0700 |
|---|---|---|
| committer | Wei Mao <[email protected]> | 2017-03-21 12:59:49 -0700 |
| commit | 3e230151ec6c58be8c7e65082a5f75e1652526d5 (patch) | |
| tree | 2dfef6c108e818112de4e73332b5abb87bbf4746 /setup/devcon | |
| parent | 0fcda712a220abea5dc7a6e60c4f406ca14d34dc (diff) | |
Fix an trailing \r\n issue
Diffstat (limited to 'setup/devcon')
| -rw-r--r-- | setup/devcon/devcon.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/setup/devcon/devcon.cpp b/setup/devcon/devcon.cpp index 1328b91c..b1bdbf2a 100644 --- a/setup/devcon/devcon.cpp +++ b/setup/devcon/devcon.cpp @@ -56,20 +56,18 @@ Return Value: if(locbuffer) { if(count) { - int c; - int back = 0; - // // strip any trailing "\r\n"s and replace by a single "\n" - // - while(((c = *CharPrev(locbuffer,locbuffer+count)) == TEXT('\r')) || - (c == TEXT('\n'))) { - count--; - back++; - } - if(back) { - locbuffer[count++] = TEXT('\n'); - locbuffer[count] = TEXT('\0'); + LPTSTR p, q; + for(p = q = locbuffer; *p != TEXT('\0'); p++) { + if(p != q) { + *q = *p; + } + if(*p != TEXT('\r')) { + q++; + } } + *q = TEXT('\0'); + // // now write to apropriate stream // |
