Fix build on 64bit platforms

This commit is contained in:
Tilman Keskinoz 2007-08-12 17:03:48 +00:00
parent 20b6501258
commit d967ce5cd9
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=197534
6 changed files with 285 additions and 40 deletions

View file

@ -1,5 +1,14 @@
--- gman.c.orig Mon Dec 13 22:25:03 2004
+++ gman.c Mon Dec 13 22:26:54 2004
@@ -47,7 +47,7 @@
pthread_mutex_init(&context_lock,NULL);
pthread_mutex_init(&loading_man_path_lock,NULL);
init_context();
- debuging = (int)context->get_value("debuging");
+ debuging = (intptr_t)context->get_value("debuging");
pthread_mutex_lock(&gtk_lock);
gtk_init (&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
@@ -62,6 +62,8 @@
//gtk_main();

View file

@ -1,40 +1,52 @@
--- mandata.c.orig Sun Aug 29 09:29:38 2004
+++ mandata.c Sun Aug 29 09:33:45 2004
@@ -241,11 +241,11 @@
char buffer2[BUFFER_SIZE];
switch ((int)context->get_value("show_mode")) {
case 0:
- sprintf(buffer,"%s -T '%s manual page' -n GMan -e man ",
+ sprintf(buffer,"%s -T '%s manual page' -n GMan -e man %s",
(char*)context->get_value("xterm_command"),
- get_display_name(buffer1));
- len = strlen(buffer);
- attach(buffer+len,man_path->GetPath(),file_name);
+ get_display_name(buffer1), get_display_name(buffer1));
+/* len = strlen(buffer);
+ attach(buffer+len,man_path->GetPath(),file_name); */
//g_warning(buffer);
if(!fork())
{
@@ -256,9 +256,9 @@
break;
case 1:
sprintf(loc_name," ~/.gman.%s.ps ",get_display_name(buffer1));
- sprintf(buffer,"man -t ");
- len = strlen(buffer);
- attach(buffer+len,man_path->GetPath(),file_name);
+ sprintf(buffer,"man -t %s", get_display_name(buffer1));
+/* len = strlen(buffer);
+ attach(buffer+len,man_path->GetPath(),file_name); */
strcat(buffer," >> ");
strcat(buffer,loc_name);
strcat(buffer," ; ");
@@ -306,7 +306,7 @@
case 2:
sprintf(loc_name," ~/.gman.%s.html ",get_display_name(buffer1));
//g_warning(loc_name);
- strcpy(buffer,"/usr/lib/cgi-bin/gman.pl ");
+ strcpy(buffer,"/usr/local/www/cgi-bin/gman.pl ");
strcat(buffer," ");
strcat(buffer,get_section_name(buffer2));
strcat(buffer," ");
--- mandata.c.orig 2007-08-12 19:00:16.000000000 +0200
+++ mandata.c 2007-08-12 19:00:46.000000000 +0200
@@ -239,13 +239,13 @@
char buffer[2*BUFFER_SIZE];
char loc_name[BUFFER_SIZE];
char buffer2[BUFFER_SIZE];
- switch ((int)context->get_value("show_mode")) {
+ switch ((intptr_t)context->get_value("show_mode")) {
case 0:
- sprintf(buffer,"%s -T '%s manual page' -n GMan -e man ",
+ sprintf(buffer,"%s -T '%s manual page' -n GMan -e man %s",
(char*)context->get_value("xterm_command"),
- get_display_name(buffer1));
- len = strlen(buffer);
- attach(buffer+len,man_path->GetPath(),file_name);
+ get_display_name(buffer1), get_display_name(buffer1));
+/* len = strlen(buffer);
+ attach(buffer+len,man_path->GetPath(),file_name); */
//g_warning(buffer);
if(!fork())
{
@@ -256,9 +256,9 @@
break;
case 1:
sprintf(loc_name," ~/.gman.%s.ps ",get_display_name(buffer1));
- sprintf(buffer,"man -t ");
- len = strlen(buffer);
- attach(buffer+len,man_path->GetPath(),file_name);
+ sprintf(buffer,"man -t %s", get_display_name(buffer1));
+/* len = strlen(buffer);
+ attach(buffer+len,man_path->GetPath(),file_name); */
strcat(buffer," >> ");
strcat(buffer,loc_name);
strcat(buffer," ; ");
@@ -306,7 +306,7 @@
case 2:
sprintf(loc_name," ~/.gman.%s.html ",get_display_name(buffer1));
//g_warning(loc_name);
- strcpy(buffer,"/usr/lib/cgi-bin/gman.pl ");
+ strcpy(buffer,"/usr/local/www/cgi-bin/gman.pl ");
strcat(buffer," ");
strcat(buffer,get_section_name(buffer2));
strcat(buffer," ");
@@ -350,7 +350,7 @@
break;
default:
if(context->get_value("show_warning"))
- g_print("unexpected \'show_mode\' : %d ",(int)context->get_value("show_mode"));
+ g_print("unexpected \'show_mode\' : %d ",(intptr_t)context->get_value("show_mode"));
return;
}
//g_warning(buffer);

View file

@ -0,0 +1,167 @@
--- menu.c.bak 2007-08-12 18:39:59.000000000 +0200
+++ menu.c 2007-08-12 18:44:35.000000000 +0200
@@ -173,32 +173,33 @@
/*flag = 0 means not to invoke call backs when changing the states of buttons.*/
void updata_menu_buttons(int flag)
{
- int i,j,k,k2;
- k = (int)context->get_value("display_section_policy");
+ int i,j;
+ intptr_t k,k2;
+ k = (intptr_t)context->get_value("display_section_policy");
if(k>0 && k<=2)
if(!((GtkCheckMenuItem*)(section_select[k]))->active){
if(!flag) signal_menu_change++;
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(section_select[k]),1);
}
- k = (int)context->get_value("display_section");
+ k = (intptr_t)context->get_value("display_section");
for (i = 0;i<10;i++)
if(!(k&(1<<i)) != !(((GtkCheckMenuItem*)(section_buttons[i]))->active)) {
if(!flag) signal_menu_change++;
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(section_buttons[i]),k&(1<<i));
}
- k = (int)context->get_value("searching_mode");
+ k = (intptr_t)context->get_value("searching_mode");
if(k>0 && k<=1)
if(!(((GtkCheckMenuItem*)(searching_mode_buttons[k]))->active)) {
if(!flag) signal_menu_change++;
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(searching_mode_buttons[k]),1);
}
- k = (int)context->get_value("show_mode");
+ k = (intptr_t)context->get_value("show_mode");
if(k>0 && k<=3)
if(!(((GtkCheckMenuItem*)(show_mode_buttons[k]))->active)) {
if(!flag) signal_menu_change++;
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(show_mode_buttons[k]),1);
}
- k2 = (int)context->get_value("show_status_bar");
+ k2 = (intptr_t)context->get_value("show_status_bar");
i = k2&(1<<k);
j = (((GtkCheckMenuItem*)(status_bar_button))->active);
if((i&&!j) || (!i&&j)) {
@@ -220,10 +221,10 @@
static void updata_widget_show(int flag)
{
- int k,k2;
+ intptr_t k,k2;
- k = (int)context->get_value("searching_mode");
- k2 = (int)context->get_value("show_status_bar");
+ k = (intptr_t)context->get_value("searching_mode");
+ k2 = (intptr_t)context->get_value("show_status_bar");
if(k2&(1<<k))
gtk_widget_show(hbox_status);
@@ -258,8 +259,8 @@
gtk_window_set_title(GTK_WINDOW(window), "Gman");
gtk_window_set_policy( GTK_WINDOW( window ), FALSE, TRUE, FALSE );
gtk_window_set_default_size(GTK_WINDOW(window),
- (int)context->get_value("h_size"),
- (int)context->get_value("v_size"));
+ (intptr_t)context->get_value("h_size"),
+ (intptr_t)context->get_value("v_size"));
gtk_widget_set_usize(GTK_WIDGET(window),200,150);
main_vbox = gtk_vbox_new(FALSE, 1);
@@ -443,14 +444,14 @@
static int section_policy_callback(GtkWidget *w, gpointer data) {
// static int signal;
- int k,k2;
- k2 = (int) data;
+ intptr_t k,k2;
+ k2 = (intptr_t) data;
if(!((GtkCheckMenuItem*)(section_select[k2]))->active) return 1;
// g_message("Hello, World! %x\n signal = %d",data,signal_menu_change);
if(signal_menu_change>0) {signal_menu_change--;return 1;}
//if(!signal) {signal++;return 1;}
//signal--;
- k = (int) context->get_value("display_section_policy");
+ k = (intptr_t) context->get_value("display_section_policy");
if(k == k2) return 1;
pthread_mutex_lock(&context_lock);
context->set_value("display_section_policy","int",(void*)k2);
@@ -461,12 +462,12 @@
}
static int section_select_callback(GtkWidget *w, gpointer data) {
- int var;
+ intptr_t var;
if(signal_menu_change>0) {signal_menu_change--;return 1;}
pthread_mutex_lock(&context_lock);
- var = (int)context->get_value("display_section");
- var ^= (int)data;
+ var = (intptr_t)context->get_value("display_section");
+ var ^= (intptr_t)data;
context->set_value("display_section","int",(void*)var);
if (context->get_value("display_section_policy")) {
task_set_active(task_extract_man_data);
@@ -496,7 +497,7 @@
}
// context->save(stdout,"automatically made by Gman");
- gtk_exit((int)data);
+ gtk_exit((intptr_t)data);
}
static int window_resize_callback(GtkWidget *w, GtkAllocation * size, gpointer data)
@@ -573,10 +574,10 @@
static int status_bar_callback (GtkWidget *widget, gpointer data)
{
- int k,k2;
+ intptr_t k,k2;
if(signal_menu_change>0) {signal_menu_change--;return 1;}
- k2 = (int) context->get_value("show_status_bar");
- k = (int) context->get_value("searching_mode");
+ k2 = (intptr_t) context->get_value("show_status_bar");
+ k = (intptr_t) context->get_value("searching_mode");
if(((GtkCheckMenuItem*)(status_bar_button))->active) k2 = k2 | (1<<k);
else k2 = k2 & ~(1<<k);
pthread_mutex_lock(&context_lock);
@@ -588,13 +589,13 @@
static int search_mode_callback (GtkWidget *widget, gpointer data)
{
- int k,k2;
- k2 = (int) data;
+ intptr_t k,k2;
+ k2 = (intptr_t) data;
if(!((GtkCheckMenuItem*)(searching_mode_buttons[k2]))->active) return 1;
if(signal_menu_change>0) {signal_menu_change--;return 1;}
//if(!signal) {signal++;return 1;}
//signal--;
- k = (int) context->get_value("searching_mode");
+ k = (intptr_t) context->get_value("searching_mode");
if(k == k2) return 1;
pthread_mutex_lock(&context_lock);
context->set_value("searching_mode","int",(void*)k2);
@@ -606,13 +607,13 @@
static int show_mode_callback (GtkWidget *widget, gpointer data)
{
- int k,k2;
- k2 = (int) data;
+ intptr_t k,k2;
+ k2 = (intptr_t) data;
if(!((GtkCheckMenuItem*)(show_mode_buttons[k2]))->active) return 1;
if(signal_menu_change>0) {signal_menu_change--;return 1;}
//if(!signal) {signal++;return 1;}
//signal--;
- k = (int) context->get_value("show_mode");
+ k = (intptr_t) context->get_value("show_mode");
if(k == k2) return 1;
pthread_mutex_lock(&context_lock);
context->set_value("show_mode","int",(void*)k2);
@@ -638,7 +639,7 @@
static int button_clicked_callback(GtkWidget * w,gpointer data)
{
- int i = (int) data;
+ intptr_t i = (intptr_t) data;
switch (i) {
case 1: task_set_stop(task_key_word_search);break;
case 2: task_set_active(task_key_word_search);break;

View file

@ -0,0 +1,26 @@
--- task.c.bak 2007-08-12 18:47:02.000000000 +0200
+++ task.c 2007-08-12 18:47:32.000000000 +0200
@@ -112,12 +112,12 @@
do {
have_task = 0;
task = (Task *)NULL;
- int flag = 0;
+ intptr_t flag = 0;
pthread_mutex_lock(&task_group->lock);
j = task_group->tasks->get_size();
for(i = 0; i<j && !have_task ;i++) {
if((task = (Task*)task_group->tasks->get_item(i))->signals[0]->get_size()) {
- flag = ((int)task->signals[0]->get_item(0) & ~1) | (task->state & 1);
+ flag = ((intptr_t)task->signals[0]->get_item(0) & ~1) | (task->state & 1);
task->signals[0]->delete_item(0);
have_task++;
}
@@ -126,7 +126,7 @@
have_task++;
}
else if (task->signals[1]->get_size()) {
- flag = ((int)task->signals[1]->get_item(1) & ~1);
+ flag = ((intptr_t)task->signals[1]->get_item(1) & ~1);
task->signals[1]->delete_item(0);
have_task++;
}

View file

@ -0,0 +1,20 @@
--- taskfunc.c.bak 2007-08-12 18:49:55.000000000 +0200
+++ taskfunc.c 2007-08-12 18:51:16.000000000 +0200
@@ -38,13 +38,13 @@
{
ManItem ** buffer;
int i,j,count;
- int display_section_ID;
+ intptr_t display_section_ID;
pthread_mutex_lock(&context_lock);
- switch ((int)context->get_value("display_section_policy")) {
+ switch ((intptr_t)context->get_value("display_section_policy")) {
case 0: display_section_ID = ~0;break;
- case 1: display_section_ID = ~(int)(context->get_value("display_section"));break;
- case 2: display_section_ID = (int)context->get_value("display_section"); break;
+ case 1: display_section_ID = ~(intptr_t)(context->get_value("display_section"));break;
+ case 2: display_section_ID = (intptr_t)context->get_value("display_section"); break;
default: fprintf(stderr,"warning: init_man_data: \"display_section_policy\" "
"have invalid value %d",context->get_value("display_section_policy"));
display_section_ID = ~0;

View file

@ -0,0 +1,11 @@
--- window2.c.orig 2007-08-12 18:52:11.000000000 +0200
+++ window2.c 2007-08-12 18:52:53.000000000 +0200
@@ -223,7 +223,7 @@
GtkWidget * x, *apply_button,*add_new_button;
gchar * c, *c2;
int i;
- int select = (int)data;
+ long select = (long)data;
gchar * clist_item[3];
// printf("point2 data = %d\n",select);
apply_button = (GtkWidget*)gtk_object_get_data(GTK_OBJECT(window2),"button2");