[Redbutton-devel] SF.net SVN: redbutton: [6] redbutton-download/trunk
Brought to you by:
skilvington
|
From: <ski...@us...> - 2006-03-01 16:32:41
|
Revision: 6 Author: skilvington Date: 2006-03-01 08:32:29 -0800 (Wed, 01 Mar 2006) ViewCVS: http://svn.sourceforge.net/redbutton/?rev=6&view=rev Log Message: ----------- replace TRUE/FALSE with stdbool Modified Paths: -------------- redbutton-download/trunk/TODO redbutton-download/trunk/carousel.c redbutton-download/trunk/findmheg.c redbutton-download/trunk/module.c redbutton-download/trunk/module.h redbutton-download/trunk/utils.h Modified: redbutton-download/trunk/TODO =================================================================== --- redbutton-download/trunk/TODO 2006-03-01 16:05:30 UTC (rev 5) +++ redbutton-download/trunk/TODO 2006-03-01 16:32:29 UTC (rev 6) @@ -1,5 +1,3 @@ -replace TRUE/FALSE with stdbool - work out why this happened on BBC1 once: read: Value too large for defined data type Unable to read PID Modified: redbutton-download/trunk/carousel.c =================================================================== --- redbutton-download/trunk/carousel.c 2006-03-01 16:05:30 UTC (rev 5) +++ redbutton-download/trunk/carousel.c 2006-03-01 16:32:29 UTC (rev 6) @@ -22,6 +22,7 @@ #include <stdio.h> #include <stdint.h> +#include <stdbool.h> #include <netinet/in.h> #include "carousel.h" @@ -34,14 +35,14 @@ load_carousel(struct carousel *car) { unsigned char *table; - int done; + bool done; /* no modules yet */ car->nmodules = 0; car->modules = NULL; /* see what the next DSMCC table is */ - done = FALSE; + done = false; do { struct dsmccMessageHeader *dsmcc; @@ -114,7 +115,7 @@ if(car->got_dsi) return; - car->got_dsi = TRUE; + car->got_dsi = true; elementary_pid = process_biop_service_gateway_info(car->service_id, &car->assoc, DSI_privateDataByte(dsi), ntohs(dsi->privateDataLength)); Modified: redbutton-download/trunk/findmheg.c =================================================================== --- redbutton-download/trunk/findmheg.c 2006-03-01 16:05:30 UTC (rev 5) +++ redbutton-download/trunk/findmheg.c 2006-03-01 16:32:29 UTC (rev 6) @@ -22,6 +22,7 @@ #include <stdio.h> #include <stdint.h> +#include <stdbool.h> #include <netinet/in.h> #include "carousel.h" @@ -68,7 +69,7 @@ uint16_t section_length; uint16_t offset; uint16_t map_pid = 0; - int found; + bool found; unsigned char *pmt; uint8_t stream_type; uint16_t elementary_pid; @@ -90,7 +91,7 @@ _car.npids = 0; _car.pids = NULL; /* no modules loaded yet */ - _car.got_dsi = FALSE; + _car.got_dsi = false; _car.nmodules = 0; _car.modules = NULL; @@ -101,7 +102,7 @@ section_length = 3 + (((pat[1] & 0x0f) << 8) + pat[2]); /* find the PMT for this service_id */ - found = FALSE; + found = false; offset = 8; /* -4 for the CRC at the end */ while((offset < (section_length - 4)) && !found) @@ -109,7 +110,7 @@ if((pat[offset] << 8) + pat[offset+1] == service_id) { map_pid = ((pat[offset+2] & 0x1f) << 8) + pat[offset+3]; - found = TRUE; + found = true; } else { Modified: redbutton-download/trunk/module.c =================================================================== --- redbutton-download/trunk/module.c 2006-03-01 16:05:30 UTC (rev 5) +++ redbutton-download/trunk/module.c 2006-03-01 16:32:29 UTC (rev 6) @@ -22,6 +22,7 @@ #include <stdio.h> #include <string.h> +#include <stdbool.h> #include <zlib.h> #include <netinet/in.h> @@ -77,8 +78,8 @@ mod->block_size = ntohs(dii->blockSize); mod->nblocks = (ntohl(diimod->moduleSize) + mod->block_size - 1) / mod->block_size; mod->blocks_left = mod->nblocks; - mod->got_block = safe_malloc(mod->nblocks); - bzero(mod->got_block, mod->nblocks); + mod->got_block = safe_malloc(mod->nblocks * sizeof(bool)); + bzero(mod->got_block, mod->nblocks * sizeof(bool)); mod->size = ntohl(diimod->moduleSize); mod->data = safe_malloc(mod->size); @@ -126,7 +127,7 @@ if(mod->got_block[block]) return; - mod->got_block[block] = TRUE; + mod->got_block[block] = true; memcpy(mod->data + (block * mod->block_size), data, length); mod->blocks_left --; Modified: redbutton-download/trunk/module.h =================================================================== --- redbutton-download/trunk/module.h 2006-03-01 16:05:30 UTC (rev 5) +++ redbutton-download/trunk/module.h 2006-03-01 16:32:29 UTC (rev 6) @@ -24,6 +24,7 @@ #define __MODULE_H__ #include <stdint.h> +#include <stdbool.h> #include "dsmcc.h" #include "assoc.h" @@ -45,7 +46,7 @@ uint16_t block_size; uint16_t nblocks; uint32_t blocks_left; /* number of blocks left to download */ - unsigned char *got_block; /* which blocks we have downloaded so far */ + bool *got_block; /* which blocks we have downloaded so far */ uint32_t size; /* size of the file */ unsigned char *data; /* the actual file data */ }; @@ -61,7 +62,7 @@ struct assoc assoc; /* map stream_id's to elementary_pid's */ int32_t npids; /* PIDs we are reading data from */ struct pid_fds *pids; /* array, npids in length */ - int got_dsi; /* TRUE if we have downloaded the DSI */ + bool got_dsi; /* true if we have downloaded the DSI */ uint32_t nmodules; /* modules we have/are downloading */ struct module *modules; /* array, nmodules in length */ }; Modified: redbutton-download/trunk/utils.h =================================================================== --- redbutton-download/trunk/utils.h 2006-03-01 16:05:30 UTC (rev 5) +++ redbutton-download/trunk/utils.h 2006-03-01 16:32:29 UTC (rev 6) @@ -27,11 +27,6 @@ #include <stdarg.h> #include <stdint.h> -#ifndef FALSE -#define FALSE 0 -#define TRUE 1 -#endif - #ifndef MAX #define MAX(a, b) ((a) > (b) ? (a) : (b)) #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |