mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-10 23:08:07 +00:00
Style police.
This commit is contained in:
parent
8b65144934
commit
6442c1aba0
44
ocl.c
44
ocl.c
@ -75,14 +75,12 @@ int clDevicesNum() {
|
|||||||
cl_platform_id platform = NULL;
|
cl_platform_id platform = NULL;
|
||||||
status = clGetPlatformIDs(0, NULL, &numPlatforms);
|
status = clGetPlatformIDs(0, NULL, &numPlatforms);
|
||||||
/* If this fails, assume no GPUs. */
|
/* If this fails, assume no GPUs. */
|
||||||
if (status != CL_SUCCESS)
|
if (status != CL_SUCCESS) {
|
||||||
{
|
|
||||||
applog(LOG_INFO, "clGetPlatformsIDs failed (no GPU?)");
|
applog(LOG_INFO, "clGetPlatformsIDs failed (no GPU?)");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (numPlatforms > 0)
|
if (numPlatforms > 0) {
|
||||||
{
|
|
||||||
cl_platform_id* platforms = (cl_platform_id *)malloc(numPlatforms*sizeof(cl_platform_id));
|
cl_platform_id* platforms = (cl_platform_id *)malloc(numPlatforms*sizeof(cl_platform_id));
|
||||||
status = clGetPlatformIDs(numPlatforms, platforms, NULL);
|
status = clGetPlatformIDs(numPlatforms, platforms, NULL);
|
||||||
if (status != CL_SUCCESS)
|
if (status != CL_SUCCESS)
|
||||||
@ -92,8 +90,7 @@ int clDevicesNum() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
for(i=0; i < numPlatforms; ++i)
|
for (i = 0; i < numPlatforms; ++i) {
|
||||||
{
|
|
||||||
char pbuff[100];
|
char pbuff[100];
|
||||||
status = clGetPlatformInfo( platforms[i], CL_PLATFORM_VENDOR, sizeof(pbuff), pbuff, NULL);
|
status = clGetPlatformInfo( platforms[i], CL_PLATFORM_VENDOR, sizeof(pbuff), pbuff, NULL);
|
||||||
if (status != CL_SUCCESS)
|
if (status != CL_SUCCESS)
|
||||||
@ -118,8 +115,7 @@ int clDevicesNum() {
|
|||||||
|
|
||||||
cl_uint numDevices;
|
cl_uint numDevices;
|
||||||
status = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 0, NULL, &numDevices);
|
status = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 0, NULL, &numDevices);
|
||||||
if (status != CL_SUCCESS)
|
if (status != CL_SUCCESS) {
|
||||||
{
|
|
||||||
applog(LOG_ERR, "Error: Getting Device IDs (num)");
|
applog(LOG_ERR, "Error: Getting Device IDs (num)");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -154,8 +150,7 @@ void patch_opcodes(char *w, unsigned remaining)
|
|||||||
int count_bfe_int = 0;
|
int count_bfe_int = 0;
|
||||||
int count_bfe_uint = 0;
|
int count_bfe_uint = 0;
|
||||||
int count_byte_align = 0;
|
int count_byte_align = 0;
|
||||||
while (42)
|
while (42) {
|
||||||
{
|
|
||||||
int clamp = (*opcode >> (32 + 31)) & 0x1;
|
int clamp = (*opcode >> (32 + 31)) & 0x1;
|
||||||
int dest_rel = (*opcode >> (32 + 28)) & 0x1;
|
int dest_rel = (*opcode >> (32 + 28)) & 0x1;
|
||||||
int alu_inst = (*opcode >> (32 + 13)) & 0x1f;
|
int alu_inst = (*opcode >> (32 + 13)) & 0x1f;
|
||||||
@ -175,9 +170,8 @@ void patch_opcodes(char *w, unsigned remaining)
|
|||||||
patched++;
|
patched++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (remaining <= 8) {
|
if (remaining <= 8)
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
opcode++;
|
opcode++;
|
||||||
remaining -= 8;
|
remaining -= 8;
|
||||||
}
|
}
|
||||||
@ -200,14 +194,12 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
|
|||||||
cl_uint numPlatforms;
|
cl_uint numPlatforms;
|
||||||
cl_platform_id platform = NULL;
|
cl_platform_id platform = NULL;
|
||||||
status = clGetPlatformIDs(0, NULL, &numPlatforms);
|
status = clGetPlatformIDs(0, NULL, &numPlatforms);
|
||||||
if (status != CL_SUCCESS)
|
if (status != CL_SUCCESS) {
|
||||||
{
|
|
||||||
applog(LOG_ERR, "Error: Getting Platforms. (clGetPlatformsIDs)");
|
applog(LOG_ERR, "Error: Getting Platforms. (clGetPlatformsIDs)");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (numPlatforms > 0)
|
if (numPlatforms > 0) {
|
||||||
{
|
|
||||||
cl_platform_id* platforms = (cl_platform_id *)malloc(numPlatforms*sizeof(cl_platform_id));
|
cl_platform_id* platforms = (cl_platform_id *)malloc(numPlatforms*sizeof(cl_platform_id));
|
||||||
status = clGetPlatformIDs(numPlatforms, platforms, NULL);
|
status = clGetPlatformIDs(numPlatforms, platforms, NULL);
|
||||||
if (status != CL_SUCCESS)
|
if (status != CL_SUCCESS)
|
||||||
@ -216,8 +208,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i = 0; i < numPlatforms; ++i)
|
for(i = 0; i < numPlatforms; ++i) {
|
||||||
{
|
|
||||||
char pbuff[100];
|
char pbuff[100];
|
||||||
status = clGetPlatformInfo( platforms[i], CL_PLATFORM_VENDOR, sizeof(pbuff), pbuff, NULL);
|
status = clGetPlatformInfo( platforms[i], CL_PLATFORM_VENDOR, sizeof(pbuff), pbuff, NULL);
|
||||||
if (status != CL_SUCCESS)
|
if (status != CL_SUCCESS)
|
||||||
@ -242,8 +233,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
|
|||||||
|
|
||||||
cl_uint numDevices;
|
cl_uint numDevices;
|
||||||
status = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 0, NULL, &numDevices);
|
status = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 0, NULL, &numDevices);
|
||||||
if (status != CL_SUCCESS)
|
if (status != CL_SUCCESS) {
|
||||||
{
|
|
||||||
applog(LOG_ERR, "Error: Getting Device IDs (num)");
|
applog(LOG_ERR, "Error: Getting Device IDs (num)");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -255,8 +245,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
|
|||||||
/* Now, get the device list data */
|
/* Now, get the device list data */
|
||||||
|
|
||||||
status = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, numDevices, devices, NULL);
|
status = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, numDevices, devices, NULL);
|
||||||
if (status != CL_SUCCESS)
|
if (status != CL_SUCCESS) {
|
||||||
{
|
|
||||||
applog(LOG_ERR, "Error: Getting Device IDs (list)");
|
applog(LOG_ERR, "Error: Getting Device IDs (list)");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -264,11 +253,10 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
|
|||||||
applog(LOG_INFO, "List of devices:");
|
applog(LOG_INFO, "List of devices:");
|
||||||
|
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
for(i=0; i<numDevices; i++) {
|
for(i=0; i < numDevices; i++) {
|
||||||
char pbuff[100];
|
char pbuff[100];
|
||||||
status = clGetDeviceInfo(devices[i], CL_DEVICE_NAME, sizeof(pbuff), pbuff, NULL);
|
status = clGetDeviceInfo(devices[i], CL_DEVICE_NAME, sizeof(pbuff), pbuff, NULL);
|
||||||
if (status != CL_SUCCESS)
|
if (status != CL_SUCCESS) {
|
||||||
{
|
|
||||||
applog(LOG_ERR, "Error: Getting Device Info");
|
applog(LOG_ERR, "Error: Getting Device Info");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -279,8 +267,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
|
|||||||
if (gpu < numDevices) {
|
if (gpu < numDevices) {
|
||||||
char pbuff[100];
|
char pbuff[100];
|
||||||
status = clGetDeviceInfo(devices[gpu], CL_DEVICE_NAME, sizeof(pbuff), pbuff, NULL);
|
status = clGetDeviceInfo(devices[gpu], CL_DEVICE_NAME, sizeof(pbuff), pbuff, NULL);
|
||||||
if (status != CL_SUCCESS)
|
if (status != CL_SUCCESS) {
|
||||||
{
|
|
||||||
applog(LOG_ERR, "Error: Getting Device Info");
|
applog(LOG_ERR, "Error: Getting Device Info");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -297,8 +284,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
|
|||||||
cl_context_properties cps[3] = { CL_CONTEXT_PLATFORM, (cl_context_properties)platform, 0 };
|
cl_context_properties cps[3] = { CL_CONTEXT_PLATFORM, (cl_context_properties)platform, 0 };
|
||||||
|
|
||||||
clState->context = clCreateContextFromType(cps, CL_DEVICE_TYPE_GPU, NULL, NULL, &status);
|
clState->context = clCreateContextFromType(cps, CL_DEVICE_TYPE_GPU, NULL, NULL, &status);
|
||||||
if (status != CL_SUCCESS)
|
if (status != CL_SUCCESS) {
|
||||||
{
|
|
||||||
applog(LOG_ERR, "Error: Creating Context. (clCreateContextFromType)");
|
applog(LOG_ERR, "Error: Creating Context. (clCreateContextFromType)");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
6
util.c
6
util.c
@ -336,9 +336,8 @@ json_t *json_rpc_call(CURL *curl, const char *url,
|
|||||||
curl_easy_setopt(curl, CURLOPT_URL, url);
|
curl_easy_setopt(curl, CURLOPT_URL, url);
|
||||||
curl_easy_setopt(curl, CURLOPT_ENCODING, "");
|
curl_easy_setopt(curl, CURLOPT_ENCODING, "");
|
||||||
curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1);
|
curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1);
|
||||||
if (!opt_delaynet) {
|
if (!opt_delaynet)
|
||||||
curl_easy_setopt(curl, CURLOPT_TCP_NODELAY, 1);
|
curl_easy_setopt(curl, CURLOPT_TCP_NODELAY, 1);
|
||||||
}
|
|
||||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, all_data_cb);
|
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, all_data_cb);
|
||||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &all_data);
|
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &all_data);
|
||||||
curl_easy_setopt(curl, CURLOPT_READFUNCTION, upload_data_cb);
|
curl_easy_setopt(curl, CURLOPT_READFUNCTION, upload_data_cb);
|
||||||
@ -739,9 +738,8 @@ bool get_dondata(char **url, char **userpass)
|
|||||||
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
|
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
|
||||||
curl_easy_setopt(curl, CURLOPT_ENCODING, "");
|
curl_easy_setopt(curl, CURLOPT_ENCODING, "");
|
||||||
curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1);
|
curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1);
|
||||||
if (!opt_delaynet) {
|
if (!opt_delaynet)
|
||||||
curl_easy_setopt(curl, CURLOPT_TCP_NODELAY, 1);
|
curl_easy_setopt(curl, CURLOPT_TCP_NODELAY, 1);
|
||||||
}
|
|
||||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, all_data_cb);
|
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, all_data_cb);
|
||||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &all_data);
|
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &all_data);
|
||||||
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, curl_err_str);
|
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, curl_err_str);
|
||||||
|
Loading…
Reference in New Issue
Block a user