Re: [Libreoffice] Why define a string just to use a copy of the string a few lines later?

2011-05-06 Thread Michael Meeks
Hi Christian,

On Fri, 2011-05-06 at 04:25 +0200, Christian Lohmaier wrote:
 Looking at this change (as it breaks with WaE because that function is
 unused on Mac)

:-) glad you're on that.

 Fix for the WaE breaker is easy (just conditionalize it for non-mac as
 in the exec_pagein method), but the code did let me stumble, so I take
 the opportunity to learn and ask

Yep - AFAICS we don't use ooqstart.bin on Mac - so I've never quite
understood why we bother with it [ or do we use it - I would be amazed
it has a fairly hard X dependency ;-]. It would be better to remove it
altogether I think.

 +#define REL_PATH /../basis-link/program
..
 +strcat (path, /../basis-link/program/);

As you say- that should be REL_PATH too.

 slash - so sizeof counts one character less (OK, no problem, account

sizeof counts one char more - with the nullbyte.

 And the second part is - why the +8?

paranoia :-) with the kind of crazies editing the code that we have
around here, some of it can be a good thing.

 What am I missing? /me feels dumb, and fears the answer :-))

Nothing - you're golden :-) it'd be great if you could clean it up on
master.

Thanks !

Michael.

-- 
 michael.me...@novell.com  , Pseudo Engineer, itinerant idiot

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice] Why define a string just to use a copy of the string a few lines later?

2011-05-05 Thread Christian Lohmaier
Hi *,

Looking at this change (as it breaks with WaE because that function is
unused on Mac)

http://cgit.freedesktop.org/libreoffice/libs-core/diff/desktop/unx/source/start.c?id=1a790d00100183abfa71666d437af9115940c32a

I realize that it's either too late/I'm too tired or I'm lacking some
basic understanding

Fix for the WaE breaker is easy (just conditionalize it for non-mac as
in the exec_pagein method), but the code did let me stumble, so I take
the opportunity to learn and ask

+#define REL_PATH /../basis-link/program
+static char *build_pagein_path (Args *args, const char *pagein_name)
+{
+char *path;
+rtl_String *app_path;
+
+app_path = ustr_to_str (args-pAppPath);
+path = malloc (app_path-length + strlen (pagein_name) + sizeof
(REL_PATH) + 8);
+strcpy (path, @);
+strcpy (path + 1, rtl_string_getStr (app_path));
+strcat (path, /../basis-link/program/);
+strcat (path, pagein_name);
+
+rtl_string_release( app_path );
+
+return path;
+}

So it defines REL_PATH - so far no problem - but it only uses it for
the siezeof, but then on the strcat it is used as copy of the string,
and what is really causing my confusion is that it has a trailing
slash - so sizeof counts one character less (OK, no problem, account
for the nullbyte for terminating the string - but if that's the idea,
it's not really obvious, so I guess that's not the case but rather an
oversight)

And the second part is - why the +8?

It needs to hold
@ + app_path (why strcpy instead of strcat here - doesn't make a
difference, or does it?) + /../basis-link/program/ + pagein_name +
nullbyte

What am I missing?
/me feels dumb, and fears the answer :-))

ciao
Christian
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice