зеркало из https://github.com/mozilla/gecko-dev.git
Merge m-c to fx-team
This commit is contained in:
Коммит
bf6636a318
2
CLOBBER
2
CLOBBER
|
@ -22,4 +22,4 @@
|
|||
# changes to stick? As of bug 928195, this shouldn't be necessary! Please
|
||||
# don't change CLOBBER for WebIDL changes any more.
|
||||
|
||||
Clobber to work around bug 959928 / bug 1020776.
|
||||
Clobber for bug 1022262.
|
||||
|
|
|
@ -27,18 +27,6 @@ let sanitizeId = function(id){
|
|||
|
||||
const PSEUDOURI = "indexeddb://" + sanitizeId(id) // https://bugzilla.mozilla.org/show_bug.cgi?id=779197
|
||||
|
||||
// Firefox 26 and earlier releases don't support `indexedDB` in sandboxes
|
||||
// automatically, so we need to inject `indexedDB` to `this` scope ourselves.
|
||||
if (typeof(indexedDB) === "undefined") {
|
||||
Cc["@mozilla.org/dom/indexeddb/manager;1"].
|
||||
getService(Ci.nsIIndexedDatabaseManager).
|
||||
initWindowless(this);
|
||||
|
||||
// Firefox 14 gets this with a prefix
|
||||
if (typeof(indexedDB) === "undefined")
|
||||
this.indexedDB = mozIndexedDB;
|
||||
}
|
||||
|
||||
// Use XPCOM because `require("./url").URL` doesn't expose the raw uri object.
|
||||
let principaluri = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService).
|
||||
|
@ -50,8 +38,9 @@ let principal = Cc["@mozilla.org/scriptsecuritymanager;1"].
|
|||
|
||||
exports.indexedDB = Object.freeze({
|
||||
open: indexedDB.openForPrincipal.bind(indexedDB, principal),
|
||||
openForPrincipal: indexedDB.openForPrincipal.bind(indexedDB),
|
||||
deleteDatabase: indexedDB.deleteForPrincipal.bind(indexedDB, principal),
|
||||
cmp: indexedDB.cmp
|
||||
cmp: indexedDB.cmp.bind(indexedDB)
|
||||
});
|
||||
|
||||
exports.IDBKeyRange = IDBKeyRange;
|
||||
|
|
|
@ -19,13 +19,13 @@
|
|||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="83392cae2c964fa6f8a97ac3fc515c3f94ef3c1c"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="431aed0a7c7560c6eacd35ea69aa0a7a4ebe72c7"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="44b04243e31cd16f3baf54fcd4b5fecf9deb8b94"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cd88d860656c31c7da7bb310d6a160d0011b0961"/>
|
||||
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="3326b51017252e09ccdd715dec6c5e12a7d1ecfe"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="c510babaf88dfa2cfe2c202afb2649ee124569af"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="c9cc24ebbfa5427defcc4c99d4d08c2ee6cbcea8"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="89b697fee631fce716942d65b3d05fb08128bbab"/>
|
||||
<!-- Stock Android things -->
|
||||
<project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
|
||||
<project name="platform/bionic" path="bionic" revision="c72b8f6359de7ed17c11ddc9dfdde3f615d188a9"/>
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="83392cae2c964fa6f8a97ac3fc515c3f94ef3c1c"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="431aed0a7c7560c6eacd35ea69aa0a7a4ebe72c7"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="44b04243e31cd16f3baf54fcd4b5fecf9deb8b94"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="c510babaf88dfa2cfe2c202afb2649ee124569af"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="c9cc24ebbfa5427defcc4c99d4d08c2ee6cbcea8"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="89b697fee631fce716942d65b3d05fb08128bbab"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<!-- Stock Android things -->
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<project name="platform_build" path="build" remote="b2g" revision="276ce45e78b09c4a4ee643646f691d22804754c1">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="83392cae2c964fa6f8a97ac3fc515c3f94ef3c1c"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="431aed0a7c7560c6eacd35ea69aa0a7a4ebe72c7"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="44b04243e31cd16f3baf54fcd4b5fecf9deb8b94"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
|
@ -23,7 +23,7 @@
|
|||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="c9cc24ebbfa5427defcc4c99d4d08c2ee6cbcea8"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="89b697fee631fce716942d65b3d05fb08128bbab"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="f92a936f2aa97526d4593386754bdbf02db07a12"/>
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="6e47ff2790f5656b5b074407829ceecf3e6188c4"/>
|
||||
|
|
|
@ -19,13 +19,13 @@
|
|||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="83392cae2c964fa6f8a97ac3fc515c3f94ef3c1c"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="431aed0a7c7560c6eacd35ea69aa0a7a4ebe72c7"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="44b04243e31cd16f3baf54fcd4b5fecf9deb8b94"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cd88d860656c31c7da7bb310d6a160d0011b0961"/>
|
||||
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="3326b51017252e09ccdd715dec6c5e12a7d1ecfe"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="c510babaf88dfa2cfe2c202afb2649ee124569af"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="c9cc24ebbfa5427defcc4c99d4d08c2ee6cbcea8"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="89b697fee631fce716942d65b3d05fb08128bbab"/>
|
||||
<!-- Stock Android things -->
|
||||
<project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
|
||||
<project name="platform/bionic" path="bionic" revision="c72b8f6359de7ed17c11ddc9dfdde3f615d188a9"/>
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
</project>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="83392cae2c964fa6f8a97ac3fc515c3f94ef3c1c"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="431aed0a7c7560c6eacd35ea69aa0a7a4ebe72c7"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="44b04243e31cd16f3baf54fcd4b5fecf9deb8b94"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="c510babaf88dfa2cfe2c202afb2649ee124569af"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="c9cc24ebbfa5427defcc4c99d4d08c2ee6cbcea8"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="89b697fee631fce716942d65b3d05fb08128bbab"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<!-- Stock Android things -->
|
||||
|
|
|
@ -4,6 +4,6 @@
|
|||
"remote": "",
|
||||
"branch": ""
|
||||
},
|
||||
"revision": "d25f3c113e3543c8f15143a858f8e9d880dfc071",
|
||||
"revision": "371393ff791d599fe41e90ed64e17d2055605966",
|
||||
"repo_path": "/integration/gaia-central"
|
||||
}
|
||||
|
|
|
@ -17,12 +17,12 @@
|
|||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="83392cae2c964fa6f8a97ac3fc515c3f94ef3c1c"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="431aed0a7c7560c6eacd35ea69aa0a7a4ebe72c7"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="44b04243e31cd16f3baf54fcd4b5fecf9deb8b94"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="c510babaf88dfa2cfe2c202afb2649ee124569af"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="c9cc24ebbfa5427defcc4c99d4d08c2ee6cbcea8"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="89b697fee631fce716942d65b3d05fb08128bbab"/>
|
||||
<!-- Stock Android things -->
|
||||
<project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
|
||||
<project name="platform/bionic" path="bionic" revision="d2eb6c7b6e1bc7643c17df2d9d9bcb1704d0b9ab"/>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="83392cae2c964fa6f8a97ac3fc515c3f94ef3c1c"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="431aed0a7c7560c6eacd35ea69aa0a7a4ebe72c7"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="44b04243e31cd16f3baf54fcd4b5fecf9deb8b94"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="83392cae2c964fa6f8a97ac3fc515c3f94ef3c1c"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="431aed0a7c7560c6eacd35ea69aa0a7a4ebe72c7"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="44b04243e31cd16f3baf54fcd4b5fecf9deb8b94"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="c510babaf88dfa2cfe2c202afb2649ee124569af"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="c9cc24ebbfa5427defcc4c99d4d08c2ee6cbcea8"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="89b697fee631fce716942d65b3d05fb08128bbab"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<!-- Stock Android things -->
|
||||
|
|
|
@ -17,12 +17,12 @@
|
|||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="83392cae2c964fa6f8a97ac3fc515c3f94ef3c1c"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="431aed0a7c7560c6eacd35ea69aa0a7a4ebe72c7"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="44b04243e31cd16f3baf54fcd4b5fecf9deb8b94"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="c510babaf88dfa2cfe2c202afb2649ee124569af"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="c9cc24ebbfa5427defcc4c99d4d08c2ee6cbcea8"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="89b697fee631fce716942d65b3d05fb08128bbab"/>
|
||||
<project name="gonk-patches" path="patches" remote="b2g" revision="223a2421006e8f5da33f516f6891c87cae86b0f6"/>
|
||||
<!-- Stock Android things -->
|
||||
<project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
|
||||
|
|
|
@ -188,7 +188,6 @@
|
|||
#endif
|
||||
@BINPATH@/components/dom_notification.xpt
|
||||
@BINPATH@/components/dom_html.xpt
|
||||
@BINPATH@/components/dom_indexeddb.xpt
|
||||
@BINPATH@/components/dom_offline.xpt
|
||||
@BINPATH@/components/dom_payment.xpt
|
||||
@BINPATH@/components/dom_json.xpt
|
||||
|
|
|
@ -5,6 +5,7 @@ const promise = require("devtools/toolkit/deprecated-sync-thenables");
|
|||
const {EventEmitter} = Cu.import("resource://gre/modules/devtools/event-emitter.js");
|
||||
const {generateUUID} = Cc['@mozilla.org/uuid-generator;1'].getService(Ci.nsIUUIDGenerator);
|
||||
const {FileUtils} = Cu.import("resource://gre/modules/FileUtils.jsm");
|
||||
const { indexedDB } = require("sdk/indexed-db");
|
||||
|
||||
/**
|
||||
* IndexedDB wrapper that just save project objects
|
||||
|
@ -20,10 +21,6 @@ const IDB = {
|
|||
open: function () {
|
||||
let deferred = promise.defer();
|
||||
|
||||
var idbManager = Cc["@mozilla.org/dom/indexeddb/manager;1"]
|
||||
.getService(Ci.nsIIndexedDatabaseManager);
|
||||
idbManager.initWindowless(global);
|
||||
|
||||
let request = global.indexedDB.open("AppProjects", 5);
|
||||
request.onerror = function(event) {
|
||||
deferred.reject("Unable to open AppProjects indexedDB. " +
|
||||
|
|
|
@ -202,7 +202,6 @@
|
|||
@BINPATH@/components/dom_network.xpt
|
||||
@BINPATH@/components/dom_notification.xpt
|
||||
@BINPATH@/components/dom_html.xpt
|
||||
@BINPATH@/components/dom_indexeddb.xpt
|
||||
@BINPATH@/components/dom_offline.xpt
|
||||
@BINPATH@/components/dom_json.xpt
|
||||
@BINPATH@/components/dom_power.xpt
|
||||
|
|
|
@ -1945,8 +1945,8 @@ GK_ATOM(onratechange, "onratechange")
|
|||
GK_ATOM(ondurationchange, "ondurationchange")
|
||||
GK_ATOM(onvolumechange, "onvolumechange")
|
||||
GK_ATOM(onaddtrack, "onaddtrack")
|
||||
GK_ATOM(oncontrollerchange, "oncontrollerchange")
|
||||
GK_ATOM(oncuechange, "oncuechange")
|
||||
GK_ATOM(oncurrentchange, "oncurrentchange")
|
||||
GK_ATOM(onenter, "onenter")
|
||||
GK_ATOM(onexit, "onexit")
|
||||
GK_ATOM(onneedkey, "onneedkey")
|
||||
|
|
|
@ -40,7 +40,7 @@ SVGMatrix::SetA(float aA, ErrorResult& rv)
|
|||
}
|
||||
|
||||
gfxMatrix mx = GetMatrix();
|
||||
mx.xx = aA;
|
||||
mx._11 = aA;
|
||||
SetMatrix(mx);
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ SVGMatrix::SetB(float aB, ErrorResult& rv)
|
|||
}
|
||||
|
||||
gfxMatrix mx = GetMatrix();
|
||||
mx.yx = aB;
|
||||
mx._12 = aB;
|
||||
SetMatrix(mx);
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ SVGMatrix::SetC(float aC, ErrorResult& rv)
|
|||
}
|
||||
|
||||
gfxMatrix mx = GetMatrix();
|
||||
mx.xy = aC;
|
||||
mx._21 = aC;
|
||||
SetMatrix(mx);
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ SVGMatrix::SetD(float aD, ErrorResult& rv)
|
|||
}
|
||||
|
||||
gfxMatrix mx = GetMatrix();
|
||||
mx.yy = aD;
|
||||
mx._22 = aD;
|
||||
SetMatrix(mx);
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ SVGMatrix::SetE(float aE, ErrorResult& rv)
|
|||
}
|
||||
|
||||
gfxMatrix mx = GetMatrix();
|
||||
mx.x0 = aE;
|
||||
mx._31 = aE;
|
||||
SetMatrix(mx);
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ SVGMatrix::SetF(float aF, ErrorResult& rv)
|
|||
}
|
||||
|
||||
gfxMatrix mx = GetMatrix();
|
||||
mx.y0 = aF;
|
||||
mx._32 = aF;
|
||||
SetMatrix(mx);
|
||||
}
|
||||
|
||||
|
@ -176,7 +176,7 @@ SVGMatrix::FlipX()
|
|||
{
|
||||
const gfxMatrix& mx = GetMatrix();
|
||||
nsRefPtr<SVGMatrix> matrix =
|
||||
new SVGMatrix(gfxMatrix(-mx.xx, -mx.yx, mx.xy, mx.yy, mx.x0, mx.y0));
|
||||
new SVGMatrix(gfxMatrix(-mx._11, -mx._12, mx._21, mx._22, mx._31, mx._32));
|
||||
return matrix.forget();
|
||||
}
|
||||
|
||||
|
@ -185,7 +185,7 @@ SVGMatrix::FlipY()
|
|||
{
|
||||
const gfxMatrix& mx = GetMatrix();
|
||||
nsRefPtr<SVGMatrix> matrix =
|
||||
new SVGMatrix(gfxMatrix(mx.xx, mx.yx, -mx.xy, -mx.yy, mx.x0, mx.y0));
|
||||
new SVGMatrix(gfxMatrix(mx._11, mx._12, -mx._21, -mx._22, mx._31, mx._32));
|
||||
return matrix.forget();
|
||||
}
|
||||
|
||||
|
@ -199,9 +199,9 @@ SVGMatrix::SkewX(float angle, ErrorResult& rv)
|
|||
}
|
||||
|
||||
const gfxMatrix& mx = GetMatrix();
|
||||
gfxMatrix skewMx(mx.xx, mx.yx,
|
||||
(float) (mx.xy + mx.xx*ta), (float) (mx.yy + mx.yx*ta),
|
||||
mx.x0, mx.y0);
|
||||
gfxMatrix skewMx(mx._11, mx._12,
|
||||
(float) (mx._21 + mx._11*ta), (float) (mx._22 + mx._12*ta),
|
||||
mx._31, mx._32);
|
||||
nsRefPtr<SVGMatrix> matrix = new SVGMatrix(skewMx);
|
||||
return matrix.forget();
|
||||
}
|
||||
|
@ -216,9 +216,9 @@ SVGMatrix::SkewY(float angle, ErrorResult& rv)
|
|||
}
|
||||
|
||||
const gfxMatrix& mx = GetMatrix();
|
||||
gfxMatrix skewMx((float) (mx.xx + mx.xy*ta), (float) (mx.yx + mx.yy*ta),
|
||||
mx.xy, mx.yy,
|
||||
mx.x0, mx.y0);
|
||||
gfxMatrix skewMx((float) (mx._11 + mx._21*ta), (float) (mx._12 + mx._22*ta),
|
||||
mx._21, mx._22,
|
||||
mx._31, mx._32);
|
||||
|
||||
nsRefPtr<SVGMatrix> matrix = new SVGMatrix(skewMx);
|
||||
return matrix.forget();
|
||||
|
|
|
@ -83,17 +83,17 @@ public:
|
|||
SVGTransform* GetParentObject() const;
|
||||
virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
|
||||
|
||||
float A() const { return static_cast<float>(GetMatrix().xx); }
|
||||
float A() const { return static_cast<float>(GetMatrix()._11); }
|
||||
void SetA(float aA, ErrorResult& rv);
|
||||
float B() const { return static_cast<float>(GetMatrix().yx); }
|
||||
float B() const { return static_cast<float>(GetMatrix()._12); }
|
||||
void SetB(float aB, ErrorResult& rv);
|
||||
float C() const { return static_cast<float>(GetMatrix().xy); }
|
||||
float C() const { return static_cast<float>(GetMatrix()._21); }
|
||||
void SetC(float aC, ErrorResult& rv);
|
||||
float D() const { return static_cast<float>(GetMatrix().yy); }
|
||||
float D() const { return static_cast<float>(GetMatrix()._22); }
|
||||
void SetD(float aD, ErrorResult& rv);
|
||||
float E() const { return static_cast<float>(GetMatrix().x0); }
|
||||
float E() const { return static_cast<float>(GetMatrix()._31); }
|
||||
void SetE(float aE, ErrorResult& rv);
|
||||
float F() const { return static_cast<float>(GetMatrix().y0); }
|
||||
float F() const { return static_cast<float>(GetMatrix()._32); }
|
||||
void SetF(float aF, ErrorResult& rv);
|
||||
already_AddRefed<SVGMatrix> Multiply(SVGMatrix& aMatrix);
|
||||
already_AddRefed<SVGMatrix> Inverse(ErrorResult& aRv);
|
||||
|
|
|
@ -206,7 +206,7 @@ SVGTransform::SetTranslate(float tx, float ty, ErrorResult& rv)
|
|||
}
|
||||
|
||||
if (Transform().Type() == SVG_TRANSFORM_TRANSLATE &&
|
||||
Matrixgfx().x0 == tx && Matrixgfx().y0 == ty) {
|
||||
Matrixgfx()._31 == tx && Matrixgfx()._32 == ty) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -223,7 +223,7 @@ SVGTransform::SetScale(float sx, float sy, ErrorResult& rv)
|
|||
}
|
||||
|
||||
if (Transform().Type() == SVG_TRANSFORM_SCALE &&
|
||||
Matrixgfx().xx == sx && Matrixgfx().yy == sy) {
|
||||
Matrixgfx()._11 == sx && Matrixgfx()._22 == sy) {
|
||||
return;
|
||||
}
|
||||
AutoChangeTransformNotifier notifier(this);
|
||||
|
|
|
@ -23,14 +23,14 @@ nsSVGTransform::GetValueAsString(nsAString& aValue) const
|
|||
switch (mType) {
|
||||
case SVG_TRANSFORM_TRANSLATE:
|
||||
// The spec say that if Y is not provided, it is assumed to be zero.
|
||||
if (mMatrix.y0 != 0)
|
||||
if (mMatrix._32 != 0)
|
||||
nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(char16_t),
|
||||
MOZ_UTF16("translate(%g, %g)"),
|
||||
mMatrix.x0, mMatrix.y0);
|
||||
mMatrix._31, mMatrix._32);
|
||||
else
|
||||
nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(char16_t),
|
||||
MOZ_UTF16("translate(%g)"),
|
||||
mMatrix.x0);
|
||||
mMatrix._31);
|
||||
break;
|
||||
case SVG_TRANSFORM_ROTATE:
|
||||
if (mOriginX != 0.0f || mOriginY != 0.0f)
|
||||
|
@ -42,12 +42,12 @@ nsSVGTransform::GetValueAsString(nsAString& aValue) const
|
|||
MOZ_UTF16("rotate(%g)"), mAngle);
|
||||
break;
|
||||
case SVG_TRANSFORM_SCALE:
|
||||
if (mMatrix.xx != mMatrix.yy)
|
||||
if (mMatrix._11 != mMatrix._22)
|
||||
nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(char16_t),
|
||||
MOZ_UTF16("scale(%g, %g)"), mMatrix.xx, mMatrix.yy);
|
||||
MOZ_UTF16("scale(%g, %g)"), mMatrix._11, mMatrix._22);
|
||||
else
|
||||
nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(char16_t),
|
||||
MOZ_UTF16("scale(%g)"), mMatrix.xx);
|
||||
MOZ_UTF16("scale(%g)"), mMatrix._11);
|
||||
break;
|
||||
case SVG_TRANSFORM_SKEWX:
|
||||
nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(char16_t),
|
||||
|
@ -60,9 +60,9 @@ nsSVGTransform::GetValueAsString(nsAString& aValue) const
|
|||
case SVG_TRANSFORM_MATRIX:
|
||||
nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(char16_t),
|
||||
MOZ_UTF16("matrix(%g, %g, %g, %g, %g, %g)"),
|
||||
mMatrix.xx, mMatrix.yx,
|
||||
mMatrix.xy, mMatrix.yy,
|
||||
mMatrix.x0, mMatrix.y0);
|
||||
mMatrix._11, mMatrix._12,
|
||||
mMatrix._21, mMatrix._22,
|
||||
mMatrix._31, mMatrix._32);
|
||||
break;
|
||||
default:
|
||||
buf[0] = '\0';
|
||||
|
@ -90,8 +90,8 @@ nsSVGTransform::SetTranslate(float aTx, float aTy)
|
|||
{
|
||||
mType = SVG_TRANSFORM_TRANSLATE;
|
||||
mMatrix.Reset();
|
||||
mMatrix.x0 = aTx;
|
||||
mMatrix.y0 = aTy;
|
||||
mMatrix._31 = aTx;
|
||||
mMatrix._32 = aTy;
|
||||
mAngle = 0.f;
|
||||
mOriginX = 0.f;
|
||||
mOriginY = 0.f;
|
||||
|
@ -102,8 +102,8 @@ nsSVGTransform::SetScale(float aSx, float aSy)
|
|||
{
|
||||
mType = SVG_TRANSFORM_SCALE;
|
||||
mMatrix.Reset();
|
||||
mMatrix.xx = aSx;
|
||||
mMatrix.yy = aSy;
|
||||
mMatrix._11 = aSx;
|
||||
mMatrix._22 = aSy;
|
||||
mAngle = 0.f;
|
||||
mOriginX = 0.f;
|
||||
mOriginY = 0.f;
|
||||
|
@ -130,7 +130,7 @@ nsSVGTransform::SetSkewX(float aAngle)
|
|||
|
||||
mType = SVG_TRANSFORM_SKEWX;
|
||||
mMatrix.Reset();
|
||||
mMatrix.xy = ta;
|
||||
mMatrix._21 = ta;
|
||||
mAngle = aAngle;
|
||||
mOriginX = 0.f;
|
||||
mOriginY = 0.f;
|
||||
|
@ -145,7 +145,7 @@ nsSVGTransform::SetSkewY(float aAngle)
|
|||
|
||||
mType = SVG_TRANSFORM_SKEWY;
|
||||
mMatrix.Reset();
|
||||
mMatrix.yx = ta;
|
||||
mMatrix._12 = ta;
|
||||
mAngle = aAngle;
|
||||
mOriginX = 0.f;
|
||||
mOriginY = 0.f;
|
||||
|
@ -167,24 +167,24 @@ SVGTransformSMILData::SVGTransformSMILData(const nsSVGTransform& aTransform)
|
|||
switch (mTransformType) {
|
||||
case SVG_TRANSFORM_MATRIX: {
|
||||
const gfxMatrix& mx = aTransform.GetMatrix();
|
||||
mParams[0] = static_cast<float>(mx.xx);
|
||||
mParams[1] = static_cast<float>(mx.yx);
|
||||
mParams[2] = static_cast<float>(mx.xy);
|
||||
mParams[3] = static_cast<float>(mx.yy);
|
||||
mParams[4] = static_cast<float>(mx.x0);
|
||||
mParams[5] = static_cast<float>(mx.y0);
|
||||
mParams[0] = static_cast<float>(mx._11);
|
||||
mParams[1] = static_cast<float>(mx._12);
|
||||
mParams[2] = static_cast<float>(mx._21);
|
||||
mParams[3] = static_cast<float>(mx._22);
|
||||
mParams[4] = static_cast<float>(mx._31);
|
||||
mParams[5] = static_cast<float>(mx._32);
|
||||
break;
|
||||
}
|
||||
case SVG_TRANSFORM_TRANSLATE: {
|
||||
const gfxMatrix& mx = aTransform.GetMatrix();
|
||||
mParams[0] = static_cast<float>(mx.x0);
|
||||
mParams[1] = static_cast<float>(mx.y0);
|
||||
mParams[0] = static_cast<float>(mx._31);
|
||||
mParams[1] = static_cast<float>(mx._32);
|
||||
break;
|
||||
}
|
||||
case SVG_TRANSFORM_SCALE: {
|
||||
const gfxMatrix& mx = aTransform.GetMatrix();
|
||||
mParams[0] = static_cast<float>(mx.xx);
|
||||
mParams[1] = static_cast<float>(mx.yy);
|
||||
mParams[0] = static_cast<float>(mx._11);
|
||||
mParams[1] = static_cast<float>(mx._22);
|
||||
break;
|
||||
}
|
||||
case SVG_TRANSFORM_ROTATE:
|
||||
|
|
|
@ -75,12 +75,12 @@ public:
|
|||
|
||||
static bool MatricesEqual(const gfxMatrix& a, const gfxMatrix& b)
|
||||
{
|
||||
return a.xx == b.xx &&
|
||||
a.yx == b.yx &&
|
||||
a.xy == b.xy &&
|
||||
a.yy == b.yy &&
|
||||
a.x0 == b.x0 &&
|
||||
a.y0 == b.y0;
|
||||
return a._11 == b._11 &&
|
||||
a._12 == b._12 &&
|
||||
a._21 == b._21 &&
|
||||
a._22 == b._22 &&
|
||||
a._31 == b._31 &&
|
||||
a._32 == b._32;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
|
|
@ -167,7 +167,7 @@ BluetoothService::ToggleBtAck::Run()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
class BluetoothService::StartupTask : public nsISettingsServiceCallback
|
||||
class BluetoothService::StartupTask MOZ_FINAL : public nsISettingsServiceCallback
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
|
|
@ -67,6 +67,8 @@ static nsTArray<nsRefPtr<BluetoothReplyRunnable> > sUnbondingRunnableArray;
|
|||
|
||||
// Atomic static variables
|
||||
static Atomic<bool> sAdapterDiscoverable(false);
|
||||
static Atomic<bool> sAdapterDiscovering(false);
|
||||
static Atomic<bool> sAdapterEnabled(false);
|
||||
static Atomic<uint32_t> sAdapterDiscoverableTimeout(0);
|
||||
|
||||
/**
|
||||
|
@ -303,23 +305,22 @@ AdapterStateChangeCallback(bt_state_t aStatus)
|
|||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
|
||||
BT_LOGR("BT_STATE: %d", aStatus);
|
||||
sAdapterEnabled = (aStatus == BT_STATE_ON);
|
||||
|
||||
bool isBtEnabled = (aStatus == BT_STATE_ON);
|
||||
|
||||
if (!isBtEnabled &&
|
||||
if (!sAdapterEnabled &&
|
||||
NS_FAILED(NS_DispatchToMainThread(new CleanupTask()))) {
|
||||
BT_WARNING("Failed to dispatch to main thread!");
|
||||
return;
|
||||
}
|
||||
|
||||
nsRefPtr<nsRunnable> runnable =
|
||||
new BluetoothService::ToggleBtAck(isBtEnabled);
|
||||
new BluetoothService::ToggleBtAck(sAdapterEnabled);
|
||||
if (NS_FAILED(NS_DispatchToMainThread(runnable))) {
|
||||
BT_WARNING("Failed to dispatch to main thread!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (isBtEnabled &&
|
||||
if (sAdapterEnabled &&
|
||||
NS_FAILED(NS_DispatchToMainThread(new SetupAfterEnabledTask()))) {
|
||||
BT_WARNING("Failed to dispatch to main thread!");
|
||||
return;
|
||||
|
@ -381,13 +382,8 @@ AdapterPropertiesCallback(bt_status_t aStatus, int aNumProperties,
|
|||
BT_APPEND_NAMED_VALUE(props, "Name", propertyValue);
|
||||
} else if (p.type == BT_PROPERTY_ADAPTER_SCAN_MODE) {
|
||||
bt_scan_mode_t newMode = *(bt_scan_mode_t*)p.val;
|
||||
|
||||
if (newMode == BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE) {
|
||||
propertyValue = sAdapterDiscoverable = true;
|
||||
} else {
|
||||
propertyValue = sAdapterDiscoverable = false;
|
||||
}
|
||||
|
||||
propertyValue = sAdapterDiscoverable =
|
||||
(newMode == BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE);
|
||||
BT_APPEND_NAMED_VALUE(props, "Discoverable", propertyValue);
|
||||
} else if (p.type == BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT) {
|
||||
propertyValue = sAdapterDiscoverableTimeout = *(uint32_t*)p.val;
|
||||
|
@ -598,6 +594,8 @@ DiscoveryStateChangedCallback(bt_discovery_state_t aState)
|
|||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
|
||||
sAdapterDiscovering = (aState == BT_DISCOVERY_STARTED);
|
||||
|
||||
// Redirect to main thread to avoid racing problem
|
||||
NS_DispatchToMainThread(new DiscoveryStateChangedCallbackTask());
|
||||
}
|
||||
|
@ -714,19 +712,15 @@ BondStateChangedCallback(bt_status_t aStatus, bt_bdaddr_t* aRemoteBdAddress,
|
|||
nsAutoString remoteBdAddress;
|
||||
BdAddressTypeToString(aRemoteBdAddress, remoteBdAddress);
|
||||
|
||||
if (aState == BT_BOND_STATE_BONDED &&
|
||||
sAdapterBondedAddressArray.Contains(remoteBdAddress)) {
|
||||
// See bug 940271 for more details about this case.
|
||||
return;
|
||||
}
|
||||
|
||||
bool bonded;
|
||||
if (aState == BT_BOND_STATE_NONE) {
|
||||
bonded = false;
|
||||
sAdapterBondedAddressArray.RemoveElement(remoteBdAddress);
|
||||
} else if (aState == BT_BOND_STATE_BONDED) {
|
||||
bonded = true;
|
||||
bool bonded = (aState == BT_BOND_STATE_BONDED);
|
||||
if (bonded) {
|
||||
if (sAdapterBondedAddressArray.Contains(remoteBdAddress)) {
|
||||
// See bug 940271 for more details about this case.
|
||||
return;
|
||||
}
|
||||
sAdapterBondedAddressArray.AppendElement(remoteBdAddress);
|
||||
} else {
|
||||
sAdapterBondedAddressArray.RemoveElement(remoteBdAddress);
|
||||
}
|
||||
|
||||
// Update bonded address list to BluetoothAdapter
|
||||
|
@ -952,24 +946,20 @@ BluetoothServiceBluedroid::GetAdaptersInternal(
|
|||
uint32_t numAdapters = 1; // Bluedroid supports single adapter only
|
||||
|
||||
for (uint32_t i = 0; i < numAdapters; i++) {
|
||||
// Since Atomic<*> is not acceptable for BT_APPEND_NAMED_VALUE(),
|
||||
// create another variable to store data.
|
||||
bool discoverable = sAdapterDiscoverable;
|
||||
uint32_t discoverableTimeout = sAdapterDiscoverableTimeout;
|
||||
|
||||
BluetoothValue properties = InfallibleTArray<BluetoothNamedValue>();
|
||||
|
||||
// TODO: Revise here based on new BluetoothAdapter interface
|
||||
BT_APPEND_NAMED_VALUE(properties.get_ArrayOfBluetoothNamedValue(),
|
||||
"State", BluetoothValue(sAdapterEnabled));
|
||||
BT_APPEND_NAMED_VALUE(properties.get_ArrayOfBluetoothNamedValue(),
|
||||
"Address", sAdapterBdAddress);
|
||||
BT_APPEND_NAMED_VALUE(properties.get_ArrayOfBluetoothNamedValue(),
|
||||
"Name", sAdapterBdName);
|
||||
BT_APPEND_NAMED_VALUE(properties.get_ArrayOfBluetoothNamedValue(),
|
||||
"Discoverable", discoverable);
|
||||
"Discoverable",
|
||||
BluetoothValue(sAdapterDiscoverable));
|
||||
BT_APPEND_NAMED_VALUE(properties.get_ArrayOfBluetoothNamedValue(),
|
||||
"DiscoverableTimeout", discoverableTimeout);
|
||||
BT_APPEND_NAMED_VALUE(properties.get_ArrayOfBluetoothNamedValue(),
|
||||
"Devices", sAdapterBondedAddressArray);
|
||||
"Discovering",
|
||||
BluetoothValue(sAdapterDiscovering));
|
||||
|
||||
BT_APPEND_NAMED_VALUE(adaptersProperties.get_ArrayOfBluetoothNamedValue(),
|
||||
"Adapter", properties);
|
||||
|
@ -1274,29 +1264,16 @@ BluetoothServiceBluedroid::SetPairingConfirmationInternal(
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothServiceBluedroid::SetAuthorizationInternal(
|
||||
const nsAString& aDeviceAddress, bool aAllow,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
nsresult
|
||||
BluetoothServiceBluedroid::PrepareAdapterInternal()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static void
|
||||
NextBluetoothProfileController()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
// First, remove the task at the front which has been already done.
|
||||
// Remove the completed task at the head
|
||||
NS_ENSURE_FALSE_VOID(sControllerArray.IsEmpty());
|
||||
sControllerArray.RemoveElementAt(0);
|
||||
// Re-check if the task array is empty, if it's not, the next task will begin.
|
||||
|
||||
// Start the next task if task array is not empty
|
||||
if (!sControllerArray.IsEmpty()) {
|
||||
sControllerArray[0]->StartSession();
|
||||
}
|
||||
|
|
|
@ -74,13 +74,6 @@ public:
|
|||
SetPairingConfirmationInternal(const nsAString& aDeviceAddress, bool aConfirm,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
virtual bool
|
||||
SetAuthorizationInternal(const nsAString& aDeviceAddress, bool aAllow,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
virtual nsresult
|
||||
PrepareAdapterInternal();
|
||||
|
||||
virtual void
|
||||
Connect(const nsAString& aDeviceAddress,
|
||||
uint32_t aCod,
|
||||
|
|
|
@ -114,7 +114,7 @@ this.DataStoreChangeNotifier = {
|
|||
this.children[i].windows.splice(pos, 1);
|
||||
}
|
||||
|
||||
if (this.children[i].window.length) {
|
||||
if (this.children[i].windows.length) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -252,17 +252,6 @@ IndexedDatabaseManager::Get()
|
|||
return gDBManager;
|
||||
}
|
||||
|
||||
// static
|
||||
IndexedDatabaseManager*
|
||||
IndexedDatabaseManager::FactoryCreate()
|
||||
{
|
||||
// Returns a raw pointer that carries an owning reference! Lame, but the
|
||||
// singleton factory macros force this.
|
||||
IndexedDatabaseManager* mgr = GetOrCreate();
|
||||
NS_IF_ADDREF(mgr);
|
||||
return mgr;
|
||||
}
|
||||
|
||||
nsresult
|
||||
IndexedDatabaseManager::Init()
|
||||
{
|
||||
|
@ -646,36 +635,7 @@ IndexedDatabaseManager::BlockAndGetFileReferences(
|
|||
|
||||
NS_IMPL_ADDREF(IndexedDatabaseManager)
|
||||
NS_IMPL_RELEASE_WITH_DESTROY(IndexedDatabaseManager, Destroy())
|
||||
NS_IMPL_QUERY_INTERFACE(IndexedDatabaseManager, nsIIndexedDatabaseManager,
|
||||
nsIObserver)
|
||||
|
||||
NS_IMETHODIMP
|
||||
IndexedDatabaseManager::InitWindowless(JS::Handle<JS::Value> aGlobal, JSContext* aCx)
|
||||
{
|
||||
NS_ENSURE_TRUE(nsContentUtils::IsCallerChrome(), NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
JS::Rooted<JSObject*> global(aCx, aGlobal.toObjectOrNull());
|
||||
if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
|
||||
NS_WARNING("Passed object is not a global object!");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
bool hasIndexedDB;
|
||||
if (!JS_HasProperty(aCx, global, IDB_STR, &hasIndexedDB)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (hasIndexedDB) {
|
||||
NS_WARNING("Passed object already has an 'indexedDB' property!");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (!DefineIndexedDB(aCx, global)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMPL_QUERY_INTERFACE(IndexedDatabaseManager, nsIObserver)
|
||||
|
||||
NS_IMETHODIMP
|
||||
IndexedDatabaseManager::Observe(nsISupports* aSubject, const char* aTopic,
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
#include "mozilla/dom/indexedDB/IndexedDatabase.h"
|
||||
|
||||
#include "nsIIndexedDatabaseManager.h"
|
||||
#include "nsIObserver.h"
|
||||
|
||||
#include "js/TypeDecls.h"
|
||||
|
@ -19,8 +18,6 @@
|
|||
#include "nsClassHashtable.h"
|
||||
#include "nsHashKeys.h"
|
||||
|
||||
#define INDEXEDDB_MANAGER_CONTRACTID "@mozilla.org/dom/indexeddb/manager;1"
|
||||
|
||||
class nsPIDOMWindow;
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -38,15 +35,13 @@ BEGIN_INDEXEDDB_NAMESPACE
|
|||
class FileManager;
|
||||
class FileManagerInfo;
|
||||
|
||||
class IndexedDatabaseManager MOZ_FINAL : public nsIIndexedDatabaseManager,
|
||||
public nsIObserver
|
||||
class IndexedDatabaseManager MOZ_FINAL : public nsIObserver
|
||||
{
|
||||
typedef mozilla::dom::quota::OriginOrPatternString OriginOrPatternString;
|
||||
typedef mozilla::dom::quota::PersistenceType PersistenceType;
|
||||
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIINDEXEDDATABASEMANAGER
|
||||
NS_DECL_NSIOBSERVER
|
||||
|
||||
// Returns a non-owning reference.
|
||||
|
@ -57,10 +52,6 @@ public:
|
|||
static IndexedDatabaseManager*
|
||||
Get();
|
||||
|
||||
// Returns an owning reference! No one should call this but the factory.
|
||||
static IndexedDatabaseManager*
|
||||
FactoryCreate();
|
||||
|
||||
static bool
|
||||
IsClosed();
|
||||
|
||||
|
|
|
@ -7,12 +7,6 @@
|
|||
DIRS += ['ipc']
|
||||
TEST_DIRS += ['test']
|
||||
|
||||
XPIDL_SOURCES += [
|
||||
'nsIIndexedDatabaseManager.idl',
|
||||
]
|
||||
|
||||
XPIDL_MODULE = 'dom_indexeddb'
|
||||
|
||||
EXPORTS.mozilla.dom.indexedDB += [
|
||||
'Client.h',
|
||||
'DatabaseInfo.h',
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, builtinclass, uuid(538d1085-517e-405a-a0f0-eb575cb0b8e5)]
|
||||
interface nsIIndexedDatabaseManager : nsISupports
|
||||
{
|
||||
/**
|
||||
* Defines indexedDB and IDBKeyRange with its static functions on aGlobal.
|
||||
*
|
||||
* This method might go away some time in the future, indexedDB and
|
||||
* IDBKeyRange should now be defined in all the spots (content windows,
|
||||
* chrome windows, xpcshell, JS modules, JS components, JS sandboxes,
|
||||
* ipcshell, bootstrapped extensions and Jetpack)
|
||||
*
|
||||
* @param aGlobal
|
||||
* The global object, indexedDB and IDBKeyRange should be defined on.
|
||||
*/
|
||||
[implicit_jscontext]
|
||||
void initWindowless(in jsval aGlobal);
|
||||
};
|
|
@ -28,10 +28,9 @@ qemu = true
|
|||
[test_mobile_data_ipv6.js]
|
||||
disabled = Bug 979137
|
||||
[test_mobile_supported_network_types.js]
|
||||
[test_mobile_call_forwarding_set.js]
|
||||
disabled = Bug 861725
|
||||
[test_mobile_call_forwarding_get.js]
|
||||
disabled = Bug 861725
|
||||
[test_mobile_call_forwarding.js]
|
||||
[test_mobile_call_forwarding_set_error.js]
|
||||
[test_mobile_call_forwarding_get_error.js]
|
||||
[test_mobile_voice_privacy.js]
|
||||
[test_dsds_mobile_data_connection.js]
|
||||
[test_mobile_clir.js]
|
||||
|
|
|
@ -0,0 +1,105 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 60000;
|
||||
MARIONETTE_HEAD_JS = "head.js";
|
||||
|
||||
const TEST_DATA = [
|
||||
{
|
||||
action: MozMobileConnection.CALL_FORWARD_ACTION_REGISTRATION,
|
||||
reason: MozMobileConnection.CALL_FORWARD_REASON_MOBILE_BUSY,
|
||||
number: "0912345678",
|
||||
timeSeconds: 5,
|
||||
// Currently gecko only support ICC_SERVICE_CLASS_VOICE.
|
||||
serviceClass: MozMobileConnection.ICC_SERVICE_CLASS_VOICE
|
||||
}, {
|
||||
action: MozMobileConnection.CALL_FORWARD_ACTION_ENABLE,
|
||||
reason: MozMobileConnection.CALL_FORWARD_REASON_NO_REPLY,
|
||||
number: "+886912345678",
|
||||
timeSeconds: 20,
|
||||
// Currently gecko only support ICC_SERVICE_CLASS_VOICE.
|
||||
serviceClass: MozMobileConnection.ICC_SERVICE_CLASS_VOICE
|
||||
}
|
||||
];
|
||||
|
||||
function testSetCallForwardingOption(aOptions) {
|
||||
log("Test setting call forwarding to " + JSON.stringify(aOptions));
|
||||
|
||||
let promises = [];
|
||||
|
||||
// Check cfstatechange event.
|
||||
promises.push(waitForManagerEvent("cfstatechange").then(function(aEvent) {
|
||||
is(aEvent.success, true, "check success");
|
||||
is(aEvent.action, aOptions.action, "check action");
|
||||
is(aEvent.reason, aOptions.reason, "check reason");
|
||||
is(aEvent.number, aOptions.number, "check number");
|
||||
is(aEvent.timeSeconds, aOptions.timeSeconds, "check timeSeconds");
|
||||
is(aEvent.serviceClass, aOptions.serviceClass, "check serviceClass");
|
||||
}));
|
||||
// Check DOMRequest's result.
|
||||
promises.push(setCallForwardingOption(aOptions).then(null, (aError) => {
|
||||
ok(false, "got '" + aError.name + "' error");
|
||||
}));
|
||||
|
||||
return Promise.all(promises);
|
||||
}
|
||||
|
||||
function testGetCallForwardingOption(aReason, aExpectedResult) {
|
||||
log("Test getting call forwarding for " + aReason);
|
||||
|
||||
return getCallForwardingOption(aReason)
|
||||
.then(function resolve(aResults) {
|
||||
is(Array.isArray(aResults), true, "results should be an array");
|
||||
|
||||
for (let i = 0; i < aResults.length; i++) {
|
||||
let result = aResults[i];
|
||||
|
||||
// Only need to check the result containing the serviceClass that we are
|
||||
// interesting in.
|
||||
if (!(result.serviceClass & aExpectedResult.serviceClass)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
let expectedActive =
|
||||
aExpectedResult.action === MozMobileConnection.CALL_FORWARD_ACTION_ENABLE ||
|
||||
aExpectedResult.action === MozMobileConnection.CALL_FORWARD_ACTION_REGISTRATION;
|
||||
is(result.active, expectedActive, "check active");
|
||||
is(result.reason, aExpectedResult.reason, "check reason");
|
||||
is(result.number, aExpectedResult.number, "check number");
|
||||
is(result.timeSeconds, aExpectedResult.timeSeconds, "check timeSeconds");
|
||||
}
|
||||
}, function reject(aError) {
|
||||
ok(false, "got '" + aError.name + "' error");
|
||||
});
|
||||
}
|
||||
|
||||
function clearAllCallForwardingSettings() {
|
||||
log("Clear all call forwarding settings");
|
||||
|
||||
let promise = Promise.resolve();
|
||||
for (let reason = MozMobileConnection.CALL_FORWARD_REASON_UNCONDITIONAL;
|
||||
reason <= MozMobileConnection.CALL_FORWARD_REASON_ALL_CONDITIONAL_CALL_FORWARDING;
|
||||
reason++) {
|
||||
let options = {
|
||||
reason: reason,
|
||||
action: MozMobileConnection.CALL_FORWARD_ACTION_ERASURE
|
||||
};
|
||||
promise =
|
||||
promise.then(() => setCallForwardingOption(options).then(null, () => {}));
|
||||
}
|
||||
return promise;
|
||||
}
|
||||
|
||||
// Start tests
|
||||
startTestCommon(function() {
|
||||
let promise = Promise.resolve();
|
||||
for (let i = 0; i < TEST_DATA.length; i++) {
|
||||
let data = TEST_DATA[i];
|
||||
promise = promise.then(() => testSetCallForwardingOption(data))
|
||||
.then(() => testGetCallForwardingOption(data.reason, data));
|
||||
}
|
||||
// reset call forwarding settings.
|
||||
return promise.then(null, () => {})
|
||||
.then(() => clearAllCallForwardingSettings());
|
||||
});
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 60000;
|
||||
MARIONETTE_HEAD_JS = "head.js";
|
||||
|
||||
const TEST_DATA = [
|
||||
// Test get calling forwarding.
|
||||
// TODO: Bug 861725 - B2G Emulator: support call forwarding
|
||||
// Currently emulator doesn't support REQUEST_QUERY_CALL_FORWARD_STATUS, so
|
||||
// we expect to get a 'RequestNotSupported' error here.
|
||||
{
|
||||
reason: MozMobileConnection.CALL_FORWARD_REASON_UNCONDITIONAL,
|
||||
expectedErrorMsg: "RequestNotSupported"
|
||||
}, {
|
||||
reason: MozMobileConnection.CALL_FORWARD_REASON_MOBILE_BUSY,
|
||||
expectedErrorMsg: "RequestNotSupported"
|
||||
}, {
|
||||
reason: MozMobileConnection.CALL_FORWARD_REASON_NO_REPLY,
|
||||
expectedErrorMsg: "RequestNotSupported"
|
||||
}, {
|
||||
reason: MozMobileConnection.CALL_FORWARD_REASON_NOT_REACHABLE,
|
||||
expectedErrorMsg: "RequestNotSupported"
|
||||
}, {
|
||||
reason: MozMobileConnection.CALL_FORWARD_REASON_ALL_CALL_FORWARDING,
|
||||
expectedErrorMsg: "RequestNotSupported"
|
||||
}, {
|
||||
reason: MozMobileConnection.CALL_FORWARD_REASON_ALL_CONDITIONAL_CALL_FORWARDING,
|
||||
expectedErrorMsg: "RequestNotSupported"
|
||||
},
|
||||
// Test passing invalid reason
|
||||
{
|
||||
reason: 10 /* Invalid reason */,
|
||||
expectedErrorMsg: "InvalidParameter"
|
||||
}
|
||||
];
|
||||
|
||||
function testGetCallForwardingOption(aReason, aExpectedErrorMsg) {
|
||||
log("Test getting call forwarding for " + aReason);
|
||||
|
||||
return getCallForwardingOption(aReason)
|
||||
.then(function resolve() {
|
||||
ok(!aExpectedErrorMsg, "getCallForwardingOption success");
|
||||
}, function reject(aError) {
|
||||
is(aError.name, aExpectedErrorMsg, "failed to getCallForwardingOption");
|
||||
});
|
||||
}
|
||||
|
||||
// Start tests
|
||||
startTestCommon(function() {
|
||||
let promise = Promise.resolve();
|
||||
for (let i = 0; i < TEST_DATA.length; i++) {
|
||||
let data = TEST_DATA[i];
|
||||
promise = promise.then(() => testGetCallForwardingOption(data.reason,
|
||||
data.expectedErrorMsg));
|
||||
}
|
||||
return promise;
|
||||
});
|
|
@ -0,0 +1,45 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 60000;
|
||||
MARIONETTE_HEAD_JS = "head.js";
|
||||
|
||||
const TEST_DATA = [
|
||||
// Currently emulator doesn't support CALL_FORWARD_REASON_ALL_CALL_FORWARDING
|
||||
// and CALL_FORWARD_REASON_ALL_CONDITIONAL_CALL_FORWARDING, so
|
||||
// we expect to get a 'GenericFailure' error here.
|
||||
{
|
||||
reason: MozMobileConnection.CALL_FORWARD_REASON_ALL_CALL_FORWARDING,
|
||||
errorMsg: "GenericFailure"
|
||||
}, {
|
||||
reason: MozMobileConnection.CALL_FORWARD_REASON_ALL_CONDITIONAL_CALL_FORWARDING,
|
||||
errorMsg: "GenericFailure"
|
||||
},
|
||||
// Test passing invalid reason
|
||||
{
|
||||
reason: 10 /* Invalid reason */,
|
||||
errorMsg: "InvalidParameter"
|
||||
}
|
||||
];
|
||||
|
||||
function testGetCallForwardingOptionError(aReason, aErrorMsg) {
|
||||
log("Test getting call forwarding for " + aReason);
|
||||
|
||||
return getCallForwardingOption(aReason)
|
||||
.then(function resolve() {
|
||||
ok(false, "getCallForwardingOption success");
|
||||
}, function reject(aError) {
|
||||
is(aError.name, aErrorMsg, "failed to getCallForwardingOption");
|
||||
});
|
||||
}
|
||||
|
||||
// Start tests
|
||||
startTestCommon(function() {
|
||||
let promise = Promise.resolve();
|
||||
for (let i = 0; i < TEST_DATA.length; i++) {
|
||||
let data = TEST_DATA[i];
|
||||
promise = promise.then(() => testGetCallForwardingOptionError(data.reason,
|
||||
data.errorMsg));
|
||||
}
|
||||
return promise;
|
||||
});
|
|
@ -7,22 +7,21 @@ MARIONETTE_HEAD_JS = "head.js";
|
|||
const TEST_NUMBER = "0912345678";
|
||||
const TEST_TIME_SECONDS = 5;
|
||||
const TEST_DATA = [
|
||||
// Test get calling forwarding.
|
||||
// TODO: Bug 861725 - B2G Emulator: support call forwarding
|
||||
// Currently emulator doesn't support REQUEST_QUERY_CALL_FORWARD_STATUS, so
|
||||
// we expect to get a 'RequestNotSupported' error here.
|
||||
// Currently emulator doesn't support CALL_FORWARD_REASON_ALL_CALL_FORWARDING
|
||||
// and CALL_FORWARD_REASON_ALL_CONDITIONAL_CALL_FORWARDING, so
|
||||
// we expect to get a 'GenericFailure' error here.
|
||||
{
|
||||
options: {
|
||||
action: MozMobileConnection.CALL_FORWARD_ACTION_DISABLE,
|
||||
reason: MozMobileConnection.CALL_FORWARD_REASON_UNCONDITIONAL,
|
||||
reason: MozMobileConnection.CALL_FORWARD_REASON_ALL_CALL_FORWARDING,
|
||||
},
|
||||
expectedErrorMsg: "RequestNotSupported"
|
||||
errorMsg: "GenericFailure"
|
||||
}, {
|
||||
options: {
|
||||
action: MozMobileConnection.CALL_FORWARD_ACTION_ENABLE,
|
||||
reason: MozMobileConnection.CALL_FORWARD_REASON_MOBILE_BUSY,
|
||||
reason: MozMobileConnection.CALL_FORWARD_REASON_ALL_CONDITIONAL_CALL_FORWARDING,
|
||||
},
|
||||
expectedErrorMsg: "RequestNotSupported"
|
||||
errorMsg: "GenericFailure"
|
||||
},
|
||||
// Test passing invalid action. We expect to get a 'InvalidParameter' error.
|
||||
{
|
||||
|
@ -31,13 +30,13 @@ const TEST_DATA = [
|
|||
action: MozMobileConnection.CALL_FORWARD_ACTION_QUERY_STATUS,
|
||||
reason: MozMobileConnection.CALL_FORWARD_REASON_MOBILE_BUSY,
|
||||
},
|
||||
expectedErrorMsg: "InvalidParameter"
|
||||
errorMsg: "InvalidParameter"
|
||||
}, {
|
||||
options: {
|
||||
action: 10 /* Invalid action */,
|
||||
reason: MozMobileConnection.CALL_FORWARD_REASON_MOBILE_BUSY,
|
||||
},
|
||||
expectedErrorMsg: "InvalidParameter"
|
||||
errorMsg: "InvalidParameter"
|
||||
},
|
||||
// Test passing invalid reason. We expect to get a 'InvalidParameter' error.
|
||||
{
|
||||
|
@ -45,11 +44,11 @@ const TEST_DATA = [
|
|||
action: MozMobileConnection.CALL_FORWARD_ACTION_DISABLE,
|
||||
reason: 10 /*Invalid reason*/,
|
||||
},
|
||||
expectedErrorMsg: "InvalidParameter"
|
||||
errorMsg: "InvalidParameter"
|
||||
}
|
||||
];
|
||||
|
||||
function testSetCallForwardingOption(aOptions, aExpectedErrorMsg) {
|
||||
function testSetCallForwardingOption(aOptions, aErrorMsg) {
|
||||
log("Test setting call forwarding to " + JSON.stringify(aOptions));
|
||||
|
||||
aOptions.number = TEST_NUMBER;
|
||||
|
@ -57,9 +56,9 @@ function testSetCallForwardingOption(aOptions, aExpectedErrorMsg) {
|
|||
|
||||
return setCallForwardingOption(aOptions)
|
||||
.then(function resolve() {
|
||||
ok(!aExpectedErrorMsg, "setCallForwardingOption success");
|
||||
ok(false, "setCallForwardingOption success");
|
||||
}, function reject(aError) {
|
||||
is(aError.name, aExpectedErrorMsg, "failed to setCallForwardingOption");
|
||||
is(aError.name, aErrorMsg, "failed to setCallForwardingOption");
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -69,7 +68,7 @@ startTestCommon(function() {
|
|||
for (let i = 0; i < TEST_DATA.length; i++) {
|
||||
let data = TEST_DATA[i];
|
||||
promise = promise.then(() => testSetCallForwardingOption(data.options,
|
||||
data.expectedErrorMsg));
|
||||
data.errorMsg));
|
||||
}
|
||||
return promise;
|
||||
});
|
|
@ -22,6 +22,7 @@ let emulator = (function() {
|
|||
};
|
||||
|
||||
function run(cmd, callback) {
|
||||
log("Executing emulator command '" + cmd + "'");
|
||||
pendingCmdCount++;
|
||||
originalRunEmulatorCmd(cmd, function(result) {
|
||||
pendingCmdCount--;
|
||||
|
@ -29,10 +30,66 @@ let emulator = (function() {
|
|||
callback(result);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
function activateRE(re) {
|
||||
let deferred = Promise.defer();
|
||||
let cmd = 'nfc nci rf_intf_activated_ntf ' + re;
|
||||
|
||||
this.run(cmd, function(result) {
|
||||
is(result.pop(), 'OK', 'check activation of RE' + re);
|
||||
deferred.resolve();
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
};
|
||||
|
||||
function notifyDiscoverRE(re, type) {
|
||||
let deferred = Promise.defer();
|
||||
let cmd = 'nfc nci rf_discover_ntf ' + re + ' ' + type;
|
||||
|
||||
this.run(cmd, function(result) {
|
||||
is(result.pop(), 'OK', 'check discovery of RE' + re);
|
||||
deferred.resolve();
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
};
|
||||
|
||||
function setTagData(re, flag, tnf, type, payload) {
|
||||
let deferred = Promise.defer();
|
||||
let cmd = "nfc tag set " + re +
|
||||
" [" + flag + "," + tnf + "," + type + "," + payload + ",]";
|
||||
|
||||
this.run(cmd, function(result) {
|
||||
is(result.pop(), "OK", "set NDEF data of tag" + re);
|
||||
deferred.resolve();
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
};
|
||||
|
||||
function snepPutNdef(dsap, ssap, flags, tnf, type, payload, id) {
|
||||
let deferred = Promise.defer();
|
||||
let cmd = "nfc snep put " + dsap + " " + ssap + " [" + flags + "," +
|
||||
tnf + "," +
|
||||
type + "," +
|
||||
payload + "," +
|
||||
id + "]";
|
||||
this.run(cmd, function(result) {
|
||||
is(result.pop(), "OK", "send SNEP PUT");
|
||||
deferred.resolve();
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
};
|
||||
|
||||
return {
|
||||
run: run
|
||||
run: run,
|
||||
activateRE: activateRE,
|
||||
notifyDiscoverRE: notifyDiscoverRE,
|
||||
setTagData: setTagData,
|
||||
snepPutNdef: snepPutNdef
|
||||
};
|
||||
}());
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ qemu=true
|
|||
[test_ndef.js]
|
||||
[test_nfc_enabled.js]
|
||||
[test_nfc_manager_tech_discovered.js]
|
||||
[test_nfc_manager_tech_discovered_ndef.js]
|
||||
[test_nfc_peer.js]
|
||||
[test_nfc_peer_sendndef.js]
|
||||
[test_nfc_tag.js]
|
||||
|
|
|
@ -16,36 +16,12 @@ function handleTechnologyDiscoveredRE0(msg) {
|
|||
toggleNFC(false).then(runNextTest);
|
||||
}
|
||||
|
||||
function activateRE(re) {
|
||||
let deferred = Promise.defer();
|
||||
let cmd = 'nfc nci rf_intf_activated_ntf ' + re;
|
||||
|
||||
emulator.run(cmd, function(result) {
|
||||
is(result.pop(), 'OK', 'check activation of RE' + re);
|
||||
deferred.resolve();
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function notifyDiscoverRE(re, type) {
|
||||
let deferred = Promise.defer();
|
||||
let cmd = 'nfc nci rf_discover_ntf ' + re + ' ' + type;
|
||||
|
||||
emulator.run(cmd, function(result) {
|
||||
is(result.pop(), 'OK', 'check discover of RE' + re);
|
||||
deferred.resolve();
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function testActivateRE0() {
|
||||
log('Running \'testActivateRE0\'');
|
||||
window.navigator.mozSetMessageHandler(
|
||||
'nfc-manager-tech-discovered', handleTechnologyDiscoveredRE0);
|
||||
|
||||
toggleNFC(true).then(() => activateRE(0));
|
||||
toggleNFC(true).then(() => emulator.activateRE(0));
|
||||
}
|
||||
|
||||
// Check NCI Spec 5.2, this will change NCI state from
|
||||
|
@ -56,9 +32,9 @@ function testRfDiscover() {
|
|||
'nfc-manager-tech-discovered', handleTechnologyDiscoveredRE0);
|
||||
|
||||
toggleNFC(true)
|
||||
.then(() => notifyDiscoverRE(0, NCI_MORE_NOTIFICATIONS))
|
||||
.then(() => notifyDiscoverRE(1, NCI_LAST_NOTIFICATION))
|
||||
.then(() => activateRE(0));
|
||||
.then(() => emulator.notifyDiscoverRE(0, NCI_MORE_NOTIFICATIONS))
|
||||
.then(() => emulator.notifyDiscoverRE(1, NCI_LAST_NOTIFICATION))
|
||||
.then(() => emulator.activateRE(0));
|
||||
}
|
||||
|
||||
let tests = [
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 30000;
|
||||
MARIONETTE_HEAD_JS = 'head.js';
|
||||
|
||||
let tnf = NDEF.TNF_WELL_KNOWN;
|
||||
let type = "U";
|
||||
let payload = "https://www.example.com";
|
||||
let id = "";
|
||||
|
||||
let ndef = null;
|
||||
|
||||
// See nfc-nci.h.
|
||||
const NCI_LAST_NOTIFICATION = 0;
|
||||
const NCI_LIMIT_NOTIFICATION = 1;
|
||||
const NCI_MORE_NOTIFICATIONS = 2;
|
||||
|
||||
function handleTechnologyDiscoveredRE0(msg) {
|
||||
log("Received 'nfc-manager-tech-discovered'");
|
||||
is(msg.type, "techDiscovered", "check for correct message type");
|
||||
is(msg.techList[0], "P2P", "check for correct tech type");
|
||||
|
||||
if (msg.records) {
|
||||
isnot(msg.techList.indexOf("NDEF"), -1, "check for correct tech type");
|
||||
// validate received NDEF message against reference
|
||||
let ndef = [new MozNDEFRecord(tnf,
|
||||
new Uint8Array(NfcUtils.fromUTF8(type)),
|
||||
new Uint8Array(NfcUtils.fromUTF8(id)),
|
||||
new Uint8Array(NfcUtils.fromUTF8(payload)))];
|
||||
NDEF.compare(ndef, msg.records);
|
||||
toggleNFC(false).then(runNextTest);
|
||||
}
|
||||
}
|
||||
|
||||
function testReceiveNDEF() {
|
||||
log("Running 'testReceiveNDEF'");
|
||||
window.navigator.mozSetMessageHandler(
|
||||
"nfc-manager-tech-discovered", handleTechnologyDiscoveredRE0);
|
||||
toggleNFC(true)
|
||||
.then(() => emulator.activateRE(0))
|
||||
.then(() => emulator.snepPutNdef(4, 4, 0, tnf, btoa(type),
|
||||
btoa(payload), btoa(id)));
|
||||
}
|
||||
|
||||
let tests = [
|
||||
testReceiveNDEF
|
||||
];
|
||||
|
||||
SpecialPowers.pushPermissions(
|
||||
[{'type': 'nfc', 'allow': true,
|
||||
'read': true, 'write': true, context: document},
|
||||
{'type': 'nfc-manager', 'allow': true, context: document}], runTests);
|
|
@ -10,32 +10,6 @@ let url = "http://www.mozilla.org";
|
|||
const T1T_RE_INDEX = 2;
|
||||
const T2T_RE_INDEX = 3;
|
||||
|
||||
function activateRE(re) {
|
||||
let deferred = Promise.defer();
|
||||
let cmd = "nfc nci rf_intf_activated_ntf " + re;
|
||||
|
||||
emulator.run(cmd, function(result) {
|
||||
is(result.pop(), "OK", "check activation of RE" + re);
|
||||
deferred.resolve();
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function setTagData(re, flag, tnf, type, payload) {
|
||||
let deferred = Promise.defer();
|
||||
let cmd = "nfc tag set " + re +
|
||||
" [" + flag + "," + tnf + "," + type + "," + payload + ",]";
|
||||
|
||||
log("Executing \'" + cmd + "\'");
|
||||
emulator.run(cmd, function(result) {
|
||||
is(result.pop(), "OK", "set NDEF data of tag" + re);
|
||||
deferred.resolve();
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function testUrlTagDiscover(re) {
|
||||
log("Running \'testUrlTagDiscover\'");
|
||||
// TODO : Make flag value readable.
|
||||
|
|
|
@ -30,12 +30,10 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
|||
|
||||
PromiseCallback::PromiseCallback()
|
||||
{
|
||||
MOZ_COUNT_CTOR(PromiseCallback);
|
||||
}
|
||||
|
||||
PromiseCallback::~PromiseCallback()
|
||||
{
|
||||
MOZ_COUNT_DTOR(PromiseCallback);
|
||||
}
|
||||
|
||||
// ResolvePromiseCallback
|
||||
|
@ -71,13 +69,11 @@ ResolvePromiseCallback::ResolvePromiseCallback(Promise* aPromise,
|
|||
{
|
||||
MOZ_ASSERT(aPromise);
|
||||
MOZ_ASSERT(aGlobal);
|
||||
MOZ_COUNT_CTOR(ResolvePromiseCallback);
|
||||
HoldJSObjects(this);
|
||||
}
|
||||
|
||||
ResolvePromiseCallback::~ResolvePromiseCallback()
|
||||
{
|
||||
MOZ_COUNT_DTOR(ResolvePromiseCallback);
|
||||
DropJSObjects(this);
|
||||
}
|
||||
|
||||
|
@ -131,13 +127,11 @@ RejectPromiseCallback::RejectPromiseCallback(Promise* aPromise,
|
|||
{
|
||||
MOZ_ASSERT(aPromise);
|
||||
MOZ_ASSERT(mGlobal);
|
||||
MOZ_COUNT_CTOR(RejectPromiseCallback);
|
||||
HoldJSObjects(this);
|
||||
}
|
||||
|
||||
RejectPromiseCallback::~RejectPromiseCallback()
|
||||
{
|
||||
MOZ_COUNT_DTOR(RejectPromiseCallback);
|
||||
DropJSObjects(this);
|
||||
}
|
||||
|
||||
|
@ -194,13 +188,11 @@ WrapperPromiseCallback::WrapperPromiseCallback(Promise* aNextPromise,
|
|||
{
|
||||
MOZ_ASSERT(aNextPromise);
|
||||
MOZ_ASSERT(aGlobal);
|
||||
MOZ_COUNT_CTOR(WrapperPromiseCallback);
|
||||
HoldJSObjects(this);
|
||||
}
|
||||
|
||||
WrapperPromiseCallback::~WrapperPromiseCallback()
|
||||
{
|
||||
MOZ_COUNT_DTOR(WrapperPromiseCallback);
|
||||
DropJSObjects(this);
|
||||
}
|
||||
|
||||
|
@ -325,12 +317,10 @@ NativePromiseCallback::NativePromiseCallback(PromiseNativeHandler* aHandler,
|
|||
, mState(aState)
|
||||
{
|
||||
MOZ_ASSERT(aHandler);
|
||||
MOZ_COUNT_CTOR(NativePromiseCallback);
|
||||
}
|
||||
|
||||
NativePromiseCallback::~NativePromiseCallback()
|
||||
{
|
||||
MOZ_COUNT_DTOR(NativePromiseCallback);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -177,17 +177,10 @@ public:
|
|||
VolumeManager::RegisterStateObserver(&mVolumeManagerStateObserver);
|
||||
Volume::RegisterObserver(&mVolumeEventObserver);
|
||||
|
||||
VolumeManager::VolumeArray::size_type numVolumes = VolumeManager::NumVolumes();
|
||||
VolumeManager::VolumeArray::index_type i;
|
||||
for (i = 0; i < numVolumes; i++) {
|
||||
RefPtr<Volume> vol = VolumeManager::GetVolume(i);
|
||||
if (vol) {
|
||||
vol->RegisterObserver(&mVolumeEventObserver);
|
||||
// We need to pick up the intial value of the
|
||||
// ums.volume.NAME.enabled setting.
|
||||
AutoMounterSetting::CheckVolumeSettings(vol->Name());
|
||||
}
|
||||
}
|
||||
// It's possible that the VolumeManager is already in the READY state,
|
||||
// so we call CheckVolumeSettings here to cover that case. Otherwise,
|
||||
// we'll pick it up when the VolumeManage state changes to VOLUMES_READY.
|
||||
CheckVolumeSettings();
|
||||
|
||||
DBG("Calling UpdateState from constructor");
|
||||
UpdateState();
|
||||
|
@ -207,6 +200,35 @@ public:
|
|||
VolumeManager::UnregisterStateObserver(&mVolumeManagerStateObserver);
|
||||
}
|
||||
|
||||
void CheckVolumeSettings()
|
||||
{
|
||||
if (VolumeManager::State() != VolumeManager::VOLUMES_READY) {
|
||||
DBG("CheckVolumeSettings: VolumeManager is NOT READY yet");
|
||||
return;
|
||||
}
|
||||
DBG("CheckVolumeSettings: VolumeManager is READY");
|
||||
|
||||
// The VolumeManager knows about all of the volumes from vold. We now
|
||||
// know the names of all of the volumes, so we can find out what the
|
||||
// initial sharing settings are set to.
|
||||
|
||||
VolumeManager::VolumeArray::size_type numVolumes = VolumeManager::NumVolumes();
|
||||
VolumeManager::VolumeArray::index_type i;
|
||||
for (i = 0; i < numVolumes; i++) {
|
||||
RefPtr<Volume> vol = VolumeManager::GetVolume(i);
|
||||
if (vol) {
|
||||
vol->RegisterObserver(&mVolumeEventObserver);
|
||||
// We need to pick up the intial value of the
|
||||
// ums.volume.NAME.enabled setting.
|
||||
AutoMounterSetting::CheckVolumeSettings(vol->Name());
|
||||
|
||||
// Note: eventually CheckVolumeSettings will call
|
||||
// AutoMounter::SetSharingMode, which will in turn call
|
||||
// UpdateState if needed.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateState();
|
||||
|
||||
const char* ModeStr(int32_t aMode)
|
||||
|
@ -262,7 +284,7 @@ public:
|
|||
vol->SetUnmountRequested(false);
|
||||
vol->SetMountRequested(false);
|
||||
vol->SetSharingEnabled(aAllowSharing);
|
||||
DBG("Calling UpdateState due to volume %s shareing set to %d",
|
||||
DBG("Calling UpdateState due to volume %s sharing set to %d",
|
||||
vol->NameStr(), (int)aAllowSharing);
|
||||
UpdateState();
|
||||
}
|
||||
|
@ -336,6 +358,13 @@ AutoVolumeManagerStateObserver::Notify(const VolumeManager::StateChangedEvent &)
|
|||
if (!sAutoMounter) {
|
||||
return;
|
||||
}
|
||||
|
||||
// In the event that the VolumeManager just entered the VOLUMES_READY state,
|
||||
// we call CheckVolumeSettings here (it's possible that this method never
|
||||
// gets called if the VolumeManager was already in the VOLUMES_READY state
|
||||
// by the time the AutoMounter was constructed).
|
||||
sAutoMounter->CheckVolumeSettings();
|
||||
|
||||
DBG("Calling UpdateState due to VolumeManagerStateObserver");
|
||||
sAutoMounter->UpdateState();
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=741267
|
|||
<![CDATA[
|
||||
|
||||
/** Test for Bug 741267 **/
|
||||
const Cu = Components.utils;
|
||||
function isXrayWrapper(x) {
|
||||
return Components.utils.isXrayWrapper(x);
|
||||
}
|
||||
|
@ -163,16 +164,18 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=741267
|
|||
for (var i = 0; i < data.data.length; ++i) {
|
||||
// Watch out for premultiplied bits... just set all the alphas to 255
|
||||
if (i % 4 == 3) {
|
||||
data.data[i] = 255;
|
||||
// Note - We need to waive Xrays here because indexed access on Typed
|
||||
// Arrays is forbidden over Xrays for performance reasons.
|
||||
Cu.waiveXrays(data.data)[i] = 255;
|
||||
} else {
|
||||
data.data[i] = i;
|
||||
Cu.waiveXrays(data.data)[i] = i;
|
||||
}
|
||||
}
|
||||
ctx.putImageData(data, 0, 0);
|
||||
var data2 = ctx.getImageData(0, 0, 1, 1);
|
||||
is(data2.data.length, data.data.length, "Lengths must match");
|
||||
for (i = 0; i < data.data.length; ++i)
|
||||
is(data.data[i], data2.data[i], "Data at " + i + " should match");
|
||||
is(Cu.waiveXrays(data.data)[i], Cu.waiveXrays(data2.data)[i], "Data at " + i + " should match");
|
||||
} catch (e) {
|
||||
ok(false, "Imagedata manipulation via an Xray shouldn't throw " + e);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ interface ServiceWorker : EventTarget {
|
|||
ServiceWorker implements AbstractWorker;
|
||||
|
||||
enum ServiceWorkerState {
|
||||
"parsed",
|
||||
"installing",
|
||||
"installed",
|
||||
"activating",
|
||||
|
|
|
@ -15,23 +15,26 @@ interface ServiceWorkerContainer {
|
|||
// and discussion at https://etherpad.mozilla.org/serviceworker07apr
|
||||
[Unforgeable] readonly attribute ServiceWorker? installing;
|
||||
[Unforgeable] readonly attribute ServiceWorker? waiting;
|
||||
[Unforgeable] readonly attribute ServiceWorker? current;
|
||||
[Unforgeable] readonly attribute ServiceWorker? active;
|
||||
[Unforgeable] readonly attribute ServiceWorker? controller;
|
||||
|
||||
// Promise<ServiceWorker>
|
||||
readonly attribute Promise ready;
|
||||
|
||||
// Promise<sequence<ServiceWorker>?>
|
||||
[Throws]
|
||||
Promise getAll();
|
||||
|
||||
// Promise<ServiceWorker>
|
||||
[Throws]
|
||||
Promise register(DOMString url, optional RegistrationOptionList options);
|
||||
|
||||
// Promise<any>
|
||||
[Throws]
|
||||
Promise unregister(DOMString? scope);
|
||||
|
||||
// Promise<ServiceWorker>
|
||||
[Throws]
|
||||
Promise whenReady();
|
||||
|
||||
attribute EventHandler onupdatefound;
|
||||
attribute EventHandler oncurrentchange;
|
||||
attribute EventHandler oncontrollerchange;
|
||||
attribute EventHandler onreloadpage;
|
||||
attribute EventHandler onerror;
|
||||
};
|
||||
|
@ -46,5 +49,5 @@ partial interface ServiceWorkerContainer {
|
|||
};
|
||||
|
||||
dictionary RegistrationOptionList {
|
||||
DOMString scope = "*";
|
||||
DOMString scope = "/*";
|
||||
};
|
||||
|
|
|
@ -1547,7 +1547,7 @@ function getNetworkKey(network)
|
|||
|
||||
if (key_mgmt == "WPA-PSK") {
|
||||
encryption = "WPA-PSK";
|
||||
} else if (key_mgmt == "WPA-EAP") {
|
||||
} else if (key_mgmt.indexOf("WPA-EAP") != -1) {
|
||||
encryption = "WPA-EAP";
|
||||
} else if (key_mgmt == "NONE" && auth_alg === "OPEN SHARED") {
|
||||
encryption = "WEP";
|
||||
|
@ -1850,7 +1850,7 @@ function WifiWorker() {
|
|||
netToDOM = function(net) {
|
||||
var ssid = dequote(net.ssid);
|
||||
var security = (net.key_mgmt === "NONE" && net.wep_key0) ? ["WEP"] :
|
||||
(net.key_mgmt && net.key_mgmt !== "NONE") ? [net.key_mgmt] :
|
||||
(net.key_mgmt && net.key_mgmt !== "NONE") ? [net.key_mgmt.split(" ")[0]] :
|
||||
[];
|
||||
var password;
|
||||
if (("psk" in net && net.psk) ||
|
||||
|
@ -1900,6 +1900,8 @@ function WifiWorker() {
|
|||
if (net.keyManagement === "WEP") {
|
||||
wep = true;
|
||||
net.keyManagement = "NONE";
|
||||
} else if (net.keyManagement === "WPA-EAP") {
|
||||
net.keyManagement += " IEEE8021X";
|
||||
}
|
||||
|
||||
configured.key_mgmt = net.key_mgmt = net.keyManagement; // WPA2-PSK, WPA-PSK, etc.
|
||||
|
|
|
@ -2100,9 +2100,6 @@ RuntimeService::CreateServiceWorker(const GlobalObject& aGlobal,
|
|||
nsRefPtr<ServiceWorker> serviceWorker =
|
||||
new ServiceWorker(window, sharedWorker);
|
||||
|
||||
// While it hasn't been parsed, the intention is to only expose ServiceWorkers
|
||||
// to content after it has indeed been parsed.
|
||||
serviceWorker->mState = ServiceWorkerState::Parsed;
|
||||
serviceWorker->mURL = aScriptURL;
|
||||
serviceWorker->mScope = NS_ConvertUTF8toUTF16(aScope);
|
||||
|
||||
|
|
|
@ -97,7 +97,14 @@ ServiceWorkerContainer::GetWaiting()
|
|||
}
|
||||
|
||||
already_AddRefed<workers::ServiceWorker>
|
||||
ServiceWorkerContainer::GetCurrent()
|
||||
ServiceWorkerContainer::GetActive()
|
||||
{
|
||||
// FIXME(nsm): Bug 1002570
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
already_AddRefed<workers::ServiceWorker>
|
||||
ServiceWorkerContainer::GetController()
|
||||
{
|
||||
// FIXME(nsm): Bug 1002570
|
||||
return nullptr;
|
||||
|
@ -112,11 +119,12 @@ ServiceWorkerContainer::GetAll(ErrorResult& aRv)
|
|||
}
|
||||
|
||||
already_AddRefed<Promise>
|
||||
ServiceWorkerContainer::WhenReady(ErrorResult& aRv)
|
||||
ServiceWorkerContainer::Ready()
|
||||
{
|
||||
// FIXME(nsm): Bug 984048
|
||||
aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
|
||||
return nullptr;
|
||||
// FIXME(nsm): Bug 1025077
|
||||
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(mWindow);
|
||||
nsRefPtr<Promise> promise = new Promise(global);
|
||||
return promise.forget();
|
||||
}
|
||||
|
||||
// Testing only.
|
||||
|
|
|
@ -29,7 +29,7 @@ public:
|
|||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ServiceWorkerContainer, DOMEventTargetHelper)
|
||||
|
||||
IMPL_EVENT_HANDLER(updatefound)
|
||||
IMPL_EVENT_HANDLER(currentchange)
|
||||
IMPL_EVENT_HANDLER(controllerchange)
|
||||
IMPL_EVENT_HANDLER(reloadpage)
|
||||
IMPL_EVENT_HANDLER(error)
|
||||
|
||||
|
@ -64,13 +64,16 @@ public:
|
|||
GetWaiting();
|
||||
|
||||
already_AddRefed<ServiceWorker>
|
||||
GetCurrent();
|
||||
GetActive();
|
||||
|
||||
already_AddRefed<ServiceWorker>
|
||||
GetController();
|
||||
|
||||
already_AddRefed<Promise>
|
||||
GetAll(ErrorResult& aRv);
|
||||
|
||||
already_AddRefed<Promise>
|
||||
WhenReady(ErrorResult& aRv);
|
||||
Ready();
|
||||
|
||||
// Testing only.
|
||||
already_AddRefed<Promise>
|
||||
|
|
|
@ -227,7 +227,7 @@ ServiceWorkerManager::Register(nsIDOMWindow* aWindow, const nsAString& aScope,
|
|||
}
|
||||
|
||||
nsCString cleanedScope;
|
||||
rv = scopeURI->GetSpec(cleanedScope);
|
||||
rv = scopeURI->GetSpecIgnoringRef(cleanedScope);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
|
|
@ -20,10 +20,11 @@
|
|||
ok(typeof navigator.serviceWorker.register === "function", "navigator.serviceWorker.register() should be a function.");
|
||||
ok(typeof navigator.serviceWorker.unregister === "function", "navigator.serviceWorker.unregister() should be a function.");
|
||||
ok(typeof navigator.serviceWorker.getAll === "function", "navigator.serviceWorker.getAll() should be a function.");
|
||||
ok(typeof navigator.serviceWorker.whenReady === "function", "navigator.serviceWorker.whenReady() should be a function.");
|
||||
ok(navigator.serviceWorker.installing === null, "There should be no installing worker for an uncontrolled document.");
|
||||
ok(navigator.serviceWorker.waiting === null, "There should be no waiting worker for an uncontrolled document.");
|
||||
ok(navigator.serviceWorker.current === null, "There should be no current worker for an uncontrolled document.");
|
||||
ok(navigator.serviceWorker.ready instanceof Promise, "navigator.serviceWorker.ready should be a Promise.");
|
||||
ok(navigator.serviceWorker.installing === null, "There should be no installing worker for an uncontrolled scope.");
|
||||
ok(navigator.serviceWorker.waiting === null, "There should be no waiting worker for an uncontrolled scope.");
|
||||
ok(navigator.serviceWorker.active === null, "There should be no active worker for an uncontrolled scope.");
|
||||
ok(navigator.serviceWorker.controller === null, "There should be no active worker for an uncontrolled document.");
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
|
|
@ -0,0 +1,182 @@
|
|||
About Hunspell
|
||||
--------------
|
||||
|
||||
Hunspell is a spell checker and morphological analyzer library and program
|
||||
designed for languages with rich morphology and complex word compounding or
|
||||
character encoding. Hunspell interfaces: Ispell-like terminal interface
|
||||
using Curses library, Ispell pipe interface, OpenOffice.org UNO module.
|
||||
|
||||
Hunspell's code base comes from the OpenOffice.org MySpell
|
||||
(http://lingucomponent.openoffice.org/MySpell-3.zip). See README.MYSPELL,
|
||||
AUTHORS.MYSPELL and license.myspell files.
|
||||
Hunspell is designed to eventually replace Myspell in OpenOffice.org.
|
||||
|
||||
Main features of Hunspell spell checker and morphological analyzer:
|
||||
|
||||
- Unicode support (affix rules work only with the first 65535 Unicode characters)
|
||||
|
||||
- Morphological analysis (in custom item and arrangement style) and stemming
|
||||
|
||||
- Max. 65535 affix classes and twofold affix stripping (for agglutinative
|
||||
languages, like Azeri, Basque, Estonian, Finnish, Hungarian, Turkish, etc.)
|
||||
|
||||
- Support complex compoundings (for example, Hungarian and German)
|
||||
|
||||
- Support language specific features (for example, special casing of
|
||||
Azeri and Turkish dotted i, or German sharp s)
|
||||
|
||||
- Handle conditional affixes, circumfixes, fogemorphemes,
|
||||
forbidden words, pseudoroots and homonyms.
|
||||
|
||||
- Free software (LGPL, GPL, MPL tri-license)
|
||||
|
||||
Compiling on Unix/Linux
|
||||
-----------------------
|
||||
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
|
||||
For dictionary development, use the --with-warnings option of configure.
|
||||
|
||||
For interactive user interface of Hunspell executable, use the --with-ui option.
|
||||
|
||||
The developer packages you need to compile Hunspell's interface:
|
||||
|
||||
glibc-devel
|
||||
|
||||
optional developer packages:
|
||||
|
||||
ncurses (need for --with-ui), eg. libncursesw5 for UTF-8
|
||||
readline (for fancy input line editing,
|
||||
configure parameter: --with-readline)
|
||||
locale and gettext (but you can also use the
|
||||
--with-included-gettext configure parameter)
|
||||
|
||||
Hunspell distribution uses new Autoconf (2.59) and Automake (1.9).
|
||||
|
||||
Compiling on Windows
|
||||
--------------------
|
||||
|
||||
1. Compiling with Windows SDK
|
||||
|
||||
Download the free Windows SDK of Microsoft, open a command prompt
|
||||
window and cd into hunspell/src/win_api. Use the following command
|
||||
to compile hunspell:
|
||||
|
||||
vcbuild
|
||||
|
||||
2. Compiling in Cygwin environment
|
||||
|
||||
Download and install Cygwin environment for Windows with the following
|
||||
extra packages:
|
||||
|
||||
make
|
||||
gcc-g++ development package
|
||||
mingw development package (for cygwin.dll free native Windows compilation)
|
||||
ncurses, readline (for user interface)
|
||||
iconv (character conversion)
|
||||
|
||||
2.1. Cygwin1.dll dependent compiling
|
||||
|
||||
Open a Cygwin shell, cd into the hunspell root directory:
|
||||
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
|
||||
For dictionary development, use the --with-warnings option of configure.
|
||||
|
||||
For interactive user interface of Hunspell executable, use the --with-ui option.
|
||||
|
||||
readline configure parameter: --with-readline (for fancy input line editing)
|
||||
|
||||
1.2. Cygwin1.dll free compiling
|
||||
|
||||
Open a Cygwin shell, cd into the hunspell/src/win_api and
|
||||
|
||||
make -f Makefile.cygwin
|
||||
|
||||
Testing
|
||||
-------
|
||||
|
||||
Testing Hunspell (see tests in tests/ subdirectory):
|
||||
|
||||
make check
|
||||
|
||||
or with Valgrind debugger:
|
||||
|
||||
make check
|
||||
VALGRIND=[Valgrind_tool] make check
|
||||
|
||||
For example:
|
||||
|
||||
make check
|
||||
VALGRIND=memcheck make check
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
|
||||
features and dictionary format:
|
||||
man 5 hunspell
|
||||
|
||||
man hunspell
|
||||
hunspell -h
|
||||
http://hunspell.sourceforge.net
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
The src/tools dictionary contains ten executables after compiling
|
||||
(or some of them are in the src/win_api):
|
||||
|
||||
affixcompress: dictionary generation from large (millions of words) vocabularies
|
||||
analyze: example of spell checking, stemming and morphological analysis
|
||||
chmorph: example of automatic morphological generation and conversion
|
||||
example: example of spell checking and suggestion
|
||||
hunspell: main program for spell checking and others (see manual)
|
||||
hunzip: decompressor of hzip format
|
||||
hzip: compressor of hzip format
|
||||
makealias: alias compression (Hunspell only, not back compatible with MySpell)
|
||||
munch: dictionary generation from vocabularies (it needs an affix file, too).
|
||||
unmunch: list all recognized words of a MySpell dictionary
|
||||
wordforms: word generation (Hunspell version of unmunch)
|
||||
|
||||
After compiling and installing (see INSTALL) you can
|
||||
run the Hunspell spell checker (compiled with user interface)
|
||||
with a Hunspell or Myspell dictionary:
|
||||
|
||||
hunspell -d en_US text.txt
|
||||
|
||||
or without interface:
|
||||
|
||||
hunspell
|
||||
hunspell -d en_UK -l <text.txt
|
||||
|
||||
Dictionaries consist of an affix and dictionary file, see tests/
|
||||
or http://wiki.services.openoffice.org/wiki/Dictionaries.
|
||||
|
||||
Using Hunspell library with GCC
|
||||
-------------------------------
|
||||
|
||||
Including in your program:
|
||||
#include <hunspell.hxx>
|
||||
|
||||
Linking with Hunspell static library:
|
||||
g++ -lhunspell example.cxx
|
||||
|
||||
Dictionaries
|
||||
------------
|
||||
|
||||
Myspell & Hunspell dictionaries:
|
||||
http://extensions.libreoffice.org
|
||||
http://cgit.freedesktop.org/libreoffice/dictionaries
|
||||
http://extensions.openoffice.org
|
||||
http://wiki.services.openoffice.org/wiki/Dictionaries
|
||||
|
||||
Aspell dictionaries (need some conversion):
|
||||
ftp://ftp.gnu.org/gnu/aspell/dict
|
||||
Conversion steps: see relevant feature request at http://hunspell.sf.net.
|
||||
|
||||
László Németh
|
||||
nemeth at numbertext org
|
|
@ -1,61 +0,0 @@
|
|||
******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Ryan VanderMeulen (ryanvm@gmail.com)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******
|
||||
|
||||
Hunspell Version: 1.3.2
|
||||
Additional Patches: 694002, 710967, 710940, 784776
|
||||
|
||||
Hunspell Author: László Németh
|
||||
MySpell Author: Kevin Hendricks & David Einstein
|
||||
|
||||
Hunspell is a spell checker and morphological analyser library. Hunspell
|
||||
is based on OpenOffice.org's Myspell. Documentation, tests, and examples
|
||||
are available at http://hunspell.sourceforge.net.
|
||||
|
||||
A special thanks and credit goes to Geoff Kuenning, the creator of Ispell.
|
||||
MySpell's affix algorithms were based on those of Ispell, which should be
|
||||
noted is copyright Geoff Kuenning et al and now available under a BSD-style
|
||||
license. For more information on Ispell and affix compression in general,
|
||||
please see: http://lasr.cs.ucla.edu/geoff/ispell.html (Ispell homepage)
|
||||
|
||||
An almost complete rewrite of MySpell for use by the Mozilla project was
|
||||
developed by David Einstein. David was a significant help in improving MySpell.
|
||||
|
||||
Special thanks also goes to László Németh, who is the author of the Hungarian
|
||||
dictionary and who developed and contributed the code to support compound words
|
||||
in MySpell and fixed numerous problems with the encoding case conversion tables
|
||||
along with rewriting MySpell as Hunspell and ensuring compatibility with the
|
||||
Mozilla codebase.
|
|
@ -0,0 +1,2 @@
|
|||
Hunspell Version: 1.3.3
|
||||
Additional Patches: See patches directory.
|
|
@ -1,59 +1,5 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
#include "license.hunspell"
|
||||
#include "license.myspell"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -63,13 +9,17 @@
|
|||
#include "affentry.hxx"
|
||||
#include "csutil.hxx"
|
||||
|
||||
#define MAXTEMPWORDLEN (MAXWORDUTF8LEN + 4)
|
||||
|
||||
PfxEntry::PfxEntry(AffixMgr* pmgr, affentry* dp)
|
||||
// register affix manager
|
||||
: pmyMgr(pmgr)
|
||||
, next(NULL)
|
||||
, nexteq(NULL)
|
||||
, nextne(NULL)
|
||||
, flgnxt(NULL)
|
||||
{
|
||||
// register affix manager
|
||||
pmyMgr = pmgr;
|
||||
|
||||
// set up its initial values
|
||||
|
||||
aflag = dp->aflag; // flag
|
||||
strip = dp->strip; // string to strip
|
||||
appnd = dp->appnd; // string to append
|
||||
|
@ -82,9 +32,6 @@ PfxEntry::PfxEntry(AffixMgr* pmgr, affentry* dp)
|
|||
memcpy(c.conds, dp->c.l.conds1, MAXCONDLEN_1);
|
||||
c.l.conds2 = dp->c.l.conds2;
|
||||
} else memcpy(c.conds, dp->c.conds, MAXCONDLEN);
|
||||
next = NULL;
|
||||
nextne = NULL;
|
||||
nexteq = NULL;
|
||||
morphcode = dp->morphcode;
|
||||
contclass = dp->contclass;
|
||||
contclasslen = dp->contclasslen;
|
||||
|
@ -107,16 +54,17 @@ PfxEntry::~PfxEntry()
|
|||
// add prefix to this word assuming conditions hold
|
||||
char * PfxEntry::add(const char * word, int len)
|
||||
{
|
||||
char tword[MAXWORDUTF8LEN + 4];
|
||||
char tword[MAXTEMPWORDLEN];
|
||||
|
||||
if ((len > stripl || (len == 0 && pmyMgr->get_fullstrip())) &&
|
||||
(len >= numconds) && test_condition(word) &&
|
||||
(!stripl || (strncmp(word, strip, stripl) == 0)) &&
|
||||
((MAXWORDUTF8LEN + 4) > (len + appndl - stripl))) {
|
||||
((MAXTEMPWORDLEN) > (len + appndl - stripl))) {
|
||||
/* we have a match so add prefix */
|
||||
char * pp = tword;
|
||||
if (appndl) {
|
||||
strcpy(tword,appnd);
|
||||
strncpy(tword, appnd, MAXTEMPWORDLEN-1);
|
||||
tword[MAXTEMPWORDLEN-1] = '\0';
|
||||
pp += appndl;
|
||||
}
|
||||
strcpy(pp, (word + stripl));
|
||||
|
@ -164,13 +112,15 @@ inline int PfxEntry::test_condition(const char * st)
|
|||
if (*st == '\0' && p) return 0; // word <= condition
|
||||
break;
|
||||
}
|
||||
case '.': if (!pos) { // dots are not metacharacters in groups: [.]
|
||||
case '.':
|
||||
if (!pos) { // dots are not metacharacters in groups: [.]
|
||||
p = nextchar(p);
|
||||
// skip the next character
|
||||
for (st++; (opts & aeUTF8) && (*st & 0xc0) == 0x80; st++);
|
||||
if (*st == '\0' && p) return 0; // word <= condition
|
||||
break;
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
default: {
|
||||
if (*st == *p) {
|
||||
st++;
|
||||
|
@ -187,11 +137,11 @@ inline int PfxEntry::test_condition(const char * st)
|
|||
}
|
||||
if (pos && st != pos) {
|
||||
ingroup = true;
|
||||
while (p && *p != ']' && (p = nextchar(p)));
|
||||
while (p && *p != ']' && ((p = nextchar(p)) != NULL));
|
||||
}
|
||||
} else if (pos) {
|
||||
ingroup = true;
|
||||
while (p && *p != ']' && (p = nextchar(p)));
|
||||
while (p && *p != ']' && ((p = nextchar(p)) != NULL));
|
||||
}
|
||||
} else if (pos) { // group
|
||||
p = nextchar(p);
|
||||
|
@ -207,7 +157,7 @@ struct hentry * PfxEntry::checkword(const char * word, int len, char in_compound
|
|||
{
|
||||
int tmpl; // length of tmpword
|
||||
struct hentry * he; // hash entry of root word or NULL
|
||||
char tmpword[MAXWORDUTF8LEN + 4];
|
||||
char tmpword[MAXTEMPWORDLEN];
|
||||
|
||||
// on entry prefix is 0 length or already matches the beginning of the word.
|
||||
// So if the remaining root word has positive length
|
||||
|
@ -221,7 +171,10 @@ struct hentry * PfxEntry::checkword(const char * word, int len, char in_compound
|
|||
// generate new root word by removing prefix and adding
|
||||
// back any characters that would have been stripped
|
||||
|
||||
if (stripl) strcpy (tmpword, strip);
|
||||
if (stripl) {
|
||||
strncpy(tmpword, strip, MAXTEMPWORDLEN-1);
|
||||
tmpword[MAXTEMPWORDLEN-1] = '\0';
|
||||
}
|
||||
strcpy ((tmpword + stripl), (word + appndl));
|
||||
|
||||
// now make sure all of the conditions on characters
|
||||
|
@ -268,7 +221,7 @@ struct hentry * PfxEntry::check_twosfx(const char * word, int len,
|
|||
{
|
||||
int tmpl; // length of tmpword
|
||||
struct hentry * he; // hash entry of root word or NULL
|
||||
char tmpword[MAXWORDUTF8LEN + 4];
|
||||
char tmpword[MAXTEMPWORDLEN];
|
||||
|
||||
// on entry prefix is 0 length or already matches the beginning of the word.
|
||||
// So if the remaining root word has positive length
|
||||
|
@ -283,7 +236,10 @@ struct hentry * PfxEntry::check_twosfx(const char * word, int len,
|
|||
// generate new root word by removing prefix and adding
|
||||
// back any characters that would have been stripped
|
||||
|
||||
if (stripl) strcpy (tmpword, strip);
|
||||
if (stripl) {
|
||||
strncpy(tmpword, strip, MAXTEMPWORDLEN-1);
|
||||
tmpword[MAXTEMPWORDLEN-1] = '\0';
|
||||
}
|
||||
strcpy ((tmpword + stripl), (word + appndl));
|
||||
|
||||
// now make sure all of the conditions on characters
|
||||
|
@ -315,7 +271,7 @@ char * PfxEntry::check_twosfx_morph(const char * word, int len,
|
|||
char in_compound, const FLAG needflag)
|
||||
{
|
||||
int tmpl; // length of tmpword
|
||||
char tmpword[MAXWORDUTF8LEN + 4];
|
||||
char tmpword[MAXTEMPWORDLEN];
|
||||
|
||||
// on entry prefix is 0 length or already matches the beginning of the word.
|
||||
// So if the remaining root word has positive length
|
||||
|
@ -330,7 +286,10 @@ char * PfxEntry::check_twosfx_morph(const char * word, int len,
|
|||
// generate new root word by removing prefix and adding
|
||||
// back any characters that would have been stripped
|
||||
|
||||
if (stripl) strcpy (tmpword, strip);
|
||||
if (stripl) {
|
||||
strncpy(tmpword, strip, MAXTEMPWORDLEN-1);
|
||||
tmpword[MAXTEMPWORDLEN-1] = '\0';
|
||||
}
|
||||
strcpy ((tmpword + stripl), (word + appndl));
|
||||
|
||||
// now make sure all of the conditions on characters
|
||||
|
@ -362,7 +321,7 @@ char * PfxEntry::check_morph(const char * word, int len, char in_compound, const
|
|||
{
|
||||
int tmpl; // length of tmpword
|
||||
struct hentry * he; // hash entry of root word or NULL
|
||||
char tmpword[MAXWORDUTF8LEN + 4];
|
||||
char tmpword[MAXTEMPWORDLEN];
|
||||
char result[MAXLNLEN];
|
||||
char * st;
|
||||
|
||||
|
@ -381,7 +340,10 @@ char * PfxEntry::check_morph(const char * word, int len, char in_compound, const
|
|||
// generate new root word by removing prefix and adding
|
||||
// back any characters that would have been stripped
|
||||
|
||||
if (stripl) strcpy (tmpword, strip);
|
||||
if (stripl) {
|
||||
strncpy(tmpword, strip, MAXTEMPWORDLEN-1);
|
||||
tmpword[MAXTEMPWORDLEN-1] = '\0';
|
||||
}
|
||||
strcpy ((tmpword + stripl), (word + appndl));
|
||||
|
||||
// now make sure all of the conditions on characters
|
||||
|
@ -449,10 +411,15 @@ char * PfxEntry::check_morph(const char * word, int len, char in_compound, const
|
|||
}
|
||||
|
||||
SfxEntry::SfxEntry(AffixMgr * pmgr, affentry* dp)
|
||||
: pmyMgr(pmgr) // register affix manager
|
||||
, next(NULL)
|
||||
, nexteq(NULL)
|
||||
, nextne(NULL)
|
||||
, flgnxt(NULL)
|
||||
, l_morph(NULL)
|
||||
, r_morph(NULL)
|
||||
, eq_morph(NULL)
|
||||
{
|
||||
// register affix manager
|
||||
pmyMgr = pmgr;
|
||||
|
||||
// set up its initial values
|
||||
aflag = dp->aflag; // char flag
|
||||
strip = dp->strip; // string to strip
|
||||
|
@ -467,9 +434,6 @@ SfxEntry::SfxEntry(AffixMgr * pmgr, affentry* dp)
|
|||
memcpy(c.l.conds1, dp->c.l.conds1, MAXCONDLEN_1);
|
||||
c.l.conds2 = dp->c.l.conds2;
|
||||
} else memcpy(c.conds, dp->c.conds, MAXCONDLEN);
|
||||
next = NULL;
|
||||
nextne = NULL;
|
||||
nexteq = NULL;
|
||||
rappnd = myrevstrdup(appnd);
|
||||
morphcode = dp->morphcode;
|
||||
contclass = dp->contclass;
|
||||
|
@ -494,15 +458,16 @@ SfxEntry::~SfxEntry()
|
|||
// add suffix to this word assuming conditions hold
|
||||
char * SfxEntry::add(const char * word, int len)
|
||||
{
|
||||
char tword[MAXWORDUTF8LEN + 4];
|
||||
char tword[MAXTEMPWORDLEN];
|
||||
|
||||
/* make sure all conditions match */
|
||||
if ((len > stripl || (len == 0 && pmyMgr->get_fullstrip())) &&
|
||||
(len >= numconds) && test_condition(word + len, word) &&
|
||||
(!stripl || (strcmp(word + len - stripl, strip) == 0)) &&
|
||||
((MAXWORDUTF8LEN + 4) > (len + appndl - stripl))) {
|
||||
((MAXTEMPWORDLEN) > (len + appndl - stripl))) {
|
||||
/* we have a match so add suffix */
|
||||
strcpy(tword,word);
|
||||
strncpy(tword, word, MAXTEMPWORDLEN-1);
|
||||
tword[MAXTEMPWORDLEN-1] = '\0';
|
||||
if (appndl) {
|
||||
strcpy(tword + len - stripl, appnd);
|
||||
} else {
|
||||
|
@ -537,24 +502,37 @@ inline int SfxEntry::test_condition(const char * st, const char * beg)
|
|||
int i = 1;
|
||||
while (1) {
|
||||
switch (*p) {
|
||||
case '\0': return 1;
|
||||
case '[': { p = nextchar(p); pos = st; break; }
|
||||
case '^': { p = nextchar(p); neg = true; break; }
|
||||
case ']': { if (!neg && !ingroup) return 0;
|
||||
i++;
|
||||
// skip the next character
|
||||
if (!ingroup) {
|
||||
for (; (opts & aeUTF8) && (st >= beg) && (*st & 0xc0) == 0x80; st--);
|
||||
st--;
|
||||
}
|
||||
pos = NULL;
|
||||
neg = false;
|
||||
ingroup = false;
|
||||
p = nextchar(p);
|
||||
if (st < beg && p) return 0; // word <= condition
|
||||
break;
|
||||
}
|
||||
case '.': if (!pos) { // dots are not metacharacters in groups: [.]
|
||||
case '\0':
|
||||
return 1;
|
||||
case '[':
|
||||
p = nextchar(p);
|
||||
pos = st;
|
||||
break;
|
||||
case '^':
|
||||
p = nextchar(p);
|
||||
neg = true;
|
||||
break;
|
||||
case ']':
|
||||
if (!neg && !ingroup)
|
||||
return 0;
|
||||
i++;
|
||||
// skip the next character
|
||||
if (!ingroup)
|
||||
{
|
||||
for (; (opts & aeUTF8) && (st >= beg) && (*st & 0xc0) == 0x80; st--);
|
||||
st--;
|
||||
}
|
||||
pos = NULL;
|
||||
neg = false;
|
||||
ingroup = false;
|
||||
p = nextchar(p);
|
||||
if (st < beg && p)
|
||||
return 0; // word <= condition
|
||||
break;
|
||||
case '.':
|
||||
if (!pos)
|
||||
{
|
||||
// dots are not metacharacters in groups: [.]
|
||||
p = nextchar(p);
|
||||
// skip the next character
|
||||
for (st--; (opts & aeUTF8) && (st >= beg) && (*st & 0xc0) == 0x80; st--);
|
||||
|
@ -569,6 +547,7 @@ inline int SfxEntry::test_condition(const char * st, const char * beg)
|
|||
}
|
||||
break;
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
default: {
|
||||
if (*st == *p) {
|
||||
p = nextchar(p);
|
||||
|
@ -589,7 +568,7 @@ inline int SfxEntry::test_condition(const char * st, const char * beg)
|
|||
if (neg) return 0;
|
||||
else if (i == numconds) return 1;
|
||||
ingroup = true;
|
||||
while (p && *p != ']' && (p = nextchar(p)));
|
||||
while (p && *p != ']' && ((p = nextchar(p)) != NULL));
|
||||
st--;
|
||||
}
|
||||
if (p && *p != ']') p = nextchar(p);
|
||||
|
@ -597,8 +576,8 @@ inline int SfxEntry::test_condition(const char * st, const char * beg)
|
|||
if (neg) return 0;
|
||||
else if (i == numconds) return 1;
|
||||
ingroup = true;
|
||||
while (p && *p != ']' && (p = nextchar(p)))
|
||||
;
|
||||
while (p && *p != ']' && ((p = nextchar(p)) != NULL))
|
||||
;
|
||||
// if (p && *p != ']') p = nextchar(p);
|
||||
st--;
|
||||
}
|
||||
|
@ -624,7 +603,7 @@ struct hentry * SfxEntry::checkword(const char * word, int len, int optflags,
|
|||
int tmpl; // length of tmpword
|
||||
struct hentry * he; // hash entry pointer
|
||||
unsigned char * cp;
|
||||
char tmpword[MAXWORDUTF8LEN + 4];
|
||||
char tmpword[MAXTEMPWORDLEN];
|
||||
PfxEntry* ep = ppfx;
|
||||
|
||||
// if this suffix is being cross checked with a prefix
|
||||
|
@ -649,7 +628,8 @@ struct hentry * SfxEntry::checkword(const char * word, int len, int optflags,
|
|||
// back any characters that would have been stripped or
|
||||
// or null terminating the shorter string
|
||||
|
||||
strcpy (tmpword, word);
|
||||
strncpy (tmpword, word, MAXTEMPWORDLEN-1);
|
||||
tmpword[MAXTEMPWORDLEN-1] = '\0';
|
||||
cp = (unsigned char *)(tmpword + tmpl);
|
||||
if (stripl) {
|
||||
strcpy ((char *)cp, strip);
|
||||
|
@ -702,7 +682,10 @@ struct hentry * SfxEntry::checkword(const char * word, int len, int optflags,
|
|||
} else if (wlst && (*ns < maxSug)) {
|
||||
int cwrd = 1;
|
||||
for (int k=0; k < *ns; k++)
|
||||
if (strcmp(tmpword, wlst[k]) == 0) cwrd = 0;
|
||||
if (strcmp(tmpword, wlst[k]) == 0) {
|
||||
cwrd = 0;
|
||||
break;
|
||||
}
|
||||
if (cwrd) {
|
||||
wlst[*ns] = mystrdup(tmpword);
|
||||
if (wlst[*ns] == NULL) {
|
||||
|
@ -725,7 +708,7 @@ struct hentry * SfxEntry::check_twosfx(const char * word, int len, int optflags,
|
|||
int tmpl; // length of tmpword
|
||||
struct hentry * he; // hash entry pointer
|
||||
unsigned char * cp;
|
||||
char tmpword[MAXWORDUTF8LEN + 4];
|
||||
char tmpword[MAXTEMPWORDLEN];
|
||||
PfxEntry* ep = ppfx;
|
||||
|
||||
|
||||
|
@ -749,7 +732,8 @@ struct hentry * SfxEntry::check_twosfx(const char * word, int len, int optflags,
|
|||
// back any characters that would have been stripped or
|
||||
// or null terminating the shorter string
|
||||
|
||||
strcpy (tmpword, word);
|
||||
strncpy(tmpword, word, MAXTEMPWORDLEN-1);
|
||||
tmpword[MAXTEMPWORDLEN-1] = '\0';
|
||||
cp = (unsigned char *)(tmpword + tmpl);
|
||||
if (stripl) {
|
||||
strcpy ((char *)cp, strip);
|
||||
|
@ -786,7 +770,7 @@ char * SfxEntry::check_twosfx_morph(const char * word, int len, int optflags,
|
|||
{
|
||||
int tmpl; // length of tmpword
|
||||
unsigned char * cp;
|
||||
char tmpword[MAXWORDUTF8LEN + 4];
|
||||
char tmpword[MAXTEMPWORDLEN];
|
||||
PfxEntry* ep = ppfx;
|
||||
char * st;
|
||||
|
||||
|
@ -814,7 +798,8 @@ char * SfxEntry::check_twosfx_morph(const char * word, int len, int optflags,
|
|||
// back any characters that would have been stripped or
|
||||
// or null terminating the shorter string
|
||||
|
||||
strcpy (tmpword, word);
|
||||
strncpy(tmpword, word, MAXTEMPWORDLEN-1);
|
||||
tmpword[MAXTEMPWORDLEN-1] = '\0';
|
||||
cp = (unsigned char *)(tmpword + tmpl);
|
||||
if (stripl) {
|
||||
strcpy ((char *)cp, strip);
|
|
@ -1,60 +1,3 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#ifndef _AFFIX_HXX_
|
||||
#define _AFFIX_HXX_
|
||||
|
||||
|
@ -68,6 +11,10 @@
|
|||
|
||||
class LIBHUNSPELL_DLL_EXPORTED PfxEntry : protected AffEntry
|
||||
{
|
||||
private:
|
||||
PfxEntry(const PfxEntry&);
|
||||
PfxEntry& operator = (const PfxEntry&);
|
||||
private:
|
||||
AffixMgr* pmyMgr;
|
||||
|
||||
PfxEntry * next;
|
||||
|
@ -124,6 +71,10 @@ public:
|
|||
|
||||
class LIBHUNSPELL_DLL_EXPORTED SfxEntry : protected AffEntry
|
||||
{
|
||||
private:
|
||||
SfxEntry(const SfxEntry&);
|
||||
SfxEntry& operator = (const SfxEntry&);
|
||||
private:
|
||||
AffixMgr* pmyMgr;
|
||||
char * rappnd;
|
||||
|
||||
|
|
|
@ -1,59 +1,5 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
#include "license.hunspell"
|
||||
#include "license.myspell"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -102,6 +48,7 @@ AffixMgr::AffixMgr(const char * affpath, HashMgr** ptr, int * md, const char * k
|
|||
compoundroot = FLAG_NULL; // compound word signing flag
|
||||
compoundpermitflag = FLAG_NULL; // compound permitting flag for suffixed word
|
||||
compoundforbidflag = FLAG_NULL; // compound fordidden flag for suffixed word
|
||||
compoundmoresuffixes = 0; // allow more suffixes within compound words
|
||||
checkcompounddup = 0; // forbid double words in compounds
|
||||
checkcompoundrep = 0; // forbid bad compounds (may be non compound word with a REP substitution)
|
||||
checkcompoundcase = 0; // forbid upper and lowercase combinations at word bounds
|
||||
|
@ -307,6 +254,14 @@ AffixMgr::~AffixMgr()
|
|||
#endif
|
||||
}
|
||||
|
||||
void AffixMgr::finishFileMgr(FileMgr *afflst)
|
||||
{
|
||||
delete afflst;
|
||||
|
||||
// convert affix trees to sorted list
|
||||
process_pfx_tree_to_list();
|
||||
process_sfx_tree_to_list();
|
||||
}
|
||||
|
||||
// read in aff file and build up prefix and suffix entry objects
|
||||
int AffixMgr::parse_file(const char * affpath, const char * key)
|
||||
|
@ -333,7 +288,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
|
||||
// read in each line ignoring any that do not
|
||||
// start with a known line type indicator
|
||||
while ((line = afflst->getline())) {
|
||||
while ((line = afflst->getline()) != NULL) {
|
||||
mychomp(line);
|
||||
|
||||
/* remove byte order mark */
|
||||
|
@ -348,7 +303,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the keyboard string */
|
||||
if (strncmp(line,"KEY",3) == 0) {
|
||||
if (parse_string(line, &keystring, afflst->getlinenum())) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -356,7 +311,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the try string */
|
||||
if (strncmp(line,"TRY",3) == 0) {
|
||||
if (parse_string(line, &trystring, afflst->getlinenum())) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -364,7 +319,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the name of the character set used by the .dict and .aff */
|
||||
if (strncmp(line,"SET",3) == 0) {
|
||||
if (parse_string(line, &encoding, afflst->getlinenum())) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
if (strcmp(encoding, "UTF-8") == 0) {
|
||||
|
@ -384,7 +339,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the flag used by the controlled compound words */
|
||||
if (strncmp(line,"COMPOUNDFLAG",12) == 0) {
|
||||
if (parse_flag(line, &compoundflag, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -393,12 +348,12 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
if (strncmp(line,"COMPOUNDBEGIN",13) == 0) {
|
||||
if (complexprefixes) {
|
||||
if (parse_flag(line, &compoundend, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
if (parse_flag(line, &compoundbegin, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -407,7 +362,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the flag used by compound words */
|
||||
if (strncmp(line,"COMPOUNDMIDDLE",14) == 0) {
|
||||
if (parse_flag(line, &compoundmiddle, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -415,12 +370,12 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
if (strncmp(line,"COMPOUNDEND",11) == 0) {
|
||||
if (complexprefixes) {
|
||||
if (parse_flag(line, &compoundbegin, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
if (parse_flag(line, &compoundend, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -429,7 +384,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the data used by compound_check() method */
|
||||
if (strncmp(line,"COMPOUNDWORDMAX",15) == 0) {
|
||||
if (parse_num(line, &cpdwordmax, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -437,7 +392,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the flag sign compounds in dictionary */
|
||||
if (strncmp(line,"COMPOUNDROOT",12) == 0) {
|
||||
if (parse_flag(line, &compoundroot, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -445,7 +400,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the flag used by compound_check() method */
|
||||
if (strncmp(line,"COMPOUNDPERMITFLAG",18) == 0) {
|
||||
if (parse_flag(line, &compoundpermitflag, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -453,11 +408,15 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the flag used by compound_check() method */
|
||||
if (strncmp(line,"COMPOUNDFORBIDFLAG",18) == 0) {
|
||||
if (parse_flag(line, &compoundforbidflag, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (strncmp(line,"COMPOUNDMORESUFFIXES",20) == 0) {
|
||||
compoundmoresuffixes = 1;
|
||||
}
|
||||
|
||||
if (strncmp(line,"CHECKCOMPOUNDDUP",16) == 0) {
|
||||
checkcompounddup = 1;
|
||||
}
|
||||
|
@ -480,14 +439,14 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
|
||||
if (strncmp(line,"NOSUGGEST",9) == 0) {
|
||||
if (parse_flag(line, &nosuggest, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (strncmp(line,"NONGRAMSUGGEST",14) == 0) {
|
||||
if (parse_flag(line, &nongramsuggest, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -495,7 +454,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the flag used by forbidden words */
|
||||
if (strncmp(line,"FORBIDDENWORD",13) == 0) {
|
||||
if (parse_flag(line, &forbiddenword, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -503,7 +462,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the flag used by forbidden words */
|
||||
if (strncmp(line,"LEMMA_PRESENT",13) == 0) {
|
||||
if (parse_flag(line, &lemma_present, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -511,7 +470,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the flag used by circumfixes */
|
||||
if (strncmp(line,"CIRCUMFIX",9) == 0) {
|
||||
if (parse_flag(line, &circumfix, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -519,7 +478,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the flag used by fogemorphemes */
|
||||
if (strncmp(line,"ONLYINCOMPOUND",14) == 0) {
|
||||
if (parse_flag(line, &onlyincompound, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -527,7 +486,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the flag used by `needaffixs' */
|
||||
if (strncmp(line,"PSEUDOROOT",10) == 0) {
|
||||
if (parse_flag(line, &needaffix, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -535,7 +494,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the flag used by `needaffixs' */
|
||||
if (strncmp(line,"NEEDAFFIX",9) == 0) {
|
||||
if (parse_flag(line, &needaffix, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -543,7 +502,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the minimal length for words in compounds */
|
||||
if (strncmp(line,"COMPOUNDMIN",11) == 0) {
|
||||
if (parse_num(line, &cpdmin, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
if (cpdmin < 1) cpdmin = 1;
|
||||
|
@ -552,7 +511,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the max. words and syllables in compounds */
|
||||
if (strncmp(line,"COMPOUNDSYLLABLE",16) == 0) {
|
||||
if (parse_cpdsyllable(line, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -560,7 +519,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the flag used by compound_check() method */
|
||||
if (strncmp(line,"SYLLABLENUM",11) == 0) {
|
||||
if (parse_string(line, &cpdsyllablenum, afflst->getlinenum())) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -573,7 +532,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the extra word characters */
|
||||
if (strncmp(line,"WORDCHARS",9) == 0) {
|
||||
if (parse_array(line, &wordchars, &wordchars_utf16, &wordchars_utf16_len, utf8, afflst->getlinenum())) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -581,7 +540,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the ignored characters (for example, Arabic optional diacretics charachters */
|
||||
if (strncmp(line,"IGNORE",6) == 0) {
|
||||
if (parse_array(line, &ignorechars, &ignorechars_utf16, &ignorechars_utf16_len, utf8, afflst->getlinenum())) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -589,7 +548,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the typical fault correcting table */
|
||||
if (strncmp(line,"REP",3) == 0) {
|
||||
if (parse_reptable(line, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -597,7 +556,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the input conversion table */
|
||||
if (strncmp(line,"ICONV",5) == 0) {
|
||||
if (parse_convtable(line, afflst, &iconvtable, "ICONV")) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -605,7 +564,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the input conversion table */
|
||||
if (strncmp(line,"OCONV",5) == 0) {
|
||||
if (parse_convtable(line, afflst, &oconvtable, "OCONV")) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -613,7 +572,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the phonetic translation table */
|
||||
if (strncmp(line,"PHONE",5) == 0) {
|
||||
if (parse_phonetable(line, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -621,7 +580,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the checkcompoundpattern table */
|
||||
if (strncmp(line,"CHECKCOMPOUNDPATTERN",20) == 0) {
|
||||
if (parse_checkcpdtable(line, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -629,7 +588,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the defcompound table */
|
||||
if (strncmp(line,"COMPOUNDRULE",12) == 0) {
|
||||
if (parse_defcpdtable(line, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -637,7 +596,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the related character map table */
|
||||
if (strncmp(line,"MAP",3) == 0) {
|
||||
if (parse_maptable(line, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -645,7 +604,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the word breakpoints table */
|
||||
if (strncmp(line,"BREAK",5) == 0) {
|
||||
if (parse_breaktable(line, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -653,7 +612,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the language for language specific codes */
|
||||
if (strncmp(line,"LANG",4) == 0) {
|
||||
if (parse_string(line, &lang, afflst->getlinenum())) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
langnum = get_lang_num(lang);
|
||||
|
@ -666,7 +625,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
|
||||
if (strncmp(line,"MAXNGRAMSUGS",12) == 0) {
|
||||
if (parse_num(line, &maxngramsugs, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -676,14 +635,14 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
|
||||
if (strncmp(line,"MAXDIFF",7) == 0) {
|
||||
if (parse_num(line, &maxdiff, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (strncmp(line,"MAXCPDSUGS",10) == 0) {
|
||||
if (parse_num(line, &maxcpdsugs, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -703,7 +662,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the flag used by forbidden words */
|
||||
if (strncmp(line,"KEEPCASE",8) == 0) {
|
||||
if (parse_flag(line, &keepcase, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -711,7 +670,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the flag used by `forceucase' */
|
||||
if (strncmp(line,"FORCEUCASE",10) == 0) {
|
||||
if (parse_flag(line, &forceucase, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -719,7 +678,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the flag used by `warn' */
|
||||
if (strncmp(line,"WARN",4) == 0) {
|
||||
if (parse_flag(line, &warn, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -731,7 +690,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the flag used by the affix generator */
|
||||
if (strncmp(line,"SUBSTANDARD",11) == 0) {
|
||||
if (parse_flag(line, &substandard, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -750,19 +709,14 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
dupflags_ini = 0;
|
||||
}
|
||||
if (parse_affix(line, ft, afflst, dupflags)) {
|
||||
delete afflst;
|
||||
process_pfx_tree_to_list();
|
||||
process_sfx_tree_to_list();
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
delete afflst;
|
||||
|
||||
// convert affix trees to sorted list
|
||||
process_pfx_tree_to_list();
|
||||
process_sfx_tree_to_list();
|
||||
finishFileMgr(afflst);
|
||||
// affix trees are sorted now
|
||||
|
||||
// now we can speed up performance greatly taking advantage of the
|
||||
// relationship between the affixes and the idea of "subsets".
|
||||
|
@ -1373,7 +1327,7 @@ int AffixMgr::cpdrep_check(const char * word, int wl)
|
|||
}
|
||||
|
||||
// forbid compoundings when there are special patterns at word bound
|
||||
int AffixMgr::cpdpat_check(const char * word, int pos, hentry * r1, hentry * r2, const char affixed)
|
||||
int AffixMgr::cpdpat_check(const char * word, int pos, hentry * r1, hentry * r2, const char /*affixed*/)
|
||||
{
|
||||
int len;
|
||||
for (int i = 0; i < numcheckcpd; i++) {
|
||||
|
@ -1386,7 +1340,7 @@ int AffixMgr::cpdpat_check(const char * word, int pos, hentry * r1, hentry * r2,
|
|||
// zero pattern (0/flag) => unmodified stem (zero affixes allowed)
|
||||
(!*(checkcpdtable[i].pattern) || (
|
||||
(*(checkcpdtable[i].pattern)=='0' && r1->blen <= pos && strncmp(word + pos - r1->blen, r1->word, r1->blen) == 0) ||
|
||||
(*(checkcpdtable[i].pattern)!='0' && (len = strlen(checkcpdtable[i].pattern)) &&
|
||||
(*(checkcpdtable[i].pattern)!='0' && ((len = strlen(checkcpdtable[i].pattern)) != 0) &&
|
||||
strncmp(word + pos - len, checkcpdtable[i].pattern, len) == 0)))) {
|
||||
return 1;
|
||||
}
|
||||
|
@ -1447,7 +1401,10 @@ int AffixMgr::defcpd_check(hentry *** words, short wnum, hentry * rv, hentry **
|
|||
for (i = 0; i < numdefcpd; i++) {
|
||||
for (j = 0; j < defcpdtable[i].len; j++) {
|
||||
if (defcpdtable[i].def[j] != '*' && defcpdtable[i].def[j] != '?' &&
|
||||
TESTAFF(rv->astr, defcpdtable[i].def[j], rv->alen)) ok = 1;
|
||||
TESTAFF(rv->astr, defcpdtable[i].def[j], rv->alen)) {
|
||||
ok = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ok == 0) {
|
||||
|
@ -1598,7 +1555,7 @@ struct hentry * AffixMgr::compound_check(const char * word, int len,
|
|||
int oldlen = 0;
|
||||
int checkedstriple = 0;
|
||||
int onlycpdrule;
|
||||
int affixed = 0;
|
||||
char affixed = 0;
|
||||
hentry ** oldwords = words;
|
||||
|
||||
int checked_prefix;
|
||||
|
@ -1680,8 +1637,9 @@ struct hentry * AffixMgr::compound_check(const char * word, int len,
|
|||
if (onlycpdrule) break;
|
||||
if (compoundflag &&
|
||||
!(rv = prefix_check(st, i, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN, compoundflag))) {
|
||||
if ((rv = suffix_check(st, i, 0, NULL, NULL, 0, NULL,
|
||||
FLAG_NULL, compoundflag, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN)) && !hu_mov_rule &&
|
||||
if (((rv = suffix_check(st, i, 0, NULL, NULL, 0, NULL,
|
||||
FLAG_NULL, compoundflag, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN)) ||
|
||||
(compoundmoresuffixes && (rv = suffix_check_twosfx(st, i, 0, NULL, compoundflag)))) && !hu_mov_rule &&
|
||||
sfx->getCont() &&
|
||||
((compoundforbidflag && TESTAFF(sfx->getCont(), compoundforbidflag,
|
||||
sfx->getContLen())) || (compoundend &&
|
||||
|
@ -1694,9 +1652,11 @@ struct hentry * AffixMgr::compound_check(const char * word, int len,
|
|||
if (rv ||
|
||||
(((wordnum == 0) && compoundbegin &&
|
||||
((rv = suffix_check(st, i, 0, NULL, NULL, 0, NULL, FLAG_NULL, compoundbegin, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN)) ||
|
||||
(compoundmoresuffixes && (rv = suffix_check_twosfx(st, i, 0, NULL, compoundbegin))) || // twofold suffixes + compound
|
||||
(rv = prefix_check(st, i, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN, compoundbegin)))) ||
|
||||
((wordnum > 0) && compoundmiddle &&
|
||||
((rv = suffix_check(st, i, 0, NULL, NULL, 0, NULL, FLAG_NULL, compoundmiddle, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN)) ||
|
||||
(compoundmoresuffixes && (rv = suffix_check_twosfx(st, i, 0, NULL, compoundmiddle))) || // twofold suffixes + compound
|
||||
(rv = prefix_check(st, i, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN, compoundmiddle)))))
|
||||
) checked_prefix = 1;
|
||||
// else check forbiddenwords and needaffix
|
||||
|
@ -2099,7 +2059,7 @@ int AffixMgr::compound_check_morph(const char * word, int len,
|
|||
int cmax;
|
||||
|
||||
int onlycpdrule;
|
||||
int affixed = 0;
|
||||
char affixed = 0;
|
||||
hentry ** oldwords = words;
|
||||
|
||||
setcminmax(&cmin, &cmax, word, len);
|
||||
|
@ -2169,11 +2129,12 @@ int AffixMgr::compound_check_morph(const char * word, int len,
|
|||
}
|
||||
|
||||
if (!rv) {
|
||||
if (onlycpdrule) break;
|
||||
if (onlycpdrule && strlen(*result) > MAXLNLEN/10) break;
|
||||
if (compoundflag &&
|
||||
!(rv = prefix_check(st, i, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN, compoundflag))) {
|
||||
if ((rv = suffix_check(st, i, 0, NULL, NULL, 0, NULL,
|
||||
FLAG_NULL, compoundflag, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN)) && !hu_mov_rule &&
|
||||
if (((rv = suffix_check(st, i, 0, NULL, NULL, 0, NULL,
|
||||
FLAG_NULL, compoundflag, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN)) ||
|
||||
(compoundmoresuffixes && (rv = suffix_check_twosfx(st, i, 0, NULL, compoundflag)))) && !hu_mov_rule &&
|
||||
sfx->getCont() &&
|
||||
((compoundforbidflag && TESTAFF(sfx->getCont(), compoundforbidflag,
|
||||
sfx->getContLen())) || (compoundend &&
|
||||
|
@ -2186,9 +2147,11 @@ int AffixMgr::compound_check_morph(const char * word, int len,
|
|||
if (rv ||
|
||||
(((wordnum == 0) && compoundbegin &&
|
||||
((rv = suffix_check(st, i, 0, NULL, NULL, 0, NULL, FLAG_NULL, compoundbegin, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN)) ||
|
||||
(compoundmoresuffixes && (rv = suffix_check_twosfx(st, i, 0, NULL, compoundbegin))) || // twofold suffix+compound
|
||||
(rv = prefix_check(st, i, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN, compoundbegin)))) ||
|
||||
((wordnum > 0) && compoundmiddle &&
|
||||
((rv = suffix_check(st, i, 0, NULL, NULL, 0, NULL, FLAG_NULL, compoundmiddle, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN)) ||
|
||||
(compoundmoresuffixes && (rv = suffix_check_twosfx(st, i, 0, NULL, compoundmiddle))) || // twofold suffix+compound
|
||||
(rv = prefix_check(st, i, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN, compoundmiddle)))))
|
||||
) {
|
||||
// char * p = prefix_check_morph(st, i, 0, compound);
|
||||
|
@ -3608,7 +3571,7 @@ int AffixMgr::parse_reptable(char * line, FileMgr * af)
|
|||
/* now parse the numrep lines to read in the remainder of the table */
|
||||
char * nl;
|
||||
for (int j=0; j < numrep; j++) {
|
||||
if (!(nl = af->getline())) return 1;
|
||||
if ((nl = af->getline()) == NULL) return 1;
|
||||
mychomp(nl);
|
||||
tp = nl;
|
||||
i = 0;
|
||||
|
@ -4312,7 +4275,7 @@ int AffixMgr::parse_affix(char * line, const char at, FileMgr * af, char * dupf
|
|||
std::vector<affentry>::iterator start = affentries.begin();
|
||||
std::vector<affentry>::iterator end = affentries.end();
|
||||
for (std::vector<affentry>::iterator entry = start; entry != end; ++entry) {
|
||||
if (!(nl = af->getline())) return 1;
|
||||
if ((nl = af->getline()) == NULL) return 1;
|
||||
mychomp(nl);
|
||||
tp = nl;
|
||||
i = 0;
|
|
@ -1,60 +1,3 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#ifndef _AFFIXMGR_HXX_
|
||||
#define _AFFIXMGR_HXX_
|
||||
|
||||
|
@ -98,6 +41,7 @@ class LIBHUNSPELL_DLL_EXPORTED AffixMgr
|
|||
FLAG compoundroot;
|
||||
FLAG compoundforbidflag;
|
||||
FLAG compoundpermitflag;
|
||||
int compoundmoresuffixes;
|
||||
int checkcompounddup;
|
||||
int checkcompoundrep;
|
||||
int checkcompoundcase;
|
||||
|
@ -301,6 +245,7 @@ private:
|
|||
int process_sfx_tree_to_list();
|
||||
int redundant_condition(char, char * strip, int stripl,
|
||||
const char * cond, int);
|
||||
void finishFileMgr(FileMgr *afflst);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,60 +1,3 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#ifndef _ATYPES_HXX_
|
||||
#define _ATYPES_HXX_
|
||||
|
||||
|
@ -114,7 +57,7 @@ static inline void HUNSPELL_WARNING(FILE *, const char *, ...) {}
|
|||
#define FLAG_NULL 0x00
|
||||
#define FREE_FLAG(a) a = 0
|
||||
|
||||
#define TESTAFF( a, b , c ) flag_bsearch((unsigned short *) a, (unsigned short) b, c)
|
||||
#define TESTAFF( a, b , c ) (flag_bsearch((unsigned short *) a, (unsigned short) b, c))
|
||||
|
||||
struct affentry
|
||||
{
|
||||
|
|
|
@ -1,60 +1,3 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#ifndef _BASEAFF_HXX_
|
||||
#define _BASEAFF_HXX_
|
||||
|
||||
|
@ -62,7 +5,11 @@
|
|||
|
||||
class LIBHUNSPELL_DLL_EXPORTED AffEntry
|
||||
{
|
||||
private:
|
||||
AffEntry(const AffEntry&);
|
||||
AffEntry& operator = (const AffEntry&);
|
||||
protected:
|
||||
AffEntry() {}
|
||||
char * appnd;
|
||||
char * strip;
|
||||
unsigned char appndl;
|
||||
|
|
|
@ -1,60 +1,5 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* L. David Baron (dbaron@dbaron.org)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
#include "license.hunspell"
|
||||
#include "license.myspell"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -72,6 +17,11 @@ struct unicode_info {
|
|||
unsigned short clower;
|
||||
};
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#include <wchar.h>
|
||||
#endif
|
||||
|
||||
#ifdef OPENOFFICEORG
|
||||
# include <unicode/uchar.h>
|
||||
#else
|
||||
|
@ -100,6 +50,21 @@ struct unicode_info2 {
|
|||
static struct unicode_info2 * utf_tbl = NULL;
|
||||
static int utf_tbl_count = 0; // utf_tbl can be used by multiple Hunspell instances
|
||||
|
||||
FILE * myfopen(const char * path, const char * mode) {
|
||||
#ifdef _WIN32
|
||||
#define WIN32_LONG_PATH_PREFIX "\\\\?\\"
|
||||
if (strncmp(path, WIN32_LONG_PATH_PREFIX, 4) == 0) {
|
||||
int len = MultiByteToWideChar(CP_UTF8, 0, path, -1, NULL, 0);
|
||||
wchar_t *buff = (wchar_t *) malloc(len * sizeof(wchar_t));
|
||||
MultiByteToWideChar(CP_UTF8, 0, path, -1, buff, len);
|
||||
FILE * f = _wfopen(buff, (strcmp(mode, "r") == 0) ? L"r" : L"rb");
|
||||
free(buff);
|
||||
return f;
|
||||
}
|
||||
#endif
|
||||
return fopen(path, mode);
|
||||
}
|
||||
|
||||
/* only UTF-16 (BMP) implementation */
|
||||
char * u16_u8(char * dest, int size, const w_char * src, int srclen) {
|
||||
signed char * u8 = (signed char *)dest;
|
||||
|
@ -396,7 +361,10 @@ char * line_uniq(char * text, char breakchar) {
|
|||
for ( i = 1; i < linenum; i++ ) {
|
||||
int dup = 0;
|
||||
for (int j = 0; j < i; j++) {
|
||||
if (strcmp(lines[i], lines[j]) == 0) dup = 1;
|
||||
if (strcmp(lines[i], lines[j]) == 0) {
|
||||
dup = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!dup) {
|
||||
if ((i > 1) || (*(lines[0]) != '\0')) {
|
||||
|
@ -5531,6 +5499,7 @@ struct cs_info * get_current_cs(const char * es) {
|
|||
ccs[i].cupper = i;
|
||||
}
|
||||
|
||||
|
||||
nsCOMPtr<nsIUnicodeEncoder> encoder;
|
||||
nsCOMPtr<nsIUnicodeDecoder> decoder;
|
||||
|
||||
|
@ -5707,7 +5676,7 @@ unsigned short unicodetoupper(unsigned short c, int langnum)
|
|||
if (c == 0x0069 && ((langnum == LANG_az) || (langnum == LANG_tr)))
|
||||
return 0x0130;
|
||||
#ifdef OPENOFFICEORG
|
||||
return u_toupper(c);
|
||||
return static_cast<unsigned short>(u_toupper(c));
|
||||
#else
|
||||
#ifdef MOZILLA_CLIENT
|
||||
return ToUpperCase((char16_t) c);
|
||||
|
@ -5725,7 +5694,7 @@ unsigned short unicodetolower(unsigned short c, int langnum)
|
|||
if (c == 0x0049 && ((langnum == LANG_az) || (langnum == LANG_tr)))
|
||||
return 0x0131;
|
||||
#ifdef OPENOFFICEORG
|
||||
return u_tolower(c);
|
||||
return static_cast<unsigned short>(u_tolower(c));
|
||||
#else
|
||||
#ifdef MOZILLA_CLIENT
|
||||
return ToLowerCase((char16_t) c);
|
|
@ -1,60 +1,3 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#ifndef __CSUTILHXX__
|
||||
#define __CSUTILHXX__
|
||||
|
||||
|
@ -109,6 +52,9 @@
|
|||
#define FORBIDDENWORD 65510
|
||||
#define ONLYUPCASEFLAG 65511
|
||||
|
||||
// fopen or optional _wfopen to fix long pathname problem of WIN32
|
||||
LIBHUNSPELL_DLL_EXPORTED FILE * myfopen(const char * path, const char * mode);
|
||||
|
||||
// convert UTF-16 characters to UTF-8
|
||||
LIBHUNSPELL_DLL_EXPORTED char * u16_u8(char * dest, int size, const w_char * src, int srclen);
|
||||
|
||||
|
|
|
@ -1,36 +1,3 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -38,6 +5,7 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#include "dictmgr.hxx"
|
||||
#include "csutil.hxx"
|
||||
|
||||
DictMgr::DictMgr(const char * dictpath, const char * etype) : numdict(0)
|
||||
{
|
||||
|
@ -90,7 +58,7 @@ int DictMgr::parse_file(const char * dictpath, const char * etype)
|
|||
|
||||
// open the dictionary list file
|
||||
FILE * dictlst;
|
||||
dictlst = fopen(dictpath,"r");
|
||||
dictlst = myfopen(dictpath,"r");
|
||||
if (!dictlst) {
|
||||
return 1;
|
||||
}
|
||||
|
@ -133,7 +101,8 @@ int DictMgr::parse_file(const char * dictpath, const char * etype)
|
|||
case 3:
|
||||
free(pdict->region);
|
||||
pdict->region=NULL;
|
||||
case 2: //deliberate fallthrough
|
||||
/* FALLTHROUGH */
|
||||
case 2:
|
||||
free(pdict->lang);
|
||||
pdict->lang=NULL;
|
||||
default:
|
|
@ -1,37 +1,3 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#ifndef _DICTMGR_HXX_
|
||||
#define _DICTMGR_HXX_
|
||||
|
||||
|
@ -49,7 +15,10 @@ struct dictentry {
|
|||
|
||||
class LIBHUNSPELL_DLL_EXPORTED DictMgr
|
||||
{
|
||||
|
||||
private:
|
||||
DictMgr(const DictMgr&);
|
||||
DictMgr& operator = (const DictMgr&);
|
||||
private:
|
||||
int numdict;
|
||||
dictentry * pdentry;
|
||||
|
||||
|
|
|
@ -1,80 +0,0 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "filemgr.hxx"
|
||||
|
||||
int FileMgr::fail(const char * err, const char * par) {
|
||||
fprintf(stderr, err, par);
|
||||
return -1;
|
||||
}
|
||||
|
||||
FileMgr::FileMgr(const char * file, const char * key) {
|
||||
linenum = 0;
|
||||
hin = NULL;
|
||||
fin = fopen(file, "r");
|
||||
if (!fin) {
|
||||
// check hzipped file
|
||||
char * st = (char *) malloc(strlen(file) + strlen(HZIP_EXTENSION) + 1);
|
||||
if (st) {
|
||||
strcpy(st, file);
|
||||
strcat(st, HZIP_EXTENSION);
|
||||
hin = new Hunzip(st, key);
|
||||
free(st);
|
||||
}
|
||||
}
|
||||
if (!fin && !hin) fail(MSG_OPEN, file);
|
||||
}
|
||||
|
||||
FileMgr::~FileMgr()
|
||||
{
|
||||
if (fin) fclose(fin);
|
||||
if (hin) delete hin;
|
||||
}
|
||||
|
||||
char * FileMgr::getline() {
|
||||
const char * l;
|
||||
linenum++;
|
||||
if (fin) return fgets(in, BUFSIZE - 1, fin);
|
||||
if (hin && (l = hin->getline())) return strcpy(in, l);
|
||||
linenum--;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int FileMgr::getlinenum() {
|
||||
return linenum;
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
#include "license.hunspell"
|
||||
#include "license.myspell"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "filemgr.hxx"
|
||||
#include "csutil.hxx"
|
||||
|
||||
int FileMgr::fail(const char * err, const char * par) {
|
||||
fprintf(stderr, err, par);
|
||||
return -1;
|
||||
}
|
||||
|
||||
FileMgr::FileMgr(const char * file, const char * key)
|
||||
: hin(NULL)
|
||||
, linenum(0)
|
||||
{
|
||||
in[0] = '\0';
|
||||
|
||||
fin = myfopen(file, "r");
|
||||
if (!fin) {
|
||||
// check hzipped file
|
||||
char * st = (char *) malloc(strlen(file) + strlen(HZIP_EXTENSION) + 1);
|
||||
if (st) {
|
||||
strcpy(st, file);
|
||||
strcat(st, HZIP_EXTENSION);
|
||||
hin = new Hunzip(st, key);
|
||||
free(st);
|
||||
}
|
||||
}
|
||||
if (!fin && !hin) fail(MSG_OPEN, file);
|
||||
}
|
||||
|
||||
FileMgr::~FileMgr()
|
||||
{
|
||||
if (fin) fclose(fin);
|
||||
if (hin) delete hin;
|
||||
}
|
||||
|
||||
char * FileMgr::getline() {
|
||||
const char * l;
|
||||
linenum++;
|
||||
if (fin) return fgets(in, BUFSIZE - 1, fin);
|
||||
if (hin && ((l = hin->getline()) != NULL)) return strcpy(in, l);
|
||||
linenum--;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int FileMgr::getlinenum() {
|
||||
return linenum;
|
||||
}
|
|
@ -1,37 +1,4 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
/* file manager class - read lines of files [filename] OR [filename.hz] */
|
||||
#ifndef _FILEMGR_HXX_
|
||||
#define _FILEMGR_HXX_
|
||||
|
||||
|
@ -42,6 +9,9 @@
|
|||
|
||||
class LIBHUNSPELL_DLL_EXPORTED FileMgr
|
||||
{
|
||||
private:
|
||||
FileMgr(const FileMgr&);
|
||||
FileMgr& operator = (const FileMgr&);
|
||||
protected:
|
||||
FILE * fin;
|
||||
Hunzip * hin;
|
||||
|
|
|
@ -1,64 +1,11 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
#include "license.hunspell"
|
||||
#include "license.myspell"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <limits>
|
||||
|
||||
#include "hashmgr.hxx"
|
||||
#include "csutil.hxx"
|
||||
|
@ -67,12 +14,19 @@
|
|||
// build a hash table from a munched word list
|
||||
|
||||
HashMgr::HashMgr(const char * tpath, const char * apath, const char * key)
|
||||
: tablesize(0)
|
||||
, tableptr(NULL)
|
||||
, userword(0)
|
||||
, flag_mode(FLAG_CHAR)
|
||||
, complexprefixes(0)
|
||||
, utf8(0)
|
||||
, forbiddenword(FORBIDDENWORD) // forbidden word signing flag
|
||||
, numaliasf(0)
|
||||
, aliasf(NULL)
|
||||
, aliasflen(0)
|
||||
, numaliasm(0)
|
||||
, aliasm(NULL)
|
||||
{
|
||||
tablesize = 0;
|
||||
tableptr = NULL;
|
||||
flag_mode = FLAG_CHAR;
|
||||
complexprefixes = 0;
|
||||
utf8 = 0;
|
||||
langnum = 0;
|
||||
lang = NULL;
|
||||
enc = NULL;
|
||||
|
@ -80,11 +34,6 @@ HashMgr::HashMgr(const char * tpath, const char * apath, const char * key)
|
|||
ignorechars = NULL;
|
||||
ignorechars_utf16 = NULL;
|
||||
ignorechars_utf16_len = 0;
|
||||
numaliasf = 0;
|
||||
aliasf = NULL;
|
||||
numaliasm = 0;
|
||||
aliasm = NULL;
|
||||
forbiddenword = FORBIDDENWORD; // forbidden word signing flag
|
||||
load_config(apath, key);
|
||||
int ec = load_tables(tpath, key);
|
||||
if (ec) {
|
||||
|
@ -170,7 +119,7 @@ int HashMgr::add_word(const char * word, int wbl, int wcl, unsigned short * aff,
|
|||
int al, const char * desc, bool onlyupcase)
|
||||
{
|
||||
bool upcasehomonym = false;
|
||||
int descl = desc ? (aliasm ? sizeof(short) : strlen(desc) + 1) : 0;
|
||||
int descl = desc ? (aliasm ? sizeof(char *) : strlen(desc) + 1) : 0;
|
||||
// variable-length hash record with word and optional fields
|
||||
struct hentry* hp =
|
||||
(struct hentry *) malloc (sizeof(struct hentry) + wbl + descl);
|
||||
|
@ -264,18 +213,21 @@ int HashMgr::add_word(const char * word, int wbl, int wcl, unsigned short * aff,
|
|||
}
|
||||
|
||||
int HashMgr::add_hidden_capitalized_word(char * word, int wbl, int wcl,
|
||||
unsigned short * flags, int al, char * dp, int captype)
|
||||
unsigned short * flags, int flagslen, char * dp, int captype)
|
||||
{
|
||||
if (flags == NULL)
|
||||
flagslen = 0;
|
||||
|
||||
// add inner capitalized forms to handle the following allcap forms:
|
||||
// Mixed caps: OpenOffice.org -> OPENOFFICE.ORG
|
||||
// Allcaps with suffixes: CIA's -> CIA'S
|
||||
if (((captype == HUHCAP) || (captype == HUHINITCAP) ||
|
||||
((captype == ALLCAP) && (flags != NULL))) &&
|
||||
!((flags != NULL) && TESTAFF(flags, forbiddenword, al))) {
|
||||
unsigned short * flags2 = (unsigned short *) malloc (sizeof(unsigned short) * (al+1));
|
||||
((captype == ALLCAP) && (flagslen != 0))) &&
|
||||
!((flagslen != 0) && TESTAFF(flags, forbiddenword, flagslen))) {
|
||||
unsigned short * flags2 = (unsigned short *) malloc (sizeof(unsigned short) * (flagslen+1));
|
||||
if (!flags2) return 1;
|
||||
if (al) memcpy(flags2, flags, al * sizeof(unsigned short));
|
||||
flags2[al] = ONLYUPCASEFLAG;
|
||||
if (flagslen) memcpy(flags2, flags, flagslen * sizeof(unsigned short));
|
||||
flags2[flagslen] = ONLYUPCASEFLAG;
|
||||
if (utf8) {
|
||||
char st[BUFSIZE];
|
||||
w_char w[BUFSIZE];
|
||||
|
@ -283,11 +235,11 @@ int HashMgr::add_hidden_capitalized_word(char * word, int wbl, int wcl,
|
|||
mkallsmall_utf(w, wlen, langnum);
|
||||
mkallcap_utf(w, 1, langnum);
|
||||
u16_u8(st, BUFSIZE, w, wlen);
|
||||
return add_word(st,wbl,wcl,flags2,al+1,dp, true);
|
||||
return add_word(st,wbl,wcl,flags2,flagslen+1,dp, true);
|
||||
} else {
|
||||
mkallsmall(word, csconv);
|
||||
mkinitcap(word, csconv);
|
||||
return add_word(word,wbl,wcl,flags2,al+1,dp, true);
|
||||
return add_word(word,wbl,wcl,flags2,flagslen+1,dp, true);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
@ -417,8 +369,8 @@ int HashMgr::load_tables(const char * tpath, const char * key)
|
|||
if (dict == NULL) return 1;
|
||||
|
||||
// first read the first line of file to get hash table size */
|
||||
if (!(ts = dict->getline())) {
|
||||
HUNSPELL_WARNING(stderr, "error: empty dic file\n");
|
||||
if ((ts = dict->getline()) == NULL) {
|
||||
HUNSPELL_WARNING(stderr, "error: empty dic file %s\n", tpath);
|
||||
delete dict;
|
||||
return 2;
|
||||
}
|
||||
|
@ -431,30 +383,32 @@ int HashMgr::load_tables(const char * tpath, const char * key)
|
|||
}
|
||||
|
||||
tablesize = atoi(ts);
|
||||
if (tablesize == 0) {
|
||||
|
||||
int nExtra = 5 + USERWORD;
|
||||
|
||||
if (tablesize <= 0 || (tablesize >= (std::numeric_limits<int>::max() - 1 - nExtra) / int(sizeof(struct hentry *)))) {
|
||||
HUNSPELL_WARNING(stderr, "error: line 1: missing or bad word count in the dic file\n");
|
||||
delete dict;
|
||||
return 4;
|
||||
}
|
||||
tablesize = tablesize + 5 + USERWORD;
|
||||
if ((tablesize %2) == 0) tablesize++;
|
||||
tablesize += nExtra;
|
||||
if ((tablesize % 2) == 0) tablesize++;
|
||||
|
||||
// allocate the hash table
|
||||
tableptr = (struct hentry **) malloc(tablesize * sizeof(struct hentry *));
|
||||
tableptr = (struct hentry **) calloc(tablesize, sizeof(struct hentry *));
|
||||
if (! tableptr) {
|
||||
delete dict;
|
||||
return 3;
|
||||
}
|
||||
for (int i=0; i<tablesize; i++) tableptr[i] = NULL;
|
||||
|
||||
// loop through all words on much list and add to hash
|
||||
// table and create word and affix strings
|
||||
|
||||
while ((ts = dict->getline())) {
|
||||
while ((ts = dict->getline()) != NULL) {
|
||||
mychomp(ts);
|
||||
// split each line into word and morphological description
|
||||
dp = ts;
|
||||
while ((dp = strchr(dp, ':'))) {
|
||||
while ((dp = strchr(dp, ':')) != NULL) {
|
||||
if ((dp > ts + 3) && (*(dp - 3) == ' ' || *(dp - 3) == '\t')) {
|
||||
for (dp -= 4; dp >= ts && (*dp == ' ' || *dp == '\t'); dp--);
|
||||
if (dp < ts) { // missing word
|
||||
|
@ -670,7 +624,7 @@ int HashMgr::load_config(const char * affpath, const char * key)
|
|||
// read in each line ignoring any that do not
|
||||
// start with a known line type indicator
|
||||
|
||||
while ((line = afflst->getline())) {
|
||||
while ((line = afflst->getline()) != NULL) {
|
||||
mychomp(line);
|
||||
|
||||
/* remove byte order mark */
|
||||
|
@ -810,7 +764,7 @@ int HashMgr::parse_aliasf(char * line, FileMgr * af)
|
|||
/* now parse the numaliasf lines to read in the remainder of the table */
|
||||
char * nl;
|
||||
for (int j=0; j < numaliasf; j++) {
|
||||
if (!(nl = af->getline())) return 1;
|
||||
if ((nl = af->getline()) == NULL) return 1;
|
||||
mychomp(nl);
|
||||
tp = nl;
|
||||
i = 0;
|
||||
|
@ -917,7 +871,7 @@ int HashMgr::parse_aliasm(char * line, FileMgr * af)
|
|||
/* now parse the numaliasm lines to read in the remainder of the table */
|
||||
char * nl = line;
|
||||
for (int j=0; j < numaliasm; j++) {
|
||||
if (!(nl = af->getline())) return 1;
|
||||
if ((nl = af->getline()) == NULL) return 1;
|
||||
mychomp(nl);
|
||||
tp = nl;
|
||||
i = 0;
|
|
@ -1,60 +1,3 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#ifndef _HASHMGR_HXX_
|
||||
#define _HASHMGR_HXX_
|
||||
|
||||
|
|
|
@ -1,60 +1,3 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#ifndef _HTYPES_HXX_
|
||||
#define _HTYPES_HXX_
|
||||
|
||||
|
|
|
@ -1,59 +1,5 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
#include "license.hunspell"
|
||||
#include "license.myspell"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -66,6 +12,8 @@
|
|||
#endif
|
||||
#include "csutil.hxx"
|
||||
|
||||
#include <string>
|
||||
|
||||
Hunspell::Hunspell(const char * affpath, const char * dpath, const char * key)
|
||||
{
|
||||
encoding = NULL;
|
||||
|
@ -382,6 +330,10 @@ int Hunspell::spell(const char * word, int * info, char ** root)
|
|||
char cw[MAXWORDUTF8LEN];
|
||||
char wspace[MAXWORDUTF8LEN];
|
||||
w_char unicw[MAXWORDLEN];
|
||||
|
||||
int info2 = 0;
|
||||
if (!info) info = &info2; else *info = 0;
|
||||
|
||||
// Hunspell supports XML input of the simplified API (see manual)
|
||||
if (strcmp(word, SPELL_XML) == 0) return 1;
|
||||
int nc = strlen(word);
|
||||
|
@ -400,7 +352,6 @@ int Hunspell::spell(const char * word, int * info, char ** root)
|
|||
if (rl && rl->conv(word, wspace)) wl = cleanword2(cw, wspace, unicw, &nc, &captype, &abbv);
|
||||
else wl = cleanword2(cw, word, unicw, &nc, &captype, &abbv);
|
||||
|
||||
int info2 = 0;
|
||||
if (wl == 0 || maxdic == 0) return 1;
|
||||
if (root) *root = NULL;
|
||||
|
||||
|
@ -418,13 +369,14 @@ int Hunspell::spell(const char * word, int * info, char ** root)
|
|||
} else break;
|
||||
}
|
||||
if ((i == wl) && (nstate == NNUM)) return 1;
|
||||
if (!info) info = &info2; else *info = 0;
|
||||
|
||||
switch(captype) {
|
||||
case HUHCAP:
|
||||
/* FALLTHROUGH */
|
||||
case HUHINITCAP:
|
||||
*info += SPELL_ORIGCAP;
|
||||
case NOCAP: {
|
||||
/* FALLTHROUGH */
|
||||
case NOCAP:
|
||||
rv = checkword(cw, info, root);
|
||||
if ((abbv) && !(rv)) {
|
||||
memcpy(wspace,cw,wl);
|
||||
|
@ -433,7 +385,6 @@ int Hunspell::spell(const char * word, int * info, char ** root)
|
|||
rv = checkword(wspace, info, root);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ALLCAP: {
|
||||
*info += SPELL_ORIGCAP;
|
||||
rv = checkword(cw, info, root);
|
||||
|
@ -457,7 +408,7 @@ int Hunspell::spell(const char * word, int * info, char ** root)
|
|||
*apostrophe = '\0';
|
||||
wl2 = u8_u16(tmpword, MAXWORDLEN, cw);
|
||||
*apostrophe = '\'';
|
||||
if (wl2 < nc) {
|
||||
if (wl2 >= 0 && wl2 < nc) {
|
||||
mkinitcap2(apostrophe + 1, unicw + wl2 + 1, nc - wl2 - 1);
|
||||
rv = checkword(cw, info, root);
|
||||
if (rv) break;
|
||||
|
@ -804,19 +755,28 @@ int Hunspell::suggest(char*** slst, const char * word)
|
|||
char * dot = strchr(cw, '.');
|
||||
if (dot && (dot > cw)) {
|
||||
int captype_;
|
||||
if (utf8) {
|
||||
if (utf8)
|
||||
{
|
||||
w_char w_[MAXWORDLEN];
|
||||
int wl_ = u8_u16(w_, MAXWORDLEN, dot + 1);
|
||||
captype_ = get_captype_utf8(w_, wl_, langnum);
|
||||
} else captype_ = get_captype(dot+1, strlen(dot+1), csconv);
|
||||
if (captype_ == INITCAP) {
|
||||
if (captype_ == INITCAP)
|
||||
{
|
||||
char * st = mystrdup(cw);
|
||||
if (st) st = (char *) realloc(st, wl + 2);
|
||||
if (st) {
|
||||
st[(dot - cw) + 1] = ' ';
|
||||
strcpy(st + (dot - cw) + 2, dot + 1);
|
||||
ns = insert_sug(slst, st, ns);
|
||||
free(st);
|
||||
if (st)
|
||||
{
|
||||
char *newst = (char *) realloc(st, wl + 2);
|
||||
if (newst == NULL)
|
||||
free(st);
|
||||
st = newst;
|
||||
}
|
||||
if (st)
|
||||
{
|
||||
st[(dot - cw) + 1] = ' ';
|
||||
strcpy(st + (dot - cw) + 2, dot + 1);
|
||||
ns = insert_sug(slst, st, ns);
|
||||
free(st);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -902,7 +862,7 @@ int Hunspell::suggest(char*** slst, const char * word)
|
|||
*pos = '\0';
|
||||
strcpy(w, (*slst)[j]);
|
||||
strcat(w, pos + 1);
|
||||
spell(w, &info, NULL);
|
||||
(void)spell(w, &info, NULL);
|
||||
if ((info & SPELL_COMPOUND) && (info & SPELL_FORBIDDEN)) {
|
||||
*pos = ' ';
|
||||
} else *pos = '-';
|
||||
|
@ -1724,6 +1684,13 @@ int Hunspell::get_langnum() const
|
|||
return langnum;
|
||||
}
|
||||
|
||||
int Hunspell::input_conv(const char * word, char * dest)
|
||||
{
|
||||
RepList * rl = (pAMgr) ? pAMgr->get_iconvtable() : NULL;
|
||||
return (rl && rl->conv(word, dest));
|
||||
}
|
||||
|
||||
|
||||
// return the beginning of the element (attr == NULL) or the attribute
|
||||
const char * Hunspell::get_xml_pos(const char * s, const char * attr)
|
||||
{
|
||||
|
@ -1748,11 +1715,11 @@ int Hunspell::get_xml_list(char ***slst, char * list, const char * tag) {
|
|||
int n = 0;
|
||||
char * p;
|
||||
if (!list) return 0;
|
||||
for (p = list; (p = strstr(p, tag)); p++) n++;
|
||||
for (p = list; ((p = strstr(p, tag)) != NULL); p++) n++;
|
||||
if (n == 0) return 0;
|
||||
*slst = (char **) malloc(sizeof(char *) * n);
|
||||
if (!*slst) return 0;
|
||||
for (p = list, n = 0; (p = strstr(p, tag)); p++, n++) {
|
||||
for (p = list, n = 0; ((p = strstr(p, tag)) != NULL); p++, n++) {
|
||||
int l = strlen(p);
|
||||
(*slst)[n] = (char *) malloc(l + 1);
|
||||
if (!(*slst)[n]) return n;
|
||||
|
@ -1764,6 +1731,19 @@ int Hunspell::get_xml_list(char ***slst, char * list, const char * tag) {
|
|||
return n;
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
void myrep(std::string& str, const std::string& search, const std::string& replace)
|
||||
{
|
||||
size_t pos = 0;
|
||||
while ((pos = str.find(search, pos)) != std::string::npos)
|
||||
{
|
||||
str.replace(pos, search.length(), replace);
|
||||
pos += replace.length();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int Hunspell::spellml(char*** slst, const char * word)
|
||||
{
|
||||
char *q, *q2;
|
||||
|
@ -1775,26 +1755,26 @@ int Hunspell::spellml(char*** slst, const char * word)
|
|||
q2 = strstr(q2, "<word");
|
||||
if (!q2) return 0; // bad XML input
|
||||
if (check_xml_par(q, "type=", "analyze")) {
|
||||
int n = 0, s = 0;
|
||||
int n = 0;
|
||||
if (get_xml_par(cw, strchr(q2, '>'), MAXWORDUTF8LEN - 10)) n = analyze(slst, cw);
|
||||
if (n == 0) return 0;
|
||||
// convert the result to <code><a>ana1</a><a>ana2</a></code> format
|
||||
for (int i = 0; i < n; i++) s+= strlen((*slst)[i]);
|
||||
char * r = (char *) malloc(6 + 5 * s + 7 * n + 7 + 1); // XXX 5*s->&->&
|
||||
if (!r) return 0;
|
||||
strcpy(r, "<code>");
|
||||
std::string r;
|
||||
r.append("<code>");
|
||||
for (int i = 0; i < n; i++) {
|
||||
int l = strlen(r);
|
||||
strcpy(r + l, "<a>");
|
||||
strcpy(r + l + 3, (*slst)[i]);
|
||||
mystrrep(r + l + 3, "\t", " ");
|
||||
mystrrep(r + l + 3, "<", "<");
|
||||
mystrrep(r + l + 3, "&", "&");
|
||||
strcat(r, "</a>");
|
||||
r.append("<a>");
|
||||
|
||||
std::string entry((*slst)[i]);
|
||||
free((*slst)[i]);
|
||||
myrep(entry, "\t", " ");
|
||||
myrep(entry, "&", "&");
|
||||
myrep(entry, "<", "<");
|
||||
r.append(entry);
|
||||
|
||||
r.append("</a>");
|
||||
}
|
||||
strcat(r, "</code>");
|
||||
(*slst)[0] = r;
|
||||
r.append("</code>");
|
||||
(*slst)[0] = mystrdup(r.c_str());
|
||||
return 1;
|
||||
} else if (check_xml_par(q, "type=", "stem")) {
|
||||
if (get_xml_par(cw, strchr(q2, '>'), MAXWORDUTF8LEN - 1)) return stem(slst, cw);
|
||||
|
@ -1807,9 +1787,9 @@ int Hunspell::spellml(char*** slst, const char * word)
|
|||
return generate(slst, cw, cw2);
|
||||
}
|
||||
} else {
|
||||
if ((q2 = strstr(q2 + 1, "<code"))) {
|
||||
if ((q2 = strstr(q2 + 1, "<code")) != NULL) {
|
||||
char ** slst2;
|
||||
if ((n = get_xml_list(&slst2, strchr(q2, '>'), "<a>"))) {
|
||||
if ((n = get_xml_list(&slst2, strchr(q2, '>'), "<a>")) != 0) {
|
||||
int n2 = generate(slst, cw, slst2, n);
|
||||
freelist(&slst2, n);
|
||||
return uniqlist(*slst, n2);
|
|
@ -1,60 +1,3 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#ifndef _MYSPELLMGR_H_
|
||||
#define _MYSPELLMGR_H_
|
||||
|
||||
|
|
|
@ -1,60 +1,3 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#include "hunvisapi.h"
|
||||
|
||||
#include "hashmgr.hxx"
|
||||
|
@ -76,6 +19,10 @@
|
|||
|
||||
class LIBHUNSPELL_DLL_EXPORTED Hunspell
|
||||
{
|
||||
private:
|
||||
Hunspell(const Hunspell&);
|
||||
Hunspell& operator = (const Hunspell&);
|
||||
private:
|
||||
AffixMgr* pAMgr;
|
||||
HashMgr* pHMgr[MAXDIC];
|
||||
int maxdic;
|
||||
|
@ -92,6 +39,11 @@ public:
|
|||
|
||||
/* Hunspell(aff, dic) - constructor of Hunspell class
|
||||
* input: path of affix file and dictionary file
|
||||
*
|
||||
* In WIN32 environment, use UTF-8 encoded paths started with the long path
|
||||
* prefix \\\\?\\ to handle system-independent character encoding and very
|
||||
* long path names (without the long path prefix Hunspell will use fopen()
|
||||
* with system-dependent character encoding instead of _wfopen()).
|
||||
*/
|
||||
|
||||
Hunspell(const char * affpath, const char * dpath, const char * key = NULL);
|
||||
|
@ -188,6 +140,9 @@ public:
|
|||
const char * get_version();
|
||||
|
||||
int get_langnum() const;
|
||||
|
||||
/* need for putdic */
|
||||
int input_conv(const char * word, char * dest);
|
||||
|
||||
/* experimental and deprecated functions */
|
||||
|
||||
|
|
|
@ -1,36 +1,3 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code is Caolan McNamara.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010 the
|
||||
* Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Caolan McNamara (caolanm@redhat.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#ifndef _HUNSPELL_VISIBILITY_H_
|
||||
#define _HUNSPELL_VISIBILITY_H_
|
||||
|
||||
|
@ -42,7 +9,7 @@
|
|||
# else
|
||||
# define LIBHUNSPELL_DLL_EXPORTED __declspec(dllimport)
|
||||
# endif
|
||||
#elif BUILDING_LIBHUNSPELL && 1
|
||||
#elif defined(BUILDING_LIBHUNSPELL) && 1
|
||||
# define LIBHUNSPELL_DLL_EXPORTED __attribute__((__visibility__("default")))
|
||||
#else
|
||||
# define LIBHUNSPELL_DLL_EXPORTED
|
||||
|
|
|
@ -1,42 +1,9 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "hunzip.hxx"
|
||||
#include "csutil.hxx"
|
||||
|
||||
#define CODELEN 65536
|
||||
#define BASEBITREC 5000
|
||||
|
@ -51,15 +18,17 @@ int Hunzip::fail(const char * err, const char * par) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
Hunzip::Hunzip(const char * file, const char * key) {
|
||||
bufsiz = 0;
|
||||
lastbit = 0;
|
||||
inc = 0;
|
||||
outc = 0;
|
||||
dec = NULL;
|
||||
fin = NULL;
|
||||
filename = (char *) malloc(strlen(file) + 1);
|
||||
if (filename) strcpy(filename, file);
|
||||
Hunzip::Hunzip(const char * file, const char * key)
|
||||
: fin(NULL)
|
||||
, bufsiz(0)
|
||||
, lastbit(0)
|
||||
, inc(0)
|
||||
, inbits(0)
|
||||
, outc(0)
|
||||
, dec(NULL)
|
||||
{
|
||||
in[0] = out[0] = line[0] = '\0';
|
||||
filename = mystrdup(file);
|
||||
if (getcode(key) == -1) bufsiz = -1;
|
||||
else bufsiz = getbuf();
|
||||
}
|
||||
|
@ -72,7 +41,7 @@ int Hunzip::getcode(const char * key) {
|
|||
|
||||
if (!filename) return -1;
|
||||
|
||||
fin = fopen(filename, "rb");
|
||||
fin = myfopen(filename, "rb");
|
||||
if (!fin) return -1;
|
||||
|
||||
// read magic number
|
|
@ -1,36 +1,5 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
/* hunzip: file decompression for sorted dictionaries with optional encryption,
|
||||
* algorithm: prefix-suffix encoding and 16-bit Huffman encoding */
|
||||
|
||||
#ifndef _HUNZIP_HXX_
|
||||
#define _HUNZIP_HXX_
|
||||
|
@ -54,7 +23,9 @@ struct bit {
|
|||
|
||||
class LIBHUNSPELL_DLL_EXPORTED Hunzip
|
||||
{
|
||||
|
||||
private:
|
||||
Hunzip(const Hunzip&);
|
||||
Hunzip& operator = (const Hunzip&);
|
||||
protected:
|
||||
char * filename;
|
||||
FILE * fin;
|
||||
|
|
|
@ -1,59 +1,3 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#ifndef _LANGNUM_HXX_
|
||||
#define _LANGNUM_HXX_
|
||||
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Hunspell, based on MySpell.
|
||||
*
|
||||
* The Initial Developers of the Original Code are
|
||||
* Kevin Hendricks (MySpell) and Laszlo Nemeth (Hunspell).
|
||||
* Portions created by the Initial Developers are Copyright (C) 2002-2005
|
||||
* the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* David Einstein
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef MOZILLA_CLIENT
|
||||
# include "config.h"
|
||||
#endif
|
|
@ -11,17 +11,17 @@ UNIFIED_SOURCES += [
|
|||
|
||||
if not CONFIG['MOZ_NATIVE_HUNSPELL']:
|
||||
SOURCES += [
|
||||
'affentry.cpp',
|
||||
'affixmgr.cpp',
|
||||
'csutil.cpp',
|
||||
'dictmgr.cpp',
|
||||
'filemgr.cpp',
|
||||
'hashmgr.cpp',
|
||||
'hunspell.cpp',
|
||||
'hunzip.cpp',
|
||||
'phonet.cpp',
|
||||
'replist.cpp',
|
||||
'suggestmgr.cpp',
|
||||
'affentry.cxx',
|
||||
'affixmgr.cxx',
|
||||
'csutil.cxx',
|
||||
'dictmgr.cxx',
|
||||
'filemgr.cxx',
|
||||
'hashmgr.cxx',
|
||||
'hunspell.cxx',
|
||||
'hunzip.cxx',
|
||||
'phonet.cxx',
|
||||
'replist.cxx',
|
||||
'suggestmgr.cxx',
|
||||
]
|
||||
# This variable is referenced in configure.in. Make sure to change that file
|
||||
# too if you need to change this variable.
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
Bug 675553 - Switch from PRBool to bool.
|
||||
|
||||
diff --git a/extensions/spellcheck/hunspell/src/csutil.cxx b/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
--- a/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
+++ b/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
@@ -5517,17 +5517,17 @@ struct cs_info * get_current_cs(const ch
|
||||
if (NS_FAILED(rv))
|
||||
return ccs;
|
||||
decoder->SetInputErrorBehavior(decoder->kOnError_Signal);
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return ccs;
|
||||
|
||||
for (unsigned int i = 0; i <= 0xff; ++i) {
|
||||
- PRBool success = PR_FALSE;
|
||||
+ bool success = false;
|
||||
// We want to find the upper/lowercase equivalents of each byte
|
||||
// in this 1-byte character encoding. Call our encoding/decoding
|
||||
// APIs separately for each byte since they may reject some of the
|
||||
// bytes, and we want to handle errors separately for each byte.
|
||||
char lower, upper;
|
||||
do {
|
||||
if (i == 0)
|
||||
break;
|
|
@ -0,0 +1,24 @@
|
|||
Bug 690892 - Replace PR_TRUE/PR_FALSE with true/false.
|
||||
|
||||
diff --git a/extensions/spellcheck/hunspell/src/csutil.cxx b/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
--- a/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
+++ b/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
@@ -5549,17 +5549,17 @@ struct cs_info * get_current_cs(const ch
|
||||
|
||||
uniCased = ToUpperCase(uni);
|
||||
rv = encoder->Convert(&uniCased, &uniLength, &upper, &charLength);
|
||||
// Explicitly check NS_OK because we don't want to allow
|
||||
// NS_OK_UDEC_MOREOUTPUT or NS_OK_UDEC_MOREINPUT.
|
||||
if (rv != NS_OK || charLength != 1 || uniLength != 1)
|
||||
break;
|
||||
|
||||
- success = PR_TRUE;
|
||||
+ success = true;
|
||||
} while (0);
|
||||
|
||||
if (success) {
|
||||
ccs[i].cupper = upper;
|
||||
ccs[i].clower = lower;
|
||||
} else {
|
||||
ccs[i].cupper = i;
|
||||
ccs[i].clower = i;
|
|
@ -0,0 +1,25 @@
|
|||
Silence the warning about empty while body loop in clang.
|
||||
|
||||
diff --git a/extensions/spellcheck/hunspell/src/affentry.cxx b/extensions/spellcheck/hunspell/src/affentry.cxx
|
||||
--- a/extensions/spellcheck/hunspell/src/affentry.cxx
|
||||
+++ b/extensions/spellcheck/hunspell/src/affentry.cxx
|
||||
@@ -571,17 +571,18 @@ inline int SfxEntry::test_condition(cons
|
||||
while (p && *p != ']' && ((p = nextchar(p)) != NULL));
|
||||
st--;
|
||||
}
|
||||
if (p && *p != ']') p = nextchar(p);
|
||||
} else if (pos) {
|
||||
if (neg) return 0;
|
||||
else if (i == numconds) return 1;
|
||||
ingroup = true;
|
||||
- while (p && *p != ']' && ((p = nextchar(p)) != NULL));
|
||||
+ while (p && *p != ']' && ((p = nextchar(p)) != NULL))
|
||||
+ ;
|
||||
// if (p && *p != ']') p = nextchar(p);
|
||||
st--;
|
||||
}
|
||||
if (!pos) {
|
||||
i++;
|
||||
st--;
|
||||
}
|
||||
if (st < beg && p && *p != ']') return 0; // word <= condition
|
|
@ -0,0 +1,24 @@
|
|||
Bug 777292 - Change nsnull to nullptr.
|
||||
|
||||
diff --git a/extensions/spellcheck/hunspell/src/csutil.cxx b/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
--- a/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
+++ b/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
@@ -5507,17 +5507,17 @@ struct cs_info * get_current_cs(const ch
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsICharsetConverterManager> ccm = do_GetService(kCharsetConverterManagerCID, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
return ccs;
|
||||
|
||||
rv = ccm->GetUnicodeEncoder(es, getter_AddRefs(encoder));
|
||||
if (NS_FAILED(rv))
|
||||
return ccs;
|
||||
- encoder->SetOutputErrorBehavior(encoder->kOnError_Signal, nsnull, '?');
|
||||
+ encoder->SetOutputErrorBehavior(encoder->kOnError_Signal, nullptr, '?');
|
||||
rv = ccm->GetUnicodeDecoder(es, getter_AddRefs(decoder));
|
||||
if (NS_FAILED(rv))
|
||||
return ccs;
|
||||
decoder->SetInputErrorBehavior(decoder->kOnError_Signal);
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return ccs;
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
Bug 579517 - Convert NSPR numeric types to stdint types.
|
||||
|
||||
diff --git a/extensions/spellcheck/hunspell/src/csutil.cxx b/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
--- a/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
+++ b/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
@@ -5528,17 +5528,17 @@ struct cs_info * get_current_cs(const ch
|
||||
// APIs separately for each byte since they may reject some of the
|
||||
// bytes, and we want to handle errors separately for each byte.
|
||||
char lower, upper;
|
||||
do {
|
||||
if (i == 0)
|
||||
break;
|
||||
const char source = char(i);
|
||||
PRUnichar uni, uniCased;
|
||||
- PRInt32 charLength = 1, uniLength = 1;
|
||||
+ int32_t charLength = 1, uniLength = 1;
|
||||
|
||||
rv = decoder->Convert(&source, &charLength, &uni, &uniLength);
|
||||
// Explicitly check NS_OK because we don't want to allow
|
||||
// NS_OK_UDEC_MOREOUTPUT or NS_OK_UDEC_MOREINPUT.
|
||||
if (rv != NS_OK || charLength != 1 || uniLength != 1)
|
||||
break;
|
||||
uniCased = ToLowerCase(uni);
|
||||
rv = encoder->Convert(&uniCased, &uniLength, &lower, &charLength);
|
|
@ -0,0 +1,43 @@
|
|||
Bug 784776 - Don't assume NULL is numeric in Hunspell code.
|
||||
|
||||
diff --git a/extensions/spellcheck/hunspell/src/affentry.hxx b/extensions/spellcheck/hunspell/src/affentry.hxx
|
||||
--- a/extensions/spellcheck/hunspell/src/affentry.hxx
|
||||
+++ b/extensions/spellcheck/hunspell/src/affentry.hxx
|
||||
@@ -26,17 +26,17 @@ public:
|
||||
|
||||
PfxEntry(AffixMgr* pmgr, affentry* dp );
|
||||
~PfxEntry();
|
||||
|
||||
inline bool allowCross() { return ((opts & aeXPRODUCT) != 0); }
|
||||
struct hentry * checkword(const char * word, int len, char in_compound,
|
||||
const FLAG needflag = FLAG_NULL);
|
||||
|
||||
- struct hentry * check_twosfx(const char * word, int len, char in_compound, const FLAG needflag = NULL);
|
||||
+ struct hentry * check_twosfx(const char * word, int len, char in_compound, const FLAG needflag = FLAG_NULL);
|
||||
|
||||
char * check_morph(const char * word, int len, char in_compound,
|
||||
const FLAG needflag = FLAG_NULL);
|
||||
|
||||
char * check_twosfx_morph(const char * word, int len,
|
||||
char in_compound, const FLAG needflag = FLAG_NULL);
|
||||
|
||||
inline FLAG getFlag() { return aflag; }
|
||||
@@ -93,17 +93,17 @@ public:
|
||||
~SfxEntry();
|
||||
|
||||
inline bool allowCross() { return ((opts & aeXPRODUCT) != 0); }
|
||||
struct hentry * checkword(const char * word, int len, int optflags,
|
||||
PfxEntry* ppfx, char ** wlst, int maxSug, int * ns,
|
||||
// const FLAG cclass = FLAG_NULL, const FLAG needflag = FLAG_NULL, char in_compound=IN_CPD_NOT);
|
||||
const FLAG cclass = FLAG_NULL, const FLAG needflag = FLAG_NULL, const FLAG badflag = 0);
|
||||
|
||||
- struct hentry * check_twosfx(const char * word, int len, int optflags, PfxEntry* ppfx, const FLAG needflag = NULL);
|
||||
+ struct hentry * check_twosfx(const char * word, int len, int optflags, PfxEntry* ppfx, const FLAG needflag = FLAG_NULL);
|
||||
|
||||
char * check_twosfx_morph(const char * word, int len, int optflags,
|
||||
PfxEntry* ppfx, const FLAG needflag = FLAG_NULL);
|
||||
struct hentry * get_next_homonym(struct hentry * he);
|
||||
struct hentry * get_next_homonym(struct hentry * word, int optflags, PfxEntry* ppfx,
|
||||
const FLAG cclass, const FLAG needflag);
|
||||
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
Bug 927728 - Replace PRUnichar with char16_t.
|
||||
|
||||
diff --git a/extensions/spellcheck/hunspell/src/csutil.cxx b/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
--- a/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
+++ b/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
@@ -5527,17 +5527,17 @@ struct cs_info * get_current_cs(const ch
|
||||
// in this 1-byte character encoding. Call our encoding/decoding
|
||||
// APIs separately for each byte since they may reject some of the
|
||||
// bytes, and we want to handle errors separately for each byte.
|
||||
char lower, upper;
|
||||
do {
|
||||
if (i == 0)
|
||||
break;
|
||||
const char source = char(i);
|
||||
- PRUnichar uni, uniCased;
|
||||
+ char16_t uni, uniCased;
|
||||
int32_t charLength = 1, uniLength = 1;
|
||||
|
||||
rv = decoder->Convert(&source, &charLength, &uni, &uniLength);
|
||||
// Explicitly check NS_OK because we don't want to allow
|
||||
// NS_OK_UDEC_MOREOUTPUT or NS_OK_UDEC_MOREINPUT.
|
||||
if (rv != NS_OK || charLength != 1 || uniLength != 1)
|
||||
break;
|
||||
uniCased = ToLowerCase(uni);
|
||||
@@ -5680,17 +5680,17 @@ unsigned short unicodetoupper(unsigned s
|
||||
// There are a dotless lower case i pair of upper `I',
|
||||
// and an upper I with dot pair of lower `i'.
|
||||
if (c == 0x0069 && ((langnum == LANG_az) || (langnum == LANG_tr)))
|
||||
return 0x0130;
|
||||
#ifdef OPENOFFICEORG
|
||||
return static_cast<unsigned short>(u_toupper(c));
|
||||
#else
|
||||
#ifdef MOZILLA_CLIENT
|
||||
- return ToUpperCase((PRUnichar) c);
|
||||
+ return ToUpperCase((char16_t) c);
|
||||
#else
|
||||
return (utf_tbl) ? utf_tbl[c].cupper : c;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
unsigned short unicodetolower(unsigned short c, int langnum)
|
||||
{
|
||||
@@ -5698,17 +5698,17 @@ unsigned short unicodetolower(unsigned s
|
||||
// There are a dotless lower case i pair of upper `I',
|
||||
// and an upper I with dot pair of lower `i'.
|
||||
if (c == 0x0049 && ((langnum == LANG_az) || (langnum == LANG_tr)))
|
||||
return 0x0131;
|
||||
#ifdef OPENOFFICEORG
|
||||
return static_cast<unsigned short>(u_tolower(c));
|
||||
#else
|
||||
#ifdef MOZILLA_CLIENT
|
||||
- return ToLowerCase((PRUnichar) c);
|
||||
+ return ToLowerCase((char16_t) c);
|
||||
#else
|
||||
return (utf_tbl) ? utf_tbl[c].clower : c;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
int unicodeisalpha(unsigned short c)
|
||||
{
|
|
@ -0,0 +1,71 @@
|
|||
Bug 943268 - Remove nsCharsetAlias and nsCharsetConverterManager.
|
||||
|
||||
diff --git a/extensions/spellcheck/hunspell/src/csutil.cxx b/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
--- a/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
+++ b/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
@@ -28,23 +28,22 @@ struct unicode_info {
|
||||
# ifndef MOZILLA_CLIENT
|
||||
# include "utf_info.cxx"
|
||||
# define UTF_LST_LEN (sizeof(utf_lst) / (sizeof(unicode_info)))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef MOZILLA_CLIENT
|
||||
#include "nsCOMPtr.h"
|
||||
-#include "nsServiceManagerUtils.h"
|
||||
#include "nsIUnicodeEncoder.h"
|
||||
#include "nsIUnicodeDecoder.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
-#include "nsICharsetConverterManager.h"
|
||||
+#include "mozilla/dom/EncodingUtils.h"
|
||||
|
||||
-static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID);
|
||||
+using mozilla::dom::EncodingUtils;
|
||||
#endif
|
||||
|
||||
struct unicode_info2 {
|
||||
char cletter;
|
||||
unsigned short cupper;
|
||||
unsigned short clower;
|
||||
};
|
||||
|
||||
@@ -5500,32 +5499,27 @@ struct cs_info * get_current_cs(const ch
|
||||
ccs[i].cupper = i;
|
||||
}
|
||||
|
||||
|
||||
nsCOMPtr<nsIUnicodeEncoder> encoder;
|
||||
nsCOMPtr<nsIUnicodeDecoder> decoder;
|
||||
|
||||
nsresult rv;
|
||||
- nsCOMPtr<nsICharsetConverterManager> ccm = do_GetService(kCharsetConverterManagerCID, &rv);
|
||||
- if (NS_FAILED(rv))
|
||||
+
|
||||
+ nsAutoCString label(es);
|
||||
+ nsAutoCString encoding;
|
||||
+ if (!EncodingUtils::FindEncodingForLabelNoReplacement(label, encoding)) {
|
||||
return ccs;
|
||||
-
|
||||
- rv = ccm->GetUnicodeEncoder(es, getter_AddRefs(encoder));
|
||||
- if (NS_FAILED(rv))
|
||||
- return ccs;
|
||||
+ }
|
||||
+ encoder = EncodingUtils::EncoderForEncoding(encoding);
|
||||
+ decoder = EncodingUtils::DecoderForEncoding(encoding);
|
||||
encoder->SetOutputErrorBehavior(encoder->kOnError_Signal, nullptr, '?');
|
||||
- rv = ccm->GetUnicodeDecoder(es, getter_AddRefs(decoder));
|
||||
- if (NS_FAILED(rv))
|
||||
- return ccs;
|
||||
decoder->SetInputErrorBehavior(decoder->kOnError_Signal);
|
||||
|
||||
- if (NS_FAILED(rv))
|
||||
- return ccs;
|
||||
-
|
||||
for (unsigned int i = 0; i <= 0xff; ++i) {
|
||||
bool success = false;
|
||||
// We want to find the upper/lowercase equivalents of each byte
|
||||
// in this 1-byte character encoding. Call our encoding/decoding
|
||||
// APIs separately for each byte since they may reject some of the
|
||||
// bytes, and we want to handle errors separately for each byte.
|
||||
char lower, upper;
|
||||
do {
|
|
@ -0,0 +1,18 @@
|
|||
Don't include config.h in license.hunspell if MOZILLA_CLIENT is set.
|
||||
|
||||
diff --git a/extensions/spellcheck/hunspell/src/license.hunspell b/extensions/spellcheck/hunspell/src/license.hunspell
|
||||
--- a/extensions/spellcheck/hunspell/src/license.hunspell
|
||||
+++ b/extensions/spellcheck/hunspell/src/license.hunspell
|
||||
@@ -51,9 +51,11 @@
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
-#include "config.h"
|
||||
+#ifndef MOZILLA_CLIENT
|
||||
+# include "config.h"
|
||||
+#endif
|
|
@ -1,48 +1,31 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Björn Jacke. Portions created
|
||||
* by the Initial Developers are Copyright (C) 2000-2007 the Initial
|
||||
* Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Björn Jacke (bjoern.jacke@gmx.de)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* Changelog:
|
||||
* 2000-01-05 Björn Jacke <bjoern.jacke AT gmx.de>
|
||||
* Initial Release insprired by the article about phonetic
|
||||
* transformations out of c't 25/1999
|
||||
*
|
||||
* 2007-07-26 Björn Jacke <bjoern.jacke AT gmx.de>
|
||||
* Released under MPL/GPL/LGPL tri-license for Hunspell
|
||||
*
|
||||
* 2007-08-23 László Németh <nemeth at OOo>
|
||||
* Porting from Aspell to Hunspell using C-like structs
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
/* phonetic.c - generic replacement aglogithms for phonetic transformation
|
||||
Copyright (C) 2000 Bjoern Jacke
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License version 2.1 as published by the Free Software Foundation;
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
Changelog:
|
||||
|
||||
2000-01-05 Bjoern Jacke <bjoern at j3e.de>
|
||||
Initial Release insprired by the article about phonetic
|
||||
transformations out of c't 25/1999
|
||||
|
||||
2007-07-26 Bjoern Jacke <bjoern at j3e.de>
|
||||
Released under MPL/GPL/LGPL tri-license for Hunspell
|
||||
|
||||
2007-08-23 Laszlo Nemeth <nemeth at OOo>
|
||||
Porting from Aspell to Hunspell using C-like structs
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -104,7 +87,8 @@ int phonet (const char * inword, char * target,
|
|||
char word[MAXPHONETUTF8LEN + 1];
|
||||
if (len == -1) len = strlen(inword);
|
||||
if (len > MAXPHONETUTF8LEN) return 0;
|
||||
strcpy(word, inword);
|
||||
strncpy(word, inword, MAXPHONETUTF8LEN);
|
||||
word[MAXPHONETUTF8LEN] = '\0';
|
||||
|
||||
/** check word **/
|
||||
i = j = z = 0;
|
|
@ -1,48 +1,31 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Björn Jacke. Portions created
|
||||
* by the Initial Developers are Copyright (C) 2000-2007 the Initial
|
||||
* Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Björn Jacke (bjoern.jacke@gmx.de)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* Changelog:
|
||||
* 2000-01-05 Björn Jacke <bjoern.jacke AT gmx.de>
|
||||
* Initial Release insprired by the article about phonetic
|
||||
* transformations out of c't 25/1999
|
||||
*
|
||||
* 2007-07-20 Björn Jacke <bjoern.jacke AT gmx.de>
|
||||
* Released under MPL/GPL/LGPL tri-license for Hunspell
|
||||
*
|
||||
* 2007-08-22 László Németh <nemeth at OOo>
|
||||
* Porting from Aspell to Hunspell by little modifications
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
/* phonetic.c - generic replacement aglogithms for phonetic transformation
|
||||
Copyright (C) 2000 Bjoern Jacke
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License version 2.1 as published by the Free Software Foundation;
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
Changelog:
|
||||
|
||||
2000-01-05 Bjoern Jacke <bjoern at j3e.de>
|
||||
Initial Release insprired by the article about phonetic
|
||||
transformations out of c't 25/1999
|
||||
|
||||
2007-07-26 Bjoern Jacke <bjoern at j3e.de>
|
||||
Released under MPL/GPL/LGPL tri-license for Hunspell
|
||||
|
||||
2007-08-23 Laszlo Nemeth <nemeth at OOo>
|
||||
Porting from Aspell to Hunspell using C-like structs
|
||||
*/
|
||||
|
||||
#ifndef __PHONETHXX__
|
||||
#define __PHONETHXX__
|
||||
|
|
|
@ -1,36 +1,5 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
#include "license.hunspell"
|
||||
#include "license.myspell"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
|
@ -1,37 +1,3 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
/* string replacement list class */
|
||||
#ifndef _REPLIST_HXX_
|
||||
#define _REPLIST_HXX_
|
||||
|
@ -42,6 +8,9 @@
|
|||
|
||||
class LIBHUNSPELL_DLL_EXPORTED RepList
|
||||
{
|
||||
private:
|
||||
RepList(const RepList&);
|
||||
RepList& operator = (const RepList&);
|
||||
protected:
|
||||
replentry ** dat;
|
||||
int size;
|
||||
|
|
|
@ -1,59 +1,5 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
#include "license.hunspell"
|
||||
#include "license.myspell"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -161,7 +107,10 @@ int SuggestMgr::testsug(char** wlst, const char * candidate, int wl, int ns, int
|
|||
int cwrd = 1;
|
||||
if (ns == maxSug) return maxSug;
|
||||
for (int k=0; k < ns; k++) {
|
||||
if (strcmp(candidate,wlst[k]) == 0) cwrd = 0;
|
||||
if (strcmp(candidate,wlst[k]) == 0) {
|
||||
cwrd = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((cwrd) && checkword(candidate, wl, cpdsuggest, timer, timelimit)) {
|
||||
wlst[ns] = mystrdup(candidate);
|
||||
|
@ -418,8 +367,12 @@ int SuggestMgr::map_related(const char * word, char * candidate, int wn, int cn,
|
|||
int cwrd = 1;
|
||||
*(candidate + cn) = '\0';
|
||||
int wl = strlen(candidate);
|
||||
for (int m=0; m < ns; m++)
|
||||
if (strcmp(candidate, wlst[m]) == 0) cwrd = 0;
|
||||
for (int m=0; m < ns; m++) {
|
||||
if (strcmp(candidate, wlst[m]) == 0) {
|
||||
cwrd = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((cwrd) && checkword(candidate, wl, cpdsuggest, timer, timelimit)) {
|
||||
if (ns < maxSug) {
|
||||
wlst[ns] = mystrdup(candidate);
|
||||
|
@ -732,7 +685,7 @@ int SuggestMgr::extrachar(char** wlst, const char * word, int ns, int cpdsuggest
|
|||
// error is missing a letter it needs
|
||||
int SuggestMgr::forgotchar(char ** wlst, const char * word, int ns, int cpdsuggest)
|
||||
{
|
||||
char candidate[MAXSWUTF8L];
|
||||
char candidate[MAXSWUTF8L + 4];
|
||||
char * p;
|
||||
clock_t timelimit = clock();
|
||||
int timer = MINTIMER;
|
||||
|
@ -754,8 +707,8 @@ int SuggestMgr::forgotchar(char ** wlst, const char * word, int ns, int cpdsugge
|
|||
// error is missing a letter it needs
|
||||
int SuggestMgr::forgotchar_utf(char ** wlst, const w_char * word, int wl, int ns, int cpdsuggest)
|
||||
{
|
||||
w_char candidate_utf[MAXSWL];
|
||||
char candidate[MAXSWUTF8L];
|
||||
w_char candidate_utf[MAXSWL + 1];
|
||||
char candidate[MAXSWUTF8L + 4];
|
||||
w_char * p;
|
||||
clock_t timelimit = clock();
|
||||
int timer = MINTIMER;
|
||||
|
@ -815,8 +768,12 @@ int SuggestMgr::twowords(char ** wlst, const char * word, int ns, int cpdsuggest
|
|||
((c1 == 3) && (c2 >= 2)))) *p = '-';
|
||||
|
||||
cwrd = 1;
|
||||
for (int k=0; k < ns; k++)
|
||||
if (strcmp(candidate,wlst[k]) == 0) cwrd = 0;
|
||||
for (int k=0; k < ns; k++) {
|
||||
if (strcmp(candidate,wlst[k]) == 0) {
|
||||
cwrd = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ns < maxSug) {
|
||||
if (cwrd) {
|
||||
wlst[ns] = mystrdup(candidate);
|
||||
|
@ -831,8 +788,12 @@ int SuggestMgr::twowords(char ** wlst, const char * word, int ns, int cpdsuggest
|
|||
mystrlen(p + 1) > 1 &&
|
||||
mystrlen(candidate) - mystrlen(p) > 1) {
|
||||
*p = '-';
|
||||
for (int k=0; k < ns; k++)
|
||||
if (strcmp(candidate,wlst[k]) == 0) cwrd = 0;
|
||||
for (int k=0; k < ns; k++) {
|
||||
if (strcmp(candidate,wlst[k]) == 0) {
|
||||
cwrd = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ns < maxSug) {
|
||||
if (cwrd) {
|
||||
wlst[ns] = mystrdup(candidate);
|
||||
|
@ -1387,7 +1348,10 @@ int SuggestMgr::ngsuggest(char** wlst, char * w, int ns, HashMgr** pHMgr, int md
|
|||
if ((!guessorig[i] && strstr(guess[i], wlst[j])) ||
|
||||
(guessorig[i] && strstr(guessorig[i], wlst[j])) ||
|
||||
// check forbidden words
|
||||
!checkword(guess[i], strlen(guess[i]), 0, NULL, NULL)) unique = 0;
|
||||
!checkword(guess[i], strlen(guess[i]), 0, NULL, NULL)) {
|
||||
unique = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (unique) {
|
||||
wlst[ns++] = guess[i];
|
||||
|
@ -1415,7 +1379,10 @@ int SuggestMgr::ngsuggest(char** wlst, char * w, int ns, HashMgr** pHMgr, int md
|
|||
// don't suggest previous suggestions or a previous suggestion with prefixes or affixes
|
||||
if (strstr(rootsphon[i], wlst[j]) ||
|
||||
// check forbidden words
|
||||
!checkword(rootsphon[i], strlen(rootsphon[i]), 0, NULL, NULL)) unique = 0;
|
||||
!checkword(rootsphon[i], strlen(rootsphon[i]), 0, NULL, NULL)) {
|
||||
unique = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (unique) {
|
||||
wlst[ns++] = mystrdup(rootsphon[i]);
|
||||
|
@ -1909,6 +1876,10 @@ int SuggestMgr::commoncharacterpositions(char * s1, const char * s2, int * is_sw
|
|||
w_char su2[MAXSWL];
|
||||
int l1 = u8_u16(su1, MAXSWL, s1);
|
||||
int l2 = u8_u16(su2, MAXSWL, s2);
|
||||
|
||||
if (l1 <= 0 || l2 <= 0)
|
||||
return 0;
|
||||
|
||||
// decapitalize dictionary word
|
||||
if (complexprefixes) {
|
||||
mkallsmall_utf(su2+l2-1, 1, langnum);
|
|
@ -1,60 +1,3 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#ifndef _SUGGESTMGR_HXX_
|
||||
#define _SUGGESTMGR_HXX_
|
||||
|
||||
|
@ -89,6 +32,10 @@ enum { LCS_UP, LCS_LEFT, LCS_UPLEFT };
|
|||
|
||||
class LIBHUNSPELL_DLL_EXPORTED SuggestMgr
|
||||
{
|
||||
private:
|
||||
SuggestMgr(const SuggestMgr&);
|
||||
SuggestMgr& operator = (const SuggestMgr&);
|
||||
private:
|
||||
char * ckey;
|
||||
int ckeyl;
|
||||
w_char * ckey_utf;
|
||||
|
|
|
@ -1,36 +1,3 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): László Németh (nemethl@gyorsposta.hu)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#ifndef __WCHARHXX__
|
||||
#define __WCHARHXX__
|
||||
|
||||
|
|
|
@ -106,6 +106,10 @@ have_cpuid (void)
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <intrin.h> /* for __cpuid */
|
||||
#endif
|
||||
|
||||
static void
|
||||
pixman_cpuid (uint32_t feature,
|
||||
uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d)
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
#include "GLContext.h"
|
||||
#include "OGLShaderProgram.h"
|
||||
#include "gfxTypes.h"
|
||||
#include "gfxContext.h"
|
||||
#include "gfxImageSurface.h"
|
||||
#include "ScopedGLHelpers.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
#include "gfx2DGlue.h"
|
||||
|
@ -491,24 +489,29 @@ static TemporaryRef<DataSourceSurface> YInvertImageSurface(DataSourceSurface* aS
|
|||
Factory::CreateDataSourceSurfaceWithStride(aSurf->GetSize(),
|
||||
aSurf->GetFormat(),
|
||||
aSurf->Stride());
|
||||
if (!temp) {
|
||||
return nullptr;
|
||||
}
|
||||
DataSourceSurface::MappedSurface map;
|
||||
if (!temp->Map(DataSourceSurface::MapType::WRITE, &map)) {
|
||||
return nullptr;
|
||||
}
|
||||
RefPtr<DrawTarget> dt =
|
||||
Factory::CreateDrawTargetForData(BackendType::CAIRO,
|
||||
temp->GetData(),
|
||||
map.mData,
|
||||
temp->GetSize(),
|
||||
temp->Stride(),
|
||||
map.mStride,
|
||||
temp->GetFormat());
|
||||
nsRefPtr<gfxContext> ctx = new gfxContext(dt);
|
||||
ctx->SetOperator(gfxContext::OPERATOR_SOURCE);
|
||||
ctx->Scale(1.0, -1.0);
|
||||
ctx->Translate(-gfxPoint(0.0, aSurf->GetSize().height));
|
||||
|
||||
nsRefPtr<gfxImageSurface> thebesSurf =
|
||||
new gfxImageSurface(aSurf->GetData(),
|
||||
ThebesIntSize(aSurf->GetSize()),
|
||||
aSurf->Stride(),
|
||||
SurfaceFormatToImageFormat(aSurf->GetFormat()));
|
||||
ctx->SetSource(thebesSurf);
|
||||
ctx->Paint();
|
||||
if (!dt) {
|
||||
temp->Unmap();
|
||||
return nullptr;
|
||||
}
|
||||
dt->SetTransform(Matrix::Translation(0.0, aSurf->GetSize().height) *
|
||||
Matrix::Scaling(1.0, -1.0));
|
||||
Rect rect(0, 0, aSurf->GetSize().width, aSurf->GetSize().height);
|
||||
dt->DrawSurface(aSurf, rect, rect, DrawSurfaceOptions(),
|
||||
DrawOptions(1.0, CompositionOp::OP_SOURCE, AntialiasMode::NONE));
|
||||
temp->Unmap();
|
||||
return temp.forget();
|
||||
}
|
||||
|
||||
|
|
|
@ -14,8 +14,6 @@
|
|||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/gfx/Types.h"
|
||||
|
||||
class gfxImageSurface;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace gfx {
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#include "GLScreenBuffer.h"
|
||||
|
||||
#include <cstring>
|
||||
#include "gfxImageSurface.h"
|
||||
#include "GLContext.h"
|
||||
#include "GLBlitHelper.h"
|
||||
#include "GLReadTexImageHelper.h"
|
||||
|
|
|
@ -22,9 +22,6 @@
|
|||
#include "mozilla/gfx/2D.h"
|
||||
#include "mozilla/gfx/Point.h"
|
||||
|
||||
// Forwards:
|
||||
class gfxImageSurface;
|
||||
|
||||
namespace mozilla {
|
||||
namespace gfx {
|
||||
class SurfaceStream;
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
#include "GLTextureImage.h"
|
||||
#include "GLContext.h"
|
||||
#include "gfxContext.h"
|
||||
#include "gfxImageSurface.h"
|
||||
#include "gfxPlatform.h"
|
||||
#include "gfxUtils.h"
|
||||
#include "gfx2DGlue.h"
|
||||
#include "gfxImageSurface.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
#include "ScopedGLHelpers.h"
|
||||
#include "GLUploadHelpers.h"
|
||||
|
||||
|
@ -19,6 +19,8 @@
|
|||
#include "TextureImageCGL.h"
|
||||
#endif
|
||||
|
||||
using namespace mozilla::gfx;
|
||||
|
||||
namespace mozilla {
|
||||
namespace gl {
|
||||
|
||||
|
@ -516,10 +518,6 @@ TiledTextureImage::EndUpdate()
|
|||
|
||||
RefPtr<gfx::SourceSurface> updateSnapshot = mUpdateDrawTarget->Snapshot();
|
||||
RefPtr<gfx::DataSourceSurface> updateData = updateSnapshot->GetDataSurface();
|
||||
nsRefPtr<gfxASurface> updateSurface = new gfxImageSurface(updateData->GetData(),
|
||||
gfx::ThebesIntSize(updateData->GetSize()),
|
||||
updateData->Stride(),
|
||||
gfx::SurfaceFormatToImageFormat(updateData->GetFormat()));
|
||||
|
||||
// upload tiles from temp surface
|
||||
for (unsigned i = 0; i < mImages.Length(); i++) {
|
||||
|
@ -535,11 +533,18 @@ TiledTextureImage::EndUpdate()
|
|||
subregion.MoveBy(-xPos, -yPos); // Tile-local space
|
||||
// copy tile from temp target
|
||||
gfx::DrawTarget* drawTarget = mImages[i]->BeginUpdate(subregion);
|
||||
nsRefPtr<gfxContext> ctx = new gfxContext(drawTarget);
|
||||
gfxUtils::ClipToRegion(ctx, subregion);
|
||||
ctx->SetOperator(gfxContext::OPERATOR_SOURCE);
|
||||
ctx->SetSource(updateSurface, gfxPoint(-xPos, -yPos));
|
||||
ctx->Paint();
|
||||
MOZ_ASSERT(drawTarget->GetType() == BackendType::CAIRO,
|
||||
"updateSnapshot should not have been converted to data");
|
||||
gfxUtils::ClipToRegion(drawTarget, subregion);
|
||||
Size size(updateData->GetSize().width,
|
||||
updateData->GetSize().height);
|
||||
drawTarget->DrawSurface(updateData,
|
||||
Rect(Point(-xPos, -yPos), size),
|
||||
Rect(Point(0, 0), size),
|
||||
DrawSurfaceOptions(),
|
||||
DrawOptions(1.0, CompositionOp::OP_SOURCE,
|
||||
AntialiasMode::NONE));
|
||||
drawTarget->PopClip();
|
||||
mImages[i]->EndUpdate();
|
||||
}
|
||||
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче