diff --git a/circle_scripts/deps_linux.sh b/circle_scripts/deps_linux.sh index 6cac307b..efaaa55c 100755 --- a/circle_scripts/deps_linux.sh +++ b/circle_scripts/deps_linux.sh @@ -36,7 +36,7 @@ CFLAGS_MORE='--param=ssp-buffer-size=1 -fstack-protector-all' # ------- deps verisions --------- NASM_VERSION="nasm-2.16.01" -FFMPEG_VERSION="n6.0" +FFMPEG_VERSION="n6.1" OPUS_VERSION="v1.4" SODIUM_VERSION="1.0.19" VPX_VERSION="v1.13.1" @@ -89,12 +89,8 @@ export LDFLAGS=" " --disable-postproc \ --disable-swresample \ --disable-swscale-alpha \ - --disable-dct \ --disable-dwt \ --disable-lsp \ - --disable-mdct \ - --disable-rdft \ - --disable-fft \ --disable-faan \ --disable-vaapi \ --disable-vdpau \ diff --git a/circle_scripts/deps_macos.sh b/circle_scripts/deps_macos.sh index 689adf37..59981271 100755 --- a/circle_scripts/deps_macos.sh +++ b/circle_scripts/deps_macos.sh @@ -42,7 +42,7 @@ type sudo # ------- deps verisions --------- NASM_VERSION="nasm-2.14.02" YASM_VERSION="1.3.0" -FFMPEG_VERSION="n6.0" +FFMPEG_VERSION="n6.1" OPUS_VERSION="v1.4" SODIUM_VERSION="1.0.19" VPX_VERSION="v1.13.1" @@ -93,12 +93,8 @@ export LDFLAGS=" " --disable-postproc \ --disable-swresample \ --disable-swscale-alpha \ - --disable-dct \ --disable-dwt \ --disable-lsp \ - --disable-mdct \ - --disable-rdft \ - --disable-fft \ --disable-faan \ --disable-vaapi \ --disable-vdpau \ diff --git a/circle_scripts/deps_win.sh b/circle_scripts/deps_win.sh index 881e041c..4f32e346 100755 --- a/circle_scripts/deps_win.sh +++ b/circle_scripts/deps_win.sh @@ -39,7 +39,7 @@ export CFLAGS_ADDON_MORE="--param=ssp-buffer-size=1 -fstack-protector-all" # ------- deps verisions --------- NASM_VERSION="nasm-2.16.01" -FFMPEG_VERSION="n6.0" +FFMPEG_VERSION="n6.1" OPUS_VERSION="v1.4" SODIUM_VERSION="1.0.19" VPX_VERSION="v1.13.1" @@ -92,12 +92,8 @@ cd *mpeg*/ --disable-postproc \ --disable-swresample \ --disable-swscale-alpha \ - --disable-dct \ --disable-dwt \ --disable-lsp \ - --disable-mdct \ - --disable-rdft \ - --disable-fft \ --disable-faan \ --disable-vaapi \ --disable-vdpau \ diff --git a/resources/common/ffmpeg_av_jni.dll b/resources/common/ffmpeg_av_jni.dll index ebb5c46e..25f7c90c 100755 Binary files a/resources/common/ffmpeg_av_jni.dll and b/resources/common/ffmpeg_av_jni.dll differ diff --git a/resources/common/jni-c-toxcore.dll b/resources/common/jni-c-toxcore.dll index 1d9e8f90..77b10142 100755 Binary files a/resources/common/jni-c-toxcore.dll and b/resources/common/jni-c-toxcore.dll differ diff --git a/resources/common/libffmpeg_av_jni.jnilib b/resources/common/libffmpeg_av_jni.jnilib index eae20f69..71800574 100644 Binary files a/resources/common/libffmpeg_av_jni.jnilib and b/resources/common/libffmpeg_av_jni.jnilib differ diff --git a/resources/common/libffmpeg_av_jni.so b/resources/common/libffmpeg_av_jni.so index f9481594..47c91793 100755 Binary files a/resources/common/libffmpeg_av_jni.so and b/resources/common/libffmpeg_av_jni.so differ diff --git a/resources/common/libjni-c-toxcore.jnilib b/resources/common/libjni-c-toxcore.jnilib index be3b762a..6816f3d2 100644 Binary files a/resources/common/libjni-c-toxcore.jnilib and b/resources/common/libjni-c-toxcore.jnilib differ diff --git a/resources/common/libjni-c-toxcore.so b/resources/common/libjni-c-toxcore.so index 476294b3..35546b39 100755 Binary files a/resources/common/libjni-c-toxcore.so and b/resources/common/libjni-c-toxcore.so differ diff --git a/resources/common/main.db.txt b/resources/common/main.db.txt index 5105ee24..733446b1 100644 --- a/resources/common/main.db.txt +++ b/resources/common/main.db.txt @@ -387,15 +387,3 @@ CREATE INDEX IF NOT EXISTS "index_added_timestamp_on_FriendList" ON "FriendList" CREATE INDEX IF NOT EXISTS "index_is_relay_on_FriendList" ON "FriendList" ( "is_relay" ); - -ALTER TABLE GroupMessage add path_name TEXT DEFAULT NULL; -CREATE INDEX IF NOT EXISTS "index_path_name_on_GroupMessage" ON "GroupMessage" ("path_name"); - -ALTER TABLE GroupMessage add file_name TEXT DEFAULT NULL; -CREATE INDEX IF NOT EXISTS "index_file_name_on_GroupMessage" ON "GroupMessage" ("file_name"); - -ALTER TABLE GroupMessage add filename_fullpath TEXT DEFAULT NULL; -CREATE INDEX IF NOT EXISTS "index_filename_fullpath_on_GroupMessage" ON "GroupMessage" ("filename_fullpath"); - -ALTER TABLE GroupMessage add filesize INTEGER NOT NULL DEFAULT 0; -CREATE INDEX IF NOT EXISTS "index_filesize_on_GroupMessage" ON "GroupMessage" ("filesize"); diff --git a/src/main/java/com/zoffcc/applications/sorm/GroupMessage.java b/src/main/java/com/zoffcc/applications/sorm/GroupMessage.java index 3c560d5f..81ce6b3a 100644 --- a/src/main/java/com/zoffcc/applications/sorm/GroupMessage.java +++ b/src/main/java/com/zoffcc/applications/sorm/GroupMessage.java @@ -21,6 +21,7 @@ import com.zoffcc.applications.trifa.Log; +import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.Statement; import java.util.ArrayList; @@ -208,9 +209,11 @@ public long insert() try { + String insert_pstmt_sql = null; + PreparedStatement insert_pstmt = null; + // @formatter:off - Statement statement = sqldb.createStatement(); - final String sql_str="insert into " + this.getClass().getSimpleName() + + insert_pstmt_sql="insert into " + this.getClass().getSimpleName() + "(" + "message_id_tox,"+ "group_identifier,"+ @@ -234,45 +237,62 @@ public long insert() ")" + "values" + "(" + - "'"+s(this.message_id_tox)+"'," + - "'"+s(this.group_identifier)+"'," + - "'"+s(this.tox_group_peer_pubkey)+"'," + - "'"+s(this.private_message)+"'," + - "'"+s(this.tox_group_peername)+"'," + - "'"+s(this.direction)+"'," + - "'"+s(this.TOX_MESSAGE_TYPE)+"'," + - "'"+s(this.TRIFA_MESSAGE_TYPE)+"'," + - "'"+s(this.sent_timestamp)+"'," + - "'"+s(this.rcvd_timestamp)+"'," + - "'"+b(this.read)+"'," + - "'"+b(this.is_new)+"'," + - "'"+s(this.text)+"'," + - "'"+b(this.was_synced)+"'," + - "'"+s(this.msg_id_hash)+"'," + - "'"+s(this.path_name)+"'," + - "'"+s(this.file_name)+"'," + - "'"+s(this.filename_fullpath)+"'," + - "'"+s(this.filesize)+"'" + + "?1," + + "?2," + + "?3," + + "?4," + + "?5," + + "?6," + + "?7," + + "?8," + + "?9," + + "?10," + + "?11," + + "?12," + + "?13," + + "?14," + + "?15," + + "?16," + + "?17," + + "?18," + + "?19" + ")"; + insert_pstmt = sqldb.prepareStatement(insert_pstmt_sql); + + insert_pstmt.clearParameters(); + + insert_pstmt.setString(1, this.message_id_tox); + insert_pstmt.setString(2, this.group_identifier); + insert_pstmt.setString(3, this.tox_group_peer_pubkey); + insert_pstmt.setInt(4, this.private_message); + insert_pstmt.setString(5, this.tox_group_peername); + insert_pstmt.setInt(6, this.direction); + insert_pstmt.setInt(7, this.TOX_MESSAGE_TYPE); + insert_pstmt.setInt(8, this.TRIFA_MESSAGE_TYPE); + insert_pstmt.setLong(9, this.sent_timestamp); + insert_pstmt.setLong(10, this.rcvd_timestamp); + insert_pstmt.setBoolean(11, this.read); + insert_pstmt.setBoolean(12, this.is_new); + insert_pstmt.setString(13, this.text); + insert_pstmt.setBoolean(14, this.was_synced); + insert_pstmt.setString(15, this.msg_id_hash); + insert_pstmt.setString(16, this.path_name); + insert_pstmt.setString(17, this.file_name); + insert_pstmt.setString(18, this.filename_fullpath); + insert_pstmt.setLong(19, this.filesize); + if (ORMA_TRACE) { - Log.i(TAG, "sql=" + sql_str); + Log.i(TAG, "sql=" + insert_pstmt); } orma_semaphore_lastrowid_on_insert.acquire(); - statement.execute(sql_str); - ret = get_last_rowid(statement); + insert_pstmt.executeUpdate(); + insert_pstmt.close(); + ret = get_last_rowid_pstmt(); orma_semaphore_lastrowid_on_insert.release(); // @formatter:on - - try - { - statement.close(); - } - catch (Exception ignored) - { - } } catch (Exception e) { diff --git a/src/main/java/com/zoffcc/applications/sorm/Message.java b/src/main/java/com/zoffcc/applications/sorm/Message.java index e01b9be9..917aa4fc 100644 --- a/src/main/java/com/zoffcc/applications/sorm/Message.java +++ b/src/main/java/com/zoffcc/applications/sorm/Message.java @@ -309,34 +309,34 @@ public long insert() ")" + "values" + "(" + - "?," + - "?," + - "?," + - "?," + - "?," + - "?," + - "?," + - "?," + - "?," + - "?," + - "?," + - "?," + - "?," + - "?," + - "?," + - "?," + - "?," + - "?," + - "?," + - "?," + - "?," + - "?," + - "?," + - "?," + - "?," + - "?," + - "?," + - "?" + + "?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" + ")"; insert_pstmt = sqldb.prepareStatement(insert_pstmt_sql); diff --git a/src/main/java/com/zoffcc/applications/sorm/OrmaDatabase.java b/src/main/java/com/zoffcc/applications/sorm/OrmaDatabase.java index 3fbf8875..0f3b48c0 100644 --- a/src/main/java/com/zoffcc/applications/sorm/OrmaDatabase.java +++ b/src/main/java/com/zoffcc/applications/sorm/OrmaDatabase.java @@ -19,7 +19,8 @@ public class OrmaDatabase private static final String TAG = "trifa.OrmaDatabase"; final static boolean ORMA_TRACE = false; // set "false" for release builds - private static final String CREATE_DB_FILE_SHA256SUM = "HJC9IOw3S0l53MKJOLXV1iUCWaglwXLyW9gncs52wds="; + private static final String CREATE_DB_FILE_SHA256SUM = "LvrHIP4y43BVnVTsd6Y1kAZXqaqKQPnRk3+0HKFP0xA="; + private static final String CREATE_DB_FILE_ON_WINDOWS_SHA256SUM = "5QKQ8Ga1SXdvsiEbf6Ps99KdIJVTNldtI42C3UMI9DM="; public static Connection sqldb = null; static int current_db_version = 0; static Semaphore orma_semaphore_lastrowid_on_insert = new Semaphore(1); @@ -39,14 +40,16 @@ public static String sha256sum_of_file(String filename_with_path) { byte[] buffer = new byte[8192]; int count; + long bytes_read_total = 0; MessageDigest digest = MessageDigest.getInstance("SHA-256"); BufferedInputStream bis = new BufferedInputStream(new FileInputStream(filename_with_path)); while ((count = bis.read(buffer)) > 0) { digest.update(buffer, 0, count); + bytes_read_total = bytes_read_total + count; } bis.close(); - + Log.i(TAG, "sha256sum_of_file:bytes_read_total=" + bytes_read_total); byte[] hash = digest.digest(); return (bytesToString(hash)); } @@ -290,19 +293,11 @@ public static void set_new_db_version(int new_version) } } - public static int update_db(int current_db_version) + public static int update_db(final int current_db_version) { if (current_db_version < 1) { - try - { - final String update_001 = "CREATE UNIQUE INDEX ux_tox_public_key_string_of_owner ON RelayListDB(tox_public_key_string_of_owner);"; - run_multi_sql(update_001); - } - catch (Exception e) - { - e.printStackTrace(); - } + // dummy. sadly now it has to stay. } if (current_db_version < 2) @@ -611,10 +606,10 @@ public static void create_db(int current_db_version) Log.i(TAG, "loading asset file: " + asset_filename); String sha256sum_of_create_db_file = sha256sum_of_file(asset_filename); Log.i(TAG, "create_db:sha256sum_of_create_db_file=" + sha256sum_of_create_db_file); - // TODO: on some windows systems the checksum does not seem to match? - // maybe "\r\n" or the file is not read as UTF-8 ? - if ((sha256sum_of_create_db_file.equals(CREATE_DB_FILE_SHA256SUM)) || - (OperatingSystem.getCurrent() == OperatingSystem.WINDOWS)) + // TODO: on windows systems the checksum does not seem to match? + // it must be "\r\n" in the sql textfile the file has more bytes also? + if ((sha256sum_of_create_db_file.equals(CREATE_DB_FILE_SHA256SUM)) + || (sha256sum_of_create_db_file.equals(CREATE_DB_FILE_ON_WINDOWS_SHA256SUM))) { String create_db_sqls = readSQLFileAsString(asset_filename); if (current_db_version == 0) @@ -624,6 +619,8 @@ public static void create_db(int current_db_version) } else { + Log.i(TAG, "expected:"+ CREATE_DB_FILE_SHA256SUM); + Log.i(TAG, " git:" + sha256sum_of_create_db_file); Log.i(TAG, "create_db:input file sha256 hash does not match!"); System.exit(5); }