MapServer / MapServer-import

3 stars 2 forks source link

replace msSaveImageStreamGD with gdIOCtx code #1047

Open tbonfort opened 12 years ago

tbonfort commented 12 years ago

Reporter: sgillies@frii.com Date: 2004/11/10 - 05:41

So that mapserver can be compiled with VC/.NET.
tbonfort commented 12 years ago

Author: fwarmerdam Date: 2004/11/10 - 16:23

To expand on this, building with VC/.NET against the binary distribution of
GD distributed by Boutell.com fails because it uses the MSVCRT (VC6 runtime
library) while VC.NET has a different runtime library (MSVCRT70.dll?) and you
can't share file handles (FILE *) between them. 

msSaveImageGD() opens the file with fopen, and that file handle later gets passed
down into BGD.DLL. 

The same issue can arise if building MapServer with LIBC instead of MSVCRT on
VC6 or various other configurations. 
tbonfort commented 12 years ago

Author: sgillies@frii.com Date: 2004/11/10 - 16:37

Thanks, Frank, there's more discussion at

  http://www.boutell.com/gd/faq.html

My solution is to go entirely through gdIOCtx for GD IO.  Looking at gd_jpeg.c,
it's clear that the gdImage*() functions are wrappers for gdImage*Ctx() and
make use of a file-oriented ctx structure.

I'm going to replace msSaveImageStreamGD() with a msSaveImageGDCtx function
and have msSaveImageGD wrap it in exactly the same way that GD's 
gdImage*() wraps gdImage*Ctx().  While I'm at it, I will pull the mapio
output case into msSaveImage().  We then simply pass a gdIOCtx into the lower-
level function, which will be nice and clean.
tbonfort commented 12 years ago

Author: sgillies@frii.com Date: 2004/11/10 - 21:31

Extended this work to cover image loading through msLoadImageGD and loadSymbol.
Will close up after frank and hobu get a chance to test.
tbonfort commented 12 years ago

Author: sgillies@frii.com Date: 2004/11/11 - 18:44

hobu says this tested fine on his .NET build.