summaryrefslogtreecommitdiff
path: root/emulators/palmosemulator/patches/patch-ap
blob: a7157991611b1e8fc6c7d19f160993255ec095b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
$NetBSD: patch-ap,v 1.2 2007/10/24 14:28:14 dsainty Exp $

The buffer "buffer" has to be aligned on a 2 byte boundary.  On an odd byte
boundary we get the error at startup:

    Hardware exception #3 occurred while the emulator was
    calling the Palm OS function "DlkDispatchRequest". The
    emulator is now in an unstable state and will reset.

An odd byte boundary (and the above error) is typical with gcc 4.1.2 on x86.

--- SrcShared/Miscellaneous.cpp.orig	2002-03-30 01:11:15.000000000 +1200
+++ SrcShared/Miscellaneous.cpp	2007-10-25 02:41:24.000000000 +1300
@@ -1370,7 +1370,7 @@
 	char	buffer[ sizeof (DlpReqHeaderType) +
 					sizeof (DlpTinyArgWrapperType) +
 					sizeof (DlpWriteUserInfoReqHdrType) +
-					dlpMaxUserNameSize];
+					dlpMaxUserNameSize] __attribute__((__aligned__(2)));
 
 	// Get handy pointers to all of the above.
 	DlpReqHeaderType*			reqHdr		= (DlpReqHeaderType*) buffer;
@@ -2687,7 +2687,7 @@
 	// Get the thousands separator character(s).
 
 	struct lconv*	locale_data = localeconv ();
-	char*			thousands_sep = locale_data->thousands_sep;
+	const char*	thousands_sep = locale_data->thousands_sep;
 
 	if (strlen (thousands_sep) == 0)
 	{
@@ -2747,7 +2747,7 @@
 	// Get the thousands separator character(s).
 
 	struct lconv*	locale_data = localeconv ();
-	char*			thousands_sep = locale_data->thousands_sep;
+	const char*	thousands_sep = locale_data->thousands_sep;
 
 	if (strlen (thousands_sep) == 0)
 	{