summaryrefslogtreecommitdiff
path: root/pgsql.c
diff options
context:
space:
mode:
authorAndreas Baumann <abaumann@yahoo.com>2012-04-20 14:59:04 +0200
committerAndreas Baumann <abaumann@yahoo.com>2012-04-20 14:59:04 +0200
commitaa39632674616ab1530bec93e95bc6ab54643257 (patch)
tree452de320306c41c09eceb4810547296eb7982637 /pgsql.c
parent5ee33795c55ea7a6a476b7302de07c53b4420137 (diff)
downloadpgfuse-aa39632674616ab1530bec93e95bc6ab54643257.tar.gz
pgfuse-aa39632674616ab1530bec93e95bc6ab54643257.tar.bz2
some counterfixes
Diffstat (limited to 'pgsql.c')
-rw-r--r--pgsql.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/pgsql.c b/pgsql.c
index 074f551..ba51f95 100644
--- a/pgsql.c
+++ b/pgsql.c
@@ -482,8 +482,8 @@ update_again:
/* keep data on the right */
} else if( offset == 0 && len < STANDARD_BLOCK_SIZE ) {
- sprintf( sql, "UPDATE data set data = $3::bytea || substring( data from %lu for %lu ) WHERE dir_id=$1::int4 AND block_no=$2::int4",
- len + 1, STANDARD_BLOCK_SIZE - len );
+ sprintf( sql, "UPDATE data set data = $3::bytea || substring( data from %u for %u ) WHERE dir_id=$1::int4 AND block_no=$2::int4",
+ len + 1, STANDARD_BLOCK_SIZE - (unsigned int)len );
/* keep data on the left */
} else if( offset > 0 && offset + len == STANDARD_BLOCK_SIZE ) {
@@ -494,9 +494,9 @@ update_again:
/* small in the middle write, keep data on both sides */
} else if( offset > 0 && offset + len < STANDARD_BLOCK_SIZE ) {
- sprintf( sql, "UPDATE data set data = substring( data from %d for %d ) || $3::bytea || substring( data from %lu for %lu ) WHERE dir_id=$1::int4 AND block_no=$2::int4",
+ sprintf( sql, "UPDATE data set data = substring( data from %d for %d ) || $3::bytea || substring( data from %u for %u ) WHERE dir_id=$1::int4 AND block_no=$2::int4",
1, (unsigned int)offset,
- (unsigned int)offset + len + 1, STANDARD_BLOCK_SIZE - ( (unsigned int)offset + len ) );
+ (unsigned int)offset + len + 1, STANDARD_BLOCK_SIZE - ( (unsigned int)offset + (unsigned int)len ) );
/* we should never get here */
} else {