Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
liblinphone
Commits
e5e90555
Commit
e5e90555
authored
Mar 03, 2017
by
Sandrine Avakian
Browse files
Merge branch 'mantis_3600'
* mantis_3600: VFS xTruncate implementation
parents
f499b34e
a356548d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
1 deletion
+23
-1
coreapi/sqlite3_bctbx_vfs.c
coreapi/sqlite3_bctbx_vfs.c
+23
-1
No files found.
coreapi/sqlite3_bctbx_vfs.c
View file @
e5e90555
...
...
@@ -115,6 +115,28 @@ static int sqlite3bctbx_Write(sqlite3_file *p, const void *buf, int count, sqlit
return
SQLITE_IOERR_WRITE
;
}
/**
* TRuncates or extends a file depending on the size provided.
* @param p sqlite3_file file handle pointer.
* @param size New file size.
* @return SQLITE_OK on success, SQLITE_IOERR_TRUNCATE if an error occurred during truncate,
* SQLITE_ERROR if ther was a problem on the file descriptor.
*/
static
int
sqlite3bctbx_Truncate
(
sqlite3_file
*
p
,
sqlite_int64
size
){
int
rc
;
sqlite3_bctbx_file_t
*
pFile
=
(
sqlite3_bctbx_file_t
*
)
p
;
if
(
pFile
->
pbctbx_file
){
rc
=
bctbx_file_truncate
(
pFile
->
pbctbx_file
,
size
);
if
(
rc
<
0
)
{
return
SQLITE_IOERR_TRUNCATE
;
}
if
(
rc
==
0
){
return
SQLITE_OK
;
}
}
return
SQLITE_ERROR
;
}
/**
* Saves the file size associated with the file handle p into the argument pSize.
...
...
@@ -304,7 +326,7 @@ static int sqlite3bctbx_Open(sqlite3_vfs *pVfs, const char *fName, sqlite3_file
sqlite3bctbx_Close
,
/* xClose */
sqlite3bctbx_Read
,
/* xRead */
sqlite3bctbx_Write
,
/* xWrite */
NULL
,
/* xTruncate */
sqlite3bctbx_Truncate
,
/* xTruncate */
sqlite3bctbx_Sync
,
sqlite3bctbx_FileSize
,
sqlite3bctbx_nolockLock
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment