ObjPgSQL  Check-in [47585409b5]

Overview
Comment:Fix warnings
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 47585409b5d56366a5d1a266f1157d55494d207b0912383979f2492107c39f7f
User & Date: js on 2024-08-07 19:57:46
Other Links: manifest | tags
Context
2024-08-07
20:21
Set soversion check-in: 199ebef61a user: js tags: trunk
19:57
Fix warnings check-in: 47585409b5 user: js tags: trunk
19:49
Adjust to ObjFW changes check-in: f80e0a2206 user: js tags: trunk
Changes

Modified src/PGResult.m from [0b8c7e69a5] to [1bdfc53144].

1
2
3
4
5
6
7
8
9
/*
 * Copyright (c) 2012, 2013, 2014, 2015, 2016, 2017
 *   Jonathan Schleifer <js@nil.im>
 *
 * https://fossil.nil.im/objpgsql
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice is present in all copies.

|







1
2
3
4
5
6
7
8
9
/*
 * Copyright (c) 2012, 2013, 2014, 2015, 2016, 2017, 2024
 *   Jonathan Schleifer <js@nil.im>
 *
 * https://fossil.nil.im/objpgsql
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice is present in all copies.
54
55
56
57
58
59
60
61
62
63
64
65
66
- (size_t)count
{
	return PQntuples(_result);
}

- (id)objectAtIndex: (size_t)index
{
	if (index > PQntuples(_result))
		@throw [OFOutOfRangeException exception];

	return [PGResultRow pg_rowWithResult: self row: (int)index];
}
@end







|





54
55
56
57
58
59
60
61
62
63
64
65
66
- (size_t)count
{
	return PQntuples(_result);
}

- (id)objectAtIndex: (size_t)index
{
	if (index > LONG_MAX || (long)index > PQntuples(_result))
		@throw [OFOutOfRangeException exception];

	return [PGResultRow pg_rowWithResult: self row: (int)index];
}
@end

Modified src/PGResultRow.m from [ec1b0cfc06] to [fbcb8b8b2a].

1
2
3
4
5
6
7
8
9
/*
 * Copyright (c) 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019
 *   Jonathan Schleifer <js@nil.im>
 *
 * https://fossil.nil.im/objpgsql
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice is present in all copies.

|







1
2
3
4
5
6
7
8
9
/*
 * Copyright (c) 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2024
 *   Jonathan Schleifer <js@nil.im>
 *
 * https://fossil.nil.im/objpgsql
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice is present in all copies.
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
@interface PGResultRowEnumerator: OFEnumerator
{
	PGResult *_result;
	PGresult *_res;
	int _row, _pos, _count;
}

- initWithResult: (PGResult*)result row: (int)row;
@end

@interface PGResultRowKeyEnumerator: PGResultRowEnumerator
@end

@interface PGResultRowObjectEnumerator: PGResultRowEnumerator
@end







|







54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
@interface PGResultRowEnumerator: OFEnumerator
{
	PGResult *_result;
	PGresult *_res;
	int _row, _pos, _count;
}

- (instancetype)initWithResult: (PGResult*)result row: (int)row;
@end

@interface PGResultRowKeyEnumerator: PGResultRowEnumerator
@end

@interface PGResultRowObjectEnumerator: PGResultRowEnumerator
@end
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
	int i, j;

	if (state->extra[0] == 0) {
		state->extra[0] = 1;
		state->extra[1] = PQnfields(_res);
	}

	if (count > SIZE_MAX - state->state)
		@throw [OFOutOfRangeException exception];

	if (state->state + count > state->extra[1])
		count = state->extra[1] - state->state;

	for (i = j = 0; i < count; i++) {
		if (PQgetisnull(_res, _row, state->state + i))







|







139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
	int i, j;

	if (state->extra[0] == 0) {
		state->extra[0] = 1;
		state->extra[1] = PQnfields(_res);
	}

	if (count < 0 || (unsigned long)count > SIZE_MAX - state->state)
		@throw [OFOutOfRangeException exception];

	if (state->state + count > state->extra[1])
		count = state->extra[1] - state->state;

	for (i = j = 0; i < count; i++) {
		if (PQgetisnull(_res, _row, state->state + i))

Modified src/exceptions/PGException.m from [c06c45b0e7] to [f9cc400491].

1
2
3
4
5
6
7
8
9
/*
 * Copyright (c) 2012, 2013, 2014, 2015, 2016, 2017
 *   Jonathan Schleifer <js@nil.im>
 *
 * https://fossil.nil.im/objpgsql
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice is present in all copies.

|







1
2
3
4
5
6
7
8
9
/*
 * Copyright (c) 2012, 2013, 2014, 2015, 2016, 2017, 2024
 *   Jonathan Schleifer <js@nil.im>
 *
 * https://fossil.nil.im/objpgsql
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice is present in all copies.
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
@synthesize connection = _connection;

+ (instancetype)exceptionWithConnection: (PGConnection *)connection
{
	return [[[self alloc] initWithConnection: connection] autorelease];
}

- initWithConnection: (PGConnection *)connection
{
	self = [super init];

	@try {
		_connection = [connection retain];
		_error = [[OFString alloc]
		    initWithCString: PQerrorMessage([_connection pg_connection])







|







28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
@synthesize connection = _connection;

+ (instancetype)exceptionWithConnection: (PGConnection *)connection
{
	return [[[self alloc] initWithConnection: connection] autorelease];
}

- (instancetype)initWithConnection: (PGConnection *)connection
{
	self = [super init];

	@try {
		_connection = [connection retain];
		_error = [[OFString alloc]
		    initWithCString: PQerrorMessage([_connection pg_connection])

Modified tests/Tests.m from [fd95d3d886] to [730ea3b355].

1
2
3
4
5
6
7
8
9
/*
 * Copyright (c) 2012, 2013, 2014, 2015, 2016, 2017, 2018
 *   Jonathan Schleifer <js@nil.im>
 *
 * https://fossil.nil.im/objpgsql
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice is present in all copies.

|







1
2
3
4
5
6
7
8
9
/*
 * Copyright (c) 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2024
 *   Jonathan Schleifer <js@nil.im>
 *
 * https://fossil.nil.im/objpgsql
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice is present in all copies.