Mercurial > hg > audiodb
comparison audioDB.cpp @ 345:30384a82983a
Quieten newer compilers with MORE CONST CORRECTNESS.
(except, haha, gengetopt doesn't generate const-correct function
prototypes. Happy happy joy joy. Put in an explicit cast when calling
cmdline_parser().)
Adjust gengetopt.in and Makefile to support both old (2.19) and new
(2.22) versions of gengetopt. This only really means that we've lost -H
as a help switch; --help still works.
author | mas01cr |
---|---|
date | Wed, 08 Oct 2008 11:06:11 +0000 |
parents | da901c62e569 |
children | 94c18f128ce8 |
comparison
equal
deleted
inserted
replaced
344:223a5994a962 | 345:30384a82983a |
---|---|
20 | 20 |
21 bool operator==(const PointPair& a, const PointPair& b){ | 21 bool operator==(const PointPair& a, const PointPair& b){ |
22 return ( (a.trackID==b.trackID) && (a.qpos==b.qpos) && (a.spos==b.spos) ); | 22 return ( (a.trackID==b.trackID) && (a.qpos==b.qpos) && (a.spos==b.spos) ); |
23 } | 23 } |
24 | 24 |
25 audioDB::audioDB(const unsigned argc, char* const argv[]): O2_AUDIODB_INITIALIZERS | 25 audioDB::audioDB(const unsigned argc, const char *const argv[]): O2_AUDIODB_INITIALIZERS |
26 { | 26 { |
27 if(processArgs(argc, argv)<0){ | 27 if(processArgs(argc, argv)<0){ |
28 printf("No command found.\n"); | 28 printf("No command found.\n"); |
29 cmdline_parser_print_version (); | 29 cmdline_parser_print_version (); |
30 if (strlen(gengetopt_args_info_purpose) > 0) | 30 if (strlen(gengetopt_args_info_purpose) > 0) |
95 | 95 |
96 else | 96 else |
97 error("Unrecognized command",command); | 97 error("Unrecognized command",command); |
98 } | 98 } |
99 | 99 |
100 audioDB::audioDB(const unsigned argc, char* const argv[], adb__queryResponse *adbQueryResponse): O2_AUDIODB_INITIALIZERS | 100 audioDB::audioDB(const unsigned argc, const char *const argv[], adb__queryResponse *adbQueryResponse): O2_AUDIODB_INITIALIZERS |
101 { | 101 { |
102 try { | 102 try { |
103 isServer = 1; // Set to make errors report over SOAP | 103 isServer = 1; // Set to make errors report over SOAP |
104 processArgs(argc, argv); | 104 processArgs(argc, argv); |
105 // Perform database prefix substitution | 105 // Perform database prefix substitution |
111 cleanup(); | 111 cleanup(); |
112 throw(err); | 112 throw(err); |
113 } | 113 } |
114 } | 114 } |
115 | 115 |
116 audioDB::audioDB(const unsigned argc, char* const argv[], adb__statusResponse *adbStatusResponse): O2_AUDIODB_INITIALIZERS | 116 audioDB::audioDB(const unsigned argc, const char* const argv[], adb__statusResponse *adbStatusResponse): O2_AUDIODB_INITIALIZERS |
117 { | 117 { |
118 try { | 118 try { |
119 isServer = 1; // Set to make errors report over SOAP | 119 isServer = 1; // Set to make errors report over SOAP |
120 processArgs(argc, argv); | 120 processArgs(argc, argv); |
121 // Perform database prefix substitution | 121 // Perform database prefix substitution |
127 cleanup(); | 127 cleanup(); |
128 throw(err); | 128 throw(err); |
129 } | 129 } |
130 } | 130 } |
131 | 131 |
132 audioDB::audioDB(const unsigned argc, char* const argv[], adb__lisztResponse *adbLisztResponse): O2_AUDIODB_INITIALIZERS | 132 audioDB::audioDB(const unsigned argc, const char *const argv[], adb__lisztResponse *adbLisztResponse): O2_AUDIODB_INITIALIZERS |
133 { | 133 { |
134 try { | 134 try { |
135 isServer = 1; // Set to make errors report over SOAP | 135 isServer = 1; // Set to make errors report over SOAP |
136 processArgs(argc, argv); | 136 processArgs(argc, argv); |
137 // Perform database prefix substitution | 137 // Perform database prefix substitution |
191 | 191 |
192 audioDB::~audioDB(){ | 192 audioDB::~audioDB(){ |
193 cleanup(); | 193 cleanup(); |
194 } | 194 } |
195 | 195 |
196 int audioDB::processArgs(const unsigned argc, char* const argv[]){ | 196 int audioDB::processArgs(const unsigned argc, const char *const argv[]){ |
197 | 197 |
198 if(argc<2){ | 198 if(argc<2){ |
199 cmdline_parser_print_version (); | 199 cmdline_parser_print_version (); |
200 if (strlen(gengetopt_args_info_purpose) > 0) | 200 if (strlen(gengetopt_args_info_purpose) > 0) |
201 printf("%s\n", gengetopt_args_info_purpose); | 201 printf("%s\n", gengetopt_args_info_purpose); |
204 printf("%s\n", gengetopt_args_info_help[2]); | 204 printf("%s\n", gengetopt_args_info_help[2]); |
205 printf("%s\n", gengetopt_args_info_help[0]); | 205 printf("%s\n", gengetopt_args_info_help[0]); |
206 exit(0); | 206 exit(0); |
207 } | 207 } |
208 | 208 |
209 if (cmdline_parser (argc, argv, &args_info) != 0) | 209 /* KLUDGE: gengetopt generates a function which is not completely |
210 const-clean in its declaration. We cast argv here to keep the | |
211 compiler happy. -- CSR, 2008-10-08 */ | |
212 if (cmdline_parser (argc, (char *const *) argv, &args_info) != 0) | |
210 error("Error parsing command line"); | 213 error("Error parsing command line"); |
211 | 214 |
212 if(args_info.help_given){ | 215 if(args_info.help_given){ |
213 cmdline_parser_print_help(); | 216 cmdline_parser_print_help(); |
214 exit(0); | 217 exit(0); |