[Pkg-squeak-devel] Bug#567366: `memoryAllocate' implicitly converted to pointer
Bert Freudenberg
bert at freudenbergs.de
Sun Jan 31 05:20:17 UTC 2010
On 30.01.2010, at 10:50, Petter Reinholdtsen wrote:
>
>
> tags 567366 + patch
> thanks
>
> I believe the enclosed patch solve the problem, by making sure all
> source files include the changesForSqueak.h file which define
> memoryAllocate(). The patch also make sure changesForSqueak.c include
> <stdlib.h> to make sure the prototype for free() is available when
> free() is used.
>
> After looking at the source, I must admit the code quality is not very
> good. Function protypes are unknown when the functions are used (a
> problem for argument parsing and return type handling), several
> functions fail to always provide return values and a lot of unused
> variables are sprinkled around the source. The gcc warnings are
> instructive, and I suspect all the warnings reported by gcc during
> build should be looked and fixed. I do not try to do so with this
> patch, as it is better to fix it upstream.
>
> diff -ur squeak-vm-3.11.3+svn2147/platforms/Cross/plugins/Mpeg3Plugin/libmpeg/changesForSqueak.c squeak-vm-3.11.3+svn2147-pere/platforms/Cross/plugins/Mpeg3Plugin/libmpeg/changesForSqueak.c
> --- squeak-vm-3.11.3+svn2147/platforms/Cross/plugins/Mpeg3Plugin/libmpeg/changesForSqueak.c 2009-12-29 09:34:53.000000000 +0100
> +++ squeak-vm-3.11.3+svn2147-pere/platforms/Cross/plugins/Mpeg3Plugin/libmpeg/changesForSqueak.c 2010-01-30 19:12:49.000000000 +0100
> @@ -47,6 +47,8 @@
> #include <windows.h>
> #endif
>
> +#include <stdlib.h> /* for free() */
> +
> mpeg3_demuxer_t* mpeg3_new_demuxer(mpeg3_t *file, int do_audio, int do_video, int stream_id);
> mpeg3_title_t* mpeg3_new_title(mpeg3_t *file, char *path);
> mpeg3demux_timecode_t* mpeg3_append_timecode(mpeg3_demuxer_t *demuxer,
> diff -ur squeak-vm-3.11.3+svn2147/platforms/Cross/plugins/Mpeg3Plugin/libmpeg/changesForSqueak.h squeak-vm-3.11.3+svn2147-pere/platforms/Cross/plugins/Mpeg3Plugin/libmpeg/changesForSqueak.h
> --- squeak-vm-3.11.3+svn2147/platforms/Cross/plugins/Mpeg3Plugin/libmpeg/changesForSqueak.h 2009-12-29 09:34:53.000000000 +0100
> +++ squeak-vm-3.11.3+svn2147-pere/platforms/Cross/plugins/Mpeg3Plugin/libmpeg/changesForSqueak.h 2010-01-30 19:26:48.000000000 +0100
> @@ -1,4 +1,9 @@
> +#ifndef CHANGESFORSQUEAK_H
> +#define CHANGESFORSQUEAK_H
> +
> #include "mpeg3private.h"
> int mpeg3_generate_toc_for_Squeak(mpeg3_t *file, int timecode_search, int print_streams, char *buffer, int buffer_size);
> void * memoryAllocate(int number,unsigned size);
> void memoryFree(void *stuff);
> +
> +#endif /* CHANGESFORSQUEAK_H */
> diff -ur squeak-vm-3.11.3+svn2147/platforms/Cross/plugins/Mpeg3Plugin/libmpeg/mpeg3protos.h squeak-vm-3.11.3+svn2147-pere/platforms/Cross/plugins/Mpeg3Plugin/libmpeg/mpeg3protos.h
> --- squeak-vm-3.11.3+svn2147/platforms/Cross/plugins/Mpeg3Plugin/libmpeg/mpeg3protos.h 2009-12-29 09:34:53.000000000 +0100
> +++ squeak-vm-3.11.3+svn2147-pere/platforms/Cross/plugins/Mpeg3Plugin/libmpeg/mpeg3protos.h 2010-01-30 19:25:58.000000000 +0100
> @@ -1,6 +1,8 @@
> #ifndef MPEG3PROTOS_H
> #define MPEG3PROTOS_H
>
> +#include "changesForSqueak.h"
> +
> /* CSS */
>
> mpeg3_css_t* mpeg3_new_css();
> diff -ur squeak-vm-3.11.3+svn2147/platforms/Cross/plugins/Mpeg3Plugin/libmpeg/video/mpeg3videoprotos.h squeak-vm-3.11.3+svn2147-pere/platforms/Cross/plugins/Mpeg3Plugin/libmpeg/video/mpeg3videoprotos.h
> --- squeak-vm-3.11.3+svn2147/platforms/Cross/plugins/Mpeg3Plugin/libmpeg/video/mpeg3videoprotos.h 2009-12-29 09:34:53.000000000 +0100
> +++ squeak-vm-3.11.3+svn2147-pere/platforms/Cross/plugins/Mpeg3Plugin/libmpeg/video/mpeg3videoprotos.h 2010-01-30 19:41:42.000000000 +0100
> @@ -1,6 +1,8 @@
> #ifndef MPEG3VIDEOPROTOS_H
> #define MPEG3VIDEOPROTOS_H
>
> +#include "changesForSqueak.h"
> +
> void mpeg3video_idct_conversion(short* block);
> unsigned int mpeg3slice_showbits(mpeg3_slice_buffer_t *slice_buffer, int bits);
>
>
> Happy hacking,
> --
> Petter Reinholdtsen
This might make it compile but upstream says it won't work. Better to disable that plugin altogether on 64 bit platforms:
http://lists.squeak.org/pipermail/vm-dev/2010-January/003806.html
- Bert -
More information about the Pkg-squeak-devel
mailing list