diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-05-19 17:22:43 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-05-19 17:22:43 +0000 |
commit | badadc427a99e5483402c21bf5b7ae64722930e9 (patch) | |
tree | a0eb3f187458c32d8ca06dd78dce355e0166a2c2 /src/inspstring.cpp | |
parent | 315b9f6fd9ccbd3a916dc206e2275c46b46da626 (diff) |
Visual studio's ability to translate tabs to four spaces as default frustrates and peplexes tabnazi cat.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7047 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/inspstring.cpp')
-rw-r--r-- | src/inspstring.cpp | 87 |
1 files changed, 43 insertions, 44 deletions
diff --git a/src/inspstring.cpp b/src/inspstring.cpp index f5f607609..98e7228d5 100644 --- a/src/inspstring.cpp +++ b/src/inspstring.cpp @@ -43,60 +43,59 @@ #ifndef HAS_STRLCPY CoreExport size_t strlcat(char *dst, const char *src, size_t siz) { - char *d = dst; - const char *s = src; - size_t n = siz, dlen; + char *d = dst; + const char *s = src; + size_t n = siz, dlen; - while (n-- != 0 && *d != '\0') - d++; + while (n-- != 0 && *d != '\0') + d++; - dlen = d - dst; - n = siz - dlen; + dlen = d - dst; + n = siz - dlen; - if (n == 0) - return(dlen + strlen(s)); + if (n == 0) + return(dlen + strlen(s)); - while (*s != '\0') - { - if (n != 1) - { - *d++ = *s; - n--; - } + while (*s != '\0') + { + if (n != 1) + { + *d++ = *s; + n--; + } - s++; - } + s++; + } - *d = '\0'; - return(dlen + (s - src)); /* count does not include NUL */ + *d = '\0'; + return(dlen + (s - src)); /* count does not include NUL */ } CoreExport size_t strlcpy(char *dst, const char *src, size_t siz) { - char *d = dst; - const char *s = src; - size_t n = siz; - - /* Copy as many bytes as will fit */ - if (n != 0 && --n != 0) - { - do - { - if ((*d++ = *s++) == 0) - break; - } while (--n != 0); - } - - /* Not enough room in dst, add NUL and traverse rest of src */ - if (n == 0) - { - if (siz != 0) - *d = '\0'; /* NUL-terminate dst */ - while (*s++) - ; - } - - return(s - src - 1); /* count does not include NUL */ + char *d = dst; + const char *s = src; + size_t n = siz; + + /* Copy as many bytes as will fit */ + if (n != 0 && --n != 0) + { + do + { + if ((*d++ = *s++) == 0) + break; + } while (--n != 0); + } + + /* Not enough room in dst, add NUL and traverse rest of src */ + if (n == 0) + { + if (siz != 0) + *d = '\0'; /* NUL-terminate dst */ + while (*s++); + } + + return(s - src - 1); /* count does not include NUL */ } #endif |