├── example
├── jni
│ ├── Application.mk
│ ├── Android.mk
│ └── main.cpp
├── res
│ ├── drawable-hdpi
│ │ └── icon.png
│ ├── drawable-ldpi
│ │ └── icon.png
│ ├── drawable-mdpi
│ │ └── icon.png
│ ├── values
│ │ └── strings.xml
│ └── layout
│ │ └── main.xml
├── assets
│ └── my-example-db.sqlite3
├── .classpath
├── default.properties
├── AndroidManifest.xml
├── proguard.cfg
├── .project
└── .cproject
├── ReadMe.txt
├── sources
├── sqlite3ndk.h
└── sqlite3ndk.cpp
├── lgpl.txt
├── gpl-2.0.txt
└── MPL-1.1.txt
/example/jni/Application.mk:
--------------------------------------------------------------------------------
1 | APP_ABI := armeabi
2 | APP_MODULES := SQLite-NDK
3 | APP_PLATFORM := android-10
4 |
--------------------------------------------------------------------------------
/example/res/drawable-hdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KrystianBigaj/sqlite-ndk/HEAD/example/res/drawable-hdpi/icon.png
--------------------------------------------------------------------------------
/example/res/drawable-ldpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KrystianBigaj/sqlite-ndk/HEAD/example/res/drawable-ldpi/icon.png
--------------------------------------------------------------------------------
/example/res/drawable-mdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KrystianBigaj/sqlite-ndk/HEAD/example/res/drawable-mdpi/icon.png
--------------------------------------------------------------------------------
/example/assets/my-example-db.sqlite3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KrystianBigaj/sqlite-ndk/HEAD/example/assets/my-example-db.sqlite3
--------------------------------------------------------------------------------
/example/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Hello World, SQLiteNDKActivity!
4 | SQLite-NDK
5 |
6 |
--------------------------------------------------------------------------------
/example/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/default.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system use,
7 | # "build.properties", and override values to adapt the script to your
8 | # project structure.
9 |
10 | # Project target.
11 | target=android-10
12 |
--------------------------------------------------------------------------------
/example/res/layout/main.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/ReadMe.txt:
--------------------------------------------------------------------------------
1 | *** SQLite-NDK
2 |
3 | SQLite-NDK is a VFS (http://www.sqlite.org/vfs.html),
4 | that gives you access to SQLite database stored in .apk 'asset' directory.
5 |
6 | Requires Android 2.3+, you must link with 'android' library in your Android.mk:
7 | LOCAL_LDLIBS = -landroid ...
8 |
9 | Project page: http://github.com/Krystian-Bigaj/sqlite-ndk/
10 | Author: Krystian Bigaj
11 | Email: krystian.bigaj@gmail.com
12 | License: MPL 1.1/GPL 2.0/LGPL 2.1
13 |
--------------------------------------------------------------------------------
/example/jni/Android.mk:
--------------------------------------------------------------------------------
1 | LOCAL_PATH := $(call my-dir)
2 |
3 | include $(CLEAR_VARS)
4 |
5 | LOCAL_MODULE := SQLite-NDK
6 | LOCAL_LDLIBS := -llog -landroid
7 | LOCAL_STATIC_LIBRARIES := android_native_app_glue
8 |
9 | LOCAL_SRC_FILES := \
10 | main.cpp \
11 | sqlite3.c \
12 | ../../sources/sqlite3ndk.cpp
13 |
14 | LOCAL_C_INCLUDES := \
15 | $(LOCAL_PATH)/../../sources
16 |
17 | include $(BUILD_SHARED_LIBRARY)
18 |
19 | $(call import-module,android/native_app_glue)
--------------------------------------------------------------------------------
/example/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
10 |
13 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/example/proguard.cfg:
--------------------------------------------------------------------------------
1 | -optimizationpasses 5
2 | -dontusemixedcaseclassnames
3 | -dontskipnonpubliclibraryclasses
4 | -dontpreverify
5 | -verbose
6 | -optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
7 |
8 | -keep public class * extends android.app.Activity
9 | -keep public class * extends android.app.Application
10 | -keep public class * extends android.app.Service
11 | -keep public class * extends android.content.BroadcastReceiver
12 | -keep public class * extends android.content.ContentProvider
13 | -keep public class * extends android.app.backup.BackupAgentHelper
14 | -keep public class * extends android.preference.Preference
15 | -keep public class com.android.vending.licensing.ILicensingService
16 |
17 | -keepclasseswithmembernames class * {
18 | native ;
19 | }
20 |
21 | -keepclasseswithmembers class * {
22 | public (android.content.Context, android.util.AttributeSet);
23 | }
24 |
25 | -keepclasseswithmembers class * {
26 | public (android.content.Context, android.util.AttributeSet, int);
27 | }
28 |
29 | -keepclassmembers class * extends android.app.Activity {
30 | public void *(android.view.View);
31 | }
32 |
33 | -keepclassmembers enum * {
34 | public static **[] values();
35 | public static ** valueOf(java.lang.String);
36 | }
37 |
38 | -keep class * implements android.os.Parcelable {
39 | public static final android.os.Parcelable$Creator *;
40 | }
41 |
--------------------------------------------------------------------------------
/example/jni/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 |
9 | #include
10 | #include
11 |
12 | #ifndef LOG_TAG
13 | #define LOG_TAG "sqlite-ndk"
14 | #endif
15 |
16 | #define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__))
17 |
18 | void SQLiteNDKTest(void)
19 | {
20 | sqlite3 *db;
21 | sqlite3_stmt *stmt;
22 |
23 | LOGI("sqlite3_open_v2(my-example-db.sqlite3)");
24 |
25 | // Open database: my-example-db.sqlite3
26 | // Path is relative to 'assets' directory (.../example/assets)
27 | // Database can be opened only as read-only (SQLITE_OPEN_READONLY)
28 | // Last parameter is VFS name (SQLITE_NDK_VFS_NAME),
29 | // which can be used after inital call to: sqlite3_ndk_init (see below android_main)
30 | if (sqlite3_open_v2("my-example-db.sqlite3", &db, SQLITE_OPEN_READONLY,
31 | SQLITE_NDK_VFS_NAME) == SQLITE_OK)
32 | {
33 | LOGI("sqlite3_open_v2 SQLITE_OK");
34 |
35 | LOGI("sqlite3_prepare_v2(SELECT Value FROM MyTable)");
36 | if (sqlite3_prepare_v2(db, "SELECT Value FROM MyTable", -1, &stmt, NULL)
37 | == SQLITE_OK)
38 | {
39 | LOGI("SQLITE_OK");
40 |
41 | int err;
42 | LOGI("sqlite3_step");
43 | while ((err = sqlite3_step(stmt)) == SQLITE_ROW)
44 | {
45 | LOGI("sqlite3_step SQLITE_ROW");
46 |
47 | LOGI("sqlite3_column_text");
48 |
49 | // This should print:
50 | // Value: Hello world!
51 | LOGI("Value: %s\n\n", sqlite3_column_text(stmt, 0));
52 | }
53 |
54 | if (err != SQLITE_DONE)
55 | {
56 | LOGI("Query execution failed: %s\n",
57 | sqlite3_errmsg(db));
58 | }
59 |
60 | LOGI("sqlite3_finalize");
61 | sqlite3_finalize(stmt);
62 | }
63 | else
64 | {
65 | LOGI("Can't execute query: %s\n", sqlite3_errmsg(db));
66 | }
67 | }
68 | else
69 | {
70 | LOGI("Can't open database: %s\n", sqlite3_errmsg(db));
71 | }
72 |
73 | LOGI("sqlite3_close");
74 | sqlite3_close(db);
75 | }
76 |
77 | void android_main(struct android_app* app)
78 | {
79 | LOGI("sqlite3_ndk_init...");
80 |
81 | // Call sqlite3_ndk_init only once before using VFS (SQLITE_NDK_VFS_NAME),
82 | // it will register VFS into SQLite
83 | if (sqlite3_ndk_init(app->activity->assetManager) != SQLITE_OK)
84 | {
85 | LOGI("sqlite3_ndk_init failed!");
86 | return;
87 | }
88 | LOGI("sqlite3_ndk_init OK");
89 |
90 | SQLiteNDKTest();
91 |
92 | // Make sure glue isn't stripped.
93 | app_dummy();
94 | }
95 |
--------------------------------------------------------------------------------
/example/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | SQLite-NDK
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 | ?children?
14 | ?name?=outputEntries\|?children?=?name?=entry\\\\\\\|\\\|\||
15 |
16 |
17 | ?name?
18 |
19 |
20 |
21 | org.eclipse.cdt.make.core.append_environment
22 | true
23 |
24 |
25 | org.eclipse.cdt.make.core.buildArguments
26 | --login -c "cd /cygdrive/d/Projects/SQLite-NDK/example && ndk-build"
27 |
28 |
29 | org.eclipse.cdt.make.core.buildCommand
30 | D:\cygwin\bin\bash.exe
31 |
32 |
33 | org.eclipse.cdt.make.core.cleanBuildTarget
34 | clean
35 |
36 |
37 | org.eclipse.cdt.make.core.contents
38 | org.eclipse.cdt.make.core.activeConfigSettings
39 |
40 |
41 | org.eclipse.cdt.make.core.enableAutoBuild
42 | false
43 |
44 |
45 | org.eclipse.cdt.make.core.enableCleanBuild
46 | true
47 |
48 |
49 | org.eclipse.cdt.make.core.enableFullBuild
50 | true
51 |
52 |
53 | org.eclipse.cdt.make.core.fullBuildTarget
54 | V=1
55 |
56 |
57 | org.eclipse.cdt.make.core.stopOnError
58 | true
59 |
60 |
61 | org.eclipse.cdt.make.core.useDefaultBuildCmd
62 | false
63 |
64 |
65 |
66 |
67 | com.android.ide.eclipse.adt.ResourceManagerBuilder
68 |
69 |
70 |
71 |
72 | com.android.ide.eclipse.adt.PreCompilerBuilder
73 |
74 |
75 |
76 |
77 | org.eclipse.jdt.core.javabuilder
78 |
79 |
80 |
81 |
82 | com.android.ide.eclipse.adt.ApkBuilder
83 |
84 |
85 |
86 |
87 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
88 | full,incremental,
89 |
90 |
91 |
92 |
93 |
94 | com.android.ide.eclipse.adt.AndroidNature
95 | org.eclipse.jdt.core.javanature
96 | org.eclipse.cdt.core.cnature
97 | org.eclipse.cdt.core.ccnature
98 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
99 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
100 |
101 |
102 |
103 | sources
104 | 2
105 | PARENT-1-PROJECT_LOC/sources
106 |
107 |
108 |
109 |
--------------------------------------------------------------------------------
/sources/sqlite3ndk.h:
--------------------------------------------------------------------------------
1 | /* ***** BEGIN LICENSE BLOCK *****
2 | * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3 | *
4 | * The contents of this file are subject to the Mozilla Public License Version
5 | * 1.1 (the "License"); you may not use this file except in compliance with
6 | * the License. You may obtain a copy of the License at
7 | * http://www.mozilla.org/MPL/
8 | *
9 | * Software distributed under the License is distributed on an "AS IS" basis,
10 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 | * for the specific language governing rights and limitations under the
12 | * License.
13 | *
14 | * The Original Code is Krystian Bigaj code.
15 | *
16 | * The Initial Developer of the Original Code is
17 | * Krystian Bigaj (krystian.bigaj@gmail.com).
18 | * Portions created by the Initial Developer are Copyright (C) 2011
19 | * the Initial Developer. All Rights Reserved.
20 | *
21 | * Contributor(s):
22 | *
23 | * Alternatively, the contents of this file may be used under the terms of
24 | * either the GNU General Public License Version 2 or later (the "GPL"), or
25 | * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
26 | * in which case the provisions of the GPL or the LGPL are applicable instead
27 | * of those above. If you wish to allow use of your version of this file only
28 | * under the terms of either the GPL or the LGPL, and not to allow others to
29 | * use your version of this file under the terms of the MPL, indicate your
30 | * decision by deleting the provisions above and replace them with the notice
31 | * and other provisions required by the GPL or the LGPL. If you do not delete
32 | * the provisions above, a recipient may use your version of this file under
33 | * the terms of any one of the MPL, the GPL or the LGPL.
34 | *
35 | * ***** END LICENSE BLOCK ***** */
36 |
37 | #ifndef _SQLITE3_NDK_H_
38 | #define _SQLITE3_NDK_H_
39 |
40 | #include
41 | #include
42 |
43 | #ifndef SQLITE_NDK_VFS_NAME
44 | // Default name for VFS
45 | #define SQLITE_NDK_VFS_NAME "ndk-asset"
46 | #endif
47 |
48 | #ifndef SQLITE_NDK_VFS_MAKE_DEFAULT
49 | // Default sqlite3_ndk_init parameter
50 | #define SQLITE_NDK_VFS_MAKE_DEFAULT 0
51 | #endif
52 |
53 | // Default sqlite3_ndk_init parameter
54 | #define SQLITE_NDK_VFS_PARENT_VFS NULL
55 |
56 | #ifndef SQLITE_NDK_VFS_MAX_PATH
57 | // Maximum path name for database files
58 | #define SQLITE_NDK_VFS_MAX_PATH 512
59 | #endif
60 |
61 | /*
62 | * This function registers VFS into SQLite.
63 | * It should be called only once (before SQLite-NDK usage).
64 | *
65 | * Params:
66 | * - assetMgr - pointer to AAssetManager. In most cases it will be:
67 | * app->activity->assetManager (see example below).
68 | * This parameter is required
69 | * - vfsName - name of VFS that can be used in sqlite3_open_v2
70 | * as 4th parameter (http://www.sqlite.org/c3ref/open.html)
71 | * or in URI filename (http://www.sqlite.org/uri.html).
72 | * If NULL then default name "ndk-asset" is used (SQLITE_NDK_VFS_NAME)
73 | * - makeDflt - flag used to register SQLite-NDK as a default VFS.
74 | * See: sqlite3_vfs_register at http://www.sqlite.org/c3ref/vfs_find.html
75 | * Disabled by default (SQLITE_NDK_VFS_MAKE_DEFAULT)
76 | * - osVfs - name of VFS that will used only to redirect few sqlite calls.
77 | * If NULL passed, then default VFS will be used (SQLITE_NDK_VFS_PARENT_VFS)
78 | *
79 | * Example:
80 | * void android_main(struct android_app* app)
81 | * {
82 | * sqlite3_ndk_init(app->activity->assetManager);
83 | * ...
84 | * if (sqlite3_open_v2("data.sqlite3", &db, SQLITE_OPEN_READONLY,
85 | * SQLITE_NDK_VFS_NAME) == SQLITE_OK)
86 | * {
87 | * ...
88 | */
89 | int sqlite3_ndk_init(AAssetManager* assetMgr,
90 | const char* vfsName = SQLITE_NDK_VFS_NAME,
91 | int makeDflt = SQLITE_NDK_VFS_MAKE_DEFAULT,
92 | const char *osVfs = SQLITE_NDK_VFS_PARENT_VFS);
93 |
94 | #endif
95 |
--------------------------------------------------------------------------------
/lgpl.txt:
--------------------------------------------------------------------------------
1 | GNU LESSER GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 |
9 | This version of the GNU Lesser General Public License incorporates
10 | the terms and conditions of version 3 of the GNU General Public
11 | License, supplemented by the additional permissions listed below.
12 |
13 | 0. Additional Definitions.
14 |
15 | As used herein, "this License" refers to version 3 of the GNU Lesser
16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU
17 | General Public License.
18 |
19 | "The Library" refers to a covered work governed by this License,
20 | other than an Application or a Combined Work as defined below.
21 |
22 | An "Application" is any work that makes use of an interface provided
23 | by the Library, but which is not otherwise based on the Library.
24 | Defining a subclass of a class defined by the Library is deemed a mode
25 | of using an interface provided by the Library.
26 |
27 | A "Combined Work" is a work produced by combining or linking an
28 | Application with the Library. The particular version of the Library
29 | with which the Combined Work was made is also called the "Linked
30 | Version".
31 |
32 | The "Minimal Corresponding Source" for a Combined Work means the
33 | Corresponding Source for the Combined Work, excluding any source code
34 | for portions of the Combined Work that, considered in isolation, are
35 | based on the Application, and not on the Linked Version.
36 |
37 | The "Corresponding Application Code" for a Combined Work means the
38 | object code and/or source code for the Application, including any data
39 | and utility programs needed for reproducing the Combined Work from the
40 | Application, but excluding the System Libraries of the Combined Work.
41 |
42 | 1. Exception to Section 3 of the GNU GPL.
43 |
44 | You may convey a covered work under sections 3 and 4 of this License
45 | without being bound by section 3 of the GNU GPL.
46 |
47 | 2. Conveying Modified Versions.
48 |
49 | If you modify a copy of the Library, and, in your modifications, a
50 | facility refers to a function or data to be supplied by an Application
51 | that uses the facility (other than as an argument passed when the
52 | facility is invoked), then you may convey a copy of the modified
53 | version:
54 |
55 | a) under this License, provided that you make a good faith effort to
56 | ensure that, in the event an Application does not supply the
57 | function or data, the facility still operates, and performs
58 | whatever part of its purpose remains meaningful, or
59 |
60 | b) under the GNU GPL, with none of the additional permissions of
61 | this License applicable to that copy.
62 |
63 | 3. Object Code Incorporating Material from Library Header Files.
64 |
65 | The object code form of an Application may incorporate material from
66 | a header file that is part of the Library. You may convey such object
67 | code under terms of your choice, provided that, if the incorporated
68 | material is not limited to numerical parameters, data structure
69 | layouts and accessors, or small macros, inline functions and templates
70 | (ten or fewer lines in length), you do both of the following:
71 |
72 | a) Give prominent notice with each copy of the object code that the
73 | Library is used in it and that the Library and its use are
74 | covered by this License.
75 |
76 | b) Accompany the object code with a copy of the GNU GPL and this license
77 | document.
78 |
79 | 4. Combined Works.
80 |
81 | You may convey a Combined Work under terms of your choice that,
82 | taken together, effectively do not restrict modification of the
83 | portions of the Library contained in the Combined Work and reverse
84 | engineering for debugging such modifications, if you also do each of
85 | the following:
86 |
87 | a) Give prominent notice with each copy of the Combined Work that
88 | the Library is used in it and that the Library and its use are
89 | covered by this License.
90 |
91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license
92 | document.
93 |
94 | c) For a Combined Work that displays copyright notices during
95 | execution, include the copyright notice for the Library among
96 | these notices, as well as a reference directing the user to the
97 | copies of the GNU GPL and this license document.
98 |
99 | d) Do one of the following:
100 |
101 | 0) Convey the Minimal Corresponding Source under the terms of this
102 | License, and the Corresponding Application Code in a form
103 | suitable for, and under terms that permit, the user to
104 | recombine or relink the Application with a modified version of
105 | the Linked Version to produce a modified Combined Work, in the
106 | manner specified by section 6 of the GNU GPL for conveying
107 | Corresponding Source.
108 |
109 | 1) Use a suitable shared library mechanism for linking with the
110 | Library. A suitable mechanism is one that (a) uses at run time
111 | a copy of the Library already present on the user's computer
112 | system, and (b) will operate properly with a modified version
113 | of the Library that is interface-compatible with the Linked
114 | Version.
115 |
116 | e) Provide Installation Information, but only if you would otherwise
117 | be required to provide such information under section 6 of the
118 | GNU GPL, and only to the extent that such information is
119 | necessary to install and execute a modified version of the
120 | Combined Work produced by recombining or relinking the
121 | Application with a modified version of the Linked Version. (If
122 | you use option 4d0, the Installation Information must accompany
123 | the Minimal Corresponding Source and Corresponding Application
124 | Code. If you use option 4d1, you must provide the Installation
125 | Information in the manner specified by section 6 of the GNU GPL
126 | for conveying Corresponding Source.)
127 |
128 | 5. Combined Libraries.
129 |
130 | You may place library facilities that are a work based on the
131 | Library side by side in a single library together with other library
132 | facilities that are not Applications and are not covered by this
133 | License, and convey such a combined library under terms of your
134 | choice, if you do both of the following:
135 |
136 | a) Accompany the combined library with a copy of the same work based
137 | on the Library, uncombined with any other library facilities,
138 | conveyed under the terms of this License.
139 |
140 | b) Give prominent notice with the combined library that part of it
141 | is a work based on the Library, and explaining where to find the
142 | accompanying uncombined form of the same work.
143 |
144 | 6. Revised Versions of the GNU Lesser General Public License.
145 |
146 | The Free Software Foundation may publish revised and/or new versions
147 | of the GNU Lesser General Public License from time to time. Such new
148 | versions will be similar in spirit to the present version, but may
149 | differ in detail to address new problems or concerns.
150 |
151 | Each version is given a distinguishing version number. If the
152 | Library as you received it specifies that a certain numbered version
153 | of the GNU Lesser General Public License "or any later version"
154 | applies to it, you have the option of following the terms and
155 | conditions either of that published version or of any later version
156 | published by the Free Software Foundation. If the Library as you
157 | received it does not specify a version number of the GNU Lesser
158 | General Public License, you may choose any version of the GNU Lesser
159 | General Public License ever published by the Free Software Foundation.
160 |
161 | If the Library as you received it specifies that a proxy can decide
162 | whether future versions of the GNU Lesser General Public License shall
163 | apply, that proxy's public statement of acceptance of any version is
164 | permanent authorization for you to choose that version for the
165 | Library.
166 |
--------------------------------------------------------------------------------
/sources/sqlite3ndk.cpp:
--------------------------------------------------------------------------------
1 | /* ***** BEGIN LICENSE BLOCK *****
2 | * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3 | *
4 | * The contents of this file are subject to the Mozilla Public License Version
5 | * 1.1 (the "License"); you may not use this file except in compliance with
6 | * the License. You may obtain a copy of the License at
7 | * http://www.mozilla.org/MPL/
8 | *
9 | * Software distributed under the License is distributed on an "AS IS" basis,
10 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 | * for the specific language governing rights and limitations under the
12 | * License.
13 | *
14 | * The Original Code is Krystian Bigaj code.
15 | *
16 | * The Initial Developer of the Original Code is
17 | * Krystian Bigaj (krystian.bigaj@gmail.com).
18 | * Portions created by the Initial Developer are Copyright (C) 2011
19 | * the Initial Developer. All Rights Reserved.
20 | *
21 | * Contributor(s):
22 | *
23 | * Alternatively, the contents of this file may be used under the terms of
24 | * either the GNU General Public License Version 2 or later (the "GPL"), or
25 | * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
26 | * in which case the provisions of the GPL or the LGPL are applicable instead
27 | * of those above. If you wish to allow use of your version of this file only
28 | * under the terms of either the GPL or the LGPL, and not to allow others to
29 | * use your version of this file under the terms of the MPL, indicate your
30 | * decision by deleting the provisions above and replace them with the notice
31 | * and other provisions required by the GPL or the LGPL. If you do not delete
32 | * the provisions above, a recipient may use your version of this file under
33 | * the terms of any one of the MPL, the GPL or the LGPL.
34 | *
35 | * ***** END LICENSE BLOCK ***** */
36 |
37 | #include "sqlite3ndk.h"
38 |
39 | #include
40 | #include
41 |
42 | #ifndef SQLITE_DEFAULT_SECTOR_SIZE
43 | # define SQLITE_DEFAULT_SECTOR_SIZE 512
44 | #endif
45 |
46 | /**
47 | * The ndk_vfs structure is subclass of sqlite3_vfs specific
48 | * to the Android NDK AAssetManager VFS implementations
49 | */
50 | typedef struct ndk_vfs ndk_vfs;
51 | struct ndk_vfs
52 | {
53 | sqlite3_vfs vfs; /*** Must be first ***/
54 | sqlite3_vfs* vfsDefault;
55 | const struct sqlite3_io_methods *pMethods;
56 |
57 | AAssetManager* mgr;
58 | };
59 |
60 | /**
61 | * The ndk_file structure is subclass of sqlite3_file specific
62 | * to the Android NDK AAsset VFS implementations
63 | */
64 | typedef struct ndk_file ndk_file;
65 | struct ndk_file
66 | {
67 | const sqlite3_io_methods *pMethod; /*** Must be first ***/
68 |
69 | // Pointer to AAsset obtained by AAssetManager_open
70 | AAsset* asset;
71 |
72 | // Pointer to database content (AAsset_getBuffer)
73 | const void* buf;
74 |
75 | // Total lenght of database file (AAsset_getLength)
76 | off_t len;
77 | };
78 |
79 | /*
80 | * sqlite3_vfs.xOpen - open database file.
81 | * Implemented using AAssetManager_open
82 | */
83 | static int ndkOpen(sqlite3_vfs *pVfs, const char *zPath, sqlite3_file *pFile,
84 | int flags, int *pOutFlags)
85 | {
86 | const ndk_vfs* ndk = (ndk_vfs*) pVfs;
87 | ndk_file *ndkFile = (ndk_file*) pFile;
88 |
89 | // pMethod must be set to NULL, even if xOpen call fails.
90 | //
91 | // http://www.sqlite.org/c3ref/io_methods.html
92 | // "The only way to prevent a call to xClose following a failed sqlite3_vfs.xOpen
93 | // is for the sqlite3_vfs.xOpen to set the sqlite3_file.pMethods element to NULL."
94 | ndkFile->pMethod = NULL;
95 |
96 | // Allow only for opening main database file as read-only.
97 | // Opening JOURNAL/TEMP/WAL/etc. files will make call fails.
98 | // We don't need it, as DB opened from 'assets' .apk cannot
99 | // be modified
100 | if (
101 | !zPath ||
102 | (flags & SQLITE_OPEN_DELETEONCLOSE) ||
103 |
104 | !(flags & SQLITE_OPEN_READONLY) ||
105 | (flags & SQLITE_OPEN_READWRITE) ||
106 | (flags & SQLITE_OPEN_CREATE) ||
107 |
108 | !(flags & SQLITE_OPEN_MAIN_DB)
109 | )
110 | {
111 | return SQLITE_PERM;
112 | }
113 |
114 | // Try top open database file
115 | AAsset* asset = AAssetManager_open(ndk->mgr, zPath, AASSET_MODE_RANDOM);
116 | if (!asset)
117 | {
118 | return SQLITE_CANTOPEN;
119 | }
120 |
121 | // Get pointer to database. This call can fail in case for example
122 | // out of memory. If file inside .apk is compressed, then whole
123 | // file must be allocated and read into memory.
124 | // If file is not compressed (inside .apk/zip), then this functions returns pointer
125 | // to memory-mapped address in .apk file, so doesn't need to allocate
126 | // explicit additional memory.
127 | // As for today there is no simple way to set if specific file
128 | // must be compressed or not. You can control it only by file extension.
129 | // Google for: android kNoCompressExt
130 | const void* buf = AAsset_getBuffer(asset);
131 | if (!buf)
132 | {
133 | AAsset_close(asset);
134 | return SQLITE_ERROR;
135 | }
136 |
137 | ndkFile->pMethod = ndk->pMethods;
138 | ndkFile->asset = asset;
139 | ndkFile->buf = buf;
140 | ndkFile->len = AAsset_getLength(asset);
141 | if (pOutFlags)
142 | {
143 | *pOutFlags = flags;
144 | }
145 |
146 | return SQLITE_OK;
147 | }
148 |
149 | /*
150 | * sqlite3_vfs.xDelete - not implemented. Assets in .apk are read only
151 | */
152 | static int ndkDelete(sqlite3_vfs *pVfs, const char *zPath, int dirSync)
153 | {
154 | return SQLITE_ERROR;
155 | }
156 |
157 | /*
158 | * sqlite3_vfs.xAccess - tests if file exists and/or can be read.
159 | * Implemented using AAssetManager_open
160 | */
161 | static int ndkAccess(sqlite3_vfs *pVfs, const char *zPath, int flags,
162 | int *pResOut)
163 | {
164 | const ndk_vfs* ndk = (ndk_vfs*) pVfs;
165 |
166 | *pResOut = 0;
167 |
168 | switch (flags)
169 | {
170 | case SQLITE_ACCESS_EXISTS:
171 | case SQLITE_ACCESS_READ:
172 | AAsset* asset = AAssetManager_open(ndk->mgr, zPath, AASSET_MODE_RANDOM);
173 | if (asset)
174 | {
175 | AAsset_close(asset);
176 | *pResOut = 1;
177 | }
178 |
179 | break;
180 | }
181 |
182 | return SQLITE_OK;
183 | }
184 |
185 | /*
186 | * sqlite3_vfs.xFullPathname - all paths are root paths to 'assets' directory,
187 | * so just return copy of input path
188 | */
189 | static int ndkFullPathname(sqlite3_vfs *pVfs, const char *zPath, int nOut,
190 | char *zOut)
191 | {
192 | if (!zPath)
193 | {
194 | return SQLITE_ERROR;
195 | }
196 |
197 | int pos = 0;
198 | while (zPath[pos] && (pos < nOut))
199 | {
200 | zOut[pos] = zPath[pos];
201 | ++pos;
202 | }
203 | if (pos >= nOut)
204 | {
205 | return SQLITE_ERROR;
206 | }
207 | zOut[pos] = '\0';
208 |
209 | return SQLITE_OK;
210 | }
211 |
212 | /*
213 | * sqlite3_vfs.xRandomness - call redirected to default VFS.
214 | * See: sqlite3_ndk_init(..., ..., ..., osVfs)
215 | */
216 | static int ndkRandomness(sqlite3_vfs *pVfs, int nBuf, char *zBuf)
217 | {
218 | const ndk_vfs* ndk = (ndk_vfs*) pVfs;
219 |
220 | return ndk->vfsDefault->xRandomness(ndk->vfsDefault, nBuf, zBuf);
221 | }
222 |
223 | /*
224 | * sqlite3_vfs.xSleep - call redirected to default VFS.
225 | * See: sqlite3_ndk_init(..., ..., ..., osVfs)
226 | */
227 | static int ndkSleep(sqlite3_vfs *pVfs, int microseconds)
228 | {
229 | const ndk_vfs* ndk = (ndk_vfs*) pVfs;
230 |
231 | return ndk->vfsDefault->xSleep(ndk->vfsDefault, microseconds);
232 | }
233 |
234 | /*
235 | * sqlite3_vfs.xCurrentTime - call redirected to default VFS.
236 | * See: sqlite3_ndk_init(..., ..., ..., osVfs)
237 | */
238 | static int ndkCurrentTime(sqlite3_vfs *pVfs, double *prNow)
239 | {
240 | const ndk_vfs* ndk = (ndk_vfs*) pVfs;
241 |
242 | return ndk->vfsDefault->xCurrentTime(ndk->vfsDefault, prNow);
243 | }
244 |
245 | /*
246 | * sqlite3_vfs.xGetLastError - not implemented (no additional information)
247 | */
248 | static int ndkGetLastError(sqlite3_vfs *NotUsed1, int NotUsed2, char *NotUsed3)
249 | {
250 | return 0;
251 | }
252 |
253 | /*
254 | * sqlite3_vfs.xCurrentTimeInt64 - call redirected to default VFS.
255 | * See: sqlite3_ndk_init(..., ..., ..., osVfs)
256 | */
257 | static int ndkCurrentTimeInt64(sqlite3_vfs *pVfs, sqlite3_int64 *piNow)
258 | {
259 | const ndk_vfs* ndk = (ndk_vfs*) pVfs;
260 |
261 | return ndk->vfsDefault->xCurrentTimeInt64(ndk->vfsDefault, piNow);
262 | }
263 |
264 | /*
265 | * sqlite3_file.xClose - closing file opened in sqlite3_vfs.xOpen function.
266 | * Implemented using AAsset_close
267 | */
268 | static int ndkFileClose(sqlite3_file *pFile)
269 | {
270 | ndk_file* file = (ndk_file*) pFile;
271 |
272 | if (file->asset)
273 | {
274 | AAsset_close(file->asset);
275 | file->asset = NULL;
276 | file->buf = NULL;
277 | file->len = 0;
278 | }
279 |
280 | return SQLITE_OK;
281 | }
282 |
283 | /*
284 | * sqlite3_file.xRead - database read from asset memory.
285 | * See: AAsset_getBuffer in ndkOpen
286 | */
287 | static int ndkFileRead(sqlite3_file *pFile, void *pBuf, int amt,
288 | sqlite3_int64 offset)
289 | {
290 | const ndk_file* file = (ndk_file*) pFile;
291 | int got, off;
292 | int rc;
293 |
294 | off = (int) offset;
295 |
296 | // Sanity check
297 | if (file->asset == NULL)
298 | {
299 | return SQLITE_IOERR_READ;
300 | }
301 |
302 | if (off + amt <= file->len)
303 | {
304 | got = amt;
305 | rc = SQLITE_OK;
306 | }
307 | else
308 | {
309 | got = file->len - off;
310 | if (got < 0)
311 | {
312 | rc = SQLITE_IOERR_READ;
313 | }
314 | else
315 | {
316 | // http://www.sqlite.org/c3ref/io_methods.html
317 | // "If xRead() returns SQLITE_IOERR_SHORT_READ it must also
318 | // fill in the unread portions of the buffer with zeros.
319 | // A VFS that fails to zero-fill short reads might seem to work.
320 | // However, failure to zero-fill short reads will eventually lead
321 | // to database corruption."
322 | //
323 | // It might be not a problem in read-only databases,
324 | // but do it as documentation says
325 | rc = SQLITE_IOERR_SHORT_READ;
326 | memset(&((char*) pBuf)[got], 0, amt - got);
327 | }
328 | }
329 |
330 | if (got > 0)
331 | {
332 | memcpy(pBuf, (char*) file->buf + off, got);
333 | }
334 |
335 | return rc;
336 | }
337 |
338 | /*
339 | * sqlite3_file.xWrite - not implemented (.apk is read-only)
340 | */
341 | static int ndkFileWrite(sqlite3_file *, const void *, int, sqlite3_int64)
342 | {
343 | return SQLITE_IOERR_WRITE;
344 | }
345 |
346 | /*
347 | * sqlite3_file.xTruncate - not implemented (.apk is read-only)
348 | */
349 | static int ndkFileTruncate(sqlite3_file *, sqlite3_int64)
350 | {
351 | return SQLITE_IOERR_TRUNCATE;
352 | }
353 |
354 | /*
355 | * sqlite3_file.xSync - not implemented (.apk is read-only)
356 | */
357 | static int ndkFileSync(sqlite3_file *, int flags)
358 | {
359 | return SQLITE_IOERR_FSYNC;
360 | }
361 |
362 | /*
363 | * sqlite3_file.xFileSize - get database file size.
364 | * See: AAsset_getLength in ndkOpen
365 | */
366 | static int ndkFileSize(sqlite3_file *pFile, sqlite3_int64 *pSize)
367 | {
368 | ndk_file* file = (ndk_file*) pFile;
369 | *pSize = file->len;
370 |
371 | return SQLITE_OK;
372 | }
373 |
374 | /*
375 | * sqlite3_file.xLock - not implemented (.apk is read-only)
376 | */
377 | static int ndkFileLock(sqlite3_file *, int)
378 | {
379 | return SQLITE_OK;
380 | }
381 |
382 | /*
383 | * sqlite3_file.xUnlock - not implemented (.apk is read-only)
384 | */
385 | static int ndkFileUnlock(sqlite3_file *, int)
386 | {
387 | return SQLITE_OK;
388 | }
389 |
390 | /*
391 | * sqlite3_file.xCheckReservedLock - not implemented (.apk is read-only)
392 | */
393 | static int ndkFileCheckReservedLock(sqlite3_file *, int *pResOut)
394 | {
395 | *pResOut = 0;
396 |
397 | return SQLITE_OK;
398 | }
399 |
400 | /*
401 | * sqlite3_file.xFileControl - not implemented (no special codes needed for now)
402 | */
403 | static int ndkFileControl(sqlite3_file *, int, void *)
404 | {
405 | return SQLITE_NOTFOUND;
406 | }
407 |
408 | /*
409 | * sqlite3_file.xSectorSize - use same value as in os_unix.c
410 | */
411 | static int ndkFileSectorSize(sqlite3_file *)
412 | {
413 | return SQLITE_DEFAULT_SECTOR_SIZE;
414 | }
415 |
416 | /*
417 | * sqlite3_file.xDeviceCharacteristics - not implemented (.apk is read-only)
418 | */
419 | static int ndkFileDeviceCharacteristics(sqlite3_file *)
420 | {
421 | return 0;
422 | }
423 |
424 | /*
425 | * Register into SQLite. For more information see sqlite3ndk.h
426 | */
427 | int sqlite3_ndk_init(AAssetManager* assetMgr, const char* vfsName,
428 | int makeDflt, const char *osVfs)
429 | {
430 | static ndk_vfs ndkVfs;
431 | int rc;
432 |
433 | // assetMgr is required parameter
434 | if (!assetMgr)
435 | {
436 | return SQLITE_ERROR;
437 | }
438 |
439 | // Check if there was successful call to sqlite3_ndk_init before
440 | if (ndkVfs.mgr)
441 | {
442 | if (ndkVfs.mgr == assetMgr)
443 | {
444 | return SQLITE_OK;
445 | }
446 | else
447 | {
448 | // Second call to sqlite3_ndk_init cannot change assetMgr
449 | return SQLITE_ERROR;
450 | }
451 | }
452 |
453 | // Find os VFS. Used to redirect xRandomness, xSleep, xCurrentTime, ndkCurrentTimeInt64 calls
454 | ndkVfs.vfsDefault = sqlite3_vfs_find(osVfs);
455 | if (ndkVfs.vfsDefault == NULL)
456 | {
457 | return SQLITE_ERROR;
458 | }
459 |
460 | // vfsFile
461 | static const sqlite3_io_methods ndkFileMethods =
462 | {
463 | 1,
464 | ndkFileClose,
465 | ndkFileRead,
466 | ndkFileWrite,
467 | ndkFileTruncate,
468 | ndkFileSync,
469 | ndkFileSize,
470 | ndkFileLock,
471 | ndkFileUnlock,
472 | ndkFileCheckReservedLock,
473 | ndkFileControl,
474 | ndkFileSectorSize,
475 | ndkFileDeviceCharacteristics
476 | };
477 |
478 | // pMethods will be used in ndkOpen
479 | ndkVfs.pMethods = &ndkFileMethods;
480 |
481 | // vfs
482 | ndkVfs.vfs.iVersion = 3;
483 | ndkVfs.vfs.szOsFile = sizeof(ndk_file);
484 | ndkVfs.vfs.mxPathname = SQLITE_NDK_VFS_MAX_PATH;
485 | ndkVfs.vfs.pNext = 0;
486 | if (vfsName)
487 | {
488 | ndkVfs.vfs.zName = vfsName;
489 | }
490 | else
491 | {
492 | ndkVfs.vfs.zName = SQLITE_NDK_VFS_NAME;
493 | }
494 | ndkVfs.vfs.pAppData = 0;
495 | ndkVfs.vfs.xOpen = ndkOpen;
496 | ndkVfs.vfs.xDelete = ndkDelete;
497 | ndkVfs.vfs.xAccess = ndkAccess;
498 | ndkVfs.vfs.xFullPathname = ndkFullPathname;
499 | ndkVfs.vfs.xDlOpen = 0;
500 | ndkVfs.vfs.xDlError = 0;
501 | ndkVfs.vfs.xDlSym = 0;
502 | ndkVfs.vfs.xDlClose = 0;
503 | ndkVfs.vfs.xRandomness = ndkRandomness;
504 | ndkVfs.vfs.xSleep = ndkSleep;
505 | ndkVfs.vfs.xCurrentTime = ndkCurrentTime;
506 | ndkVfs.vfs.xGetLastError = ndkGetLastError;
507 | ndkVfs.vfs.xCurrentTimeInt64 = ndkCurrentTimeInt64;
508 | ndkVfs.vfs.xSetSystemCall = 0;
509 | ndkVfs.vfs.xGetSystemCall = 0;
510 | ndkVfs.vfs.xNextSystemCall = 0;
511 |
512 | // Asset manager
513 | ndkVfs.mgr = assetMgr;
514 |
515 | // Last part, try to register VFS
516 | rc = sqlite3_vfs_register(&ndkVfs.vfs, makeDflt);
517 |
518 | if (rc != SQLITE_OK)
519 | {
520 | // sqlite3_vfs_register could fails in case of sqlite3_initialize failure
521 | ndkVfs.mgr = 0;
522 | }
523 |
524 | return rc;
525 | }
526 |
--------------------------------------------------------------------------------
/example/.cproject:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 |
--------------------------------------------------------------------------------
/gpl-2.0.txt:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 2, June 1991
3 |
4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6 | Everyone is permitted to copy and distribute verbatim copies
7 | of this license document, but changing it is not allowed.
8 |
9 | Preamble
10 |
11 | The licenses for most software are designed to take away your
12 | freedom to share and change it. By contrast, the GNU General Public
13 | License is intended to guarantee your freedom to share and change free
14 | software--to make sure the software is free for all its users. This
15 | General Public License applies to most of the Free Software
16 | Foundation's software and to any other program whose authors commit to
17 | using it. (Some other Free Software Foundation software is covered by
18 | the GNU Lesser General Public License instead.) You can apply it to
19 | your programs, too.
20 |
21 | When we speak of free software, we are referring to freedom, not
22 | price. Our General Public Licenses are designed to make sure that you
23 | have the freedom to distribute copies of free software (and charge for
24 | this service if you wish), that you receive source code or can get it
25 | if you want it, that you can change the software or use pieces of it
26 | in new free programs; and that you know you can do these things.
27 |
28 | To protect your rights, we need to make restrictions that forbid
29 | anyone to deny you these rights or to ask you to surrender the rights.
30 | These restrictions translate to certain responsibilities for you if you
31 | distribute copies of the software, or if you modify it.
32 |
33 | For example, if you distribute copies of such a program, whether
34 | gratis or for a fee, you must give the recipients all the rights that
35 | you have. You must make sure that they, too, receive or can get the
36 | source code. And you must show them these terms so they know their
37 | rights.
38 |
39 | We protect your rights with two steps: (1) copyright the software, and
40 | (2) offer you this license which gives you legal permission to copy,
41 | distribute and/or modify the software.
42 |
43 | Also, for each author's protection and ours, we want to make certain
44 | that everyone understands that there is no warranty for this free
45 | software. If the software is modified by someone else and passed on, we
46 | want its recipients to know that what they have is not the original, so
47 | that any problems introduced by others will not reflect on the original
48 | authors' reputations.
49 |
50 | Finally, any free program is threatened constantly by software
51 | patents. We wish to avoid the danger that redistributors of a free
52 | program will individually obtain patent licenses, in effect making the
53 | program proprietary. To prevent this, we have made it clear that any
54 | patent must be licensed for everyone's free use or not licensed at all.
55 |
56 | The precise terms and conditions for copying, distribution and
57 | modification follow.
58 |
59 | GNU GENERAL PUBLIC LICENSE
60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61 |
62 | 0. This License applies to any program or other work which contains
63 | a notice placed by the copyright holder saying it may be distributed
64 | under the terms of this General Public License. The "Program", below,
65 | refers to any such program or work, and a "work based on the Program"
66 | means either the Program or any derivative work under copyright law:
67 | that is to say, a work containing the Program or a portion of it,
68 | either verbatim or with modifications and/or translated into another
69 | language. (Hereinafter, translation is included without limitation in
70 | the term "modification".) Each licensee is addressed as "you".
71 |
72 | Activities other than copying, distribution and modification are not
73 | covered by this License; they are outside its scope. The act of
74 | running the Program is not restricted, and the output from the Program
75 | is covered only if its contents constitute a work based on the
76 | Program (independent of having been made by running the Program).
77 | Whether that is true depends on what the Program does.
78 |
79 | 1. You may copy and distribute verbatim copies of the Program's
80 | source code as you receive it, in any medium, provided that you
81 | conspicuously and appropriately publish on each copy an appropriate
82 | copyright notice and disclaimer of warranty; keep intact all the
83 | notices that refer to this License and to the absence of any warranty;
84 | and give any other recipients of the Program a copy of this License
85 | along with the Program.
86 |
87 | You may charge a fee for the physical act of transferring a copy, and
88 | you may at your option offer warranty protection in exchange for a fee.
89 |
90 | 2. You may modify your copy or copies of the Program or any portion
91 | of it, thus forming a work based on the Program, and copy and
92 | distribute such modifications or work under the terms of Section 1
93 | above, provided that you also meet all of these conditions:
94 |
95 | a) You must cause the modified files to carry prominent notices
96 | stating that you changed the files and the date of any change.
97 |
98 | b) You must cause any work that you distribute or publish, that in
99 | whole or in part contains or is derived from the Program or any
100 | part thereof, to be licensed as a whole at no charge to all third
101 | parties under the terms of this License.
102 |
103 | c) If the modified program normally reads commands interactively
104 | when run, you must cause it, when started running for such
105 | interactive use in the most ordinary way, to print or display an
106 | announcement including an appropriate copyright notice and a
107 | notice that there is no warranty (or else, saying that you provide
108 | a warranty) and that users may redistribute the program under
109 | these conditions, and telling the user how to view a copy of this
110 | License. (Exception: if the Program itself is interactive but
111 | does not normally print such an announcement, your work based on
112 | the Program is not required to print an announcement.)
113 |
114 | These requirements apply to the modified work as a whole. If
115 | identifiable sections of that work are not derived from the Program,
116 | and can be reasonably considered independent and separate works in
117 | themselves, then this License, and its terms, do not apply to those
118 | sections when you distribute them as separate works. But when you
119 | distribute the same sections as part of a whole which is a work based
120 | on the Program, the distribution of the whole must be on the terms of
121 | this License, whose permissions for other licensees extend to the
122 | entire whole, and thus to each and every part regardless of who wrote it.
123 |
124 | Thus, it is not the intent of this section to claim rights or contest
125 | your rights to work written entirely by you; rather, the intent is to
126 | exercise the right to control the distribution of derivative or
127 | collective works based on the Program.
128 |
129 | In addition, mere aggregation of another work not based on the Program
130 | with the Program (or with a work based on the Program) on a volume of
131 | a storage or distribution medium does not bring the other work under
132 | the scope of this License.
133 |
134 | 3. You may copy and distribute the Program (or a work based on it,
135 | under Section 2) in object code or executable form under the terms of
136 | Sections 1 and 2 above provided that you also do one of the following:
137 |
138 | a) Accompany it with the complete corresponding machine-readable
139 | source code, which must be distributed under the terms of Sections
140 | 1 and 2 above on a medium customarily used for software interchange; or,
141 |
142 | b) Accompany it with a written offer, valid for at least three
143 | years, to give any third party, for a charge no more than your
144 | cost of physically performing source distribution, a complete
145 | machine-readable copy of the corresponding source code, to be
146 | distributed under the terms of Sections 1 and 2 above on a medium
147 | customarily used for software interchange; or,
148 |
149 | c) Accompany it with the information you received as to the offer
150 | to distribute corresponding source code. (This alternative is
151 | allowed only for noncommercial distribution and only if you
152 | received the program in object code or executable form with such
153 | an offer, in accord with Subsection b above.)
154 |
155 | The source code for a work means the preferred form of the work for
156 | making modifications to it. For an executable work, complete source
157 | code means all the source code for all modules it contains, plus any
158 | associated interface definition files, plus the scripts used to
159 | control compilation and installation of the executable. However, as a
160 | special exception, the source code distributed need not include
161 | anything that is normally distributed (in either source or binary
162 | form) with the major components (compiler, kernel, and so on) of the
163 | operating system on which the executable runs, unless that component
164 | itself accompanies the executable.
165 |
166 | If distribution of executable or object code is made by offering
167 | access to copy from a designated place, then offering equivalent
168 | access to copy the source code from the same place counts as
169 | distribution of the source code, even though third parties are not
170 | compelled to copy the source along with the object code.
171 |
172 | 4. You may not copy, modify, sublicense, or distribute the Program
173 | except as expressly provided under this License. Any attempt
174 | otherwise to copy, modify, sublicense or distribute the Program is
175 | void, and will automatically terminate your rights under this License.
176 | However, parties who have received copies, or rights, from you under
177 | this License will not have their licenses terminated so long as such
178 | parties remain in full compliance.
179 |
180 | 5. You are not required to accept this License, since you have not
181 | signed it. However, nothing else grants you permission to modify or
182 | distribute the Program or its derivative works. These actions are
183 | prohibited by law if you do not accept this License. Therefore, by
184 | modifying or distributing the Program (or any work based on the
185 | Program), you indicate your acceptance of this License to do so, and
186 | all its terms and conditions for copying, distributing or modifying
187 | the Program or works based on it.
188 |
189 | 6. Each time you redistribute the Program (or any work based on the
190 | Program), the recipient automatically receives a license from the
191 | original licensor to copy, distribute or modify the Program subject to
192 | these terms and conditions. You may not impose any further
193 | restrictions on the recipients' exercise of the rights granted herein.
194 | You are not responsible for enforcing compliance by third parties to
195 | this License.
196 |
197 | 7. If, as a consequence of a court judgment or allegation of patent
198 | infringement or for any other reason (not limited to patent issues),
199 | conditions are imposed on you (whether by court order, agreement or
200 | otherwise) that contradict the conditions of this License, they do not
201 | excuse you from the conditions of this License. If you cannot
202 | distribute so as to satisfy simultaneously your obligations under this
203 | License and any other pertinent obligations, then as a consequence you
204 | may not distribute the Program at all. For example, if a patent
205 | license would not permit royalty-free redistribution of the Program by
206 | all those who receive copies directly or indirectly through you, then
207 | the only way you could satisfy both it and this License would be to
208 | refrain entirely from distribution of the Program.
209 |
210 | If any portion of this section is held invalid or unenforceable under
211 | any particular circumstance, the balance of the section is intended to
212 | apply and the section as a whole is intended to apply in other
213 | circumstances.
214 |
215 | It is not the purpose of this section to induce you to infringe any
216 | patents or other property right claims or to contest validity of any
217 | such claims; this section has the sole purpose of protecting the
218 | integrity of the free software distribution system, which is
219 | implemented by public license practices. Many people have made
220 | generous contributions to the wide range of software distributed
221 | through that system in reliance on consistent application of that
222 | system; it is up to the author/donor to decide if he or she is willing
223 | to distribute software through any other system and a licensee cannot
224 | impose that choice.
225 |
226 | This section is intended to make thoroughly clear what is believed to
227 | be a consequence of the rest of this License.
228 |
229 | 8. If the distribution and/or use of the Program is restricted in
230 | certain countries either by patents or by copyrighted interfaces, the
231 | original copyright holder who places the Program under this License
232 | may add an explicit geographical distribution limitation excluding
233 | those countries, so that distribution is permitted only in or among
234 | countries not thus excluded. In such case, this License incorporates
235 | the limitation as if written in the body of this License.
236 |
237 | 9. The Free Software Foundation may publish revised and/or new versions
238 | of the General Public License from time to time. Such new versions will
239 | be similar in spirit to the present version, but may differ in detail to
240 | address new problems or concerns.
241 |
242 | Each version is given a distinguishing version number. If the Program
243 | specifies a version number of this License which applies to it and "any
244 | later version", you have the option of following the terms and conditions
245 | either of that version or of any later version published by the Free
246 | Software Foundation. If the Program does not specify a version number of
247 | this License, you may choose any version ever published by the Free Software
248 | Foundation.
249 |
250 | 10. If you wish to incorporate parts of the Program into other free
251 | programs whose distribution conditions are different, write to the author
252 | to ask for permission. For software which is copyrighted by the Free
253 | Software Foundation, write to the Free Software Foundation; we sometimes
254 | make exceptions for this. Our decision will be guided by the two goals
255 | of preserving the free status of all derivatives of our free software and
256 | of promoting the sharing and reuse of software generally.
257 |
258 | NO WARRANTY
259 |
260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268 | REPAIR OR CORRECTION.
269 |
270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278 | POSSIBILITY OF SUCH DAMAGES.
279 |
280 | END OF TERMS AND CONDITIONS
281 |
282 | How to Apply These Terms to Your New Programs
283 |
284 | If you develop a new program, and you want it to be of the greatest
285 | possible use to the public, the best way to achieve this is to make it
286 | free software which everyone can redistribute and change under these terms.
287 |
288 | To do so, attach the following notices to the program. It is safest
289 | to attach them to the start of each source file to most effectively
290 | convey the exclusion of warranty; and each file should have at least
291 | the "copyright" line and a pointer to where the full notice is found.
292 |
293 |
294 | Copyright (C)
295 |
296 | This program is free software; you can redistribute it and/or modify
297 | it under the terms of the GNU General Public License as published by
298 | the Free Software Foundation; either version 2 of the License, or
299 | (at your option) any later version.
300 |
301 | This program is distributed in the hope that it will be useful,
302 | but WITHOUT ANY WARRANTY; without even the implied warranty of
303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304 | GNU General Public License for more details.
305 |
306 | You should have received a copy of the GNU General Public License along
307 | with this program; if not, write to the Free Software Foundation, Inc.,
308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309 |
310 | Also add information on how to contact you by electronic and paper mail.
311 |
312 | If the program is interactive, make it output a short notice like this
313 | when it starts in an interactive mode:
314 |
315 | Gnomovision version 69, Copyright (C) year name of author
316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317 | This is free software, and you are welcome to redistribute it
318 | under certain conditions; type `show c' for details.
319 |
320 | The hypothetical commands `show w' and `show c' should show the appropriate
321 | parts of the General Public License. Of course, the commands you use may
322 | be called something other than `show w' and `show c'; they could even be
323 | mouse-clicks or menu items--whatever suits your program.
324 |
325 | You should also get your employer (if you work as a programmer) or your
326 | school, if any, to sign a "copyright disclaimer" for the program, if
327 | necessary. Here is a sample; alter the names:
328 |
329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330 | `Gnomovision' (which makes passes at compilers) written by James Hacker.
331 |
332 | , 1 April 1989
333 | Ty Coon, President of Vice
334 |
335 | This General Public License does not permit incorporating your program into
336 | proprietary programs. If your program is a subroutine library, you may
337 | consider it more useful to permit linking proprietary applications with the
338 | library. If this is what you want to do, use the GNU Lesser General
339 | Public License instead of this License.
340 |
--------------------------------------------------------------------------------
/MPL-1.1.txt:
--------------------------------------------------------------------------------
1 | MOZILLA PUBLIC LICENSE
2 | Version 1.1
3 |
4 | ---------------
5 |
6 | 1. Definitions.
7 |
8 | 1.0.1. "Commercial Use" means distribution or otherwise making the
9 | Covered Code available to a third party.
10 |
11 | 1.1. "Contributor" means each entity that creates or contributes to
12 | the creation of Modifications.
13 |
14 | 1.2. "Contributor Version" means the combination of the Original
15 | Code, prior Modifications used by a Contributor, and the Modifications
16 | made by that particular Contributor.
17 |
18 | 1.3. "Covered Code" means the Original Code or Modifications or the
19 | combination of the Original Code and Modifications, in each case
20 | including portions thereof.
21 |
22 | 1.4. "Electronic Distribution Mechanism" means a mechanism generally
23 | accepted in the software development community for the electronic
24 | transfer of data.
25 |
26 | 1.5. "Executable" means Covered Code in any form other than Source
27 | Code.
28 |
29 | 1.6. "Initial Developer" means the individual or entity identified
30 | as the Initial Developer in the Source Code notice required by Exhibit
31 | A.
32 |
33 | 1.7. "Larger Work" means a work which combines Covered Code or
34 | portions thereof with code not governed by the terms of this License.
35 |
36 | 1.8. "License" means this document.
37 |
38 | 1.8.1. "Licensable" means having the right to grant, to the maximum
39 | extent possible, whether at the time of the initial grant or
40 | subsequently acquired, any and all of the rights conveyed herein.
41 |
42 | 1.9. "Modifications" means any addition to or deletion from the
43 | substance or structure of either the Original Code or any previous
44 | Modifications. When Covered Code is released as a series of files, a
45 | Modification is:
46 | A. Any addition to or deletion from the contents of a file
47 | containing Original Code or previous Modifications.
48 |
49 | B. Any new file that contains any part of the Original Code or
50 | previous Modifications.
51 |
52 | 1.10. "Original Code" means Source Code of computer software code
53 | which is described in the Source Code notice required by Exhibit A as
54 | Original Code, and which, at the time of its release under this
55 | License is not already Covered Code governed by this License.
56 |
57 | 1.10.1. "Patent Claims" means any patent claim(s), now owned or
58 | hereafter acquired, including without limitation, method, process,
59 | and apparatus claims, in any patent Licensable by grantor.
60 |
61 | 1.11. "Source Code" means the preferred form of the Covered Code for
62 | making modifications to it, including all modules it contains, plus
63 | any associated interface definition files, scripts used to control
64 | compilation and installation of an Executable, or source code
65 | differential comparisons against either the Original Code or another
66 | well known, available Covered Code of the Contributor's choice. The
67 | Source Code can be in a compressed or archival form, provided the
68 | appropriate decompression or de-archiving software is widely available
69 | for no charge.
70 |
71 | 1.12. "You" (or "Your") means an individual or a legal entity
72 | exercising rights under, and complying with all of the terms of, this
73 | License or a future version of this License issued under Section 6.1.
74 | For legal entities, "You" includes any entity which controls, is
75 | controlled by, or is under common control with You. For purposes of
76 | this definition, "control" means (a) the power, direct or indirect,
77 | to cause the direction or management of such entity, whether by
78 | contract or otherwise, or (b) ownership of more than fifty percent
79 | (50%) of the outstanding shares or beneficial ownership of such
80 | entity.
81 |
82 | 2. Source Code License.
83 |
84 | 2.1. The Initial Developer Grant.
85 | The Initial Developer hereby grants You a world-wide, royalty-free,
86 | non-exclusive license, subject to third party intellectual property
87 | claims:
88 | (a) under intellectual property rights (other than patent or
89 | trademark) Licensable by Initial Developer to use, reproduce,
90 | modify, display, perform, sublicense and distribute the Original
91 | Code (or portions thereof) with or without Modifications, and/or
92 | as part of a Larger Work; and
93 |
94 | (b) under Patents Claims infringed by the making, using or
95 | selling of Original Code, to make, have made, use, practice,
96 | sell, and offer for sale, and/or otherwise dispose of the
97 | Original Code (or portions thereof).
98 |
99 | (c) the licenses granted in this Section 2.1(a) and (b) are
100 | effective on the date Initial Developer first distributes
101 | Original Code under the terms of this License.
102 |
103 | (d) Notwithstanding Section 2.1(b) above, no patent license is
104 | granted: 1) for code that You delete from the Original Code; 2)
105 | separate from the Original Code; or 3) for infringements caused
106 | by: i) the modification of the Original Code or ii) the
107 | combination of the Original Code with other software or devices.
108 |
109 | 2.2. Contributor Grant.
110 | Subject to third party intellectual property claims, each Contributor
111 | hereby grants You a world-wide, royalty-free, non-exclusive license
112 |
113 | (a) under intellectual property rights (other than patent or
114 | trademark) Licensable by Contributor, to use, reproduce, modify,
115 | display, perform, sublicense and distribute the Modifications
116 | created by such Contributor (or portions thereof) either on an
117 | unmodified basis, with other Modifications, as Covered Code
118 | and/or as part of a Larger Work; and
119 |
120 | (b) under Patent Claims infringed by the making, using, or
121 | selling of Modifications made by that Contributor either alone
122 | and/or in combination with its Contributor Version (or portions
123 | of such combination), to make, use, sell, offer for sale, have
124 | made, and/or otherwise dispose of: 1) Modifications made by that
125 | Contributor (or portions thereof); and 2) the combination of
126 | Modifications made by that Contributor with its Contributor
127 | Version (or portions of such combination).
128 |
129 | (c) the licenses granted in Sections 2.2(a) and 2.2(b) are
130 | effective on the date Contributor first makes Commercial Use of
131 | the Covered Code.
132 |
133 | (d) Notwithstanding Section 2.2(b) above, no patent license is
134 | granted: 1) for any code that Contributor has deleted from the
135 | Contributor Version; 2) separate from the Contributor Version;
136 | 3) for infringements caused by: i) third party modifications of
137 | Contributor Version or ii) the combination of Modifications made
138 | by that Contributor with other software (except as part of the
139 | Contributor Version) or other devices; or 4) under Patent Claims
140 | infringed by Covered Code in the absence of Modifications made by
141 | that Contributor.
142 |
143 | 3. Distribution Obligations.
144 |
145 | 3.1. Application of License.
146 | The Modifications which You create or to which You contribute are
147 | governed by the terms of this License, including without limitation
148 | Section 2.2. The Source Code version of Covered Code may be
149 | distributed only under the terms of this License or a future version
150 | of this License released under Section 6.1, and You must include a
151 | copy of this License with every copy of the Source Code You
152 | distribute. You may not offer or impose any terms on any Source Code
153 | version that alters or restricts the applicable version of this
154 | License or the recipients' rights hereunder. However, You may include
155 | an additional document offering the additional rights described in
156 | Section 3.5.
157 |
158 | 3.2. Availability of Source Code.
159 | Any Modification which You create or to which You contribute must be
160 | made available in Source Code form under the terms of this License
161 | either on the same media as an Executable version or via an accepted
162 | Electronic Distribution Mechanism to anyone to whom you made an
163 | Executable version available; and if made available via Electronic
164 | Distribution Mechanism, must remain available for at least twelve (12)
165 | months after the date it initially became available, or at least six
166 | (6) months after a subsequent version of that particular Modification
167 | has been made available to such recipients. You are responsible for
168 | ensuring that the Source Code version remains available even if the
169 | Electronic Distribution Mechanism is maintained by a third party.
170 |
171 | 3.3. Description of Modifications.
172 | You must cause all Covered Code to which You contribute to contain a
173 | file documenting the changes You made to create that Covered Code and
174 | the date of any change. You must include a prominent statement that
175 | the Modification is derived, directly or indirectly, from Original
176 | Code provided by the Initial Developer and including the name of the
177 | Initial Developer in (a) the Source Code, and (b) in any notice in an
178 | Executable version or related documentation in which You describe the
179 | origin or ownership of the Covered Code.
180 |
181 | 3.4. Intellectual Property Matters
182 | (a) Third Party Claims.
183 | If Contributor has knowledge that a license under a third party's
184 | intellectual property rights is required to exercise the rights
185 | granted by such Contributor under Sections 2.1 or 2.2,
186 | Contributor must include a text file with the Source Code
187 | distribution titled "LEGAL" which describes the claim and the
188 | party making the claim in sufficient detail that a recipient will
189 | know whom to contact. If Contributor obtains such knowledge after
190 | the Modification is made available as described in Section 3.2,
191 | Contributor shall promptly modify the LEGAL file in all copies
192 | Contributor makes available thereafter and shall take other steps
193 | (such as notifying appropriate mailing lists or newsgroups)
194 | reasonably calculated to inform those who received the Covered
195 | Code that new knowledge has been obtained.
196 |
197 | (b) Contributor APIs.
198 | If Contributor's Modifications include an application programming
199 | interface and Contributor has knowledge of patent licenses which
200 | are reasonably necessary to implement that API, Contributor must
201 | also include this information in the LEGAL file.
202 |
203 | (c) Representations.
204 | Contributor represents that, except as disclosed pursuant to
205 | Section 3.4(a) above, Contributor believes that Contributor's
206 | Modifications are Contributor's original creation(s) and/or
207 | Contributor has sufficient rights to grant the rights conveyed by
208 | this License.
209 |
210 | 3.5. Required Notices.
211 | You must duplicate the notice in Exhibit A in each file of the Source
212 | Code. If it is not possible to put such notice in a particular Source
213 | Code file due to its structure, then You must include such notice in a
214 | location (such as a relevant directory) where a user would be likely
215 | to look for such a notice. If You created one or more Modification(s)
216 | You may add your name as a Contributor to the notice described in
217 | Exhibit A. You must also duplicate this License in any documentation
218 | for the Source Code where You describe recipients' rights or ownership
219 | rights relating to Covered Code. You may choose to offer, and to
220 | charge a fee for, warranty, support, indemnity or liability
221 | obligations to one or more recipients of Covered Code. However, You
222 | may do so only on Your own behalf, and not on behalf of the Initial
223 | Developer or any Contributor. You must make it absolutely clear than
224 | any such warranty, support, indemnity or liability obligation is
225 | offered by You alone, and You hereby agree to indemnify the Initial
226 | Developer and every Contributor for any liability incurred by the
227 | Initial Developer or such Contributor as a result of warranty,
228 | support, indemnity or liability terms You offer.
229 |
230 | 3.6. Distribution of Executable Versions.
231 | You may distribute Covered Code in Executable form only if the
232 | requirements of Section 3.1-3.5 have been met for that Covered Code,
233 | and if You include a notice stating that the Source Code version of
234 | the Covered Code is available under the terms of this License,
235 | including a description of how and where You have fulfilled the
236 | obligations of Section 3.2. The notice must be conspicuously included
237 | in any notice in an Executable version, related documentation or
238 | collateral in which You describe recipients' rights relating to the
239 | Covered Code. You may distribute the Executable version of Covered
240 | Code or ownership rights under a license of Your choice, which may
241 | contain terms different from this License, provided that You are in
242 | compliance with the terms of this License and that the license for the
243 | Executable version does not attempt to limit or alter the recipient's
244 | rights in the Source Code version from the rights set forth in this
245 | License. If You distribute the Executable version under a different
246 | license You must make it absolutely clear that any terms which differ
247 | from this License are offered by You alone, not by the Initial
248 | Developer or any Contributor. You hereby agree to indemnify the
249 | Initial Developer and every Contributor for any liability incurred by
250 | the Initial Developer or such Contributor as a result of any such
251 | terms You offer.
252 |
253 | 3.7. Larger Works.
254 | You may create a Larger Work by combining Covered Code with other code
255 | not governed by the terms of this License and distribute the Larger
256 | Work as a single product. In such a case, You must make sure the
257 | requirements of this License are fulfilled for the Covered Code.
258 |
259 | 4. Inability to Comply Due to Statute or Regulation.
260 |
261 | If it is impossible for You to comply with any of the terms of this
262 | License with respect to some or all of the Covered Code due to
263 | statute, judicial order, or regulation then You must: (a) comply with
264 | the terms of this License to the maximum extent possible; and (b)
265 | describe the limitations and the code they affect. Such description
266 | must be included in the LEGAL file described in Section 3.4 and must
267 | be included with all distributions of the Source Code. Except to the
268 | extent prohibited by statute or regulation, such description must be
269 | sufficiently detailed for a recipient of ordinary skill to be able to
270 | understand it.
271 |
272 | 5. Application of this License.
273 |
274 | This License applies to code to which the Initial Developer has
275 | attached the notice in Exhibit A and to related Covered Code.
276 |
277 | 6. Versions of the License.
278 |
279 | 6.1. New Versions.
280 | Netscape Communications Corporation ("Netscape") may publish revised
281 | and/or new versions of the License from time to time. Each version
282 | will be given a distinguishing version number.
283 |
284 | 6.2. Effect of New Versions.
285 | Once Covered Code has been published under a particular version of the
286 | License, You may always continue to use it under the terms of that
287 | version. You may also choose to use such Covered Code under the terms
288 | of any subsequent version of the License published by Netscape. No one
289 | other than Netscape has the right to modify the terms applicable to
290 | Covered Code created under this License.
291 |
292 | 6.3. Derivative Works.
293 | If You create or use a modified version of this License (which you may
294 | only do in order to apply it to code which is not already Covered Code
295 | governed by this License), You must (a) rename Your license so that
296 | the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape",
297 | "MPL", "NPL" or any confusingly similar phrase do not appear in your
298 | license (except to note that your license differs from this License)
299 | and (b) otherwise make it clear that Your version of the license
300 | contains terms which differ from the Mozilla Public License and
301 | Netscape Public License. (Filling in the name of the Initial
302 | Developer, Original Code or Contributor in the notice described in
303 | Exhibit A shall not of themselves be deemed to be modifications of
304 | this License.)
305 |
306 | 7. DISCLAIMER OF WARRANTY.
307 |
308 | COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS,
309 | WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
310 | WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF
311 | DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING.
312 | THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE
313 | IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT,
314 | YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE
315 | COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER
316 | OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
317 | ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
318 |
319 | 8. TERMINATION.
320 |
321 | 8.1. This License and the rights granted hereunder will terminate
322 | automatically if You fail to comply with terms herein and fail to cure
323 | such breach within 30 days of becoming aware of the breach. All
324 | sublicenses to the Covered Code which are properly granted shall
325 | survive any termination of this License. Provisions which, by their
326 | nature, must remain in effect beyond the termination of this License
327 | shall survive.
328 |
329 | 8.2. If You initiate litigation by asserting a patent infringement
330 | claim (excluding declatory judgment actions) against Initial Developer
331 | or a Contributor (the Initial Developer or Contributor against whom
332 | You file such action is referred to as "Participant") alleging that:
333 |
334 | (a) such Participant's Contributor Version directly or indirectly
335 | infringes any patent, then any and all rights granted by such
336 | Participant to You under Sections 2.1 and/or 2.2 of this License
337 | shall, upon 60 days notice from Participant terminate prospectively,
338 | unless if within 60 days after receipt of notice You either: (i)
339 | agree in writing to pay Participant a mutually agreeable reasonable
340 | royalty for Your past and future use of Modifications made by such
341 | Participant, or (ii) withdraw Your litigation claim with respect to
342 | the Contributor Version against such Participant. If within 60 days
343 | of notice, a reasonable royalty and payment arrangement are not
344 | mutually agreed upon in writing by the parties or the litigation claim
345 | is not withdrawn, the rights granted by Participant to You under
346 | Sections 2.1 and/or 2.2 automatically terminate at the expiration of
347 | the 60 day notice period specified above.
348 |
349 | (b) any software, hardware, or device, other than such Participant's
350 | Contributor Version, directly or indirectly infringes any patent, then
351 | any rights granted to You by such Participant under Sections 2.1(b)
352 | and 2.2(b) are revoked effective as of the date You first made, used,
353 | sold, distributed, or had made, Modifications made by that
354 | Participant.
355 |
356 | 8.3. If You assert a patent infringement claim against Participant
357 | alleging that such Participant's Contributor Version directly or
358 | indirectly infringes any patent where such claim is resolved (such as
359 | by license or settlement) prior to the initiation of patent
360 | infringement litigation, then the reasonable value of the licenses
361 | granted by such Participant under Sections 2.1 or 2.2 shall be taken
362 | into account in determining the amount or value of any payment or
363 | license.
364 |
365 | 8.4. In the event of termination under Sections 8.1 or 8.2 above,
366 | all end user license agreements (excluding distributors and resellers)
367 | which have been validly granted by You or any distributor hereunder
368 | prior to termination shall survive termination.
369 |
370 | 9. LIMITATION OF LIABILITY.
371 |
372 | UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
373 | (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL
374 | DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE,
375 | OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR
376 | ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY
377 | CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL,
378 | WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
379 | COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
380 | INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
381 | LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY
382 | RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW
383 | PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE
384 | EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO
385 | THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
386 |
387 | 10. U.S. GOVERNMENT END USERS.
388 |
389 | The Covered Code is a "commercial item," as that term is defined in
390 | 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer
391 | software" and "commercial computer software documentation," as such
392 | terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48
393 | C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995),
394 | all U.S. Government End Users acquire Covered Code with only those
395 | rights set forth herein.
396 |
397 | 11. MISCELLANEOUS.
398 |
399 | This License represents the complete agreement concerning subject
400 | matter hereof. If any provision of this License is held to be
401 | unenforceable, such provision shall be reformed only to the extent
402 | necessary to make it enforceable. This License shall be governed by
403 | California law provisions (except to the extent applicable law, if
404 | any, provides otherwise), excluding its conflict-of-law provisions.
405 | With respect to disputes in which at least one party is a citizen of,
406 | or an entity chartered or registered to do business in the United
407 | States of America, any litigation relating to this License shall be
408 | subject to the jurisdiction of the Federal Courts of the Northern
409 | District of California, with venue lying in Santa Clara County,
410 | California, with the losing party responsible for costs, including
411 | without limitation, court costs and reasonable attorneys' fees and
412 | expenses. The application of the United Nations Convention on
413 | Contracts for the International Sale of Goods is expressly excluded.
414 | Any law or regulation which provides that the language of a contract
415 | shall be construed against the drafter shall not apply to this
416 | License.
417 |
418 | 12. RESPONSIBILITY FOR CLAIMS.
419 |
420 | As between Initial Developer and the Contributors, each party is
421 | responsible for claims and damages arising, directly or indirectly,
422 | out of its utilization of rights under this License and You agree to
423 | work with Initial Developer and Contributors to distribute such
424 | responsibility on an equitable basis. Nothing herein is intended or
425 | shall be deemed to constitute any admission of liability.
426 |
427 | 13. MULTIPLE-LICENSED CODE.
428 |
429 | Initial Developer may designate portions of the Covered Code as
430 | "Multiple-Licensed". "Multiple-Licensed" means that the Initial
431 | Developer permits you to utilize portions of the Covered Code under
432 | Your choice of the NPL or the alternative licenses, if any, specified
433 | by the Initial Developer in the file described in Exhibit A.
434 |
435 | EXHIBIT A -Mozilla Public License.
436 |
437 | ``The contents of this file are subject to the Mozilla Public License
438 | Version 1.1 (the "License"); you may not use this file except in
439 | compliance with the License. You may obtain a copy of the License at
440 | http://www.mozilla.org/MPL/
441 |
442 | Software distributed under the License is distributed on an "AS IS"
443 | basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
444 | License for the specific language governing rights and limitations
445 | under the License.
446 |
447 | The Original Code is ______________________________________.
448 |
449 | The Initial Developer of the Original Code is ________________________.
450 | Portions created by ______________________ are Copyright (C) ______
451 | _______________________. All Rights Reserved.
452 |
453 | Contributor(s): ______________________________________.
454 |
455 | Alternatively, the contents of this file may be used under the terms
456 | of the _____ license (the "[___] License"), in which case the
457 | provisions of [______] License are applicable instead of those
458 | above. If you wish to allow use of your version of this file only
459 | under the terms of the [____] License and not to allow others to use
460 | your version of this file under the MPL, indicate your decision by
461 | deleting the provisions above and replace them with the notice and
462 | other provisions required by the [___] License. If you do not delete
463 | the provisions above, a recipient may use your version of this file
464 | under either the MPL or the [___] License."
465 |
466 | [NOTE: The text of this Exhibit A may differ slightly from the text of
467 | the notices in the Source Code files of the Original Code. You should
468 | use the text of this Exhibit A rather than the text found in the
469 | Original Code Source Code for Your Modifications.]
470 |
471 |
--------------------------------------------------------------------------------