Login | Register
My pages Projects Community openCollabNet

Discussions > dev > Pointer arithmetic in src/direnum.c:561

Discussion topic

2020-04-07: This site is going to be decommissioned and shut down on 2020-07-01. Please copy and archive any data you wish to keep before that date.

Back to topic list

Pointer arithmetic in src/direnum.c:561

Author Jon <fsvs at jonmail dot co dot uk>
Full name Jon <fsvs at jonmail dot co dot uk>
Date 2008-09-18 06:36:41 PDT
Message Hi,

I think line src/direnum.c:561 should change from:

  sts->name=names[i] + this->strings;


  sts->name=this->strings + names[i];

I have spent the last 3 evenings trying to get fsvs running on my Nokia
N800 and kept getting segmentation faults every time I ran the command:

  fsvs commit -m 'yada-yada-yada' /etc

Using DEBUGP and binary chopping through the code I tracked the segfault
down to src/direnum.c:587 which uses sts->name. The last change to
sts->name was made at 561 which does the fancy pointer arithmetic to
convert an integer offset from the names[] array to a char*.

I use a cross-compiler to build programs for the Nokia N800. I
suspect that the compiler will only generate the code I want when the
source expression looks like char*+int. I think it generates bad
code when the source expression is int+char*.


« Previous message in topic | 1 of 2 | Next message in topic »


Show all messages in topic

Pointer arithmetic in src/direnum.c:561 Jon <fsvs at jonmail dot co dot uk> Jon <fsvs at jonmail dot co dot uk> 2008-09-18 06:36:41 PDT
     Re: Pointer arithmetic in src/direnum.c:561 pmarek P.Marek 2008-09-18 08:54:58 PDT
Messages per page: