Ticket #3986: 3986-regexp-v1.patch
File 3986-regexp-v1.patch, 1.6 KB (added by , 16 years ago) |
---|
-
libs/libmythtv/channelutil.cpp
1365 1365 return QString::localeAwareCompare(a.callsign, b.callsign) < 0; 1366 1366 } 1367 1367 1368 static QMutex sepExprLock; 1369 static const QRegExp sepExpr("(_|-|#|\\.)"); 1370 1368 1371 inline bool lt_smart(const DBChannel &a, const DBChannel &b) 1369 1372 { 1370 1373 int cmp = 0; … … 1378 1381 int b_minor = b.minor_chan; 1379 1382 1380 1383 // Extract minor and major numbers from channum.. 1381 const QRegExp sepExpr("(_|-|#|\\.)");1382 1384 bool tmp1, tmp2; 1383 int idx = a.channum.find(sepExpr); 1384 if (idx >= 0) 1385 int idxA, idxB; 1385 1386 { 1386 int major = a.channum.left(idx).toUInt(&tmp1); 1387 int minor = a.channum.mid(idx+1).toUInt(&tmp2); 1387 QMutexLocker locker(&sepExprLock); 1388 idxA = a.channum.find(sepExpr); 1389 idxB = b.channum.find(sepExpr); 1390 } 1391 if (idxA >= 0) 1392 { 1393 int major = a.channum.left(idxA).toUInt(&tmp1); 1394 int minor = a.channum.mid(idxA+1).toUInt(&tmp2); 1388 1395 if (tmp1 && tmp2) 1389 1396 (a_major = major), (a_minor = minor), (isIntA = false); 1390 1397 } 1391 1398 1392 idx = b.channum.find(sepExpr); 1393 if (idx >= 0) 1399 if (idxB >= 0) 1394 1400 { 1395 int major = b.channum.left(idx ).toUInt(&tmp1);1396 int minor = b.channum.mid(idx +1).toUInt(&tmp2);1401 int major = b.channum.left(idxB).toUInt(&tmp1); 1402 int minor = b.channum.mid(idxB+1).toUInt(&tmp2); 1397 1403 if (tmp1 && tmp2) 1398 1404 (b_major = major), (b_minor = minor), (isIntB = false); 1399 1405 }