firefox: try to fix some issues

This commit is contained in:
Duncaen 2019-12-10 00:13:39 +01:00 committed by Duncan Overbruck
parent bdb16635f5
commit 6de9f08999
3 changed files with 223 additions and 1 deletions

View file

@ -0,0 +1,108 @@
diff --git a/src/cubeb_sndio.c b/src/cubeb_sndio.c
index 4a05bd84..34b3513d 100644
--- media/libcubeb/src/cubeb_sndio.c
+++ media/libcubeb/src/cubeb_sndio.c
@@ -32,6 +32,7 @@
X(sio_eof) \
X(sio_getpar) \
X(sio_initpar) \
+ X(sio_nfds) \
X(sio_onmove) \
X(sio_open) \
X(sio_pollfd) \
@@ -124,6 +125,23 @@ s16_to_float(void *ptr, long nsamp)
*(--dst) = (1. / 32768) * *(--src);
}
+static const char *
+sndio_get_device()
+{
+#ifndef __OpenBSD__
+ /*
+ * On other platforms default to sndio devices,
+ * so cubebs other backends can be used instead.
+ */
+ const char *dev = getenv("AUDIODEVICE");
+ if (dev == NULL || *dev == '\0')
+ return "snd/0";
+ return dev;
+#else
+ return SIO_DEVANY;
+#endif
+}
+
static void
sndio_onmove(void *arg, int delta)
{
@@ -135,18 +153,23 @@ sndio_onmove(void *arg, int delta)
static void *
sndio_mainloop(void *arg)
{
-#define MAXFDS 8
- struct pollfd pfds[MAXFDS];
+ struct pollfd *pfds;
cubeb_stream *s = arg;
int n, eof = 0, prime, nfds, events, revents, state = CUBEB_STATE_STARTED;
size_t pstart = 0, pend = 0, rstart = 0, rend = 0;
long nfr;
+ nfds = WRAP(sio_nfds)(s->hdl);
+ pfds = calloc(nfds, sizeof (struct pollfd));
+ if (pfds == NULL)
+ return NULL;
+
DPR("sndio_mainloop()\n");
s->state_cb(s, s->arg, CUBEB_STATE_STARTED);
pthread_mutex_lock(&s->mtx);
if (!WRAP(sio_start)(s->hdl)) {
pthread_mutex_unlock(&s->mtx);
+ free(pfds);
return NULL;
}
DPR("sndio_mainloop(), started\n");
@@ -274,6 +297,7 @@ sndio_mainloop(void *arg)
s->hwpos = s->swpos;
pthread_mutex_unlock(&s->mtx);
s->state_cb(s, s->arg, state);
+ free(pfds);
return NULL;
}
@@ -281,6 +305,9 @@ sndio_mainloop(void *arg)
sndio_init(cubeb **context, char const *context_name)
{
void * libsndio = NULL;
+ struct sio_hdl *hdl;
+
+ assert(context);
#ifndef DISABLE_LIBSNDIO_DLOPEN
libsndio = dlopen("libsndio.so.7.0", RTLD_LAZY);
@@ -305,8 +332,17 @@ sndio_init(cubeb **context, char const *context_name)
#undef LOAD
#endif
+ /* test if sndio works */
+ hdl = WRAP(sio_open)(sndio_get_device(), SIO_PLAY, 1);
+ if (hdl == NULL) {
+ return CUBEB_ERROR;
+ }
+ WRAP(sio_close)(hdl);
+
DPR("sndio_init(%s)\n", context_name);
- *context = malloc(sizeof(*context));
+ *context = malloc(sizeof(**context));
+ if (*context == NULL)
+ return CUBEB_ERROR;
(*context)->libsndio = libsndio;
(*context)->ops = &sndio_ops;
(void)context_name;
@@ -377,7 +413,7 @@ sndio_stream_init(cubeb * context,
goto err;
}
s->context = context;
- s->hdl = WRAP(sio_open)(NULL, s->mode, 1);
+ s->hdl = WRAP(sio_open)(sndio_get_device(), s->mode, 1);
if (s->hdl == NULL) {
DPR("sndio_stream_init(), sio_open() failed\n");
goto err;

View file

@ -0,0 +1,114 @@
diff -up firefox-71.0/dom/indexedDB/ActorsParent.cpp.gcc-workaround firefox-71.0/dom/indexedDB/ActorsParent.cpp
--- dom/indexedDB/ActorsParent.cpp.gcc-workaround 2019-12-02 13:22:58.000000000 +0100
+++ dom/indexedDB/ActorsParent.cpp 2019-12-08 21:52:54.449199120 +0100
@@ -24311,11 +24311,11 @@ nsresult ObjectStoreAddOrPutRequestOp::D
// if we allow overwrite or not. By not allowing overwrite we raise
// detectable errors rather than corrupting data.
DatabaseConnection::CachedStatement stmt;
- const auto& optReplaceDirective = (!mOverwrite || keyUnset)
- ? NS_LITERAL_CSTRING("")
- : NS_LITERAL_CSTRING("OR REPLACE ");
rv = aConnection->GetCachedStatement(
- NS_LITERAL_CSTRING("INSERT ") + optReplaceDirective +
+ NS_LITERAL_CSTRING("INSERT ") +
+ ((!mOverwrite || keyUnset)
+ ? NS_LITERAL_CSTRING("")
+ : NS_LITERAL_CSTRING("OR REPLACE ")) +
NS_LITERAL_CSTRING("INTO object_data "
"(object_store_id, key, file_ids, data) "
"VALUES (:") +
@@ -25869,11 +25869,8 @@ void Cursor::OpenOp::PrepareIndexKeyCond
}
}
- const auto& comparisonChar =
- isIncreasingOrder ? NS_LITERAL_CSTRING(">") : NS_LITERAL_CSTRING("<");
-
mCursor->mContinueToQuery =
- aQueryStart + NS_LITERAL_CSTRING(" AND sort_column ") + comparisonChar +
+ aQueryStart + NS_LITERAL_CSTRING(" AND sort_column ") + (isIncreasingOrder ? NS_LITERAL_CSTRING(">") : NS_LITERAL_CSTRING("<")) +
NS_LITERAL_CSTRING("= :") + kStmtParamNameCurrentKey;
switch (mCursor->mDirection) {
@@ -25881,11 +25878,11 @@ void Cursor::OpenOp::PrepareIndexKeyCond
case IDBCursor::PREV:
mCursor->mContinueQuery =
aQueryStart + NS_LITERAL_CSTRING(" AND sort_column ") +
- comparisonChar + NS_LITERAL_CSTRING("= :") +
+ (isIncreasingOrder ? NS_LITERAL_CSTRING(">") : NS_LITERAL_CSTRING("<")) + NS_LITERAL_CSTRING("= :") +
kStmtParamNameCurrentKey + NS_LITERAL_CSTRING(" AND ( sort_column ") +
- comparisonChar + NS_LITERAL_CSTRING(" :") + kStmtParamNameCurrentKey +
+ (isIncreasingOrder ? NS_LITERAL_CSTRING(">") : NS_LITERAL_CSTRING("<")) + NS_LITERAL_CSTRING(" :") + kStmtParamNameCurrentKey +
NS_LITERAL_CSTRING(" OR ") + aObjectDataKeyPrefix +
- NS_LITERAL_CSTRING("object_data_key ") + comparisonChar +
+ NS_LITERAL_CSTRING("object_data_key ") + (isIncreasingOrder ? NS_LITERAL_CSTRING(">") : NS_LITERAL_CSTRING("<")) +
NS_LITERAL_CSTRING(" :") + kStmtParamNameObjectStorePosition +
NS_LITERAL_CSTRING(" ) ");
@@ -25896,12 +25893,12 @@ void Cursor::OpenOp::PrepareIndexKeyCond
"(sort_column == :") +
kStmtParamNameCurrentKey + NS_LITERAL_CSTRING(" AND ") +
aObjectDataKeyPrefix + NS_LITERAL_CSTRING("object_data_key ") +
- comparisonChar + NS_LITERAL_CSTRING("= :") +
+ (isIncreasingOrder ? NS_LITERAL_CSTRING(">") : NS_LITERAL_CSTRING("<")) + NS_LITERAL_CSTRING("= :") +
kStmtParamNameObjectStorePosition +
NS_LITERAL_CSTRING(
") OR "
"sort_column ") +
- comparisonChar + NS_LITERAL_CSTRING(" :") + kStmtParamNameCurrentKey +
+ (isIncreasingOrder ? NS_LITERAL_CSTRING(">") : NS_LITERAL_CSTRING("<")) + NS_LITERAL_CSTRING(" :") + kStmtParamNameCurrentKey +
NS_LITERAL_CSTRING(")");
break;
@@ -25909,7 +25906,7 @@ void Cursor::OpenOp::PrepareIndexKeyCond
case IDBCursor::PREV_UNIQUE:
mCursor->mContinueQuery =
aQueryStart + NS_LITERAL_CSTRING(" AND sort_column ") +
- comparisonChar + NS_LITERAL_CSTRING(" :") + kStmtParamNameCurrentKey;
+ (isIncreasingOrder ? NS_LITERAL_CSTRING(">") : NS_LITERAL_CSTRING("<")) + NS_LITERAL_CSTRING(" :") + kStmtParamNameCurrentKey;
break;
default:
@@ -26076,9 +26073,6 @@ nsresult Cursor::OpenOp::DoIndexDatabase
const bool usingKeyRange = mOptionalKeyRange.isSome();
- const auto& indexTable = mCursor->mUniqueIndex
- ? NS_LITERAL_CSTRING("unique_index_data")
- : NS_LITERAL_CSTRING("index_data");
NS_NAMED_LITERAL_CSTRING(sortColumn, "sort_column");
@@ -26099,7 +26093,9 @@ nsresult Cursor::OpenOp::DoIndexDatabase
"object_data.file_ids, "
"object_data.data "
"FROM ") +
- indexTable +
+ (mCursor->mUniqueIndex
+ ? NS_LITERAL_CSTRING("unique_index_data")
+ : NS_LITERAL_CSTRING("index_data")) +
NS_LITERAL_CSTRING(
" AS index_table "
"JOIN object_data "
@@ -26198,9 +26194,6 @@ nsresult Cursor::OpenOp::DoIndexKeyDatab
const bool usingKeyRange = mOptionalKeyRange.isSome();
- const auto& table = mCursor->mUniqueIndex
- ? NS_LITERAL_CSTRING("unique_index_data")
- : NS_LITERAL_CSTRING("index_data");
NS_NAMED_LITERAL_CSTRING(sortColumn, "sort_column");
@@ -26218,7 +26211,10 @@ nsresult Cursor::OpenOp::DoIndexKeyDatab
NS_LITERAL_CSTRING(
"object_data_key "
" FROM ") +
- table + NS_LITERAL_CSTRING(" WHERE index_id = :") +
+ (mCursor->mUniqueIndex
+ ? NS_LITERAL_CSTRING("unique_index_data")
+ : NS_LITERAL_CSTRING("index_data")) +
+ NS_LITERAL_CSTRING(" WHERE index_id = :") +
kStmtParamNameId;
const auto keyRangeClause =

View file

@ -4,7 +4,7 @@
#
pkgname=firefox
version=71.0
revision=1
revision=2
build_helper="rust"
short_desc="Mozilla Firefox web browser"
maintainer="Johannes <johannes.brechtmann@gmail.com>"