hrev43428 adds 1 changeset to branch 'master' old head: f28e19f5be174afa6dd95af9ef35171bd48e3f1f new head: 674e76845d83e668c6d46faddb49ff65ae5d28b9 ---------------------------------------------------------------------------- 674e768: Returning a string stored in a local BMessage doesn't work. Instead use a BString object as return type that copies the string so that it stays valid after return. [ Michael Lotz <mmlr@xxxxxxxx> ] ---------------------------------------------------------------------------- Revision: hrev43428 Commit: 674e76845d83e668c6d46faddb49ff65ae5d28b9 URL: http://cgit.haiku-os.org/haiku/commit/?id=674e768 Author: Michael Lotz <mmlr@xxxxxxxx> Date: Tue Dec 6 23:26:07 2011 UTC ---------------------------------------------------------------------------- 1 files changed, 4 insertions(+), 3 deletions(-) src/bin/locale/locale.cpp | 7 ++++--- ---------------------------------------------------------------------------- diff --git a/src/bin/locale/locale.cpp b/src/bin/locale/locale.cpp index 8424912..b0050ca 100644 --- a/src/bin/locale/locale.cpp +++ b/src/bin/locale/locale.cpp @@ -11,6 +11,7 @@ #include <Locale.h> #include <LocaleRoster.h> #include <Message.h> +#include <String.h> #include <getopt.h> #include <stdio.h> @@ -21,7 +22,7 @@ extern const char *__progname; static const char *kProgramName = __progname; -const char* +BString preferred_language() { BMessage preferredLanguages; @@ -75,10 +76,10 @@ main(int argc, char **argv) while ((c = getopt_long(argc, argv, "lcfh", longopts, NULL)) != -1) { switch (c) { case 'l': - printf("%s\n", preferred_language()); + printf("%s\n", preferred_language().String()); break; case 'c': - printf("%s.UTF-8\n", preferred_language()); + printf("%s.UTF-8\n", preferred_language().String()); break; case 'f': print_formatting_conventions();