Fix warnings

FossilOrigin-Name: 47585409b5d56366a5d1a266f1157d55494d207b0912383979f2492107c39f7f
This commit is contained in:
Jonathan Schleifer 2024-08-07 19:57:46 +00:00
parent 0809ee3cab
commit c3ba1a94eb
4 changed files with 8 additions and 8 deletions

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, 2013, 2014, 2015, 2016, 2017 * Copyright (c) 2012, 2013, 2014, 2015, 2016, 2017, 2024
* Jonathan Schleifer <js@nil.im> * Jonathan Schleifer <js@nil.im>
* *
* https://fossil.nil.im/objpgsql * https://fossil.nil.im/objpgsql
@ -58,7 +58,7 @@
- (id)objectAtIndex: (size_t)index - (id)objectAtIndex: (size_t)index
{ {
if (index > PQntuples(_result)) if (index > LONG_MAX || (long)index > PQntuples(_result))
@throw [OFOutOfRangeException exception]; @throw [OFOutOfRangeException exception];
return [PGResultRow pg_rowWithResult: self row: (int)index]; return [PGResultRow pg_rowWithResult: self row: (int)index];

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 * Copyright (c) 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2024
* Jonathan Schleifer <js@nil.im> * Jonathan Schleifer <js@nil.im>
* *
* https://fossil.nil.im/objpgsql * https://fossil.nil.im/objpgsql
@ -58,7 +58,7 @@ convertType(PGresult *res, int column, OFString *string)
int _row, _pos, _count; int _row, _pos, _count;
} }
- initWithResult: (PGResult*)result row: (int)row; - (instancetype)initWithResult: (PGResult*)result row: (int)row;
@end @end
@interface PGResultRowKeyEnumerator: PGResultRowEnumerator @interface PGResultRowKeyEnumerator: PGResultRowEnumerator
@ -143,7 +143,7 @@ convertType(PGresult *res, int column, OFString *string)
state->extra[1] = PQnfields(_res); state->extra[1] = PQnfields(_res);
} }
if (count > SIZE_MAX - state->state) if (count < 0 || (unsigned long)count > SIZE_MAX - state->state)
@throw [OFOutOfRangeException exception]; @throw [OFOutOfRangeException exception];
if (state->state + count > state->extra[1]) if (state->state + count > state->extra[1])

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, 2013, 2014, 2015, 2016, 2017 * Copyright (c) 2012, 2013, 2014, 2015, 2016, 2017, 2024
* Jonathan Schleifer <js@nil.im> * Jonathan Schleifer <js@nil.im>
* *
* https://fossil.nil.im/objpgsql * https://fossil.nil.im/objpgsql
@ -32,7 +32,7 @@
return [[[self alloc] initWithConnection: connection] autorelease]; return [[[self alloc] initWithConnection: connection] autorelease];
} }
- initWithConnection: (PGConnection *)connection - (instancetype)initWithConnection: (PGConnection *)connection
{ {
self = [super init]; self = [super init];

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, 2013, 2014, 2015, 2016, 2017, 2018 * Copyright (c) 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2024
* Jonathan Schleifer <js@nil.im> * Jonathan Schleifer <js@nil.im>
* *
* https://fossil.nil.im/objpgsql * https://fossil.nil.im/objpgsql