lib: Fix blank line endings
authorVolker Lendecke <vl@samba.org>
Sun, 7 Dec 2014 13:13:51 +0000 (14:13 +0100)
committerJeremy Allison <jra@samba.org>
Tue, 9 Dec 2014 03:12:07 +0000 (04:12 +0100)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
lib/util/charset/iconv.c
lib/util/idtree.c
lib/util/util_file.c

index f4815f1717ea46e6c6b6929506484081457d6ef2..bf561f26619d9764213dbf705e69942f9f996d23 100644 (file)
@@ -1,19 +1,19 @@
-/* 
+/*
    Unix SMB/CIFS implementation.
    minimal iconv implementation
    Copyright (C) Andrew Tridgell 2001
    Copyright (C) Jelmer Vernooij 2002
-   
+
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
-   
+
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
-   
+
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
@@ -80,7 +80,7 @@ static const struct charset_functions builtin_functions[] = {
        {"ASCII", ascii_pull, ascii_push},
        {"646", ascii_pull, ascii_push},
        {"ISO-8859-1", latin1_pull, latin1_push},
-#ifdef DEVELOPER       
+#ifdef DEVELOPER
        {"WEIRD", weird_pull, weird_push, true},
 #endif
 #ifdef DARWINOS
@@ -94,12 +94,12 @@ static const struct charset_functions builtin_functions[] = {
 /* if there was an error then reset the internal state,
    this ensures that we don't have a shift state remaining for
    character sets like SJIS */
