Package: ht Severity: normal Tags: patch When building 'ht' on amd64 with gcc-4.0, I get the following errors:
analy_names.cc: In function 'char* label_prefix(const char*)': analy_names.cc:98: error: cast from 'const char*' to 'int' loses precision With the attached patch 'ht' can be compiled on amd64 using gcc-4.0. The patch contains a patch which was already necessary for gcc-3.4. Regards Andreas Jochens diff -urN ../tmp-orig/ht-0.7.3/analyser/analy_names.cc ./analyser/analy_names.cc --- ../tmp-orig/ht-0.7.3/analyser/analy_names.cc 2002-07-30 18:07:53.000000000 +0200 +++ ./analyser/analy_names.cc 2005-02-04 22:06:17.000000000 +0100 @@ -95,7 +95,7 @@ char *label_prefix(const char *p) { if (p <= LPRFX_MAX) { - return label_prefixes[(int)p]; + return label_prefixes[(long)p]; } else { return (char*)p; } diff -urN ../tmp-orig/ht-0.7.3/analyser/coff_analy.cc ./analyser/coff_analy.cc --- ../tmp-orig/ht-0.7.3/analyser/coff_analy.cc 2002-09-10 18:09:27.000000000 +0200 +++ ./analyser/coff_analy.cc 2005-02-05 08:16:51.705309783 +0100 @@ -297,7 +297,7 @@ FILEOFS CoffAnalyser::addressToFileofs(Address *Addr) { if (validAddress(Addr, scinitialized)) { - FILEOFS ofs; + unsigned ofs; // Addr-=pe_shared->pe32.header_nt.image_base; RVA rva; if (!convertAddressToRVA(Addr, &rva)) return INVALID_FILE_OFS; diff -urN ../tmp-orig/ht-0.7.3/analyser/le_analy.cc ./analyser/le_analy.cc --- ../tmp-orig/ht-0.7.3/analyser/le_analy.cc 2002-10-19 11:58:30.000000000 +0200 +++ ./analyser/le_analy.cc 2005-02-05 08:20:14.086839068 +0100 @@ -549,7 +549,9 @@ if (!convertAddressToLEAddress(Addr, &na)) return false; if (!LE_addr_to_segment(le_shared, na, &sec)) return false; LEAddress temp; - bool init = LE_addr_to_ofs(le_shared, na, &temp); + FILEOFS fo_temp; + bool init = LE_addr_to_ofs(le_shared, na, &fo_temp); + temp = fo_temp; LE_OBJECT *s = objects->header + sec; switch (action) { diff -urN ../tmp-orig/ht-0.7.3/cstream.cc ./cstream.cc --- ../tmp-orig/ht-0.7.3/cstream.cc 2002-06-30 19:08:48.000000000 +0200 +++ ./cstream.cc 2005-02-04 21:52:28.000000000 +0100 @@ -120,7 +120,7 @@ UINT ssize = size; while (size >= bufferpos) { memcpy(buf, buffer+buffersize-bufferpos, bufferpos); - ((byte *)buf) += bufferpos; + buf = ((byte *)buf) + bufferpos; size -= bufferpos; bufferpos = 0; if (size) { @@ -140,7 +140,7 @@ while (bufferpos+size >= buffersize) { memcpy(buffer+bufferpos, buf, buffersize-bufferpos); size -= buffersize-bufferpos; - ((byte *)buf) += buffersize-bufferpos; + buf = ((byte *)buf) + buffersize-bufferpos; bufferpos = buffersize; if (size) { if (!flush_compressed()) return ssize - size; diff -urN ../tmp-orig/ht-0.7.3/global.h ./global.h --- ../tmp-orig/ht-0.7.3/global.h 2002-09-13 19:44:57.000000000 +0200 +++ ./global.h 2005-02-04 22:15:49.000000000 +0100 @@ -49,7 +49,7 @@ # undef dword #endif -typedef unsigned int UINT; +typedef unsigned long UINT; #define byte unsigned char #define word unsigned short diff -urN ../tmp-orig/ht-0.7.3/htanaly.cc ./htanaly.cc --- ../tmp-orig/ht-0.7.3/htanaly.cc 2003-07-02 16:26:07.000000000 +0200 +++ ./htanaly.cc 2005-02-05 08:23:13.393733735 +0100 @@ -820,7 +820,7 @@ errorbox(globalerror); continue; } - UINT end_by_lines; + unsigned end_by_lines; if ((by_lines = end_str[0]=='#')) { char *pend = &end_str[1]; bnstr(&pend, &end_by_lines, 10); @@ -1829,7 +1829,7 @@ } else { strcpy(str2, "?"); } - list->insert_str((int)xa, str, xref_type(x->type), str2); + list->insert_str((long)xa, str, xref_type(x->type), str2); xa = (Address*)x_tree->enum_next((ht_data**)&x, xa); } list->attachTitle(text); diff -urN ../tmp-orig/ht-0.7.3/htapp.cc ./htapp.cc --- ../tmp-orig/ht-0.7.3/htapp.cc 2005-02-05 08:29:54.228425808 +0100 +++ ./htapp.cc 2005-02-04 22:11:16.000000000 +0100 @@ -758,7 +758,7 @@ void *ht_project_listbox::getNext(void *entry) { - UINT e=(UINT)entry; + unsigned long e=(unsigned long)entry; if (!e) return NULL; if (project && (e < project->count())) { return (void*)(e+1); @@ -769,7 +769,7 @@ void *ht_project_listbox::getPrev(void *entry) { - UINT e=(UINT)entry; + unsigned long e=(unsigned long)entry; if (e > 1) { return (void*)(e-1); } else { @@ -782,10 +782,10 @@ static char mybuf[32]; if (project) switch (col) { case 0: - ht_snprintf(mybuf, sizeof mybuf, "%s", ((ht_project_item*)project->get((int)entry-1))->get_filename()); + ht_snprintf(mybuf, sizeof mybuf, "%s", ((ht_project_item*)project->get((long)entry-1))->get_filename()); break; case 1: - ht_snprintf(mybuf, sizeof mybuf, "%s", ((ht_project_item*)project->get((int)entry-1))->get_path()); + ht_snprintf(mybuf, sizeof mybuf, "%s", ((ht_project_item*)project->get((long)entry-1))->get_path()); break; default: strcpy(mybuf, "?"); diff -urN ../tmp-orig/ht-0.7.3/htdialog.cc ./htdialog.cc --- ../tmp-orig/ht-0.7.3/htdialog.cc 2002-10-19 22:08:14.000000000 +0200 +++ ./htdialog.cc 2005-02-05 08:23:46.864365304 +0100 @@ -455,7 +455,7 @@ void *ht_history_listbox::getNext(void *entry) { - UINT e=(UINT)entry; + unsigned long e=(unsigned long)entry; if (!e) return NULL; if (e < history->count()) { return (void*)(e+1); @@ -466,7 +466,7 @@ void *ht_history_listbox::getPrev(void *entry) { - UINT e=(UINT)entry; + unsigned long e=(unsigned long)entry; if (e > 1) { return (void*)(e-1); } else { @@ -476,7 +476,7 @@ char *ht_history_listbox::getStr(int col, void *entry) { - return ((ht_history_entry*)history->get((int)entry-1))->desc; + return ((ht_history_entry*)history->get((long)entry-1))->desc; } void ht_history_listbox::handlemsg(htmsg *msg) diff -urN ../tmp-orig/ht-0.7.3/htle.cc ./htle.cc --- ../tmp-orig/ht-0.7.3/htle.cc 2002-10-09 20:32:50.000000000 +0200 +++ ./htle.cc 2005-02-05 08:25:44.321011831 +0100 @@ -322,9 +322,9 @@ FILEOFS h = le_shared->hdr_ofs; le_shared->pagemap.count=le_shared->hdr.pagecnt; - le_shared->pagemap.offset=(dword*)malloc(le_shared->pagemap.count*sizeof *le_shared->pagemap.offset); - le_shared->pagemap.psize=(dword*)malloc(le_shared->pagemap.count*sizeof *le_shared->pagemap.psize); - le_shared->pagemap.vsize=(dword*)malloc(le_shared->pagemap.count*sizeof *le_shared->pagemap.vsize); + le_shared->pagemap.offset=(UINT*)malloc(le_shared->pagemap.count*sizeof *le_shared->pagemap.offset); + le_shared->pagemap.psize=(UINT*)malloc(le_shared->pagemap.count*sizeof *le_shared->pagemap.psize); + le_shared->pagemap.vsize=(UINT*)malloc(le_shared->pagemap.count*sizeof *le_shared->pagemap.vsize); dword last_page_offset=0, last_page=0; for (dword i=0; i<le_shared->hdr.pagecnt; i++) { @@ -487,7 +487,7 @@ streamfile->seek(mofs); s = streamfile->read(buf, s); if (!s) break; - ((byte*)buf) += s; + buf = ((byte*)buf) + s; size -= s; c += s; ofs += s; @@ -556,7 +556,7 @@ if (!map_ofs(ofs, &mofs, &msize)) break; if (s>msize) s = msize; streamfile->seek(mofs); - ((byte*)buf) += streamfile->write(buf, s); + buf = ((byte*)buf) + streamfile->write(buf, s); size -= s; c += s; ofs += s; diff -urN ../tmp-orig/ht-0.7.3/httree.cc ./httree.cc --- ../tmp-orig/ht-0.7.3/httree.cc 2002-08-26 16:07:43.000000000 +0200 +++ ./httree.cc 2005-02-05 08:29:31.857686898 +0100 @@ -158,7 +158,7 @@ */ void ht_treeview::getdata(ht_object_stream *s) { - s->putIntHex((int)selected, 4, NULL); + s->putIntHex((long)selected, 4, NULL); } /* diff -urN ../tmp-orig/ht-0.7.3/srt/srt_x86.cc ./srt/srt_x86.cc --- ../tmp-orig/ht-0.7.3/srt/srt_x86.cc 2002-09-01 19:05:13.000000000 +0200 +++ ./srt/srt_x86.cc 2005-02-04 21:52:29.000000000 +0100 @@ -60,13 +60,13 @@ k = &cpu->flags[(idx-8) % X86_FLAGS]; (*k)->done(); delete *k; - ((Object*)*k) = o; + *k = (sym_bool*) o; } else { sym_int **k; k = &cpu->regs[idx & 7]; (*k)->done(); delete *k; - ((Object*)*k) = o; + *k = (sym_int*) o; } } diff -urN ../tmp-orig/ht-0.7.3/srt/symmath.cc ./srt/symmath.cc --- ../tmp-orig/ht-0.7.3/srt/symmath.cc 2002-09-10 18:09:36.000000000 +0200 +++ ./srt/symmath.cc 2005-02-05 08:21:32.525921804 +0100 @@ -811,7 +811,7 @@ int sym_bool_intcmp::nstrfy(char *buf, int n) { int i = 0; - dword C1, C2; + UINT C1, C2; if (int1->evaluate(&C1) && int2->evaluate(&C2)) { bool r; bool handled = true; diff -urN ../tmp-orig/ht-0.7.3/stream.h ./stream.h --- ../tmp-orig/ht-0.7.3/stream.h 2002-09-27 17:53:15.000000000 +0200 +++ ./stream.h 2005-02-04 21:52:29.000000000 +0100 @@ -118,6 +118,8 @@ virtual qword getQWordHex(int size, char *desc) = 0; virtual Object * getObject(char *name) = 0; virtual void getObject(Object *&o, char *name) = 0; + virtual void getObject(Object **o, char *name) + {getObject( *o, name); }; virtual void getSeparator() = 0; virtual char * getString(char *desc) = 0; virtual UINT recordStart(UINT size); @@ -151,7 +153,7 @@ #define GET_INT_HEX(st, d) d=st->getIntHex(4, #d) #define GET_QWORD_DEC(st, d) d=st->getQWordDec(8, #d) #define GET_QWORD_HEX(st, d) d=st->getQwordHex(8, #d) -#define GET_OBJECT(st, o) st->getObject((Object *)o, #o) +#define GET_OBJECT(st, o) st->getObject((Object**)&o, #o) #define GET_STRING(st, d) d=st->getString(#d) /* -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]