*/
static bool startsWithInsensitive(const QByteArray &a, const char *b)
{
- int len = strlen(b);
- return a.size() >= len && qstrnicmp(a.constData(), b, len) == 0;
+ size_t len = strlen(b);
+ return a.size() >= len && qstrnicmp(a.constData(), b, Utility::convert(len)) == 0;
}
bool SqlQuery::isSelect()
*a = 1;
}
+// Use this function to retrieve uint (often required by Qt and WIN32) from size_t
+// without compiler warnings about possible truncation
+uint Utility::convert(size_t &convertVar)
+{
+ if( convertVar > UINT_MAX ) {
+ throw std::bad_cast();
+ }
+ return static_cast<uint>(convertVar);
+}
+
// read the output of the owncloud --version command from the owncloud
// version that is on disk. This works for most versions of the client,
// because clients that do not yet know the --version flag return the
OCSYNC_EXPORT QByteArray userAgentString();
OCSYNC_EXPORT bool hasLaunchOnStartup(const QString &appName);
OCSYNC_EXPORT void setLaunchOnStartup(const QString &appName, const QString &guiName, bool launch);
+ OCSYNC_EXPORT uint convert(size_t &convertVar);
/**
* Return the amount of free space available.