-static size_t sys_iconv(void *cd, 
+static size_t sys_iconv(void *cd,
                        const char **inbuf, size_t *inbytesleft,
                        char **outbuf, size_t *outbytesleft)
 {
-       size_t ret = iconv((iconv_t)cd, 
-                          discard_const_p(char *, inbuf), inbytesleft, 
+       size_t ret = iconv((iconv_t)cd,
+                          discard_const_p(char *, inbuf), inbytesleft,
                           outbuf, outbytesleft);
        if (ret == (size_t)-1) iconv(cd, NULL, NULL, NULL, NULL);
        return ret;
@@ -112,13 +112,13 @@ static size_t sys_iconv(void *cd,
  * It only knows about a very small number of character sets - just
  * enough that Samba works on systems that don't have iconv.
  **/
-_PUBLIC_ size_t smb_iconv(smb_iconv_t cd, 
+_PUBLIC_ size_t smb_iconv(smb_iconv_t cd,
                 const char **inbuf, size_t *inbytesleft,
                 char **outbuf, size_t *outbytesleft)
 {
        /* in many cases we can go direct */
        if (cd->direct) {
-               return cd->direct(cd->cd_direct, 
+               return cd->direct(cd->cd_direct,
                                  inbuf, inbytesleft, outbuf, outbytesleft);
        }
 
@@ -189,7 +189,7 @@ _PUBLIC_ smb_iconv_t smb_iconv_open_ex(TALLOC_CTX *mem_ctx, const char *tocode,
        int i;
 
        ret = (smb_iconv_t)talloc_named(mem_ctx,
-                                       sizeof(*ret), 
+                                       sizeof(*ret),
                                        "iconv(%s,%s)", tocode, fromcode);
        if (!ret) {
                errno = ENOMEM;
@@ -211,7 +211,7 @@ _PUBLIC_ smb_iconv_t smb_iconv_open_ex(TALLOC_CTX *mem_ctx, const char *tocode,
                                from = &builtin_functions[i];
                        }
                }
-               if (strcasecmp(tocode, builtin_functions[i].name) == 0) { 
+               if (strcasecmp(tocode, builtin_functions[i].name) == 0) {
                        if (use_builtin_handlers || builtin_functions[i].samba_internal_charset) {
                                to = &builtin_functions[i];
                        }
@@ -232,7 +232,7 @@ _PUBLIC_ smb_iconv_t smb_iconv_open_ex(TALLOC_CTX *mem_ctx, const char *tocode,
                        ret->pull = sys_iconv;
                }
        }
-       
+
        if (to == NULL) {
                ret->cd_push = iconv_open(tocode, "UTF-16LE");
                if (ret->cd_push == (iconv_t)-1)
@@ -246,7 +246,7 @@ _PUBLIC_ smb_iconv_t smb_iconv_open_ex(TALLOC_CTX *mem_ctx, const char *tocode,
        if (ret->pull == NULL && from == NULL) {
                goto failed;
        }
-       
+
        if (ret->push == NULL && to == NULL) {
                goto failed;
        }
@@ -340,7 +340,7 @@ static size_t ascii_pull(void *cd, const char **inbuf, size_t *inbytesleft,
                errno = E2BIG;
                return -1;
        }
-       
+
        return 0;
 }
 
@@ -379,7 +379,7 @@ static size_t ascii_push(void *cd, const char **inbuf, size_t *inbytesleft,
                errno = E2BIG;
                return -1;
        }
-       
+
        return ir_count;
 }
 
@@ -469,7 +469,7 @@ static size_t ucs2hex_pull(void *cd, const char **inbuf, size_t *inbytesleft,
                        errno = EINVAL;
                        return -1;
                }
-               
+
                if (sscanf(&(*inbuf)[1], "%04x", &v) != 1) {
                        errno = EILSEQ;
                        return -1;
@@ -487,7 +487,7 @@ static size_t ucs2hex_pull(void *cd, const char **inbuf, size_t *inbytesleft,
                errno = E2BIG;
                return -1;
        }
-       
+
        return 0;
 }
 
@@ -497,7 +497,7 @@ static size_t ucs2hex_push(void *cd, const char **inbuf, size_t *inbytesleft,
        while (*inbytesleft >= 2 && *outbytesleft >= 1) {
                char buf[6];
 
-               if ((*inbuf)[1] == 0 && 
+               if ((*inbuf)[1] == 0 &&
                    ((*inbuf)[0] & 0x80) == 0 &&
                    (*inbuf)[0] != '@') {
                        (*outbuf)[0] = (*inbuf)[0];
@@ -528,7 +528,7 @@ static size_t ucs2hex_push(void *cd, const char **inbuf, size_t *inbytesleft,
                errno = E2BIG;
                return -1;
        }
-       
+
        return 0;
 }
 
@@ -618,7 +618,7 @@ static size_t utf8_pull(void *cd, const char **inbuf, size_t *inbytesleft,
 
                if ((c[0] & 0xf0) == 0xe0) {
                        if (in_left < 3 ||
-                           (c[1] & 0xc0) != 0x80 || 
+                           (c[1] & 0xc0) != 0x80 ||
                            (c[2] & 0xc0) != 0x80) {
                                errno = EILSEQ;
                                goto error;
@@ -635,15 +635,15 @@ static size_t utf8_pull(void *cd, const char **inbuf, size_t *inbytesleft,
                if ((c[0] & 0xf8) == 0xf0) {
                        unsigned int codepoint;
                        if (in_left < 4 ||
-                           (c[1] & 0xc0) != 0x80 || 
+                           (c[1] & 0xc0) != 0x80 ||
                            (c[2] & 0xc0) != 0x80 ||
                            (c[3] & 0xc0) != 0x80) {
                                errno = EILSEQ;
                                goto error;
                        }
-                       codepoint = 
-                               (c[3]&0x3f) | 
-                               ((c[2]&0x3f)<<6) | 
+                       codepoint =
+                               (c[3]&0x3f) |
+                               ((c[2]&0x3f)<<6) |
                                ((c[1]&0x3f)<<12) |
                                ((c[0]&0x7)<<18);
                        if (codepoint < 0x10000) {
@@ -758,7 +758,7 @@ static size_t utf8_push(void *cd, const char **inbuf, size_t *inbytesleft,
                        c[0] = 0xe0 | (codepoint >> 12);
                        c[1] = 0x80 | ((codepoint >> 6) & 0x3f);
                        c[2] = 0x80 | (codepoint & 0x3f);
-                       
+
                        in_left  -= 2;
                        out_left -= 3;
                        uc  += 2;
@@ -775,9 +775,9 @@ static size_t utf8_push(void *cd, const char **inbuf, size_t *inbytesleft,
                        errno = EILSEQ;
                        goto error;
                }
-               codepoint = 0x10000 + (uc[2] | ((uc[3] & 0x3)<<8) | 
+               codepoint = 0x10000 + (uc[2] | ((uc[3] & 0x3)<<8) |
                                       (uc[0]<<10) | ((uc[1] & 0x3)<<18));
-               
+
                if (out_left < 4) {
                        errno = E2BIG;
                        goto error;
@@ -786,7 +786,7 @@ static size_t utf8_push(void *cd, const char **inbuf, size_t *inbytesleft,
                c[1] = 0x80 | ((codepoint >> 12) & 0x3f);
                c[2] = 0x80 | ((codepoint >> 6) & 0x3f);
                c[3] = 0x80 | (codepoint & 0x3f);
-               
+
                in_left  -= 4;
                out_left -= 4;
                uc       += 4;
@@ -807,7 +807,7 @@ static size_t utf8_push(void *cd, const char **inbuf, size_t *inbytesleft,
        *outbytesleft = out_left;
        *inbuf  = (const char *)uc;
        *outbuf = (char *)c;
-       
+
        return 0;
 
 error:
@@ -853,7 +853,7 @@ static size_t utf16_munged_pull(void *cd, const char **inbuf, size_t *inbyteslef
                        unsigned int codepoint2;
                        if (in_left < 4) {
                                codepoint = 0xfffd;
-                               goto codepoint16;                               
+                               goto codepoint16;
                        }
                        codepoint2 = uc[2] | (uc[3]<<8);
                        if ((codepoint2 & 0xfc00) != 0xdc00) {
@@ -883,12 +883,12 @@ static size_t utf16_munged_pull(void *cd, const char **inbuf, size_t *inbyteslef
        codepoint16:
                c[0] = codepoint & 0xFF;
                c[1] = (codepoint>>8) & 0xFF;
-               
+
                in_left  -= 2;
                out_left -= 2;
                uc  += 2;
                c   += 2;
-               continue;               
+               continue;
        }
 
        if (in_left == 1) {
@@ -905,7 +905,7 @@ static size_t utf16_munged_pull(void *cd, const char **inbuf, size_t *inbyteslef
        *outbytesleft = out_left;
        *inbuf  = (const char *)uc;
        *outbuf = (char *)c;
-       
+
        return 0;
 
 error:
index 6f1a4ac9dd00f45e3bd66b6a79a6309c2eaeea1f..0056c0961aa1857a151b2779c4fa37f0162f65dd 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
    Unix SMB/CIFS implementation.
 
    very efficient functions to manage mapping a id (such as a fnum) to
@@ -6,20 +6,20 @@
 
    Copyright (C) Andrew Tridgell 2004
 
-   This code is derived from lib/idr.c in the 2.6 Linux kernel, which was 
+   This code is derived from lib/idr.c in the 2.6 Linux kernel, which was
    written by Jim Houston jim.houston@ccur.com, and is
    Copyright (C) 2002 by Concurrent Computer Corporation
-    
+
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.
-   
+
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
-   
+
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
@@ -53,7 +53,7 @@
 #define set_bit(bit, v) (v) |= (1<<(bit))
 #define clear_bit(bit, v) (v) &= ~(1<<(bit))
 #define test_bit(bit, v) ((v) & (1<<(bit)))
-                                  
+
 struct idr_layer {
        uint32_t                 bitmap;
        struct idr_layer        *ary[IDR_SIZE];
@@ -195,7 +195,7 @@ static int idr_get_new_above_int(struct idr_context *idp, void *ptr, int startin
        int layers, v, id;
 
        idr_pre_get(idp);
-       
+
        id = starting_id;
 build_up:
        p = idp->top;
@@ -309,7 +309,7 @@ static int _idr_remove(struct idr_context *idp, int id)
                return -1;
        }
 
-       if ( idp->top && idp->top->count == 1 && 
+       if ( idp->top && idp->top->count == 1 &&
             (idp->layers > 1) &&
             idp->top->ary[0]) {
                /* We can drop a layer */
index 886bcae477abf55e368809e1de525d011210700e..83c746b654bec9247d21266a816d5df8d070dad7 100644 (file)
@@ -4,17 +4,17 @@
  * Copyright (C) Andrew Tridgell 1992-1998 Modified by Jeremy Allison 1995.
  *
  * Added afdgets() Jelmer Vernooij 2005
- * 
+ *
  * This program is free software; you can redistribute it and/or modify it under
  * the terms of the GNU General Public License as published by the Free
  * Software Foundation; either version 3 of the License, or (at your option)
  * any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful, but WITHOUT
  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
  * more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License along with
  * this program; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -32,7 +32,7 @@
  */
 
 /**
-read a line from a file with possible \ continuation chars. 
+read a line from a file with possible \ continuation chars.
 Blanks at the start or end of a line are stripped.
 The string will be allocated if s2 is NULL
 **/
@@ -78,7 +78,7 @@ _PUBLIC_ char *fgets_slash(char *s2,int maxlen,XFILE *f)
            }
          return(s);
        case EOF:
-         if (len <= 0 && !s2) 
+         if (len <= 0 && !s2)
            SAFE_FREE(s);
          return(len>0?s:NULL);
        case ' ':
@@ -93,7 +93,7 @@ _PUBLIC_ char *fgets_slash(char *s2,int maxlen,XFILE *f)
       if (!s2 && len > maxlen-3)
        {
          char *t;
-         
+
          maxlen *= 2;
          t = realloc_p(s, char, maxlen);
          if (!t) {
@@ -107,7 +107,7 @@ _PUBLIC_ char *fgets_slash(char *s2,int maxlen,XFILE *f)
 }
 
 /**
- * Read one line (data until next newline or eof) and allocate it 
+ * Read one line (data until next newline or eof) and allocate it
  */
 _PUBLIC_ char *afdgets(int fd, TALLOC_CTX *mem_ctx, size_t hint)
 {
@@ -200,7 +200,7 @@ _PUBLIC_ char *file_load(const char *fname, size_t *size, size_t maxsize, TALLOC
        char *p;
 
        if (!fname || !*fname) return NULL;
-       
+
        fd = open(fname,O_RDONLY);
        if (fd == -1) return NULL;
 
@@ -256,7 +256,7 @@ bool unmap_file(void *start, size_t size)
 #ifdef HAVE_MMAP
        if (munmap( start, size ) != 0) {
                DEBUG( 1, ("map_file: Failed to unmap address %p "
-                       "of size %u - %s\n", 
+                       "of size %u - %s\n",
                        start, (unsigned int)size, strerror(errno) ));
                return false;
        }
@@ -286,10 +286,10 @@ char **file_lines_parse(char *p, size_t size, int *numlines, TALLOC_CTX *mem_ctx
        if (!ret) {
                talloc_free(p);
                return NULL;
-       }       
-       
+       }
+
        talloc_steal(ret, p);
-       
+
        memset(ret, 0, sizeof(ret[0])*(i+2));
 
        ret[0] = p;
@@ -315,7 +315,7 @@ char **file_lines_parse(char *p, size_t size, int *numlines, TALLOC_CTX *mem_ctx
 
 /**
 load a file into memory and return an array of pointers to lines in the file
-must be freed with talloc_free(). 
+must be freed with talloc_free().
 **/
 _PUBLIC_ char **file_lines_load(const char *fname, int *numlines, size_t maxsize, TALLOC_CTX *mem_ctx)
 {