mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-27 20:41:58 +03:00
JNI: part 1 of typos and Java style tweaks suggested in [forum:99ac7961d82f57f3|forum post 99ac7961d82f57f3].
FossilOrigin-Name: ab00af4e48501b0413650df31147866a805c34b7ecf506d1e208bc3ae6c2ef28
This commit is contained in:
@ -429,7 +429,7 @@ $(doc.index): $(JAVA_FILES.main) $(MAKEFILE)
|
||||
.FORCE: doc
|
||||
doc: $(doc.index)
|
||||
javadoc: $(doc.index)
|
||||
# Force rebild of docs
|
||||
# Force rebuild of docs
|
||||
redoc:
|
||||
@rm -f $(doc.index)
|
||||
@$(MAKE) doc
|
||||
|
@ -133,7 +133,7 @@
|
||||
** Which sqlite3.c we're using needs to be configurable to enable
|
||||
** building against a custom copy, e.g. the SEE variant. We have to
|
||||
** include sqlite3.c, as opposed to sqlite3.h, in order to get access
|
||||
** to some interal details like SQLITE_MAX_... and friends. This
|
||||
** to some internal details like SQLITE_MAX_... and friends. This
|
||||
** increases the rebuild time considerably but we need this in order
|
||||
** to access some internal functionality and keep the to-Java-exported
|
||||
** values of SQLITE_MAX_... and SQLITE_LIMIT_... in sync with the C
|
||||
@ -5512,7 +5512,7 @@ static inline jobject new_java_fts5_api(JNIEnv * const env, fts5_api *sv){
|
||||
** Returns a per-JNIEnv global ref to the Fts5ExtensionApi singleton
|
||||
** instance, or NULL on OOM.
|
||||
*/
|
||||
static jobject s3jni_getFts5ExensionApi(JNIEnv * const env){
|
||||
static jobject s3jni_getFts5ExtensionApi(JNIEnv * const env){
|
||||
if( !SJG.fts5.jExt ){
|
||||
S3JniGlobal_mutex_enter;
|
||||
if( !SJG.fts5.jExt ){
|
||||
@ -5578,7 +5578,7 @@ JniDeclFtsApi(jobject,getInstanceForDb)(JniArgsEnvClass,jobject jDb){
|
||||
|
||||
|
||||
JniDeclFtsXA(jobject,getInstance)(JniArgsEnvClass){
|
||||
return s3jni_getFts5ExensionApi(env);
|
||||
return s3jni_getFts5ExtensionApi(env);
|
||||
}
|
||||
|
||||
JniDeclFtsXA(jint,xColumnCount)(JniArgsEnvObj,jobject jCtx){
|
||||
@ -5641,7 +5641,7 @@ static void s3jni_fts5_extension_function(Fts5ExtensionApi const *pApi,
|
||||
S3JniDeclLocal_env;
|
||||
|
||||
assert(pAux);
|
||||
jFXA = s3jni_getFts5ExensionApi(env);
|
||||
jFXA = s3jni_getFts5ExtensionApi(env);
|
||||
if( !jFXA ) goto error_oom;
|
||||
jpFts = new_java_Fts5Context(env, pFts);
|
||||
if( !jpFts ) goto error_oom;
|
||||
|
@ -1342,7 +1342,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1data_1count
|
||||
* Method: sqlite3_db_config
|
||||
* Signature: (Lorg/sqlite/jni/capi/sqlite3;IILorg/sqlite/jni/capi/OutputPointer/Int32;)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1db_1config__Lorg_sqlite_jni_capi_sqlite3_2IILorg_sqlite_jni_capi_OutputPointer_Int32_2
|
||||
JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1db_1config__Lorg_sqlite_jni_capi_sqlite3_2IILorg_sqlite_jni_capi_OutputPointer_00024Int32_2
|
||||
(JNIEnv *, jclass, jobject, jint, jint, jobject);
|
||||
|
||||
/*
|
||||
|
@ -31,11 +31,11 @@ import java.lang.annotation.*;
|
||||
never pass a null value to the callback for that parameter.</p>
|
||||
|
||||
<p>Passing a null, for this annotation's definition of null, for
|
||||
any parameter marked with this annoation specifically invokes
|
||||
any parameter marked with this annotation specifically invokes
|
||||
undefined behavior (see below).</p>
|
||||
|
||||
<p>Passing 0 (i.e. C NULL) or a negative value for any long-type
|
||||
parameter marked with this annoation specifically invokes undefined
|
||||
parameter marked with this annotation specifically invokes undefined
|
||||
behavior (see below). Such values are treated as C pointers in the
|
||||
JNI layer.</p>
|
||||
|
||||
|
@ -12,14 +12,9 @@
|
||||
** This file declares the main JNI bindings for the sqlite3 C API.
|
||||
*/
|
||||
package org.sqlite.jni.capi;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import org.sqlite.jni.annotation.*;
|
||||
import java.util.Arrays;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import org.sqlite.jni.annotation.*;
|
||||
|
||||
/**
|
||||
This class contains the entire C-style sqlite3 JNI API binding,
|
||||
@ -169,7 +164,7 @@ public final class CApi {
|
||||
<p>Like the C API, it returns 0 if allocation fails or if
|
||||
initialize is false and no prior aggregate context was allocated
|
||||
for cx. If initialize is true then it returns 0 only on
|
||||
allocation error. In all casses, 0 is considered the sentinel
|
||||
allocation error. In all cases, 0 is considered the sentinel
|
||||
"not a key" value.
|
||||
*/
|
||||
public static native long sqlite3_aggregate_context(sqlite3_context cx, boolean initialize);
|
||||
@ -563,7 +558,7 @@ public final class CApi {
|
||||
sqlite3_blob_open(db.getNativePointer(), dbName, tableName, columnName,
|
||||
iRow, flags, out);
|
||||
return out.take();
|
||||
};
|
||||
}
|
||||
|
||||
private static native int sqlite3_blob_read(
|
||||
@NotNull long ptrToBlob, @NotNull byte[] target, int srcOffset
|
||||
@ -1298,7 +1293,7 @@ public final class CApi {
|
||||
final OutputPointer.sqlite3 out = new OutputPointer.sqlite3();
|
||||
sqlite3_open(filename, out);
|
||||
return out.take();
|
||||
};
|
||||
}
|
||||
|
||||
public static native int sqlite3_open_v2(
|
||||
@Nullable String filename, @NotNull OutputPointer.sqlite3 ppDb,
|
||||
@ -1314,7 +1309,7 @@ public final class CApi {
|
||||
final OutputPointer.sqlite3 out = new OutputPointer.sqlite3();
|
||||
sqlite3_open_v2(filename, out, flags, zVfs);
|
||||
return out.take();
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
The sqlite3_prepare() family of functions require slightly
|
||||
@ -1410,7 +1405,7 @@ public final class CApi {
|
||||
|
||||
/**
|
||||
Works like the canonical sqlite3_prepare_v2() but its "tail"
|
||||
output paramter is returned as the index offset into the given
|
||||
output parameter is returned as the index offset into the given
|
||||
byte array at which SQL parsing stopped.
|
||||
*/
|
||||
public static int sqlite3_prepare_v2(
|
||||
@ -1462,7 +1457,7 @@ public final class CApi {
|
||||
|
||||
/**
|
||||
Works like the canonical sqlite3_prepare_v2() but its "tail"
|
||||
output paramter is returned as the index offset into the given
|
||||
output parameter is returned as the index offset into the given
|
||||
byte array at which SQL parsing stopped.
|
||||
*/
|
||||
public static int sqlite3_prepare_v3(
|
||||
@ -1542,7 +1537,7 @@ public final class CApi {
|
||||
int rc = 0;
|
||||
final OutputPointer.sqlite3_stmt outStmt = new OutputPointer.sqlite3_stmt();
|
||||
while( 0==rc && pos<sqlChunk.length ){
|
||||
sqlite3_stmt stmt = null;
|
||||
sqlite3_stmt stmt;
|
||||
if( pos>0 ){
|
||||
sqlChunk = Arrays.copyOfRange(sqlChunk, pos,
|
||||
sqlChunk.length);
|
||||
|
@ -13,7 +13,7 @@
|
||||
*/
|
||||
package org.sqlite.jni.capi;
|
||||
/**
|
||||
This marker interface exists soley for use as a documentation and
|
||||
This marker interface exists solely for use as a documentation and
|
||||
class-grouping tool. It should be applied to interfaces or
|
||||
classes which have a call() method implementing some specific
|
||||
callback interface on behalf of the C library.
|
||||
@ -34,7 +34,7 @@ package org.sqlite.jni.capi;
|
||||
proxying for, minus the {@code sqlite3_} prefix, plus a {@code
|
||||
Callback} suffix. e.g. {@code sqlite3_busy_handler()}'s callback is
|
||||
named {@code BusyHandlerCallback}. Exceptions are made where that
|
||||
would potentially be ambiguous, e.g. {@link ConfigSqllogCallback}
|
||||
would potentially be ambiguous, e.g. {@link ConfigSqlLogCallback}
|
||||
instead of {@code ConfigCallback} because the {@code
|
||||
sqlite3_config()} interface may need to support more callback types
|
||||
in the future.
|
||||
|
@ -20,7 +20,7 @@ package org.sqlite.jni.capi;
|
||||
from the native JNI code is unduly quirky due to a lack of
|
||||
autoboxing at that level.
|
||||
|
||||
<p>The usage is similar for all of thes types:
|
||||
<p>The usage is similar for all of these types:
|
||||
|
||||
<pre>{@code
|
||||
OutputPointer.sqlite3 out = new OutputPointer.sqlite3();
|
||||
@ -55,9 +55,9 @@ public final class OutputPointer {
|
||||
/** Sets the current value to null. */
|
||||
public void clear(){value = null;}
|
||||
/** Returns the current value. */
|
||||
public final org.sqlite.jni.capi.sqlite3 get(){return value;}
|
||||
public org.sqlite.jni.capi.sqlite3 get(){return value;}
|
||||
/** Equivalent to calling get() then clear(). */
|
||||
public final org.sqlite.jni.capi.sqlite3 take(){
|
||||
public org.sqlite.jni.capi.sqlite3 take(){
|
||||
final org.sqlite.jni.capi.sqlite3 v = value;
|
||||
value = null;
|
||||
return v;
|
||||
@ -76,9 +76,9 @@ public final class OutputPointer {
|
||||
/** Sets the current value to null. */
|
||||
public void clear(){value = null;}
|
||||
/** Returns the current value. */
|
||||
public final org.sqlite.jni.capi.sqlite3_blob get(){return value;}
|
||||
public org.sqlite.jni.capi.sqlite3_blob get(){return value;}
|
||||
/** Equivalent to calling get() then clear(). */
|
||||
public final org.sqlite.jni.capi.sqlite3_blob take(){
|
||||
public org.sqlite.jni.capi.sqlite3_blob take(){
|
||||
final org.sqlite.jni.capi.sqlite3_blob v = value;
|
||||
value = null;
|
||||
return v;
|
||||
@ -98,9 +98,9 @@ public final class OutputPointer {
|
||||
/** Sets the current value to null. */
|
||||
public void clear(){value = null;}
|
||||
/** Returns the current value. */
|
||||
public final org.sqlite.jni.capi.sqlite3_stmt get(){return value;}
|
||||
public org.sqlite.jni.capi.sqlite3_stmt get(){return value;}
|
||||
/** Equivalent to calling get() then clear(). */
|
||||
public final org.sqlite.jni.capi.sqlite3_stmt take(){
|
||||
public org.sqlite.jni.capi.sqlite3_stmt take(){
|
||||
final org.sqlite.jni.capi.sqlite3_stmt v = value;
|
||||
value = null;
|
||||
return v;
|
||||
@ -120,9 +120,9 @@ public final class OutputPointer {
|
||||
/** Sets the current value to null. */
|
||||
public void clear(){value = null;}
|
||||
/** Returns the current value. */
|
||||
public final org.sqlite.jni.capi.sqlite3_value get(){return value;}
|
||||
public org.sqlite.jni.capi.sqlite3_value get(){return value;}
|
||||
/** Equivalent to calling get() then clear(). */
|
||||
public final org.sqlite.jni.capi.sqlite3_value take(){
|
||||
public org.sqlite.jni.capi.sqlite3_value take(){
|
||||
final org.sqlite.jni.capi.sqlite3_value v = value;
|
||||
value = null;
|
||||
return v;
|
||||
@ -144,9 +144,9 @@ public final class OutputPointer {
|
||||
/** Initializes with the value v. */
|
||||
public Bool(boolean v){value = v;}
|
||||
/** Returns the current value. */
|
||||
public final boolean get(){return value;}
|
||||
public boolean get(){return value;}
|
||||
/** Sets the current value to v. */
|
||||
public final void set(boolean v){value = v;}
|
||||
public void set(boolean v){value = v;}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -164,9 +164,9 @@ public final class OutputPointer {
|
||||
/** Initializes with the value v. */
|
||||
public Int32(int v){value = v;}
|
||||
/** Returns the current value. */
|
||||
public final int get(){return value;}
|
||||
public int get(){return value;}
|
||||
/** Sets the current value to v. */
|
||||
public final void set(int v){value = v;}
|
||||
public void set(int v){value = v;}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -184,9 +184,9 @@ public final class OutputPointer {
|
||||
/** Initializes with the value v. */
|
||||
public Int64(long v){value = v;}
|
||||
/** Returns the current value. */
|
||||
public final long get(){return value;}
|
||||
public long get(){return value;}
|
||||
/** Sets the current value. */
|
||||
public final void set(long v){value = v;}
|
||||
public void set(long v){value = v;}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -204,9 +204,9 @@ public final class OutputPointer {
|
||||
/** Initializes with the value v. */
|
||||
public String(java.lang.String v){value = v;}
|
||||
/** Returns the current value. */
|
||||
public final java.lang.String get(){return value;}
|
||||
public java.lang.String get(){return value;}
|
||||
/** Sets the current value. */
|
||||
public final void set(java.lang.String v){value = v;}
|
||||
public void set(java.lang.String v){value = v;}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -224,9 +224,9 @@ public final class OutputPointer {
|
||||
/** Initializes with the value v. */
|
||||
public ByteArray(byte[] v){value = v;}
|
||||
/** Returns the current value. */
|
||||
public final byte[] get(){return value;}
|
||||
public byte[] get(){return value;}
|
||||
/** Sets the current value. */
|
||||
public final void set(byte[] v){value = v;}
|
||||
public void set(byte[] v){value = v;}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -246,8 +246,8 @@ public final class OutputPointer {
|
||||
/** Initializes with the value v. */
|
||||
public ByteBuffer(java.nio.ByteBuffer v){value = v;}
|
||||
/** Returns the current value. */
|
||||
public final java.nio.ByteBuffer get(){return value;}
|
||||
public java.nio.ByteBuffer get(){return value;}
|
||||
/** Sets the current value. */
|
||||
public final void set(java.nio.ByteBuffer v){value = v;}
|
||||
public void set(java.nio.ByteBuffer v){value = v;}
|
||||
}
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ public interface PrepareMultiCallback extends CallbackProxy {
|
||||
A PrepareMultiCallback impl which steps entirely through a result set,
|
||||
ignoring all non-error results.
|
||||
*/
|
||||
public static final class StepAll implements PrepareMultiCallback {
|
||||
final class StepAll implements PrepareMultiCallback {
|
||||
public StepAll(){}
|
||||
/**
|
||||
Calls sqlite3_step() on st until it returns something other than
|
||||
|
@ -13,7 +13,6 @@
|
||||
** SQLTester framework.
|
||||
*/
|
||||
package org.sqlite.jni.capi;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
@ -31,7 +30,7 @@ enum ResultBufferMode {
|
||||
ESCAPED,
|
||||
//! Append output as-is
|
||||
ASIS
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
Modes to specify how to emit multi-row output from
|
||||
@ -42,7 +41,7 @@ enum ResultRowMode {
|
||||
ONELINE,
|
||||
//! Add a newline between each result row.
|
||||
NEWLINE
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
Base exception type for test-related failures.
|
||||
@ -278,7 +277,7 @@ public class SQLTester {
|
||||
}
|
||||
|
||||
private StringBuilder clearBuffer(StringBuilder b){
|
||||
b.setLength(0);;
|
||||
b.setLength(0);
|
||||
return b;
|
||||
}
|
||||
|
||||
@ -780,7 +779,7 @@ abstract class Command {
|
||||
class CloseDbCommand extends Command {
|
||||
public void process(SQLTester t, TestScript ts, String[] argv) throws Exception{
|
||||
argcCheck(ts,argv,0,1);
|
||||
Integer id;
|
||||
int id;
|
||||
if(argv.length>1){
|
||||
String arg = argv[1];
|
||||
if("all".equals(arg)){
|
||||
@ -1020,7 +1019,7 @@ class VerbosityCommand extends Command {
|
||||
|
||||
class CommandDispatcher {
|
||||
|
||||
private static java.util.Map<String,Command> commandMap =
|
||||
private static final java.util.Map<String,Command> commandMap =
|
||||
new java.util.HashMap<>();
|
||||
|
||||
/**
|
||||
@ -1244,7 +1243,7 @@ class TestScript {
|
||||
}
|
||||
cur.pos = i;
|
||||
final String rv = cur.sb.toString();
|
||||
if( i==cur.src.length && 0==rv.length() ){
|
||||
if( i==cur.src.length && rv.isEmpty() ){
|
||||
return null /* EOF */;
|
||||
}
|
||||
return rv;
|
||||
@ -1364,7 +1363,7 @@ class TestScript {
|
||||
if( m.find() ){
|
||||
throw new IncompatibleDirective(this, m.group(1)+": "+m.group(3));
|
||||
}
|
||||
if( line.indexOf("\n|")>=0 ){
|
||||
if( line.contains("\n|") ){
|
||||
throw new IncompatibleDirective(this, "newline-pipe combination.");
|
||||
}
|
||||
return;
|
||||
|
Reference in New Issue
Block a user