Merge lp:~mordred/drizzle/bug552936 into lp:~drizzle-trunk/drizzle/development

Proposed by Monty Taylor
Status: Merged
Merged at revision: not available
Proposed branch: lp:~mordred/drizzle/bug552936
Merge into: lp:~drizzle-trunk/drizzle/development
Diff against target: 47 lines (+17/-6)
1 file modified
drizzled/internal/default.cc (+17/-6)
To merge this branch: bzr merge lp:~mordred/drizzle/bug552936
Reviewer Review Type Date Requested Status
Brian Aker Pending
Review via email: mp+22641@code.launchpad.net

Description of the change

Fix the --defaults-file check.

To post a comment you must log in.
lp:~mordred/drizzle/bug552936 updated
1430. By Monty Taylor

The logic here was actually looking for strlen.

1431. By Monty Taylor

Use const std::string.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'drizzled/internal/default.cc'
2--- drizzled/internal/default.cc 2010-02-05 18:02:02 +0000
3+++ drizzled/internal/default.cc 2010-04-01 18:32:30 +0000
4@@ -324,26 +324,37 @@
5 int org_argc= argc, prev_argc= 0;
6 *defaults= *extra_defaults= *group_suffix= 0;
7
8+ const std::string DEFAULTS_FILE("--defaults-file=");
9+ const std::string DEFAULTS_EXTRA_FILE("--defaults-extra-file=");
10+ const std::string DEFAULTS_GROUP_SUFFIX("--defaults-group-suffix=");
11+
12 while (argc >= 2 && argc != prev_argc)
13 {
14 /* Skip program name or previously handled argument */
15 argv++;
16 prev_argc= argc; /* To check if we found */
17- if (!*defaults && (strncmp(*argv,"--defaults-file=", sizeof("--defaults-file=")) == 0))
18+ if (!*defaults && (strncmp(*argv,
19+ DEFAULTS_FILE.c_str(),
20+ DEFAULTS_FILE.size()) == 0))
21 {
22- *defaults= *argv + sizeof("--defaults-file=")-1;
23+ *defaults= *argv + DEFAULTS_FILE.size();
24 argc--;
25 continue;
26 }
27- if (!*extra_defaults && (strncmp(*argv, "--defaults-extra-file=", sizeof("--defaults-extra-file=")) == 0))
28+ if (!*extra_defaults && (strncmp(*argv,
29+ DEFAULTS_EXTRA_FILE.c_str(),
30+ DEFAULTS_EXTRA_FILE.size()) == 0))
31 {
32- *extra_defaults= *argv + sizeof("--defaults-extra-file=")-1;
33+ *extra_defaults= *argv + DEFAULTS_EXTRA_FILE.size();
34 argc--;
35 continue;
36 }
37- if (!*group_suffix && (strncmp(*argv, "--defaults-group-suffix=", sizeof("--defaults-group-suffix=")) == 0))
38+ if (!*group_suffix && (strncmp(*argv,
39+ DEFAULTS_GROUP_SUFFIX.c_str(),
40+ DEFAULTS_GROUP_SUFFIX.size()) == 0))
41+
42 {
43- *group_suffix= *argv + sizeof("--defaults-group-suffix=")-1;
44+ *group_suffix= *argv + DEFAULTS_GROUP_SUFFIX.size();
45 argc--;
46 continue;
47 }