Opened 12 years ago

Closed 12 years ago

#41 closed defect (fixed)

small fix needed to build against wx2.9

Reported by: Wookey Owned by: Olly Betts
Priority: blocker Milestone: 1.2.7
Component: aven Version:
Keywords: Cc:

Description

building against wx2.9 (on debian testing=wheezy) fails in namecompare.cc:

LL -DWXGTK -pthread -Wall -Wunused -Wshadow -Wpointer-arith -Wwrite-strings -Wcast-align -g -O2 -c -o aven-namecompare.o test -f 'namecompare.cc' || echo './'namecompare.cc namecompare.cc: In function ‘int name_cmp(const wxString&, const wxString&, int)’: namecompare.cc:33:41: error: operands to ?: have different types ‘int’ and ‘wxUniChar’ namecompare.cc:34:41: error: operands to ?: have different types ‘int’ and ‘wxUniChar’

This simple patch fixes it: Index: survex-1.2.6/src/namecompare.cc =================================================================== --- survex-1.2.6.orig/src/namecompare.cc 2013-04-09 01:30:08.000000000 +0100 +++ survex-1.2.6/src/namecompare.cc 2013-04-09 01:31:39.844104393 +0100 @@ -30,8 +30,8 @@

int name_cmp(const wxString &a, const wxString &b, int separator) {

size_t i = 0; while (1) {

  • int cha = (i == a.size() ? 0 : a[i]);
  • int chb = (i == b.size() ? 0 : b[i]);

+ int cha = (i == a.size() ? 0 : (int) a[i]); + int chb = (i == b.size() ? 0 : (int) b[i]);

/* done if end of either string */

if (!cha
!chb) return cha - chb;

It may be that there is a better fix but this does the basic job.

Change History (2)

comment:1 Changed 12 years ago by Wookey

Hmm formatting fail. Let's try again:

Index: survex-1.2.6/src/namecompare.cc
===================================================================
--- survex-1.2.6.orig/src/namecompare.cc        2013-04-09 01:30:08.000000000 +0100
+++ survex-1.2.6/src/namecompare.cc     2013-04-09 01:31:39.844104393 +0100
@@ -30,8 +30,8 @@
 int name_cmp(const wxString &a, const wxString &b, int separator) {
    size_t i = 0;
    while (1) {
-      int cha = (i == a.size() ? 0 : a[i]);
-      int chb = (i == b.size() ? 0 : b[i]);
+      int cha = (i == a.size() ? 0 : (int) a[i]);
+      int chb = (i == b.size() ? 0 : (int) b[i]);

       /* done if end of either string */
       if (!cha || !chb) return cha - chb;

comment:2 Changed 12 years ago by Olly Betts

Component: Otheraven
Milestone: 1.2.7
Resolution: fixed
Status: newclosed

Already fixed on trunk:

https://github.com/ojwb/survex/commit/29c302d31adf002eb7122796cf38a4d557f579b3

(If you have a patch, attaching it is more helpful than pasting it - easier to download and apply that way...)

Note: See TracTickets for help on using tickets.