[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[kazehakase]: FTBFS под GNU/Hurd: mozilla.cpp:132: error: 'PATH_MAX' was
From: |
Yavor Doganov |
Subject: |
[kazehakase]: FTBFS под GNU/Hurd: mozilla.cpp:132: error: 'PATH_MAX' was not declared in this scope |
Date: |
Thu, 20 Aug 2009 17:09:23 +0300 |
User-agent: |
Wanderlust/2.15.6 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (Gojō) APEL/10.7 Emacs/23.1 (i486-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) |
Пак ще досаждам с Kz :-)
Не се компилира под GNU/Hurd:
mozilla.cpp: In function 'gboolean xulrunner_init()':
mozilla.cpp:132: error: 'PATH_MAX' was not declared in this scope
mozilla.cpp:135: error: 'xpcomPath' was not declared in this scope
make[6]: *** [gecko_la-mozilla.lo] Error 1
Според POSIX PATH_MAX не трябва да се използва безусловно, защото не е
гарантирано този символ да е дефиниран. При GNU/Hurd файловите имена
нямат ограничения и затова плющи.
Прилагам кръпка, използваща стандартния подход -- динамично заделяне
на памет в геометрично нарастващ цикъл. Не съм съсвсем сигурен дали
всичко е правилно (заделяне/чистене на памет и т.н.), затова моля за
коментари.
2009-08-20 Yavor Doganov <address@hidden>
Avoid PATH_MAX, undefined on GNU/Hurd.
* module/embed/gecko/mozilla.cpp (xulrunner_init): Use a
geometrically growing loop to allocate memory dynamically.
* local directory is at address@hidden/kazehakase--debian--1.0--patch-52
* comparing to address@hidden/kazehakase--debian--1.0--patch-52
M module/embed/gecko/mozilla.cpp
* modified files
--- orig/module/embed/gecko/mozilla.cpp
+++ mod/module/embed/gecko/mozilla.cpp
@@ -136,24 +136,44 @@
"2", PR_TRUE
};
- char xpcomPath[PATH_MAX];
+ char *xpcomPath;
+ gsize allocated = 128;
+ nsresult rv;
+
+ while (1)
+ {
+ xpcomPath = (char *) g_malloc(allocated);
+
+ rv = GRE_GetGREPathWithProperties(&greVersion, 1,
+ nsnull, 0,
+ xpcomPath,
+ allocated);
+
+ if (strlen(xpcomPath) < allocated -1)
+ break;
+
+ g_free(xpcomPath);
+ allocated *= 2;
+ }
- nsresult rv = GRE_GetGREPathWithProperties(&greVersion, 1, nsnull, 0,
- xpcomPath,
sizeof(xpcomPath));
if (NS_FAILED(rv))
- return FALSE;
+ goto out;
rv = XPCOMGlueStartup(xpcomPath);
if (NS_FAILED(rv))
- return FALSE;
+ goto out;
rv = GTKEmbedGlueStartup();
if (NS_FAILED(rv))
- return FALSE;
+ goto out;
rv = GTKEmbedGlueStartupInternal();
if (NS_FAILED(rv))
- return FALSE;
+ goto out;
+
+ out:
+ g_free(xpcomPath);
+ return FALSE;
char *lastSlash = strrchr(xpcomPath, '/');
if (lastSlash)
@@ -161,6 +181,7 @@
gtk_moz_embed_set_path(xpcomPath);
+ g_free(xpcomPath);
return TRUE;
}
- [kazehakase]: FTBFS под GNU/Hurd: mozilla.cpp:132: error: 'PATH_MAX' was not declared in this scope,
Yavor Doganov <=
- Re: [kazehakase]: FTBFS под GNU/Hurd: mozilla.cpp:132: error: 'PATH_MAX' was not declared in this scope, Dimitur Kirov, 2009/08/20
- Re: [kazehakase]: FTBFS под GNU/Hurd: mozilla.cpp:132: error: 'PATH_MAX' was not declared in this scope, Dimitur Kirov, 2009/08/20
- Re: [kazehakase]: FTBFS под GNU/Hurd: mozilla.cpp:132: error: 'PATH_MAX' was not declared in this scope, Yavor Doganov, 2009/08/21
- Re: [kazehakase]: FTBFS под GNU/Hurd: mozilla.cpp:132: error: 'PATH_MAX' was not declared in this scope, Dimitur Kirov, 2009/08/21
- Re: [kazehakase]: FTBFS под GNU/Hurd: mozilla.cpp:132: error: 'PATH_MAX' was not declared in this scope, Yavor Doganov, 2009/08/21
- Re: [kazehakase]: FTBFS под GNU/Hurd: mozilla.cpp:132: error: 'PATH_MAX' was not declared in this scope, Dimitur Kirov, 2009/08/21
- Re: [kazehakase]: FTBFS под GNU/Hurd: mozilla.cpp:132: error: 'PATH_MAX' was not declared in this scope, Yavor Doganov, 2009/08/21
- Re: [kazehakase]: FTBFS под GNU/Hurd: mozilla.cpp:132: error: 'PATH_MAX' was not declared in this scope, Dimitur Kirov, 2009/08/21