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
Context
- [Libreoffice] Why define a string just to use a copy of the string a few lines later? · Christian Lohmaier
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.