[ common ]
*/
-#if defined(_USE_AGAR) || defined(_USE_QT)
+#if defined(_USE_QT)
#include <string.h>
#include "common.h"
#include "config.h"
#include "fileio.h"
-
-#ifndef SUPPORT_SECURE_FUNCTIONS
-//errno_t _tfopen_s(FILE** pFile, const _TCHAR *filename, const _TCHAR *mode)
-//{
-// if((*pFile = _tfopen(filename, mode)) != NULL) {
-// return 0;
-// } else {
-// return errno;
-// }
-//}
+#if !defined(SUPPORT_SECURE_FUNCTIONS) || defined(Q_OS_WIN)
errno_t _strcpy_s(char *strDestination, size_t numberOfElements, const char *strSource)
{
strcpy(strDestination, strSource);
return 0;
}
-# if !defined(Q_OS_WIN32)
+int _vsprintf_s(_TCHAR *buffer, size_t sizeOfBuffer, const _TCHAR *format, ...)
+{
+ va_list ap;
+ va_start(ap, format);
+ int result = vsprintf(buffer, format, ap);
+ va_end(ap);
+ return result;
+}
+
+
+# if !defined(Q_OS_WIN)
errno_t _tcscpy_s(_TCHAR *strDestination, size_t numberOfElements, const _TCHAR *strSource)
{
_tcscpy(strDestination, strSource);
} pair;
// max/min from WinDef.h
-//#ifndef max
-//#define max(a,b) (((a) > (b)) ? (a) : (b))
-//#endif
-//#ifndef min
-//#define min(a,b) (((a) < (b)) ? (a) : (b))
-//#endif
-
// rgb color
#if !defined(_USE_QT)
#define _RGB888
typedef int errno_t;
#endif
// secture functions
-#ifndef SUPPORT_SECURE_FUNCTIONS
+#if !defined(SUPPORT_SECURE_FUNCTIONS) || defined(Q_OS_WIN)
# ifndef errno_t
typedef int errno_t;
# endif
-//errno_t _tfopen_s(FILE** pFile, const _TCHAR *filename, const _TCHAR *mode);
+# if defined(Q_OS_WIN)
+# define strcpy_s _strcpy_s
+# define tcscpy_s _tcscpy_s
+# define tcstok_s _tcstok_s
+# define stprintf_s _stprintf_s
+# define vstprintf_s _vstprintf_s
+# define vsprintf_s _vsprintf_s
+# endif
errno_t _strcpy_s(char *strDestination, size_t numberOfElements, const char *strSource);
# if !defined(Q_OS_WIN) //&& !defined(Q_OS_CYGWIN)
errno_t _tcscpy_s(_TCHAR *strDestination, size_t numberOfElements, const _TCHAR *strSource);
int _stprintf_s(_TCHAR *buffer, size_t sizeOfBuffer, const _TCHAR *format, ...);
int _vstprintf_s(_TCHAR *buffer, size_t numberOfElements, const _TCHAR *format, va_list argptr);
#else
-#define _strcpy_s strcpy_s
+# define _strcpy_s strcpy_s
#endif
// wav file header
#pragma pack()
-//#if defined(_USE_SDL) || defined(_USE_AGAR) || defined(_USE_QT)
// misc
#ifdef __cplusplus
bool check_file_extension(const _TCHAR* file_path, const _TCHAR* ext);
d88_sct_t d88_sct;
memset(&d88_hdr, 0, sizeof(d88_hdr_t));
- _strcpy_s(d88_hdr.title, sizeof(d88_hdr.title), "TELEDISK");
+ //_strcpy_s(d88_hdr.title, sizeof(d88_hdr.title), "TELEDISK");
+ strncpy(d88_hdr.title, "TELEDISK", sizeof(d88_hdr.title));
d88_hdr.protect = 0; // non-protected
file_size.d = 0;
d88_sct_t d88_sct;
memset(&d88_hdr, 0, sizeof(d88_hdr_t));
- _strcpy_s(d88_hdr.title, sizeof(d88_hdr.title), "IMAGEDISK");
+ strncpy(d88_hdr.title, "IMAGEDISK", sizeof(d88_hdr.title));
+ //_strcpy_s(d88_hdr.title, sizeof(d88_hdr.title), "IMAGEDISK");
d88_hdr.protect = 0; // non-protected
file_size.d = 0;
d88_sct_t d88_sct;
memset(&d88_hdr, 0, sizeof(d88_hdr_t));
- _strcpy_s(d88_hdr.title, sizeof(d88_hdr.title), "CPDREAD");
+ strncpy(d88_hdr.title, "CPDREAD", sizeof(d88_hdr.title));
+ //_strcpy_s(d88_hdr.title, sizeof(d88_hdr.title), "CPDREAD");
d88_hdr.protect = 0; // non-protected
file_size.d = 0;
d88_sct_t d88_sct;
memset(&d88_hdr, 0, sizeof(d88_hdr_t));
- _strcpy_s(d88_hdr.title, sizeof(d88_hdr.title), "SOLID");
+ strncpy(d88_hdr.title, "SOLID", sizeof(d88_hdr.title));
+ //_strcpy_s(d88_hdr.title, sizeof(d88_hdr.title), "SOLID");
d88_hdr.protect = 0; // non-protected
file_size.d = 0;
#include "vm.h"
#include "../emu.h"
#else
-#include <windows.h>
+# if !defined(_USE_QT)
+# include <windows.h>
+# endif
#include "../common.h"
#endif
ops[i] = d_mem_stored->read_data8(pc + i);
}
int length = cpu_disassemble_m6809(buffer_tmp, pc, ops, ops);
- _strcpy_s(buffer, buffer_len, buffer_tmp);
+ //_strcpy_s(buffer, buffer_len, buffer_tmp);
+ memset(buffer_tmp, 0x00, sizeof(buffer_tmp));
+ strncpy(buffer, buffer_tmp, (buffer_len >= 1024) ? 1023 : buffer_len);
return length;
}
#endif