View Full Version : Dev-C++ execution terminated
Marzman
02-16-2008, 04:53 PM
I'm trying to compile in Dev-C++ (4.9.9.2) and I am getting a few build errors:
if( ra != 0 || rb != 0 || rc != 0 ) return -1;
In function `uint32 get_u24(FILE*, uint32*)':
[Warning] converting of negative value `-0x000000001' to `uint32'
In function `uint32 get_u32(FILE*, uint32*)':
if( ra != 0 || rb != 0 || rc != 0 || rd != 0 ) return -1;
[Warning] converting of negative value `-0x000000001' to `uint32'
In function `FETCH* FETCH_createInstance(int (*)(void*, uint8, const uint8*, uint32, uint32), void*)':
FETCH* p = malloc(sizeof(FETCH));
invalid conversion from `void*' to `FETCH*'
I'm kind of new to this so any sort of translation into an actual solution would be most appreciated.
Ajmukon
02-17-2008, 01:38 PM
post the entire code if possible.
unless it is REALLY LONG....
Marzman
02-17-2008, 01:58 PM
///////////////////////////////////////////////////////////////////////////////////////////////////
struct _FETCH
{
pthread_t thread;
FILE* stream;
recv_flv_packet cb;
void* cb_ptr;
uint8* packet;
};
///////////////////////////////////////////////////////////////////////////////////////////////////
static int get_u8(FILE* p, uint8* ret)
{
int r = fgetc(p);
if( r == EOF ) return -1;
*ret = (uint8)r;
return 0;
}
static uint32 get_u24(FILE* p, uint32* ret)
{
uint8 a,b,c;
int ra,rb,rc;
ra = get_u8(p,&a);
rb = get_u8(p,&b);
rc = get_u8(p,&c);
if( ra != 0 || rb != 0 || rc != 0 ) return -1;
*ret = ((uint32)a << 16) | ((uint32)b << 8) | (uint32)c;
return 0;
}
static uint32 get_u32(FILE* p, uint32* ret)
{
uint8 a,b,c,d;
int ra,rb,rc,rd;
ra = get_u8(p,&a);
rb = get_u8(p,&b);
rc = get_u8(p,&c);
rd = get_u8(p,&d);
if( ra != 0 || rb != 0 || rc != 0 || rd != 0 ) return -1;
*ret = ((uint32)a << 24) | ((uint32)b << 16) | ((uint32)c << 8) | (uint32)d;
return 0;
}
static int skip(FILE* p, int size)
{
int i;
uint8 t8;
for(i=0; i<size; i++)
{
if( get_u8(p, &t8) != 0 ) return -1;
}
return 0;
}
static int read_buffer(FILE* p, uint8* buf, int size)
{
return fread(buf, 1, size, p ) == size ? 0 : -1;
}
static void put_u8(uint8* buf, uint8 val)
{
buf[0] = val;
}
static void put_u24(uint8* buf, uint32 val)
{
buf[0] = (val >> 16) & 0xff;
buf[1] = (val >> 8 ) & 0xff;
buf[2] = (val >> 0 ) & 0xff;
}
static void put_u32(uint8* buf, uint32 val)
{
buf[0] = (val >> 24) & 0xff;
buf[1] = (val >> 16) & 0xff;
buf[2] = (val >> 8 ) & 0xff;
buf[3] = (val >> 0 ) & 0xff;
}
///////////////////////////////////////////////////////////////////////////////////////////////////
static int send_packet(FETCH* p, uint8 picture_type, uint8* buf, uint32 buf_size, uint32 time)
{
if( p->cb == NULL ) return -1;
return p->cb(p->cb_ptr, picture_type, buf, buf_size, time);
}
static int read_header(FETCH* p)
{
uint32 t32;
uint8 t8;
if( get_u8(p->stream, &t8) != 0 || t8 != 'F' ) return -1;
if( get_u8(p->stream, &t8) != 0 || t8 != 'L' ) return -1;
if( get_u8(p->stream, &t8) != 0 || t8 != 'V' ) return -1;
if( get_u8(p->stream, &t8) != 0 || t8 != 1 ) return -1;
if( get_u8(p->stream, &t8) != 0 ) return -1;
// printf( "header: %s,%s\n", t8 & 4 ? "hasAudio" : "noAudio", t8 & 1 ? "hasVideo" : "noVideo" );
if( get_u32(p->stream, &t32) != 0 ) return -1;
// printf( "header: %08X\n", t32 );
if( get_u32(p->stream, &t32) != 0 ) return -1;
// printf( "header: %08X\n", t32 );
return 0;
}
static int read_packet(FETCH* p, uint8* buf, uint32* buf_size, uint8* picture_type, uint32* time, uint32 max_buf_size)
{
uint32 size, size2, reserved;
uint8 flag;
if( get_u24(p->stream, &size) != 0 ) return -1;
// printf("%d, ", size);
if(size < 11) return -1; // packet size error
if( get_u24(p->stream, time) != 0 ) return -1;
// printf("%dms, ", time );
if( get_u32(p->stream, &reserved) != 0 ) return -1;
if( get_u8(p->stream, &flag) != 0 ) return -1;
// printf("%02X\n", flag);
*picture_type = flag;
if( size >= max_buf_size ) return -1; // size over!!
put_u24(buf + 0, size);
put_u24(buf + 3, *time);
put_u32(buf + 6, reserved);
put_u8(buf + 10, flag);
if( read_buffer(p->stream, buf + 11, size - 1) != 0 )
{
fprintf(stderr,"sizerror!!!!\n" );
return -1;
}
// skip(p->stream,size-1);
if( get_u32(p->stream, &size2) != 0 ) return -1;
// if(size2 != size + 11) return -1; // packet size error;
put_u32(buf + size + 10, size2);
*buf_size = size + 15;
return 0;
}
static int read_body(FETCH* p)
{
int err;
uint8 tag;
uint32 size;
uint8 picture_type;
uint32 time;
while( 1 ) //! is_eob(p))
{
if( get_u8(p->stream, &tag) != 0 ) return -1;
switch(tag)
{
case 8: // audio
// printf("A: ");
break;
case 9: // video
// printf("V: ");
break;
default:
// printf("U: ");
break;
}
*p->packet = tag;
err = read_packet(p, p->packet+1, &size, &picture_type, &time, PACKETBUFFER_SIZE-1);
if( err != 0 ) return err;
if (send_packet(p, picture_type, p->packet, size, time) < 0) return -1;
}
return 0;
}
///////////////////////////////////////////////////////////////////////////////////////////////////
FETCH* FETCH_createInstance(recv_flv_packet cb, void* cb_ptr)
{
FETCH* p = malloc(sizeof(FETCH));
memset( p, 0, sizeof(FETCH));
p->cb = cb;
p->cb_ptr = cb_ptr;
p->packet = (uint8*)malloc(PACKETBUFFER_SIZE);
return p;
}
void FETCH_release(FETCH* p)
{
free(p->packet);
free(p);
}
int FETCH_read(FETCH* p, FILE* fp)
{
p->stream = fp;
if( read_header( p ) != 0 )
{
fprintf(stderr, "header error!!\n");
return -1;
}
read_body( p );
return 0;
}
Ajmukon
02-17-2008, 05:44 PM
try changing all the "-1" returns to "1"
DO NOT RUN CODE- only compile...
it has been a long time since i took "intro to programming"....
Marzman
02-18-2008, 07:52 AM
try changing all the "-1" returns to "1"
DO NOT RUN CODE- only compile...
it has been a long time since i took "intro to programming"....
I was only compiling, and your suggestion worked, plus I've never taken anything in programming (as you can probably tell).
Have you any idea on the second individual error, that was thrid overall:
FETCH* p = malloc(sizeof(FETCH));
invalid conversion from `void*' to `FETCH*'
Ajmukon
02-18-2008, 12:00 PM
I was only compiling, and your suggestion worked, plus I've never taken anything in programming (as you can probably tell).
Have you any idea on the second individual error, that was thrid overall:
FETCH* p = malloc(sizeof(FETCH));
invalid conversion from `void*' to `FETCH*'
so you still have that error?
..
i never used the "FETCH" command....
if your willing to wait, i will try to get some information from a friend who is taking computer programming as a major...
Marzman
02-18-2008, 01:03 PM
so you still have that error?
..
i never used the "FETCH" command....
if your willing to wait, i will try to get some information from a friend who is taking computer programming as a major...
Yeah,
FETCH* p = malloc(sizeof(FETCH));
gives me:
In function `FETCH* FETCH_createInstance(int (*)(void*, uint8, const uint8*, uint32, uint32), void*)':
and
invalid conversion from `void*' to `FETCH*'
I'm more than willing to wait, I just wish dev-c++ was a lil' less cryptic. In saying that it is the best compiler I've tried so far (and others seem to think it's over all).
Marzman
03-15-2008, 03:14 AM
I thought i'd post the compile log (in the hope it might help):
Compiler: Default compiler
Building Makefile: "C:\Dev-Cpp\Makefile.win"
Executing make...
make.exe -f "C:\Dev-Cpp\Makefile.win" all
g++.exe -c G:/fetch.c -o G:/fetch.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include"
G:/fetch.c: In function `FETCH* FETCH_createInstance(int (*)(void*, uint8, const uint8*, uint32, uint32), FETCH*)':
G:/fetch.c:232: error: invalid conversion from `void*' to `FETCH*'
make.exe: *** [G:/fetch.o] Error 1
Execution terminated
If any one new is laying eyes on this then here is the build log before I made the changes discussed above
Compiler: Default compiler
Building Makefile: "C:\Dev-Cpp\Makefile.win"
Executing make...
make.exe -f "C:\Dev-Cpp\Makefile.win" all
g++.exe -c G:/fetch.c -o G:/fetch.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include"
G:/fetch.c: In function `uint32 get_u24(FILE*, uint32*)':
G:/fetch.c:62: warning: converting of negative value `-0x000000001' to `uint32'
G:/fetch.c: In function `uint32 get_u32(FILE*, uint32*)':
G:/fetch.c:77: warning: converting of negative value `-0x000000001' to `uint32'
G:/fetch.c: In function `FETCH* FETCH_createInstance(int (*)(void*, uint8, const uint8*, uint32, uint32), FETCH*)':
G:/fetch.c:232: error: invalid conversion from `void*' to `FETCH*'
make.exe: *** [G:/fetch.o] Error 1
Execution terminated
Ajmukon
03-15-2008, 04:46 PM
i called my friend, he says the "fetch command" istn't being used.
So it gave an error. (at least that is what he told me real quick on the phone)
he is going to look at the code when he is able and try to find the errors.
but he cannot right now, sorry, i kind of forgot about it (been busy the past few weeks.)
could you repost the revised code?
Marzman
03-15-2008, 07:21 PM
///////////////////////////////////////////////////////////////////////////////////////////////////
struct _FETCH
{
pthread_t thread;
FILE* stream;
recv_flv_packet cb;
void* cb_ptr;
uint8* packet;
};
///////////////////////////////////////////////////////////////////////////////////////////////////
static int get_u8(FILE* p, uint8* ret)
{
int r = fgetc(p);
if( r == EOF ) return -1;
*ret = (uint8)r;
return 0;
}
static uint32 get_u24(FILE* p, uint32* ret)
{
uint8 a,b,c;
int ra,rb,rc;
ra = get_u8(p,&a);
rb = get_u8(p,&b);
rc = get_u8(p,&c);
if( ra != 0 || rb != 0 || rc != 0 ) return 1;
*ret = ((uint32)a << 16) | ((uint32)b << 8) | (uint32)c;
return 0;
}
static uint32 get_u32(FILE* p, uint32* ret)
{
uint8 a,b,c,d;
int ra,rb,rc,rd;
ra = get_u8(p,&a);
rb = get_u8(p,&b);
rc = get_u8(p,&c);
rd = get_u8(p,&d);
if( ra != 0 || rb != 0 || rc != 0 || rd != 0 ) return 1;
*ret = ((uint32)a << 24) | ((uint32)b << 16) | ((uint32)c << 8) | (uint32)d;
return 0;
}
static int skip(FILE* p, int size)
{
int i;
uint8 t8;
for(i=0; i<size; i++)
{
if( get_u8(p, &t8) != 0 ) return -1;
}
return 0;
}
static int read_buffer(FILE* p, uint8* buf, int size)
{
return fread(buf, 1, size, p ) == size ? 0 : -1;
}
static void put_u8(uint8* buf, uint8 val)
{
buf[0] = val;
}
static void put_u24(uint8* buf, uint32 val)
{
buf[0] = (val >> 16) & 0xff;
buf[1] = (val >> 8 ) & 0xff;
buf[2] = (val >> 0 ) & 0xff;
}
static void put_u32(uint8* buf, uint32 val)
{
buf[0] = (val >> 24) & 0xff;
buf[1] = (val >> 16) & 0xff;
buf[2] = (val >> 8 ) & 0xff;
buf[3] = (val >> 0 ) & 0xff;
}
///////////////////////////////////////////////////////////////////////////////////////////////////
static int send_packet(FETCH* p, uint8 picture_type, uint8* buf, uint32 buf_size, uint32 time)
{
if( p->cb == NULL ) return -1;
return p->cb(p->cb_ptr, picture_type, buf, buf_size, time);
}
static int read_header(FETCH* p)
{
uint32 t32;
uint8 t8;
if( get_u8(p->stream, &t8) != 0 || t8 != 'F' ) return -1;
if( get_u8(p->stream, &t8) != 0 || t8 != 'L' ) return -1;
if( get_u8(p->stream, &t8) != 0 || t8 != 'V' ) return -1;
if( get_u8(p->stream, &t8) != 0 || t8 != 1 ) return -1;
if( get_u8(p->stream, &t8) != 0 ) return -1;
// printf( "header: %s,%s\n", t8 & 4 ? "hasAudio" : "noAudio", t8 & 1 ? "hasVideo" : "noVideo" );
if( get_u32(p->stream, &t32) != 0 ) return -1;
// printf( "header: %08X\n", t32 );
if( get_u32(p->stream, &t32) != 0 ) return -1;
// printf( "header: %08X\n", t32 );
return 0;
}
static int read_packet(FETCH* p, uint8* buf, uint32* buf_size, uint8* picture_type, uint32* time, uint32 max_buf_size)
{
uint32 size, size2, reserved;
uint8 flag;
if( get_u24(p->stream, &size) != 0 ) return -1;
// printf("%d, ", size);
if(size < 11) return -1; // packet size error
if( get_u24(p->stream, time) != 0 ) return -1;
// printf("%dms, ", time );
if( get_u32(p->stream, &reserved) != 0 ) return -1;
if( get_u8(p->stream, &flag) != 0 ) return -1;
// printf("%02X\n", flag);
*picture_type = flag;
if( size >= max_buf_size ) return -1; // size over!!
put_u24(buf + 0, size);
put_u24(buf + 3, *time);
put_u32(buf + 6, reserved);
put_u8(buf + 10, flag);
if( read_buffer(p->stream, buf + 11, size - 1) != 0 )
{
fprintf(stderr,"sizerror!!!!\n" );
return -1;
}
// skip(p->stream,size-1);
if( get_u32(p->stream, &size2) != 0 ) return -1;
// if(size2 != size + 11) return -1; // packet size error;
put_u32(buf + size + 10, size2);
*buf_size = size + 15;
return 0;
}
static int read_body(FETCH* p)
{
int err;
uint8 tag;
uint32 size;
uint8 picture_type;
uint32 time;
while( 1 ) //! is_eob(p))
{
if( get_u8(p->stream, &tag) != 0 ) return -1;
switch(tag)
{
case 8: // audio
// printf("A: ");
break;
case 9: // video
// printf("V: ");
break;
default:
// printf("U: ");
break;
}
*p->packet = tag;
err = read_packet(p, p->packet+1, &size, &picture_type, &time, PACKETBUFFER_SIZE-1);
if( err != 0 ) return err;
if (send_packet(p, picture_type, p->packet, size, time) < 0) return -1;
}
return 0;
}
///////////////////////////////////////////////////////////////////////////////////////////////////
FETCH* FETCH_createInstance(recv_flv_packet cb, FETCH* cb_ptr)
{
FETCH* p = malloc(sizeof(FETCH));
memset( p, 0, sizeof(FETCH));
p->cb = cb;
p->cb_ptr = cb_ptr;
p->packet = (uint8*)malloc(PACKETBUFFER_SIZE);
return p;
}
void FETCH_release(FETCH* p)
{
free(p->packet);
free(p);
}
int FETCH_read(FETCH* p, FILE* fp)
{
p->stream = fp;
if( read_header( p ) != 0 )
{
fprintf(stderr, "header error!!\n");
return -1;
}
read_body( p );
return 0;
}
hallsy9
03-17-2008, 05:03 PM
what are you trying to accomplish by useing this code.
ie. what is suposto happen
Ajmukon
03-17-2008, 05:08 PM
hey hallsy!
i cant tell whats wrong, but the FETCH command tends to give the error no matter what i do when i try to compile it myself...
hallsy9
03-17-2008, 10:06 PM
why not try a different command. There may be a way arround it
Marzman
03-18-2008, 11:21 AM
what are you trying to accomplish by useing this code.
ie. what is suposto happen
The code is part of an open source transcoder I'm trying to compile, as the release includes adverts, and only seems to be licensed for a few months at a time.
why not try a different command. There may be a way arround it
I've tried, so has Ajmukon, you're more than welcome to try too. I think the problem might be that I am trying to compile under windows, and not linux, as i'm meant to. That's part of the challenge though, of which I knew before hand there would be, as there seems to be a lack of decent compilers. So far I've been through just about every microsoft and intel version, borland and digital mars, watcom and GCC (under windows) with Dev-C++ getting me the closet to compilation.
hallsy9
03-18-2008, 03:24 PM
if you wish Ubuntu is a free linux os that can be run off a cd that loads the os to the memory.
It can be downloaded ofline and has instructions to make a boot disk.
the error is on line 232 can you tell me which line of code that is.
I dont have a compiler on my computer b/c it it runs vista and keeps screwing up so i'm not running any software that doesen't come preinstalled at the moment except for bare mins. (it's vista so it has the prob)
Ajmukon
03-18-2008, 04:41 PM
Hallsy9 is my "programmer" friend who knows.. a lot more about programming than me...
i think the 232 line is the line "void FETCH_release(FETCH* p)"
Marzman
03-19-2008, 07:18 AM
i think the 232 line is the line "void FETCH_release(FETCH* p)"
According to Dev-C++ it is FETCH* p = malloc(sizeof(FETCH));
Hallsy, I do have Knoppix which I believe has the GNU compiler tools, that might be worth a try if a solution can't be found this way.
As for Vista, I'm avoiding it, in fact I only upgraded to XP reluctantly.
hallsy9
03-21-2008, 01:48 PM
"void FETCH_release(FETCH* p)"
try deleating void
Marzman
03-21-2008, 02:56 PM
"void FETCH_release(FETCH* p)"
try deleating void
I've tried that (and a few other permutations). It results in more errors, and most importantly, still includes the one we're trying to resolve.
I did find a binary someone else had created. Snag is it's for linux systems, so I would need to download cygwin, as XP seems to think file constitutes a type and that isn't usually a very good start for opening files.
Ajmukon
03-21-2008, 08:36 PM
this is a conundrum.
Hallsy is stumped... i am surprised.
try deleating the space between "* and p" (it would read FETCH*p=malloc(sizeof(FETCH));
Marzman
03-22-2008, 09:27 AM
try deleating the space between "* and p" (it would read FETCH*p=malloc(sizeof(FETCH));
That doesn't create any more errors, but it doesn't fix the one we're trying to solve, however I did come across some .deb releases. It says they're for Ubuntu 7.10, with one being for AMD 64 processors, and the other i386.
vBulletin v3.6.1, Copyright ©2000-2012, Jelsoft Enterprises Ltd.