This site is no longer active and is available for archival purposes only. Registration and login is disabled.

ipaq 4155 datatype misalignment error


ipaq 4155 datatype misalignment error

Postby ramses » Sep 5, 2004 @ 8:12am

ramses
pm Member
 
Posts: 18
Joined: Sep 5, 2004 @ 8:06am


Postby Kevin Gelso » Sep 5, 2004 @ 4:35pm

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.
User avatar
Kevin Gelso
Contributing Editor
 
Posts: 1116
Joined: Jan 10, 2004 @ 3:52pm
Location: Naperville


Postby sponge » Sep 5, 2004 @ 5:24pm

Put code tag in, moved to Dev forum.
holy internets batman.
User avatar
sponge
Not sponge
 
Posts: 12779
Joined: Jan 13, 2002 @ 8:04am
Location: New Hampshire


different sizes of structs

Postby ramses » Sep 5, 2004 @ 6:50pm

ramses
pm Member
 
Posts: 18
Joined: Sep 5, 2004 @ 8:06am


Postby mm40 » Sep 6, 2004 @ 5:22am

User avatar
mm40
pm Member
 
Posts: 135
Joined: Feb 21, 2003 @ 9:11pm


data misalignment

Postby ramses » Sep 6, 2004 @ 8:10am

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.
ramses
pm Member
 
Posts: 18
Joined: Sep 5, 2004 @ 8:06am


Postby rcp » Sep 6, 2004 @ 9:01am

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
User avatar
rcp
pm Member
 
Posts: 184
Joined: Jul 18, 2003 @ 2:12am
Location: Duluth, GA. (Southeast US)


excellent idea

Postby ramses » Sep 6, 2004 @ 5:31pm

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!
ramses
pm Member
 
Posts: 18
Joined: Sep 5, 2004 @ 8:06am


small fix found for data misalignment

Postby ramses » Sep 7, 2004 @ 8:43pm

ramses
pm Member
 
Posts: 18
Joined: Sep 5, 2004 @ 8:06am


Postby refractor » Sep 7, 2004 @ 9:59pm

User avatar
refractor
pm Insider
 
Posts: 2304
Joined: Feb 5, 2002 @ 1:12pm
Location: Luxembourg


Postby rcp » Sep 8, 2004 @ 3:04am

User avatar
rcp
pm Member
 
Posts: 184
Joined: Jul 18, 2003 @ 2:12am
Location: Duluth, GA. (Southeast US)


ipaq data misalignment

Postby ramses » Sep 8, 2004 @ 5:37am

ramses
pm Member
 
Posts: 18
Joined: Sep 5, 2004 @ 8:06am


changing theoretical size

Postby ramses » Sep 8, 2004 @ 6:06am

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.
ramses
pm Member
 
Posts: 18
Joined: Sep 5, 2004 @ 8:06am


Postby mm40 » Sep 12, 2004 @ 8:26am

User avatar
mm40
pm Member
 
Posts: 135
Joined: Feb 21, 2003 @ 9:11pm


image loader

Postby ramses » Sep 14, 2004 @ 8:46pm

ramses
pm Member
 
Posts: 18
Joined: Sep 5, 2004 @ 8:06am


Next

Return to Windows Mobile


Sort


Forum Description

A discussion forum for mobile device developers on the Windows Mobile platform. Any platform specific topics are welcome.

Moderators:

Dan East, sponge, Digby, David Horn, Kevin Gelso, RICoder

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron