Some things strange with bcc 5.0
Moderators: XnTriq, helmut, xnview
Some things strange with bcc 5.0
Hello
I am using libgfl version 2.11 and when I change to 2.20 or 2.40 there are some strange things like:
1.- Bitmap->BytesPerLine on 2.11 has a value of 1350 (that is ok ) and on 2.20/2.40 it has a value of 1352 (that is not ok)
2.- If i try to load a picture of n bytes on 2.11 I got on
GFL_FILE_INFORMATION info;
....
gflGetFileInformation(_parc(1),_parnl(2),&info);
...
info.FileSize---> has the right value
but with 2.20 or 2.40 it has a really strange value but not the filesize
I use Bcc 5.0.
Thanks in advance
Jose Ignacio Jimenez Alarcon
I am using libgfl version 2.11 and when I change to 2.20 or 2.40 there are some strange things like:
1.- Bitmap->BytesPerLine on 2.11 has a value of 1350 (that is ok ) and on 2.20/2.40 it has a value of 1352 (that is not ok)
2.- If i try to load a picture of n bytes on 2.11 I got on
GFL_FILE_INFORMATION info;
....
gflGetFileInformation(_parc(1),_parnl(2),&info);
...
info.FileSize---> has the right value
but with 2.20 or 2.40 it has a really strange value but not the filesize
I use Bcc 5.0.
Thanks in advance
Jose Ignacio Jimenez Alarcon
-
- Author of XnView
- Posts: 44583
- Joined: Mon Oct 13, 2003 7:31 am
- Location: France
Re: Some things strange with bcc 5.0
Strange a difference of 2 bytes?? Could you send me original file?josei wrote:Hello
I am using libgfl version 2.11 and when I change to 2.20 or 2.40 there are some strange things like:
1.- Bitmap->BytesPerLine on 2.11 has a value of 1350 (that is ok ) and on 2.20/2.40 it has a value of 1352 (that is not ok)
2.- If i try to load a picture of n bytes on 2.11 I got on
GFL_FILE_INFORMATION info;
....
gflGetFileInformation(_parc(1),_parnl(2),&info);
...
info.FileSize---> has the right value
but with 2.20 or 2.40 it has a really strange value but not the filesize
Pierre.
-
- Posts: 47
- Joined: Fri Nov 19, 2004 10:50 am
- Location: Paris, France
-
- Posts: 78
- Joined: Wed Aug 04, 2004 8:32 pm
Solution is simple. (As long as this is indeed the reason).
LinePadding member of is initilized to 4 (2.20+) while it was prior 1 (2.11)
Change it back to 1 manually after call to gflGetDefaultLoadParams.
test it yourself:
LinePadding member of is initilized to 4 (2.20+) while it was prior 1 (2.11)
Change it back to 1 manually after call to gflGetDefaultLoadParams.
test it yourself:
Code: Select all
#include <windows.h>
#include <stdio.h>
#include <iostream>
#include <libgfl.h>
#pragma link "b_libgfl.lib"
using namespace std;
int main(int argc, char* argv[])
{
gflLibraryInit();
GFL_LOAD_PARAMS x;
gflGetDefaultLoadParams(&x);
cout << x.LinePadding << endl;
Sleep(2000);
return 0;
}
-
- Author of XnView
- Posts: 44583
- Joined: Mon Oct 13, 2003 7:31 am
- Location: France
-
- Posts: 78
- Joined: Wed Aug 04, 2004 8:32 pm
I know.xnview wrote:Right, now the padding is 4, better for windows compatibility...MaierMan wrote:Solution is simple. (As long as this is indeed the reason).
LinePadding member of is initilized to 4 (2.20+) while it was prior 1 (2.11)
Change it back to 1 manually after call to gflGetDefaultLoadParams.
But I think this change (between 2.11 and 2.20) is what causes the "issues" experienced here.
Had the problem myself with a routine that accessed the GFL_BITMAP.Data member directly.
Things broke (because the padded bytes were read as well) and I had a hard time figuring out what happend.
That reminds me:
References/Structures/GFL_LOAD_PARAMS wrote:LinePadding
Pad for a pixels line (For example, a value of 4 allow a line padding on 32bits).
Default value : 1
Hello
First of all, many thanks to all who answered my question.
Well with linepadding=1 the problem with the two extra bytes is now resolved.
But I have the second problem
The size on windows of a image (dicom) is 524288 bytes with 2.11 I got on Filesize this value but with 2.40 I get the following value 13293124
With a jpg file of 69635 bytes with 2.11 I got this value but now I get 13296832
I use the followings settings
load_option.Flags |= GFL_LOAD_SKIP_ALPHA;
load_option.Origin = GFL_BOTTOM_LEFT;
load_option.ColorModel = GFL_BGR;
I don´t know if there is any diference but I have a c function that modify the defaulf file selection dialog of windows to show a thumbnail, like xnview, and one of the fields is filesize...it shows the right file size.
Yours
Jose Jimenez Alarcon
First of all, many thanks to all who answered my question.
Well with linepadding=1 the problem with the two extra bytes is now resolved.
But I have the second problem
The size on windows of a image (dicom) is 524288 bytes with 2.11 I got on Filesize this value but with 2.40 I get the following value 13293124
With a jpg file of 69635 bytes with 2.11 I got this value but now I get 13296832
I use the followings settings
load_option.Flags |= GFL_LOAD_SKIP_ALPHA;
load_option.Origin = GFL_BOTTOM_LEFT;
load_option.ColorModel = GFL_BGR;
I don´t know if there is any diference but I have a c function that modify the defaulf file selection dialog of windows to show a thumbnail, like xnview, and one of the fields is filesize...it shows the right file size.
Yours
Jose Jimenez Alarcon
-
- Author of XnView
- Posts: 44583
- Joined: Mon Oct 13, 2003 7:31 am
- Location: France
Strange anyone has the same problem?josei wrote:Hello
First of all, many thanks to all who answered my question.
Well with linepadding=1 the problem with the two extra bytes is now resolved.
But I have the second problem
The size on windows of a image (dicom) is 524288 bytes with 2.11 I got on Filesize this value but with 2.40 I get the following value 13293124
With a jpg file of 69635 bytes with 2.11 I got this value but now I get 13296832
I use the followings settings
load_option.Flags |= GFL_LOAD_SKIP_ALPHA;
load_option.Origin = GFL_BOTTOM_LEFT;
load_option.ColorModel = GFL_BGR;
I don´t know if there is any diference but I have a c function that modify the defaulf file selection dialog of windows to show a thumbnail, like xnview, and one of the fields is filesize...it shows the right file size.
Yours
Jose Jimenez Alarcon
Pierre.
-
- Posts: 78
- Joined: Wed Aug 04, 2004 8:32 pm
Question is: how do you get the value?xnview wrote: Strange anyone has the same problem?
something like ftell();
or maybe GetFileAttributesEx()?
Latter has some issues when computing the size the wrong way. But can not fully recall what was causing them...
have to look in my code archive...
(and this issue is most likely pre-vcs time so I dont have neigther CVS nor SVN history... Not sure If Ill find it )
Hello
I work with C so Filesize is get from GFL_FILE_INFORMATION structure with the followinf call
gflGetFileInformation(_parc(1),_parnl(2),&info);
_parc(1): Name of the file
_parnl(2): -1 (index)
for dicom (no compressed files) you have the size on the header of the file...son there is no external calls
for other files I got the size from xnview
Yours
Jose Jimenez Alarcon
I work with C so Filesize is get from GFL_FILE_INFORMATION structure with the followinf call
gflGetFileInformation(_parc(1),_parnl(2),&info);
_parc(1): Name of the file
_parnl(2): -1 (index)
for dicom (no compressed files) you have the size on the header of the file...son there is no external calls
for other files I got the size from xnview
Yours
Jose Jimenez Alarcon
-
- Author of XnView
- Posts: 44583
- Joined: Mon Oct 13, 2003 7:31 am
- Location: France
Do you have the same with all files?josei wrote:Hello
I work with C so Filesize is get from GFL_FILE_INFORMATION structure with the followinf call
gflGetFileInformation(_parc(1),_parnl(2),&info);
_parc(1): Name of the file
_parnl(2): -1 (index)
for dicom (no compressed files) you have the size on the header of the file...son there is no external calls
for other files I got the size from xnview
Yours
Jose Jimenez Alarcon
Pierre.
-
- Posts: 78
- Joined: Wed Aug 04, 2004 8:32 pm
What happens if you run this testcase program.
Its a console application which expects first argument to be the file )
(You'll propably need to set appropriate #pragma link)
(Maybe doing <iostream.h> inststead of <iostream> but anyway)
I can verfiy that output is correct with BCB6 and MSVC.NET 2003.
(Means GFL and WIN32API match and even the "bads" are ok)
But there might be issues with BCB5 series (IIRC)
testcase program
Its a console application which expects first argument to be the file )
(You'll propably need to set appropriate #pragma link)
(Maybe doing <iostream.h> inststead of <iostream> but anyway)
I can verfiy that output is correct with BCB6 and MSVC.NET 2003.
(Means GFL and WIN32API match and even the "bads" are ok)
But there might be issues with BCB5 series (IIRC)
testcase program
Code: Select all
#include <iostream>
#include <windows.h>
#include <libgfl.h>
#pragma link "b_libgfl.lib"
int main(int argc, char* argv[])
{
OSVERSIONINFO osi;
osi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
if (GetVersionEx(&osi))
{
std::cout << "WinVer: " << osi.dwMajorVersion << "." << osi.dwMinorVersion << "." << osi.dwBuildNumber << " (" << osi.szCSDVersion << ")" << std::endl;
}
if (argc != 2)
{
std::cout << "Wrong arg count" << std::endl;
return 0;
}
gflLibraryInit();
GFL_FILE_INFORMATION fi;
GFL_ERROR err;
if ((err = gflGetFileInformation(argv[1], -1, &fi)) == GFL_NO_ERROR)
{
std::cout << "GflSDK: " << fi.FileSize << std::endl;
WIN32_FILE_ATTRIBUTE_DATA fad;
if (GetFileAttributesEx(argv[1], GetFileExInfoStandard, &fad))
{
// ok, this will mess with files > 4GB, but using __int64 is too much for such a testcase :p
std::cout << "Win32API: " << (fad.nFileSizeLow + fad.nFileSizeHigh * MAXDWORD) << std::endl;
std::cout << "Win32API bad1: " << (fad.nFileSizeLow) << std::endl;
std::cout << "Win32API bad2: " << (fad.nFileSizeLow + fad.nFileSizeHigh) << std::endl;
}
gflFreeFileInformation(&fi);
}
else
{
std::cout << "Failed to retrieve info" << std::endl;
std::cout << "GFL: " << gflGetErrorString(err) << std::endl;
}
gflLibraryExit();
return 0;
}
-
- Posts: 47
- Joined: Fri Nov 19, 2004 10:50 am
- Location: Paris, France