remove some vs warning

Signed-off-by: Anshul Maheshwari <er.anshul.maheshwari@gmail.com>
This commit is contained in:
Anshul Maheshwari 2015-09-30 13:37:27 +05:30
parent a973c0a9c3
commit cc0ee507dd
16 changed files with 59 additions and 45 deletions

View File

@ -100,7 +100,7 @@ int asf_getmoredata(struct lib_ccx_ctx *ctx, struct demuxer_data **ppdata)
unsigned char *curpos;
int64_t getbytes;
int result = 0;
size_t result = 0;
struct demuxer_data *data;
if(!*ppdata)

View File

@ -133,7 +133,7 @@ void do_NAL (struct lib_cc_decode *ctx, unsigned char *NALstart, LLONG NAL_lengt
// Process inbuf bytes in buffer holding and AVC (H.264) video stream.
// The number of processed bytes is returned.
LLONG process_avc ( struct lib_cc_decode *ctx, unsigned char *avcbuf, LLONG avcbuflen ,struct cc_subtitle *sub)
size_t process_avc ( struct lib_cc_decode *ctx, unsigned char *avcbuf, size_t avcbuflen ,struct cc_subtitle *sub)
{
unsigned char *bpos = avcbuf;
unsigned char *NALstart;

View File

@ -49,5 +49,5 @@ struct avc_ctx
struct avc_ctx *init_avc(void);
void dinit_avc(struct avc_ctx **ctx);
void do_NAL (struct lib_cc_decode *ctx, unsigned char *NALstart, LLONG NAL_length, struct cc_subtitle *sub);
size_t process_avc(struct lib_cc_decode *ctx, unsigned char *avcbuf, size_t avcbuflen, struct cc_subtitle *sub);
#endif

View File

@ -1170,7 +1170,7 @@ int isdb_parse_data_group(void *codec_ctx,const uint8_t *buf, struct cc_subtitle
return buf - buf_pivot;
}
int isdbsub_decode(struct lib_cc_decode *dec_ctx, const uint8_t *buf, int buf_size, struct cc_subtitle *sub)
int isdbsub_decode(struct lib_cc_decode *dec_ctx, const uint8_t *buf, size_t buf_size, struct cc_subtitle *sub)
{
const uint8_t *header_end = NULL;
int ret = 0;
@ -1200,5 +1200,5 @@ int isdb_set_global_time(struct lib_cc_decode *dec_ctx, uint64_t timestamp)
{
ISDBSubContext *ctx = dec_ctx->private_data;
ctx->timestamp = timestamp;
return CCX_OK;
}

View File

@ -5,7 +5,7 @@
#include "ccx_decoders_structs.h"
int isdb_set_global_time(struct lib_cc_decode *dec_ctx, uint64_t timestamp);
int isdbsub_decode(struct lib_cc_decode *dec_ctx, const uint8_t *buf, int buf_size, struct cc_subtitle *sub);
int isdbsub_decode(struct lib_cc_decode *dec_ctx, const uint8_t *buf, size_t buf_size, struct cc_subtitle *sub);
void delete_isdb_caption(void *isdb_ctx);
void *init_isdb_caption(void);

View File

@ -144,7 +144,7 @@ struct demuxer_data
enum ccx_code_type codec;
enum ccx_bufferdata_type bufferdatatype;
unsigned char *buffer;
int len;
size_t len;
LLONG pts;
struct demuxer_data *next_stream;
struct demuxer_data *next_program;

View File

@ -474,7 +474,7 @@ void write_cc_line_as_transcript2(struct eia608_screen *data, struct encoder_ctx
}
ret = write(context->out->fh, context->encoded_crlf, context->encoded_crlf_length);
if(ret < context->encoded_crlf_length)
if(ret < context->encoded_crlf_length)
{
mprint("Warning:Loss of data\n");
}

View File

@ -37,7 +37,7 @@ static int read_pic_data(struct bitstream *esstream);
/* Process a mpeg-2 data stream with "lenght" bytes in buffer "data".
* The number of processed bytes is returned.
* Defined in ISO/IEC 13818-2 6.2 */
LLONG process_m2v (struct lib_cc_decode *ctx, unsigned char *data, LLONG length, struct cc_subtitle *sub)
size_t process_m2v (struct lib_cc_decode *ctx, unsigned char *data, size_t length, struct cc_subtitle *sub)
{
if (length<8) // Need to look ahead 8 bytes
return length;

View File

@ -15,16 +15,16 @@
* @return 0 or number of bytes, if returned 0 then op should check error number to know
* details of error
*/
LLONG buffered_read_opt (struct ccx_demuxer *ctx, unsigned char *buffer, unsigned int bytes);
size_t buffered_read_opt (struct ccx_demuxer *ctx, unsigned char *buffer, unsigned int bytes);
/**
* Skip bytes from file buffer and if needed also seek file for number of bytes.
*
*/
static LLONG inline buffered_skip(struct ccx_demuxer *ctx, unsigned int bytes)
static size_t inline buffered_skip(struct ccx_demuxer *ctx, unsigned int bytes)
{
LLONG result;
size_t result;
if (bytes <= ctx->bytesinbuffer - ctx->filebuffer_pos)
{
ctx->filebuffer_pos += bytes;
@ -41,9 +41,9 @@ static LLONG inline buffered_skip(struct ccx_demuxer *ctx, unsigned int bytes)
* Read bytes from file buffer and if needed also read file for number of bytes.
*
*/
static LLONG inline buffered_read(struct ccx_demuxer *ctx, unsigned char *buffer, unsigned int bytes)
static size_t inline buffered_read(struct ccx_demuxer *ctx, unsigned char *buffer, size_t bytes)
{
LLONG result;
size_t result;
if (bytes <= ctx->bytesinbuffer - ctx->filebuffer_pos)
{
if (buffer != NULL)
@ -68,9 +68,9 @@ static LLONG inline buffered_read(struct ccx_demuxer *ctx, unsigned char *buffer
* Read single byte from file buffer and if needed also read file for number of bytes.
*
*/
static LLONG inline buffered_read_byte(struct ccx_demuxer *ctx, unsigned char *buffer)
static size_t inline buffered_read_byte(struct ccx_demuxer *ctx, unsigned char *buffer)
{
LLONG result;
size_t result;
if (ctx->bytesinbuffer - ctx->filebuffer_pos)
{
if (buffer)

View File

@ -284,9 +284,9 @@ void return_to_buffer (struct ccx_demuxer *ctx, unsigned char *buffer, unsigned
*
* TODO instead of using global ccx_options move them to ccx_demuxer
*/
LLONG buffered_read_opt (struct ccx_demuxer *ctx, unsigned char *buffer, unsigned int bytes)
size_t buffered_read_opt (struct ccx_demuxer *ctx, unsigned char *buffer, size_t bytes)
{
LLONG copied = 0;
size_t copied = 0;
time_t seconds = 0;
position_sanity_check(ctx->infd);
@ -465,7 +465,7 @@ unsigned char buffered_get_byte (struct ccx_demuxer *ctx)
{
unsigned char b;
unsigned char *b_p = &b;
int result;
size_t result;
result = buffered_read_byte(ctx, b_p);
if (result == 1)

View File

@ -26,7 +26,7 @@ int ps_getmoredata(struct lib_ccx_ctx *ctx, struct demuxer_data ** ppdata)
{
int enough = 0;
int payload_read = 0;
int result;
size_t result;
static unsigned vpesnum=0;
@ -192,18 +192,24 @@ int ps_getmoredata(struct lib_ccx_ctx *ctx, struct demuxer_data ** ppdata)
else if ((nextheader[3]&0xf0)==0xe0)
{
int hlen; // Dummy variable, unused
int peslen = read_video_pes_header(ctx->demux_ctx, data, nextheader, &hlen, 0);
if (peslen < 0)
int ret;
size_t peslen;
ret = read_video_pes_header(ctx->demux_ctx, data, nextheader, &hlen, 0);
if (ret < 0)
{
end_of_file=1;
break;
}
else
{
peslen = ret;
}
vpesnum++;
dbg_print(CCX_DMT_VERBOSE, "PES video packet #%u\n", vpesnum);
int want = (int) ((BUFSIZE-data->len)>peslen ? peslen : (BUFSIZE-data->len));
//peslen is unsigned since loop would have already broken if it was negative
int want = (int) ((BUFSIZE-data->len) > peslen ? peslen : (BUFSIZE-data->len));
if (want != peslen) {
mprint("General LOOP: want(%d) != peslen(%d) \n", want, peslen);
@ -480,13 +486,14 @@ void raw_loop (struct lib_ccx_ctx *ctx)
/* Process inbuf bytes in buffer holding raw caption data (three byte packets, the first being the field).
* The number of processed bytes is returned. */
LLONG process_raw_with_field (struct lib_cc_decode *dec_ctx, struct cc_subtitle *sub, unsigned char* buffer, int len)
size_t process_raw_with_field(struct lib_cc_decode *dec_ctx, struct cc_subtitle *sub, unsigned char* buffer, size_t len)
{
unsigned char data[3];
size_t i;
data[0]=0x04; // Field 1
dec_ctx->current_field = 1;
for (unsigned long i=0; i < len; i=i+3)
for (i = 0; i < len; i=i+3)
{
if ( !dec_ctx->saw_caption_block && *(buffer+i)==0xff && *(buffer+i+1)==0xff)
{
@ -508,12 +515,13 @@ LLONG process_raw_with_field (struct lib_cc_decode *dec_ctx, struct cc_subtitle
/* Process inbuf bytes in buffer holding raw caption data (two byte packets).
* The number of processed bytes is returned. */
LLONG process_raw ( struct lib_cc_decode *ctx, struct cc_subtitle *sub, unsigned char *buffer, int len)
size_t process_raw(struct lib_cc_decode *ctx, struct cc_subtitle *sub, unsigned char *buffer, size_t len)
{
unsigned char data[3];
size_t i;
data[0]=0x04; // Field 1
for (unsigned long i=0; i < len; i=i+2)
for (i = 0; i < len; i = i+2)
{
if ( !ctx->saw_caption_block && *(buffer+i)==0xff && *(buffer+i+1)==0xff)
{
@ -547,7 +555,7 @@ void delete_datalist(struct demuxer_data *list)
int process_data(struct encoder_ctx *enc_ctx, struct lib_cc_decode *dec_ctx, struct demuxer_data *data_node)
{
LLONG got; // Means 'consumed' from buffer actually
size_t got; // Means 'consumed' from buffer actually
int ret = 0;
static LLONG last_pts = 0x01FFFFFFFFLL;
struct cc_subtitle *dec_sub = &dec_ctx->dec_sub;
@ -868,7 +876,7 @@ void rcwt_loop(struct lib_ccx_ctx *ctx)
LLONG currfts;
uint16_t cbcount = 0;
int bread = 0; // Bytes read
int result;
LLONG result;
struct encoder_ctx *enc_ctx = update_encoder_list(ctx);

View File

@ -155,7 +155,7 @@ int init_file_buffer(struct ccx_demuxer *ctx);
int ps_getmoredata(struct lib_ccx_ctx *ctx, struct demuxer_data **ppdata);
int general_getmoredata(struct lib_ccx_ctx *ctx, struct demuxer_data **data);
void raw_loop (struct lib_ccx_ctx *ctx);
LLONG process_raw (struct lib_cc_decode *ctx, struct cc_subtitle *sub, unsigned char *buffer, int len);
size_t process_raw(struct lib_cc_decode *ctx, struct cc_subtitle *sub, unsigned char *buffer, size_t len);
void general_loop(struct lib_ccx_ctx *ctx);
void processhex (char *filename);
void rcwt_loop(struct lib_ccx_ctx *ctx);
@ -169,7 +169,7 @@ int asf_getmoredata(struct lib_ccx_ctx *ctx, struct demuxer_data **ppdata);
int wtv_getmoredata(struct lib_ccx_ctx *ctx, struct demuxer_data **ppdata);
// es_functions.c
LLONG process_m2v (struct lib_cc_decode *ctx, unsigned char *data, LLONG length,struct cc_subtitle *sub);
size_t process_m2v(struct lib_cc_decode *ctx, unsigned char *data, size_t length, struct cc_subtitle *sub);
extern unsigned top_field_first;
@ -213,7 +213,7 @@ int read_video_pes_header (struct ccx_demuxer *ctx, struct demuxer_data *data, u
void init_ts(struct ccx_demuxer *ctx);
int ts_readpacket(struct ccx_demuxer* ctx, struct ts_payload *payload);
long ts_readstream(struct ccx_demuxer *ctx, struct demuxer_data **data);
LLONG ts_getmoredata(struct ccx_demuxer *ctx, struct demuxer_data **data);
int ts_getmoredata(struct ccx_demuxer *ctx, struct demuxer_data **data);
int write_section(struct ccx_demuxer *ctx, struct ts_payload *payload, unsigned char*buf, int size, struct program_info *pinfo);
void ts_buffer_psi_packet(struct ccx_demuxer *ctx);
int parse_PMT (struct ccx_demuxer *ctx, unsigned char *buf, int len, struct program_info *pinfo);
@ -226,7 +226,6 @@ void parse_SDT(struct ccx_demuxer *ctx);
// myth.c
void myth_loop(struct lib_ccx_ctx *ctx);
LLONG process_avc (struct lib_cc_decode *ctx, unsigned char *avcbuf, LLONG avcbuflen ,struct cc_subtitle *sub);
// utility.c
void fatal(int exit_code, const char *fmt, ...);
void mprint (const char *fmt, ...);

View File

@ -16,8 +16,9 @@
/**
* Get offset of a member
*/
#ifndef offsetof
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
#ifndef ccx_offsetof
#define ccx_offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
#endif
/**
@ -27,7 +28,7 @@
* @param member the name of the member within the struct.
*
*/
#define container_of(ptr, type, member) ((type *)( (char *)ptr - offsetof(type,member) ))
#define container_of(ptr, type, member) ((type *)( (char *)ptr - ccx_offsetof(type,member) ))
/*@}*/

View File

@ -774,7 +774,7 @@ long ts_readstream(struct ccx_demuxer *ctx, struct demuxer_data **data)
// TS specific data grabber
LLONG ts_getmoredata(struct ccx_demuxer *ctx, struct demuxer_data **data)
int ts_getmoredata(struct ccx_demuxer *ctx, struct demuxer_data **data)
{
int ret = CCX_OK;

View File

@ -42,6 +42,7 @@
<ClInclude Include="..\src\libpng\pngpriv.h" />
<ClInclude Include="..\src\libpng\pngstruct.h" />
<ClInclude Include="..\src\lib_ccx\608_spupng.h" />
<ClInclude Include="..\src\lib_ccx\avc_functions.h" />
<ClInclude Include="..\src\lib_ccx\ccx_common_char_encoding.h" />
<ClInclude Include="..\src\lib_ccx\ccx_common_common.h" />
<ClInclude Include="..\src\lib_ccx\ccx_common_constants.h" />
@ -53,6 +54,7 @@
<ClInclude Include="..\src\lib_ccx\ccx_decoders_708_encoding.h" />
<ClInclude Include="..\src\lib_ccx\ccx_decoders_708_output.h" />
<ClInclude Include="..\src\lib_ccx\ccx_decoders_common.h" />
<ClInclude Include="..\src\lib_ccx\ccx_decoders_isdb.h" />
<ClInclude Include="..\src\lib_ccx\ccx_decoders_structs.h" />
<ClInclude Include="..\src\lib_ccx\ccx_decoders_xds.h" />
<ClInclude Include="..\src\lib_ccx\ccx_encoders_common.h" />
@ -149,6 +151,7 @@
<ClCompile Include="..\src\lib_ccx\ccx_decoders_708_encoding.c" />
<ClCompile Include="..\src\lib_ccx\ccx_decoders_708_output.c" />
<ClCompile Include="..\src\lib_ccx\ccx_decoders_common.c" />
<ClCompile Include="..\src\lib_ccx\ccx_decoders_isdb.c" />
<ClCompile Include="..\src\lib_ccx\ccx_decoders_xds.c" />
<ClCompile Include="..\src\lib_ccx\ccx_demuxer.c" />
<ClCompile Include="..\src\lib_ccx\ccx_dtvcc.c" />
@ -206,7 +209,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">

View File

@ -246,6 +246,12 @@
<ClInclude Include="..\src\lib_ccx\ccx_decoders_708_output.h">
<Filter>Header Files\ccx_decoders</Filter>
</ClInclude>
<ClInclude Include="..\src\lib_ccx\ccx_decoders_isdb.h">
<Filter>Header Files\ccx_decoders</Filter>
</ClInclude>
<ClInclude Include="..\src\lib_ccx\avc_functions.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\src\ccextractor.c">
@ -587,12 +593,6 @@
<ClCompile Include="..\src\win_iconv\win_iconv.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\lib_ccx\608_webvtt.c">
<Filter>Source Files\ccx_encoders</Filter>
</ClCompile>
<ClCompile Include="..\src\lib_ccx\ccx_encoder_xds.c">
<Filter>Source Files\ccx_encoders</Filter>
</ClCompile>
<ClCompile Include="..\src\lib_ccx\ccx_encoders_sami.c">
<Filter>Source Files\ccx_encoders</Filter>
</ClCompile>
@ -611,5 +611,8 @@
<ClCompile Include="..\src\lib_ccx\ccx_encoders_xds.c">
<Filter>Source Files\ccx_encoders</Filter>
</ClCompile>
<ClCompile Include="..\src\lib_ccx\ccx_decoders_isdb.c">
<Filter>Source Files\ccx_decoders</Filter>
</ClCompile>
</ItemGroup>
</Project>