From 68b29a08bc21b15b923b3430fbc41baedba73883 Mon Sep 17 00:00:00 2001 From: tobigun Date: Sat, 14 Jun 2008 18:24:43 +0000 Subject: Removed some "const" parameter modifiers for external function declarations. Pascal has no equivalent to C's "pointer to constant type" const modifier. E.g. "const char* cstr" is not equivalent to "const cstr: PChar". This is because the first is a variable pointer to a constant type and the latter is a constant pointer to a variable type. This means contrary to the C version, in the incorrect pascal version the string can be changed. So it is like a false friend in this example, although "cstr: PChar" is not correct either, as the string can be changed too. Also note that "var myvar: TMyType" is always passed as reference (a pointer is used for this, so it is equivalent to "myvar: PMyType"). This also normally applies to "const myvar: TMyType". But not if the type-size is < 4byte or the function is declared as stdcall or cdecl. In these cases the variable is passed on the stack and not as a pointer. So NEVER replace a C declaration "const my_type_t* my_var" with "const my_var: TMy_type" as it might fail. Use the var modifier instead. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1148 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lib/ffmpeg/avformat.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code/lib/ffmpeg/avformat.pas') diff --git a/Game/Code/lib/ffmpeg/avformat.pas b/Game/Code/lib/ffmpeg/avformat.pas index 4095ddc6..730a64e4 100644 --- a/Game/Code/lib/ffmpeg/avformat.pas +++ b/Game/Code/lib/ffmpeg/avformat.pas @@ -744,7 +744,7 @@ function av_oformat_next(f: PAVOutputFormat): PAVOutputFormat; cdecl; external av__format; {$IFEND} -function av_guess_image2_codec({const} filename: PChar): TCodecID; +function av_guess_image2_codec(filename: {const} PChar): TCodecID; cdecl; external av__format; (* XXX: use automatic init with either ELF sections or C file parser *) -- cgit v1.2.3