ObjFW  Check-in [9723036211]

Overview
Comment:OFSystemInfo: Fix signedness in comparison
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 97230362119e44e03bc2161b22772c3824f32d8cb9ab12863d15ae1fc2fe4ea3
User & Date: js on 2018-10-06 18:39:06
Other Links: manifest | tags
Context
2018-10-06
19:36
OFTCPSocket: Implement sync connect via async check-in: c5c4d38220 user: js tags: trunk
18:39
OFSystemInfo: Fix signedness in comparison check-in: 9723036211 user: js tags: trunk
18:31
.travis.yml: Change download URL for amiga-gcc check-in: d7795b525e user: js tags: trunk
Changes

Modified src/OFSystemInfo.m from [02f4d2521e] to [b0d88583f9].

93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108

#if defined(OF_X86_64) || defined(OF_X86)
struct x86_regs {
	uint32_t eax, ebx, ecx, edx;
};
#endif

static size_t pageSize;
static size_t numberOfCPUs;
static OFString *operatingSystemName = nil;
static OFString *operatingSystemVersion = nil;

static void
initOperatingSystemName(void)
{
#if defined(OF_IOS)







|
|







93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108

#if defined(OF_X86_64) || defined(OF_X86)
struct x86_regs {
	uint32_t eax, ebx, ecx, edx;
};
#endif

static size_t pageSize = 4096;
static size_t numberOfCPUs = 1;
static OFString *operatingSystemName = nil;
static OFString *operatingSystemVersion = nil;

static void
initOperatingSystemName(void)
{
#if defined(OF_IOS)
268
269
270
271
272
273
274


275
276
277
278
279
280
281
282
283
284
285
286
287
288
289

290
291
292
293

294
295
296


297
298
299
300
301
302
303
	return regs;
}
#endif

@implementation OFSystemInfo
+ (void)initialize
{


	if (self != [OFSystemInfo class])
		return;

#if defined(OF_WINDOWS)
	SYSTEM_INFO si;
	GetSystemInfo(&si);
	pageSize = si.dwPageSize;
	numberOfCPUs = si.dwNumberOfProcessors;
#elif defined(OF_QNX)
	if ((pageSize = sysconf(_SC_PAGESIZE)) < 1)
		pageSize = 4096;
	numberOfCPUs = _syspage_ptr->num_cpu;
#else
# if defined(HAVE_SYSCONF) && defined(_SC_PAGESIZE)
	if ((pageSize = sysconf(_SC_PAGESIZE)) < 1)

# endif
		pageSize = 4096;
# if defined(HAVE_SYSCONF) && defined(_SC_NPROCESSORS_CONF)
	if ((numberOfCPUs = sysconf(_SC_NPROCESSORS_CONF)) < 1)

# endif
		numberOfCPUs = 1;
#endif


}

+ (instancetype)alloc
{
	OF_UNRECOGNIZED_SELECTOR
}








>
>









|
|



|
>

<

|
>

<

>
>







268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293

294
295
296
297

298
299
300
301
302
303
304
305
306
307
	return regs;
}
#endif

@implementation OFSystemInfo
+ (void)initialize
{
	long tmp;

	if (self != [OFSystemInfo class])
		return;

#if defined(OF_WINDOWS)
	SYSTEM_INFO si;
	GetSystemInfo(&si);
	pageSize = si.dwPageSize;
	numberOfCPUs = si.dwNumberOfProcessors;
#elif defined(OF_QNX)
	if ((tmp = sysconf(_SC_PAGESIZE)) > 0)
		pageSize = tmp;
	numberOfCPUs = _syspage_ptr->num_cpu;
#else
# if defined(HAVE_SYSCONF) && defined(_SC_PAGESIZE)
	if ((tmp = sysconf(_SC_PAGESIZE)) > 0)
		pageSize = tmp;
# endif

# if defined(HAVE_SYSCONF) && defined(_SC_NPROCESSORS_CONF)
	if ((tmp = sysconf(_SC_NPROCESSORS_CONF)) > 0)
		numberOfCPUs = tmp;
# endif

#endif

	(void)tmp;
}

+ (instancetype)alloc
{
	OF_UNRECOGNIZED_SELECTOR
}