Page 1 of 2
ipaq 4155 datatype misalignment error

Posted:
Sep 5, 2004 @ 8:12am
by ramses

Posted:
Sep 5, 2004 @ 4:35pm
by Kevin Gelso
Put this down into the devolopers forum. Also when putting your code it makes it easier to read if you do [ code] then put ur code here [/code ] Just type that in without the spaces in the tag.

Posted:
Sep 5, 2004 @ 5:24pm
by sponge
Put code tag in, moved to Dev forum.
different sizes of structs

Posted:
Sep 5, 2004 @ 6:50pm
by ramses

Posted:
Sep 6, 2004 @ 5:22am
by mm40
data misalignment

Posted:
Sep 6, 2004 @ 8:10am
by ramses
From what I have seen in the code, I think that my realloc is the thing causing my problems. If I change the code to simply not use realloc, then the problem no longer occurrs. I just have to figure out a good way to move the data in lpDIB over to a variable then back into lpDIB without using realloc. I did some reading on about good memory practices on the pocket pc and it mentions to get rid of the C calls. I think I'll just make some changes to fit with the article if possible.

Posted:
Sep 6, 2004 @ 9:01am
by rcp
I just read the article you mentioned and I can't believe that it said to not use malloc(). I've got lots of code that uses it and one game that malloc/frees tons of memory (well over 10mb). None of this has ever caused a problem. No leaks, drips, runs or errors.
For your specific situation, keep the header/palette information apart from the bitmap data. The header shouldn't stored as BITMAPINFOHEADER, but as a more generic structure.. read in BITMAPINFOHEADER and then translate. This is helpful when you start reading bitmaps of other types... such as JPG or TGA. With your header in a generic format and the bitmap data in its own array, your CBitmap class can work for more than one file type. Change your ::LoadDIB(char *filename) to ::FromFile(char *filename) and have that function look at the extension (or similar) to determine the filetype and then call the specific function for that filetype. It sounds like more work, but three years down the road when you are using this class for 10 different formats, you'll be happy you got it right to start! My 'bitmap' class was started in '91 with Win31 and I still use it today. Get these basic classes solid and you can use them for years.
Cheers,
rcp
excellent idea

Posted:
Sep 6, 2004 @ 5:31pm
by ramses
I didn't even think of using different image types until now. That would actually work out well. I also found information on how to load a bitmap from file from a good site.
Reading in multiple file formats does seem like more work, however, it will offer me more flexebility in the future. I think I'll go ahead and start working on it!
small fix found for data misalignment

Posted:
Sep 7, 2004 @ 8:43pm
by ramses

Posted:
Sep 7, 2004 @ 9:59pm
by refractor

Posted:
Sep 8, 2004 @ 3:04am
by rcp
ipaq data misalignment

Posted:
Sep 8, 2004 @ 5:37am
by ramses
changing theoretical size

Posted:
Sep 8, 2004 @ 6:06am
by ramses
I padded the mallocs with 32 and changed the equasion to the theoretical size and I didn't have any results. In fact, after I changed the equasion to load height*width*bitsize then it won't even load my images anymore. I will continue to look to see where the problem is.

Posted:
Sep 12, 2004 @ 8:26am
by mm40
image loader

Posted:
Sep 14, 2004 @ 8:46pm
by ramses