Skip to content

Commit

Permalink
tests: fixed a bug wrapping byte arrays in non native buffers
Browse files Browse the repository at this point in the history
Signed-off-by: Burkhard Mittelbach <wasabi37a@googlemail.com>
  • Loading branch information
Wasabi375 committed Apr 13, 2019
1 parent d392f1a commit 775b30e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/test/kotlin/assimp/anchor.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package assimp

import io.kotlintest.*
import kool.*
import java.io.*
import java.net.*
import java.nio.*
Expand Down Expand Up @@ -74,7 +75,7 @@ fun Importer.testFile(path: String,
logger.info { "reading from memory:" }

val bytes = FileInputStream(File(path)).readBytes()
val buffer = ByteBuffer.wrap(bytes)
val buffer = ByteBuffer(bytes)

val hintStart = path.indexOfLast { it == '.' }
val hint = path.substring(hintStart + 1)
Expand Down Expand Up @@ -194,7 +195,7 @@ fun Importer.testFiles(paths: List<String>,

logger.info { "reading from memory:" }

val files = paths.map { it to ByteBuffer.wrap(FileInputStream(File(it)).readBytes()) }.toMap()
val files = paths.map { it to ByteBuffer(FileInputStream(File(it)).readBytes()) }.toMap()

val memScene = readFilesFromMemory(baseFile, files, flags)
if (memScene == null && failOnNull) {
Expand Down

0 comments on commit 775b30e

Please sign in to comment.