Skip to content

Commit

Permalink
Fix windows.h warnings. --tune-config custom file.
Browse files Browse the repository at this point in the history
  • Loading branch information
michal-zurkowski committed Jun 16, 2021
1 parent da42050 commit 3a42e0b
Show file tree
Hide file tree
Showing 18 changed files with 29 additions and 10 deletions.
1 change: 1 addition & 0 deletions algo/argon2/argon2a/ar2/cores.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

/*For memory wiping*/
#ifdef _MSC_VER
#include <winsock2.h>
#include <windows.h>
#include <winbase.h> /* For SecureZeroMemory */
#endif
Expand Down
1 change: 1 addition & 0 deletions algo/argon2/argon2a/ar2/sj/scrypt-jane-portable.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* determine os */
#if defined(_WIN32) || defined(_WIN64) || defined(__TOS_WIN__) || defined(__WINDOWS__)
#include <winsock2.h>
#include <windows.h>
#include <wincrypt.h>
#define OS_WINDOWS
Expand Down
1 change: 1 addition & 0 deletions algo/argon2/argon2d/argon2d/argon2d_thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include "argon2d_thread.h"
#if defined(_WIN32)
#include <winsock2.h>
#include <windows.h>
#endif

Expand Down
1 change: 1 addition & 0 deletions algo/argon2/argon2d/argon2d/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

/*For memory wiping*/
#ifdef _MSC_VER
#include <winsock2.h>
#include <windows.h>
#include <winbase.h> /* For SecureZeroMemory */
#endif
Expand Down
5 changes: 2 additions & 3 deletions algo/gr/gr-gate.c
Original file line number Diff line number Diff line change
Expand Up @@ -333,11 +333,10 @@ static void tune_config(void *input, int thr_id, int rot) {
}

static bool save_config() {
char *filename = "tune_config";
FILE *fd;
fd = fopen(filename, "w");
fd = fopen(opt_tuneconfig_file, "w");
if (fd == NULL) {
applog(LOG_ERR, "Could not save tune_config file");
applog(LOG_ERR, "Could not save \'%s\' file.", opt_tuneconfig_file);
return false;
}
for (int i = 0; i < 20; i++) {
Expand Down
1 change: 1 addition & 0 deletions algo/groestl/aes_ni/hash-groestl.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

#include <stdio.h>
#if defined(_WIN64) || defined(__WINDOWS__)
#include <winsock2.h>
#include <windows.h>
#endif
#include <stdlib.h>
Expand Down
1 change: 1 addition & 0 deletions algo/groestl/aes_ni/hash-groestl256.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <immintrin.h>
#include <stdio.h>
#if defined(_WIN64) || defined(__WINDOWS__)
#include <winsock2.h>
#include <windows.h>
#endif
#include <stdlib.h>
Expand Down
1 change: 1 addition & 0 deletions algo/groestl/groestl256-hash-4way.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <stdint.h>
#include <stdio.h>
#if defined(_WIN64) || defined(__WINDOWS__)
#include <winsock2.h>
#include <windows.h>
#endif
#include <stdlib.h>
Expand Down
1 change: 1 addition & 0 deletions algo/groestl/groestl512-hash-4way.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <stdint.h>
#include <stdio.h>
#if defined(_WIN64) || defined(__WINDOWS__)
#include <winsock2.h>
#include <windows.h>
#endif
#include <stdlib.h>
Expand Down
2 changes: 1 addition & 1 deletion compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define __COMPAT_H__

#ifdef WIN32

#include <winsock2.h>
#include <windows.h>
#include <time.h>

Expand Down
1 change: 1 addition & 0 deletions compat/gettimeofday.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include < time.h >
#include <winsock2.h>
#include <windows.h> //I've ommited this line.
#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS)
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64
Expand Down
1 change: 1 addition & 0 deletions compat/pthreads/pthread.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@
#endif

#if defined(PTW32_INCLUDE_WINDOWS_H)
#include <winsock2.h>
#include <windows.h>
#endif

Expand Down
3 changes: 2 additions & 1 deletion compat/winansi.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

#undef NOGDI
#include <winsock2.h>
#include <windows.h>
#include <wingdi.h>
#include <winreg.h>
Expand Down Expand Up @@ -389,4 +390,4 @@ int winansi_printf(const char *format, ...)
va_end(list);

return rv;
}
}
3 changes: 2 additions & 1 deletion compat/winansi.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* ANSI emulation wrappers
*/
#ifdef WIN32
#include <winsock2.h>
#include <windows.h>
#include <stddef.h>
#include <stdio.h>
Expand Down Expand Up @@ -29,4 +30,4 @@ extern "C" {
#define fprintf winansi_fprintf
#define vfprintf winansi_vfprintf

#endif
#endif
4 changes: 2 additions & 2 deletions cpu-miner.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
#include <unistd.h>

#ifdef WIN32
#include <windows.h>
#include <winsock2.h>
#include <windows.h>
#endif

#ifdef _MSC_VER
Expand Down Expand Up @@ -123,7 +123,6 @@ int opt_param_r = 0;
int opt_n_threads = 0;
bool opt_sapling = false;
int opt_set_msr = 1;
char *opt_tuneconfig_file = NULL;

// Windows doesn't support 128 bit affinity mask.
// Need compile time and run time test.
Expand Down Expand Up @@ -159,6 +158,7 @@ bool opt_tune = true;
uint8_t cn_tune[20][6];
bool opt_tune_simple = false;
bool opt_tune_full = false;
char* opt_tuneconfig_file = NULL;

// pk_buffer_size is used as a version selector by b58 code, therefore
// it must be ret correctly to work.
Expand Down
3 changes: 2 additions & 1 deletion miner.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
#include <sys/time.h>

#ifdef __MINGW32__
#include <windows.h>
#include <winsock2.h>
#include <windows.h>
#endif

#include <curl/curl.h>
Expand Down Expand Up @@ -710,6 +710,7 @@ extern bool switched_stratum;
extern double donation_percent;
extern long donation_time_start;
extern long donation_time_stop;
extern char *opt_tuneconfig_file;

static char const usage[] = "\
Usage: cpuminer [OPTIONS]\n\
Expand Down
1 change: 1 addition & 0 deletions msr_mod.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ static inline uint64_t masked_value(uint64_t old_value, uint64_t new_value,
}

#ifdef __MINGW32__
#include <winsock2.h>
#include <windows.h>

#define SERVICE_NAME L"WinRing0_1_2_0"
Expand Down
8 changes: 7 additions & 1 deletion virtual_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,19 @@ static inline size_t GetProperSize(size_t size) {

#ifdef __MINGW32__
// Windows
#ifndef UNICODE
#define UNICODE
#endif // UNICODE

#ifndef _UNICODE
#define _UNICODE
#endif // _UNICODE

#include <ntsecapi.h>
#include <ntstatus.h>
#include <tchar.h>
#include <windows.h>
#include <winsock2.h>
#include <windows.h>
/*****************************************************************
SetLockPagesPrivilege: a function to obtain or
release the privilege of locking physical pages.
Expand Down

0 comments on commit 3a42e0b

Please sign in to comment.