gnucash maint: Multiple changes pushed
John Ralls
jralls at code.gnucash.org
Thu Oct 4 18:49:22 EDT 2018
Updated via https://github.com/Gnucash/gnucash/commit/7a4b06c4 (commit)
via https://github.com/Gnucash/gnucash/commit/a8c88401 (commit)
via https://github.com/Gnucash/gnucash/commit/3eab36e8 (commit)
from https://github.com/Gnucash/gnucash/commit/e0683662 (commit)
commit 7a4b06c442a85da338a6cb35654bd91d30d699d6
Author: John Ralls <jralls at ceridwen.us>
Date: Thu Oct 4 15:44:32 2018 -0700
Bug 796878 - test-qofsession fails on x86_32.
diff --git a/libgnucash/engine/qofsession.cpp b/libgnucash/engine/qofsession.cpp
index d15752a..a42ad09 100644
--- a/libgnucash/engine/qofsession.cpp
+++ b/libgnucash/engine/qofsession.cpp
@@ -225,8 +225,9 @@ QofSessionImpl::load (QofPercentageFunc percentage_func) noexcept
(err != ERR_SQL_DB_TOO_OLD) &&
(err != ERR_SQL_DB_TOO_NEW))
{
- qof_book_destroy(m_book);
+ auto old_book = m_book;
m_book = qof_book_new();
+ qof_book_destroy(old_book);
LEAVE ("error from backend %d", get_error ());
return;
}
diff --git a/libgnucash/engine/test/test-qofsession.cpp b/libgnucash/engine/test/test-qofsession.cpp
index bdb448c..4e7fd98 100644
--- a/libgnucash/engine/test/test-qofsession.cpp
+++ b/libgnucash/engine/test/test-qofsession.cpp
@@ -170,20 +170,22 @@ TEST (QofSessionTest, clear_error)
TEST (QofSessionTest, load)
{
- // We register a provider that gives a backend that
- // throws an error on load.
- // This error during load should cause the qof session to
- // "roll back" the book load.
+ /* We register a provider that gives a backend that throws an error on load.
+ * This error during load should cause the qof session to destroy the book
+ * and create a new one.
+ */
qof_backend_register_provider (get_provider ());
QofSession s;
s.begin ("book1", false, false, false);
auto book = s.get_book ();
s.load (nullptr);
- EXPECT_EQ (book, s.get_book ());
+ EXPECT_NE (book, s.get_book ());
- // Now we'll do the load without returning an error from the backend,
- // and ensure that it's the original book and that it's not empty.
+ /* Now we'll do the load without returning an error from the backend,
+ * and ensure that it's the new book from the previous test.
+ */
load_error = false;
+ book = s.get_book();
s.load (nullptr);
EXPECT_EQ (book, s.get_book ());
EXPECT_EQ (s.get_error(), ERR_BACKEND_NO_ERR);
commit a8c884016e1b313863cc554dca3babd63c784b17
Author: John Ralls <jralls at ceridwen.us>
Date: Thu Oct 4 14:05:49 2018 -0700
Make the case of the Mac help directories the same as in the Bundle.
Using the preferred camel-case rendering.
diff --git a/gnucash/gnome-utils/gnc-ui.h b/gnucash/gnome-utils/gnc-ui.h
index f817970..359051a 100644
--- a/gnucash/gnome-utils/gnc-ui.h
+++ b/gnucash/gnome-utils/gnc-ui.h
@@ -43,8 +43,8 @@
# define HF_GUIDE "gnucash-guide.chm"
# define HF_HELP "gnucash-help.chm"
#elif defined MAC_INTEGRATION
-# define HF_GUIDE "Gnucash Guide"
-# define HF_HELP "Gnucash Help"
+# define HF_GUIDE "GnuCash Guide"
+# define HF_HELP "GnuCash Help"
#else
# define HF_GUIDE "gnucash-guide"
# define HF_HELP "gnucash-help"
commit 3eab36e83274dd0397e1be1c8f9bdc37743b02b9
Author: John Ralls <jralls at ceridwen.us>
Date: Thu Oct 4 14:03:58 2018 -0700
Reindent Mac version of gnc_gnome_help.
diff --git a/gnucash/gnome-utils/gnc-gnome-utils.c b/gnucash/gnome-utils/gnc-gnome-utils.c
index e44da79..f3b7ed8 100644
--- a/gnucash/gnome-utils/gnc-gnome-utils.c
+++ b/gnucash/gnome-utils/gnc-gnome-utils.c
@@ -241,15 +241,15 @@ void
gnc_gnome_help (const char *dir, const char *detail)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-NSString *subdir = [NSString stringWithUTF8String: dir];
-NSString *tag, *subdirectory;
+ NSString *subdir = [NSString stringWithUTF8String: dir];
+ NSString *tag, *subdirectory;
NSURL *url = NULL;
if (detail)
-tag = [NSString stringWithUTF8String: detail];
-else if ([subdir compare: @HF_HELP] == NSOrderedSame)
+ tag = [NSString stringWithUTF8String: detail];
+ else if ([subdir compare: @HF_HELP] == NSOrderedSame)
tag = @"help";
-else if ([subdir compare: @HF_GUIDE] == NSOrderedSame)
+ else if ([subdir compare: @HF_GUIDE] == NSOrderedSame)
tag = @"index";
else
{
@@ -266,18 +266,18 @@ else if ([subdir compare: @HF_GUIDE] == NSOrderedSame)
* add some more pieces, and put it all back together again. Then,
* because the gettext way of handling localizations is different from
* OSX's, we have to figure out which translation to use. */
-NSArray *components = [NSArray arrayWithObjects: @"share", @"doc", @"gnucash-docs", nil ];
+ NSArray *components = [NSArray arrayWithObjects: @"share", @"doc", @"gnucash-docs", nil ];
NSString *prefix = [[[NSBundle mainBundle] resourcePath]
stringByDeletingLastPathComponent];
NSArray *prefix_comps = [[prefix pathComponents]
- arrayByAddingObjectsFromArray: components];
-NSString *docs_dir = [NSString pathWithComponents: prefix_comps];
+ arrayByAddingObjectsFromArray: components];
+ NSString *docs_dir = [NSString pathWithComponents: prefix_comps];
NSArray *languages = [[NSUserDefaults standardUserDefaults]
- objectForKey: @"AppleLanguages"];
+ objectForKey: @"AppleLanguages"];
BOOL dir;
-subdir = [[[subdir lowercaseString] componentsSeparatedByString: @" "]
- componentsJoinedByString: @"-"];
-if (![[NSFileManager defaultManager] fileExistsAtPath: docs_dir])
+ subdir = [[[subdir lowercaseString] componentsSeparatedByString: @" "]
+ componentsJoinedByString: @"-"];
+ if (![[NSFileManager defaultManager] fileExistsAtPath: docs_dir])
{
const gchar *message =
_("GnuCash could not find the files for the help documentation. "
@@ -296,28 +296,28 @@ if (![[NSFileManager defaultManager] fileExistsAtPath: docs_dir])
NSArray *elements;
unsigned int paths;
NSString *completed_path = [NSString alloc];
-this_lang = [this_lang stringByTrimmingCharactersInSet:
- [NSCharacterSet characterSetWithCharactersInString:
+ this_lang = [this_lang stringByTrimmingCharactersInSet:
+ [NSCharacterSet characterSetWithCharactersInString:
@"\""]];
-elements = [this_lang componentsSeparatedByString: @"-"];
+ elements = [this_lang componentsSeparatedByString: @"-"];
this_lang = [elements objectAtIndex: 0];
-path = [docs_dir stringByAppendingPathComponent: this_lang];
-paths = [path completePathIntoString: &completed_path
- caseSensitive: FALSE
- matchesIntoArray: NULL filterTypes: NULL];
+ path = [docs_dir stringByAppendingPathComponent: this_lang];
+ paths = [path completePathIntoString: &completed_path
+ caseSensitive: FALSE
+ matchesIntoArray: NULL filterTypes: NULL];
if (paths > 1 &&
- [[NSFileManager defaultManager]
- fileExistsAtPath: completed_path
- isDirectory: &dir])
+ [[NSFileManager defaultManager]
+ fileExistsAtPath: completed_path
+ isDirectory: &dir])
if (dir)
{
@try
{
-url = [NSURL fileURLWithPath:
+ url = [NSURL fileURLWithPath:
[[[completed_path
- stringByAppendingPathComponent: subdir]
- stringByAppendingPathComponent: tag]
- stringByAppendingPathExtension: @"html"]];
+ stringByAppendingPathComponent: subdir]
+ stringByAppendingPathComponent: tag]
+ stringByAppendingPathExtension: @"html"]];
}
@catch (NSException *e)
{
@@ -327,7 +327,7 @@ url = [NSURL fileURLWithPath:
}
break;
}
-if ([this_lang compare: @"en"] == NSOrderedSame)
+ if ([this_lang compare: @"en"] == NSOrderedSame)
break; /* Special case, forces use of "C" locale */
}
}
@@ -336,11 +336,11 @@ if ([this_lang compare: @"en"] == NSOrderedSame)
@try
{
url = [NSURL
- fileURLWithPath: [[[[docs_dir
- stringByAppendingPathComponent: @"C"]
- stringByAppendingPathComponent: subdir]
- stringByAppendingPathComponent: tag]
- stringByAppendingPathExtension: @"html"]];
+ fileURLWithPath: [[[[docs_dir
+ stringByAppendingPathComponent: @"C"]
+ stringByAppendingPathComponent: subdir]
+ stringByAppendingPathComponent: tag]
+ stringByAppendingPathExtension: @"html"]];
}
@catch (NSException *e)
{
@@ -355,10 +355,10 @@ if ([this_lang compare: @"en"] == NSOrderedSame)
{
@try
{
-url = [NSURL fileURLWithPath: [[NSBundle mainBundle]
- pathForResource: tag
- ofType: @"html"
- inDirectory: subdir ]];
+ url = [NSURL fileURLWithPath: [[NSBundle mainBundle]
+ pathForResource: tag
+ ofType: @"html"
+ inDirectory: subdir ]];
}
@catch (NSException *e)
{
@@ -369,7 +369,7 @@ url = [NSURL fileURLWithPath: [[NSBundle mainBundle]
}
/* Now just open the URL in the default app for opening URLs */
if (url)
-[[NSWorkspace sharedWorkspace] openURL: url];
+ [[NSWorkspace sharedWorkspace] openURL: url];
else
{
const gchar *message =
Summary of changes:
gnucash/gnome-utils/gnc-gnome-utils.c | 74 +++++++++++++++---------------
gnucash/gnome-utils/gnc-ui.h | 4 +-
libgnucash/engine/qofsession.cpp | 3 +-
libgnucash/engine/test/test-qofsession.cpp | 16 ++++---
4 files changed, 50 insertions(+), 47 deletions(-)
More information about the gnucash-changes
mailing list