From a7acf10566af549eb71e7a421397c8073d55e0f6 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 16 Aug 1998 03:04:06 +0000 Subject: server.c: fixed a bug in close_file() with the new files.c handling code bitmap.c: added bitmap hanlding code in preparation for increasing the default max open files to several thousand (This used to be commit f573a65b67e7a57586fec57845598e49b157ee0a) --- source3/lib/bitmap.c | 121 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 source3/lib/bitmap.c (limited to 'source3/lib/bitmap.c') diff --git a/source3/lib/bitmap.c b/source3/lib/bitmap.c new file mode 100644 index 0000000000..f67ea994e5 --- /dev/null +++ b/source3/lib/bitmap.c @@ -0,0 +1,121 @@ +/* + Unix SMB/Netbios implementation. + Version 1.9. + simple bitmap functions + Copyright (C) Andrew Tridgell 1992-1998 + + 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, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "includes.h" + +/* these functions provide a simple way to allocate integers from a + pool without repitition */ + + +/**************************************************************************** +allocate a bitmap of the specified size +****************************************************************************/ +struct bitmap *bitmap_allocate(int n) +{ + struct bitmap *bm; + + bm = (struct bitmap *)malloc(sizeof(*bm)); + bm->n = n; + + if (!bm) return NULL; + + bm->b = (uint32 *)malloc(sizeof(bm->b[0])*(n+31)/32); + if (!bm->b) { + free(bm); + return NULL; + } + + memset(bm->b, 0, sizeof(bm->b[0])*bm->n); + + return bm; +} + +/**************************************************************************** +free a bitmap structure +****************************************************************************/ +void bitmap_free(struct bitmap *bm) +{ + free(bm->b); + bm->b = NULL; + free(bm); +} + + +/**************************************************************************** +set a bit in a bitmap +****************************************************************************/ +BOOL bitmap_set(struct bitmap *bm, unsigned i) +{ + if (i >= bm->n) return False; + bm->b[i/32] |= (1<<(i%32)); + return True; +} + +/**************************************************************************** +query a bit in a bitmap +****************************************************************************/ +BOOL bitmap_query(struct bitmap *bm, unsigned i) +{ + if (i >= bm->n) return False; + if (bm->b[i/32] & (1<<(i%32))) { + return True; + } + return False; +} + +/**************************************************************************** +find a zero bit in a bitmap starting at the specified offset, with +wraparound +****************************************************************************/ +int bitmap_find(struct bitmap *bm, unsigned ofs) +{ + int i, j; + + if (ofs > bm->n) ofs = 0; + + i = ofs; + while (i < bm->n) { + if (~(bm->b[i/32])) { + j = i; + do { + if (!bitmap_query(bm, j)) return j; + j++; + } while (j & 31 && j < bm->n); + } + i += 32; + i &= ~31; + } + + i = 0; + while (i < ofs) { + if (~(bm->b[i/32])) { + j = i; + do { + if (!bitmap_query(bm, j)) return j; + j++; + } while (j & 31 && j < bm->n); + } + i += 32; + i &= ~31; + } + + return -1; +} -- cgit From 739d0b1ddc58bbb792c3eebe8c545602a4fae438 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 16 Aug 1998 04:08:47 +0000 Subject: got rid of the Files[] array completely (previously I'd just made it private to files.c) It now is a doubly linked list with a bitmap for allocated file numbers. Similarly for the fd_ptr code. I also changed the default maximum number of open files to 4096. The static cost is 1 bit per file. It all seems to work, and it passes the "does Sue scream" test, but if you see weird behaviour then please investigate. With the volume of new code that has gone in there are bound to be one or two bugs lurking. note that you must do a "make clean" before building this as many data structures have changed in size. (This used to be commit 79755ce97004b787d7e83a8d18fc4c7c003b7231) --- source3/lib/bitmap.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'source3/lib/bitmap.c') diff --git a/source3/lib/bitmap.c b/source3/lib/bitmap.c index f67ea994e5..ab84a2a84e 100644 --- a/source3/lib/bitmap.c +++ b/source3/lib/bitmap.c @@ -43,7 +43,7 @@ struct bitmap *bitmap_allocate(int n) return NULL; } - memset(bm->b, 0, sizeof(bm->b[0])*bm->n); + memset(bm->b, 0, sizeof(bm->b[0])*(n+31)/32); return bm; } @@ -69,6 +69,16 @@ BOOL bitmap_set(struct bitmap *bm, unsigned i) return True; } +/**************************************************************************** +clear a bit in a bitmap +****************************************************************************/ +BOOL bitmap_clear(struct bitmap *bm, unsigned i) +{ + if (i >= bm->n) return False; + bm->b[i/32] &= ~(1<<(i%32)); + return True; +} + /**************************************************************************** query a bit in a bitmap ****************************************************************************/ -- cgit From f2d538a105a61ce6d2852700fc328e15ac158827 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 17 Aug 1998 03:06:20 +0000 Subject: some cleanups from the conversion of Pipes[] to a linked list. I also removed most cases where a pnum is used and substituted a pipes_struct*. in files.c I added a offset of 0x1000 to all file handles on the wire. This makes it much less likely that bad parsing will give us the wrong field. (This used to be commit 8bc2627ff28d340db65bfa017daca2dc291d5ef7) --- source3/lib/bitmap.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'source3/lib/bitmap.c') diff --git a/source3/lib/bitmap.c b/source3/lib/bitmap.c index ab84a2a84e..ce677f7846 100644 --- a/source3/lib/bitmap.c +++ b/source3/lib/bitmap.c @@ -21,6 +21,8 @@ #include "includes.h" +extern int DEBUGLEVEL; + /* these functions provide a simple way to allocate integers from a pool without repitition */ @@ -64,7 +66,11 @@ set a bit in a bitmap ****************************************************************************/ BOOL bitmap_set(struct bitmap *bm, unsigned i) { - if (i >= bm->n) return False; + if (i >= bm->n) { + DEBUG(0,("Setting invalid bitmap entry %d (of %d)\n", + i, bm->n)); + return False; + } bm->b[i/32] |= (1<<(i%32)); return True; } @@ -74,7 +80,11 @@ clear a bit in a bitmap ****************************************************************************/ BOOL bitmap_clear(struct bitmap *bm, unsigned i) { - if (i >= bm->n) return False; + if (i >= bm->n) { + DEBUG(0,("clearing invalid bitmap entry %d (of %d)\n", + i, bm->n)); + return False; + } bm->b[i/32] &= ~(1<<(i%32)); return True; } @@ -82,7 +92,7 @@ BOOL bitmap_clear(struct bitmap *bm, unsigned i) /**************************************************************************** query a bit in a bitmap ****************************************************************************/ -BOOL bitmap_query(struct bitmap *bm, unsigned i) +static BOOL bitmap_query(struct bitmap *bm, unsigned i) { if (i >= bm->n) return False; if (bm->b[i/32] & (1<<(i%32))) { -- cgit From e9ea36e4d2270bd7d32da12ef6d6e2299641582d Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 5 Sep 1998 05:07:05 +0000 Subject: tridge the destroyer returns! prompted by the interpret_security() dead code that Jean-Francois pointed out I added a make target "finddead" that finds potentially dead (ie. unused) code. It spat out 304 function names ... I went through these are deleted many of them, making others static (finddead also reports functions that are used only in the local file). in doing this I have almost certainly deleted some useful code. I may have even prevented compilation with some compile options. I apologise. I decided it was better to get rid of this code now and add back the one or two functions that are needed than to keep all this baggage. So, if I have done a bit too much "destroying" then let me know. Keep the swearing to a minimum :) One bit I didn't do is the ubibt code. Chris, can you look at that? Heaps of unused functions there. Can they be made static? (This used to be commit 2204475c87f3024ea8fd1fbd7385b2def617a46f) --- source3/lib/bitmap.c | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'source3/lib/bitmap.c') diff --git a/source3/lib/bitmap.c b/source3/lib/bitmap.c index ce677f7846..9ccdbb420b 100644 --- a/source3/lib/bitmap.c +++ b/source3/lib/bitmap.c @@ -50,17 +50,6 @@ struct bitmap *bitmap_allocate(int n) return bm; } -/**************************************************************************** -free a bitmap structure -****************************************************************************/ -void bitmap_free(struct bitmap *bm) -{ - free(bm->b); - bm->b = NULL; - free(bm); -} - - /**************************************************************************** set a bit in a bitmap ****************************************************************************/ -- cgit From d71c04f927cbcbaae0708c1533748caac20ee5af Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 4 Oct 1998 04:48:17 +0000 Subject: use dummy file descriptors opened on /dev/null to ensure that the smbw file descriptor allocation order is identical to the kernels. (This used to be commit 60a683465647932f7241ba9f92443d5e5294e20b) --- source3/lib/bitmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/lib/bitmap.c') diff --git a/source3/lib/bitmap.c b/source3/lib/bitmap.c index 9ccdbb420b..93c821c528 100644 --- a/source3/lib/bitmap.c +++ b/source3/lib/bitmap.c @@ -81,7 +81,7 @@ BOOL bitmap_clear(struct bitmap *bm, unsigned i) /**************************************************************************** query a bit in a bitmap ****************************************************************************/ -static BOOL bitmap_query(struct bitmap *bm, unsigned i) +BOOL bitmap_query(struct bitmap *bm, unsigned i) { if (i >= bm->n) return False; if (bm->b[i/32] & (1<<(i%32))) { -- cgit From 3db52feb1f3b2c07ce0b06ad4a7099fa6efe3fc7 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 13 Dec 1999 13:27:58 +0000 Subject: first pass at updating head branch to be to be the same as the SAMBA_2_0 branch (This used to be commit 453a822a76780063dff23526c35408866d0c0154) --- source3/lib/bitmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/lib/bitmap.c') diff --git a/source3/lib/bitmap.c b/source3/lib/bitmap.c index 93c821c528..1813d63ff7 100644 --- a/source3/lib/bitmap.c +++ b/source3/lib/bitmap.c @@ -35,10 +35,10 @@ struct bitmap *bitmap_allocate(int n) struct bitmap *bm; bm = (struct bitmap *)malloc(sizeof(*bm)); - bm->n = n; if (!bm) return NULL; + bm->n = n; bm->b = (uint32 *)malloc(sizeof(bm->b[0])*(n+31)/32); if (!bm->b) { free(bm); -- cgit From da3053048c3d224a20d6383ac6682d31059cd46c Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sun, 11 Mar 2001 00:32:10 +0000 Subject: Merge of new 2.2 code into HEAD (Gerald I hate you :-) :-). Allows new SAMR RPC code to merge with new passdb code. Currently rpcclient doesn't compile. I'm working on it... Jeremy. (This used to be commit 0be41d5158ea4e645e93e8cd30617c038416e549) --- source3/lib/bitmap.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'source3/lib/bitmap.c') diff --git a/source3/lib/bitmap.c b/source3/lib/bitmap.c index 1813d63ff7..7625f52909 100644 --- a/source3/lib/bitmap.c +++ b/source3/lib/bitmap.c @@ -50,6 +50,21 @@ struct bitmap *bitmap_allocate(int n) return bm; } +/**************************************************************************** +free a bitmap. +****************************************************************************/ + +void bitmap_free(struct bitmap *bm) +{ + if (!bm) + return; + + if(bm->b) + free(bm->b); + + free(bm); +} + /**************************************************************************** set a bit in a bitmap ****************************************************************************/ -- cgit From 484a7c0341fe033fe26fe1e6b597ed1c456c39d4 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 17 Sep 2001 02:19:44 +0000 Subject: move to SAFE_FREE() (This used to be commit 60e907b7e8e1c008463a88ed2b076344278986ef) --- source3/lib/bitmap.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'source3/lib/bitmap.c') diff --git a/source3/lib/bitmap.c b/source3/lib/bitmap.c index 7625f52909..2ae9defb2d 100644 --- a/source3/lib/bitmap.c +++ b/source3/lib/bitmap.c @@ -41,7 +41,7 @@ struct bitmap *bitmap_allocate(int n) bm->n = n; bm->b = (uint32 *)malloc(sizeof(bm->b[0])*(n+31)/32); if (!bm->b) { - free(bm); + SAFE_FREE(bm); return NULL; } @@ -59,10 +59,8 @@ void bitmap_free(struct bitmap *bm) if (!bm) return; - if(bm->b) - free(bm->b); - - free(bm); + SAFE_FREE(bm->b); + SAFE_FREE(bm); } /**************************************************************************** -- cgit From dc1fc3ee8ec2199bc73bb5d7ec711c6800f61d65 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Tue, 2 Oct 2001 04:29:50 +0000 Subject: Removed 'extern int DEBUGLEVEL' as it is now in the smb.h header. (This used to be commit 2d0922b0eabfdc0aaf1d0797482fef47ed7fde8e) --- source3/lib/bitmap.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'source3/lib/bitmap.c') diff --git a/source3/lib/bitmap.c b/source3/lib/bitmap.c index 2ae9defb2d..b130467b22 100644 --- a/source3/lib/bitmap.c +++ b/source3/lib/bitmap.c @@ -21,12 +21,9 @@ #include "includes.h" -extern int DEBUGLEVEL; - /* these functions provide a simple way to allocate integers from a pool without repitition */ - /**************************************************************************** allocate a bitmap of the specified size ****************************************************************************/ -- cgit From f9879578c6ebfba73b1d9a51f9833cb41fff23f2 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 29 Oct 2001 08:26:45 +0000 Subject: More spelling and grammer from Vance. Thanks! Andrew Bartlett (This used to be commit f019bed7663b4a20c1b5ab6b59fcadda17b89acd) --- source3/lib/bitmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/lib/bitmap.c') diff --git a/source3/lib/bitmap.c b/source3/lib/bitmap.c index b130467b22..da123837d0 100644 --- a/source3/lib/bitmap.c +++ b/source3/lib/bitmap.c @@ -22,7 +22,7 @@ #include "includes.h" /* these functions provide a simple way to allocate integers from a - pool without repitition */ + pool without repetition */ /**************************************************************************** allocate a bitmap of the specified size -- cgit From cd68afe31256ad60748b34f7318a180cfc2127cc Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Wed, 30 Jan 2002 06:08:46 +0000 Subject: Removed version number from file header. Changed "SMB/Netbios" to "SMB/CIFS" in file header. (This used to be commit 6a58c9bd06d0d7502a24bf5ce5a2faf0a146edfa) --- source3/lib/bitmap.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source3/lib/bitmap.c') diff --git a/source3/lib/bitmap.c b/source3/lib/bitmap.c index da123837d0..8121c38bd5 100644 --- a/source3/lib/bitmap.c +++ b/source3/lib/bitmap.c @@ -1,6 +1,5 @@ /* - Unix SMB/Netbios implementation. - Version 1.9. + Unix SMB/CIFS implementation. simple bitmap functions Copyright (C) Andrew Tridgell 1992-1998 -- cgit From 6d7195d1d79c43f5ccc8dc4a9215c02177d5fa89 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sat, 2 Nov 2002 03:47:48 +0000 Subject: Merge passdb from HEAD -> 3.0 The work here includes: - metze' set/changed patch, which avoids making changes to ldap on unmodified attributes. - volker's group mapping in passdb patch - volker's samsync stuff - volkers SAMR changes. - mezte's connection caching patch - my recent changes (fix magic root check, ldap ssl) Andrew Bartlett (This used to be commit 2044d60bbe0043cdbb9aba931115672bde975d2f) --- source3/lib/bitmap.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'source3/lib/bitmap.c') diff --git a/source3/lib/bitmap.c b/source3/lib/bitmap.c index 8121c38bd5..26d21d085f 100644 --- a/source3/lib/bitmap.c +++ b/source3/lib/bitmap.c @@ -59,6 +59,30 @@ void bitmap_free(struct bitmap *bm) SAFE_FREE(bm); } +/**************************************************************************** +talloc a bitmap +****************************************************************************/ +struct bitmap *bitmap_talloc(TALLOC_CTX *mem_ctx, int n) +{ + struct bitmap *bm; + + if (!mem_ctx) return NULL; + + bm = (struct bitmap *)talloc(mem_ctx, sizeof(*bm)); + + if (!bm) return NULL; + + bm->n = n; + bm->b = (uint32 *)talloc(mem_ctx, sizeof(bm->b[0])*(n+31)/32); + if (!bm->b) { + return NULL; + } + + memset(bm->b, 0, sizeof(bm->b[0])*(n+31)/32); + + return bm; +} + /**************************************************************************** set a bit in a bitmap ****************************************************************************/ -- cgit From 3b2244526c7ae64f744539154681b9883daebc3f Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sat, 1 Feb 2003 07:25:53 +0000 Subject: Merge of signed/unsigned fixes from HEAD. (This used to be commit e9f56a157bd472914eebf64fde586104d8274717) --- source3/lib/bitmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/lib/bitmap.c') diff --git a/source3/lib/bitmap.c b/source3/lib/bitmap.c index 26d21d085f..1023dd6541 100644 --- a/source3/lib/bitmap.c +++ b/source3/lib/bitmap.c @@ -129,7 +129,7 @@ wraparound ****************************************************************************/ int bitmap_find(struct bitmap *bm, unsigned ofs) { - int i, j; + unsigned int i, j; if (ofs > bm->n) ofs = 0; -- cgit From b05b6046fc790329d6b301aafb7ddb0b64ce00ab Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 11 Dec 2003 20:00:16 +0000 Subject: Patch from James Peach . Remove the MAX_CONNECTIONS limit by increasing bitmap size. Limited by "max connections" parameter. Bug #716. Jeremy. (This used to be commit fbbeb55b230ffc477f5563af66ab65eb6598e025) --- source3/lib/bitmap.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'source3/lib/bitmap.c') diff --git a/source3/lib/bitmap.c b/source3/lib/bitmap.c index 1023dd6541..3fa20cdd11 100644 --- a/source3/lib/bitmap.c +++ b/source3/lib/bitmap.c @@ -83,6 +83,20 @@ struct bitmap *bitmap_talloc(TALLOC_CTX *mem_ctx, int n) return bm; } +/**************************************************************************** +copy as much of the source bitmap as will fit in the destination bitmap. +****************************************************************************/ + +int bitmap_copy(struct bitmap * const dst, const struct bitmap * const src) +{ + int count = MIN(dst->n, src->n); + + SMB_ASSERT(dst->b != src->b); + memcpy(dst->b, src->b, sizeof(dst->b[0])*(count+31)/32); + + return count; +} + /**************************************************************************** set a bit in a bitmap ****************************************************************************/ -- cgit From acf9d61421faa6c0055d57fdee7db300dc5431aa Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 7 Dec 2004 18:25:53 +0000 Subject: r4088: Get medieval on our ass about malloc.... :-). Take control of all our allocation functions so we can funnel through some well known functions. Should help greatly with malloc checking. HEAD patch to follow. Jeremy. (This used to be commit 620f2e608f70ba92f032720c031283d295c5c06a) --- source3/lib/bitmap.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source3/lib/bitmap.c') diff --git a/source3/lib/bitmap.c b/source3/lib/bitmap.c index 3fa20cdd11..a6b52efe09 100644 --- a/source3/lib/bitmap.c +++ b/source3/lib/bitmap.c @@ -30,12 +30,12 @@ struct bitmap *bitmap_allocate(int n) { struct bitmap *bm; - bm = (struct bitmap *)malloc(sizeof(*bm)); + bm = SMB_MALLOC_P(struct bitmap); if (!bm) return NULL; bm->n = n; - bm->b = (uint32 *)malloc(sizeof(bm->b[0])*(n+31)/32); + bm->b = SMB_MALLOC_ARRAY(uint32, (n+31)/32); if (!bm->b) { SAFE_FREE(bm); return NULL; @@ -68,12 +68,12 @@ struct bitmap *bitmap_talloc(TALLOC_CTX *mem_ctx, int n) if (!mem_ctx) return NULL; - bm = (struct bitmap *)talloc(mem_ctx, sizeof(*bm)); + bm = TALLOC_P(mem_ctx, struct bitmap); if (!bm) return NULL; bm->n = n; - bm->b = (uint32 *)talloc(mem_ctx, sizeof(bm->b[0])*(n+31)/32); + bm->b = TALLOC_ARRAY(mem_ctx, uint32, (n+31)/32); if (!bm->b) { return NULL; } -- cgit From e53d78062878940d43526c2ef0fff3030fb64983 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 9 Dec 2004 21:42:00 +0000 Subject: r4120: Never, ever, doubt valgrind :-). Fix order of evaluation bug that's been in the bitmap code for ever. Remove silly extra space in paranoid malloc. Jeremy. (This used to be commit 0a7d17bc9b178628da371e627014412e9bef5d42) --- source3/lib/bitmap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/lib/bitmap.c') diff --git a/source3/lib/bitmap.c b/source3/lib/bitmap.c index a6b52efe09..f2442d2add 100644 --- a/source3/lib/bitmap.c +++ b/source3/lib/bitmap.c @@ -41,7 +41,7 @@ struct bitmap *bitmap_allocate(int n) return NULL; } - memset(bm->b, 0, sizeof(bm->b[0])*(n+31)/32); + memset(bm->b, 0, sizeof(uint32)*((n+31)/32)); return bm; } @@ -78,7 +78,7 @@ struct bitmap *bitmap_talloc(TALLOC_CTX *mem_ctx, int n) return NULL; } - memset(bm->b, 0, sizeof(bm->b[0])*(n+31)/32); + memset(bm->b, 0, sizeof(uint32)*((n+31)/32)); return bm; } @@ -92,7 +92,7 @@ int bitmap_copy(struct bitmap * const dst, const struct bitmap * const src) int count = MIN(dst->n, src->n); SMB_ASSERT(dst->b != src->b); - memcpy(dst->b, src->b, sizeof(dst->b[0])*(count+31)/32); + memcpy(dst->b, src->b, sizeof(uint32)*((count+31)/32)); return count; } -- cgit From d824b98f80ba186030cbb70b3a1e5daf80469ecd Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 9 Jul 2007 19:25:36 +0000 Subject: r23779: Change from v2 or later to v3 or later. Jeremy. (This used to be commit 407e6e695b8366369b7c76af1ff76869b45347b3) --- source3/lib/bitmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/lib/bitmap.c') diff --git a/source3/lib/bitmap.c b/source3/lib/bitmap.c index f2442d2add..0cf5d08899 100644 --- a/source3/lib/bitmap.c +++ b/source3/lib/bitmap.c @@ -5,7 +5,7 @@ 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 + 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, -- cgit From 5e54558c6dea67b56bbfaba5698f3a434d3dffb6 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2007 00:52:41 +0000 Subject: r23784: use the GPLv3 boilerplate as recommended by the FSF and the license text (This used to be commit b0132e94fc5fef936aa766fb99a306b3628e9f07) --- source3/lib/bitmap.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source3/lib/bitmap.c') diff --git a/source3/lib/bitmap.c b/source3/lib/bitmap.c index 0cf5d08899..1f7475bc03 100644 --- a/source3/lib/bitmap.c +++ b/source3/lib/bitmap.c @@ -14,8 +14,7 @@ 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, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see . */ #include "includes.h" -- cgit From 30191d1a5704ad2b158386b511558972d539ce47 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 18 Oct 2007 17:40:25 -0700 Subject: RIP BOOL. Convert BOOL -> bool. I found a few interesting bugs in various places whilst doing this (places that assumed BOOL == int). I also need to fix the Samba4 pidl generation (next checkin). Jeremy. (This used to be commit f35a266b3cbb3e5fa6a86be60f34fe340a3ca71f) --- source3/lib/bitmap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/lib/bitmap.c') diff --git a/source3/lib/bitmap.c b/source3/lib/bitmap.c index 1f7475bc03..5e623f474a 100644 --- a/source3/lib/bitmap.c +++ b/source3/lib/bitmap.c @@ -99,7 +99,7 @@ int bitmap_copy(struct bitmap * const dst, const struct bitmap * const src) /**************************************************************************** set a bit in a bitmap ****************************************************************************/ -BOOL bitmap_set(struct bitmap *bm, unsigned i) +bool bitmap_set(struct bitmap *bm, unsigned i) { if (i >= bm->n) { DEBUG(0,("Setting invalid bitmap entry %d (of %d)\n", @@ -113,7 +113,7 @@ BOOL bitmap_set(struct bitmap *bm, unsigned i) /**************************************************************************** clear a bit in a bitmap ****************************************************************************/ -BOOL bitmap_clear(struct bitmap *bm, unsigned i) +bool bitmap_clear(struct bitmap *bm, unsigned i) { if (i >= bm->n) { DEBUG(0,("clearing invalid bitmap entry %d (of %d)\n", @@ -127,7 +127,7 @@ BOOL bitmap_clear(struct bitmap *bm, unsigned i) /**************************************************************************** query a bit in a bitmap ****************************************************************************/ -BOOL bitmap_query(struct bitmap *bm, unsigned i) +bool bitmap_query(struct bitmap *bm, unsigned i) { if (i >= bm->n) return False; if (bm->b[i/32] & (1<<(i%32))) { -- cgit