[mapserver-dev] msautotest-wxs: how to suppress the header information?

Normand Savard nsavard at mapgears.com
Tue Mar 17 15:28:49 EDT 2009


Tamas Szekeres wrote:
> 2009/3/17 Normand Savard <nsavard at mapgears.com>
>
>   
>> Tamas,
>>
>> I checked how the tests works in mstestlib.py and the generated output.
>>  When it's an wxs tests, if the output result is a png file, it's passed
>> through the demime_file() function.  This function is called when
>>  [RESULT_DEMIME] is part of the RUN_PARMS request.  It removes the
>> Content-type.
>>
>> For the other tests like the ones in gdal or misc, shp2img is used and
>> there is no such thing as Content-type in the png generated.
>>
>> Maybe I'm missing something so please do not hesitate to comment.
>>
>>
>>
>>     
>
>
> Uh, that explains many things but not all. It appears that this problem
> should be dedicated to the difference of the line ending interpretation of
> Windows and the Linux OS. On Windows we actually have 2 bytes to represent
> the line endings (0x0D 0x0A) which should also be stripped. So the following
> function would yield better results:
>
> def demime_file( filename ):
>     print '   demime  %s' % filename
>     data = open(filename,'rb').read()
>
>     for i in range(len(data)-1):
>         if data[i] == '\n' and data[i+2] == '\n':
>             open(filename,'wb').write(data[i+3:])
>             return
>     return
>
> But I have further issues with the de-stripped png images. It appears that
> the result provides invalid image unless I replace  each  0x0D 0x0A  with
> 0x0A in the png image file.
>
> Best regards,
>
> Tamas
>
>   
Tamas,

I did a hexdump and compared one of the file generated by the shp2img 
utility in the gdal test directory (see below).  I could not find the 
line endings difference you're seeing (0D 0A vs 0A).  I'm able to open 
all graphic files on Windows Geotiff excepted with the default Windows 
image viewer.  I worked with version 2.3.1 of ms4w and MapServer 
5.4.0-beta2.  I'm sure you're seeing something, maybe because of a 
difference in a library or a compilation switch or something else.  I 
don't know.

Maybe Frank can shed some light on this.

Norm

nsavard at Manie:~/products/mapserver/msautotest/gdal/tmp$ hexdump 
average_rgb.png
0000000 5089 474e 0a0d 0a1a 0000 0d00 4849 5244
0000010 0000 0c00 0000 0900 0208 0000 fe01 6add
0000020 0095 0000 49b6 4144 1854 8595 cd8d 010a
0000030 1401 bf85 333b cd31 a94a 29d9 94c9 90a7
0000040 c595 a7ac 78a4 c902 58a3 12f0 a58a 3b29
0000050 0b1b 202f 0589 7635 1616 c41a 858c 37f1
0000060 b394 f7ba 73dc 23bf 01c6 4240 0108 00e3
0000070 a801 06dd af56 bf55 e54c 077e f6d4 429e
0000080 71da 33da 2209 b10b 0087 42f9 f7d3 deb7
0000090 007a 2ac8 4c47 c62f 5a53 4c69 5b26 ea49
00000a0 72e6 89de db2c 5365 8e53 d8ba e3ee 07f1
00000b0 782b 205f b104 f116 b7d4 27b4 6294 9495
00000c0 b009 98f3 3ff4 a3e0 3472 f55d a844 8028
00000d0 035c 74f5 08fe d45d 75ff c537 317d 1c74
00000e0 69f6 0085 0000 4900 4e45 ae44 6042 0082
00000ef
----------------------------------------------------------

nsavard at Manie:~/products/mapserver/msautotest/gdal/tmp$ hexdump 
average_rgb_win.png
0000000 5089 474e 0a0d 0a1a 0000 0d00 4849 5244
0000010 0000 0c00 0000 0900 0208 0000 fe01 6add
0000020 0095 0000 49b8 4144 1854 8595 3f8d 010b
0000030 1871 3fc7 ddcf cfe5 062d 29b1 ba89 2157
0000040 e193 2be6 5e29 e481 18a5 1378 d18a cd95
0000050 f062 2406 5031 066c 2e83 7ee2 e706 28e4
0000060 e99f f3f9 3e7d 988f 0067 507c 7980 0506
0000070 bf7a 6945 69d0 e6de ec12 ef41 b09e 8ed2
0000080 5dd3 7a88 4186 31ec d140 7b6a 61de 1dbf
0000090 b201 1029 ede1 3108 532a f972 3c5a 5d91
00000a0 7b2f c8c1 d976 b435 524b ddb3 e1d7 970f
00000b0 f20f 146a 4808 1569 7d4d 8463 ca52 9575
00000c0 88ca c708 b33d 87e1 527c aa0d 227b 34a6
00000d0 900d afbb ae5f a11f fe9b ddff 4b03 3326
00000e0 0e77 b586 00c5 0000 4900 4e45 ae44 6042
00000f0 0082                                  
00000f1




More information about the mapserver-dev mailing list