Switch to unified view

a/libupnpp/smallut.cpp b/libupnpp/smallut.cpp
...
...
12
 *   You should have received a copy of the GNU General Public License
12
 *   You should have received a copy of the GNU General Public License
13
 *   along with this program; if not, write to the
13
 *   along with this program; if not, write to the
14
 *   Free Software Foundation, Inc.,
14
 *   Free Software Foundation, Inc.,
15
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
15
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
16
 */
16
 */
17
#ifdef BUILDING_RECOLL
18
#include "autoconfig.h"
19
#else
20
#include "config.h"
21
#endif
22
23
#include <stdio.h>
17
#include <stdio.h>
24
#include <stdlib.h>
18
#include <stdlib.h>
25
#include <time.h>
19
#include <time.h>
26
#include <ctype.h>
20
#include <ctype.h>
27
#include <errno.h>
21
#include <errno.h>
...
...
1318
bool SimpleRegexp::operator() (const string& val) const
1312
bool SimpleRegexp::operator() (const string& val) const
1319
{
1313
{
1320
    return simpleMatch(val);
1314
    return simpleMatch(val);
1321
}
1315
}
1322
1316
1317
string flagsToString(const vector<CharFlags>& flags, unsigned int val)
1318
{
1319
    const char *s;
1320
    string out;
1321
    for (auto& flag : flags) {
1322
        if ((val & flag.value) == flag.value) {
1323
            s = flag.yesname;
1324
        } else {
1325
            s = flag.noname;
1326
        }
1327
        if (s && *s) {
1328
            /* We have something to write */
1329
            if (out.length()) {
1330
                // If not first, add '|' separator
1331
                out.append("|");
1332
            }
1333
            out.append(s);
1334
        }
1335
    }
1336
    return out;
1337
}
1338
1339
string valToString(const vector<CharFlags>& flags, unsigned int val)
1340
{
1341
    string out;
1342
    for (auto& flag : flags) {
1343
        if (flag.value == val) {
1344
            out = flag.yesname;
1345
            return out;
1346
        }
1347
    }
1348
    {
1349
        char mybuf[100];
1350
        sprintf(mybuf, "Unknown Value 0x%x", val);
1351
        out = mybuf;
1352
    }
1353
    return out;
1354
}
1355
1356
unsigned int stringToFlags(const vector<CharFlags>& flags,
1357
                           const string& input, const char *sep)
1358
{
1359
    unsigned int out = 0;
1360
1361
    vector<string> toks;
1362
    stringToTokens(input, toks, sep);
1363
    for (auto& tok: toks) {
1364
        trimstring(tok);
1365
        for (auto& flag : flags) {
1366
            if (!tok.compare(flag.yesname)) {
1367
                /* Note: we don't break: the same name could conceivably
1368
                   set several flags. */
1369
                out |= flag.value;
1370
            }
1371
        }
1372
    }
1373
    return out;
1374
}
1375
1376
1323
// Initialization for static stuff to be called from main thread before going
1377
// Initialization for static stuff to be called from main thread before going
1324
// multiple
1378
// multiple
1325
void smallut_init_mt()
1379
void smallut_init_mt()
1326
{
1380
{
1327
    // Init langtocode() static table
1381
    // Init langtocode() static table