summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorleo2009-10-08 00:08:32 +0000
committerleo2009-10-08 00:08:32 +0000
commit9a0e93203b563299728cc41e6c455792bfe4c5af (patch)
tree4e95a0446d0aca601e2d4d2eb0e5721f595d1c5e
parent27924be9739e67cb7808dfa98c4904816bed1cea (diff)
Fixes for 64-bit systems.
git-svn-id: http://svn.leocad.org/branches/leocad-0.75@836 c7d43263-9d01-0410-8a33-9dba5d9f93d6
-rw-r--r--common/project.cpp8
-rw-r--r--config.mk5
-rw-r--r--linux/dialogs.cpp2
-rwxr-xr-xlinux/dlgpiece.cpp2
-rw-r--r--linux/main.cpp4
-rw-r--r--win/config.h1
6 files changed, 14 insertions, 8 deletions
diff --git a/common/project.cpp b/common/project.cpp
index 802c1bc..da9e82d 100644
--- a/common/project.cpp
+++ b/common/project.cpp
@@ -640,7 +640,7 @@ bool Project::FileLoad(File* file, bool bUndo, bool bMerge)
for (pGroup = pLastGroup; pGroup; pGroup = pGroup->m_pNext)
{
- i = (int)pGroup->m_pGroup;
+ i = LC_POINTER_TO_INT(pGroup->m_pGroup);
pGroup->m_pGroup = NULL;
if (i > 0xFFFF || i == -1)
@@ -662,7 +662,7 @@ bool Project::FileLoad(File* file, bool bUndo, bool bMerge)
Piece* pPiece;
for (pPiece = m_pPieces; pPiece; pPiece = pPiece->m_pNext)
{
- i = (int)pPiece->GetGroup();
+ i = LC_POINTER_TO_INT(pPiece->GetGroup());
pPiece->SetGroup(NULL);
if (i > 0xFFFF || i == -1)
@@ -4767,7 +4767,7 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
AddPiece(pPiece);
pPiece->Select(true, false, false);
- j = (int)pPiece->GetGroup();
+ j = LC_POINTER_TO_INT(pPiece->GetGroup());
if (j != -1)
pPiece->SetGroup(groups[j]);
else
@@ -4776,7 +4776,7 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
for (j = 0; j < i; j++)
{
- int g = (int)groups[j]->m_pGroup;
+ int g = LC_POINTER_TO_INT(groups[j]->m_pGroup);
groups[j]->m_pGroup = (g != -1) ? groups[g] : NULL;
}
diff --git a/config.mk b/config.mk
index 0b2c606..0e5b475 100644
--- a/config.mk
+++ b/config.mk
@@ -229,6 +229,11 @@ config:
ac_cv_sizeof_void_p=0; \
fi; \
echo "#define LC_SIZEOF_VOID_P $$ac_cv_sizeof_void_p" >> $(OSDIR)/config.h; \
+ if test "$$ac_cv_sizeof_void_p" -eq "8"; then \
+ echo "#define LC_POINTER_TO_INT(p) ((lcint32)(lcint64)(p))" >> $(OSDIR)/config.h; \
+ else \
+ echo "#define LC_POINTER_TO_INT(p) ((lcint32)(p))" >> $(OSDIR)/config.h; \
+ fi; \
rm -f conftest.c conftest conftestval; \
\
echo -n "checking size of long long... "; \
diff --git a/linux/dialogs.cpp b/linux/dialogs.cpp
index 5318caf..de0b3ef 100644
--- a/linux/dialogs.cpp
+++ b/linux/dialogs.cpp
@@ -219,7 +219,7 @@ int dlg_domodal(GtkWidget* dlg, int def)
void dlg_default_callback(GtkWidget *widget, gpointer data)
{
- *cur_ret = (int)data;
+ *cur_ret = GPOINTER_TO_INT(data);
}
gint dlg_delete_callback(GtkWidget *widget, GdkEvent* event, gpointer data)
diff --git a/linux/dlgpiece.cpp b/linux/dlgpiece.cpp
index 36f06a4..ac260c6 100755
--- a/linux/dlgpiece.cpp
+++ b/linux/dlgpiece.cpp
@@ -64,7 +64,7 @@ static void minifigdlg_color_response (GtkWidget *widget, gpointer data)
info->wizard->ChangeColor (i, GPOINTER_TO_INT (data));
info->wizard->Redraw ();
- set_button_pixmap2 (button, FlatColorArray[(int)data]);
+ set_button_pixmap2 (button, FlatColorArray[GPOINTER_TO_INT(data)]);
}
// A color button was clicked
diff --git a/linux/main.cpp b/linux/main.cpp
index 2e482bc..7720d92 100644
--- a/linux/main.cpp
+++ b/linux/main.cpp
@@ -128,7 +128,7 @@ void OnCommandDirect(GtkWidget *w, gpointer data)
if (ignore_commands)
return;
- lcGetActiveProject()->HandleCommand((LC_COMMANDS)(int)data, 0);
+ lcGetActiveProject()->HandleCommand((LC_COMMANDS)GPOINTER_TO_INT(data), 0);
}
static void view_destroy (GtkWidget *widget, gpointer data)
@@ -139,7 +139,7 @@ static void view_destroy (GtkWidget *widget, gpointer data)
void OnCommand(GtkWidget* widget, gpointer data)
{
Project* project = lcGetActiveProject();
- int id = (int)data;
+ int id = GPOINTER_TO_INT(data);
if (ignore_commands)
return;
diff --git a/win/config.h b/win/config.h
index db1fe75..f28ef05 100644
--- a/win/config.h
+++ b/win/config.h
@@ -14,6 +14,7 @@
#define LC_VERSION_TEXT "0.75"
#define LC_VERSION_TAG ""
#define LC_INSTALL_PREFIX "C:\\leocad"
+#define LC_POINTER_TO_INT(p) ((lcint32)(p))
typedef signed char lcint8;
typedef unsigned char lcuint8;