fix some warnings and a possible off-by-one error with reading scintilla text.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5257 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2018-05-28 21:09:15 +00:00
parent 1d655322d0
commit b1b5fcf4fb
6 changed files with 15 additions and 15 deletions

View file

@ -7,7 +7,7 @@
#define Hash_BytesForBuckets(b) (sizeof(bucket_t*)*(b)) #define Hash_BytesForBuckets(b) (sizeof(bucket_t*)*(b))
#define STRCMP(s1,s2) (((*s1)!=(*s2)) || (strcmp(s1,s2))) //saves about 2-6 out of 120 - expansion of idea from fastqcc #define STRCMP(s1,s2) (((*s1)!=(*s2)) || strcmp(s1,s2)) //saves about 2-6 out of 120 - expansion of idea from fastqcc
typedef struct bucket_s { typedef struct bucket_s {
void *data; void *data;
union { union {

View file

@ -1173,4 +1173,4 @@ vfile_t *QCC_AddVFile(const char *name, void *data, size_t size);
void QCC_CatVFile(vfile_t *, const char *fmt, ...); void QCC_CatVFile(vfile_t *, const char *fmt, ...);
void QCC_InsertVFile(vfile_t *, size_t pos, const char *fmt, ...); void QCC_InsertVFile(vfile_t *, size_t pos, const char *fmt, ...);
void *QCC_ReadFile(const char *fname, unsigned char *(*buf_get)(void *ctx, size_t len), void *buf_ctx, size_t *out_size, pbool issourcefile); //void *QCC_ReadFile(const char *fname, unsigned char *(*buf_get)(void *ctx, size_t len), void *buf_ctx, size_t *out_size, pbool issourcefile);

View file

@ -21,8 +21,8 @@ void QCC_PR_ParseAsm(void);
#define MEMBERFIELDNAME "__m%s" #define MEMBERFIELDNAME "__m%s"
#define STRCMP(s1,s2) (((*s1)!=(*s2)) || strcmp(s1+1,s2+1)) //saves about 2-6 out of 120 - expansion of idea from fastqcc #define STRCMP(s1,s2) (((*s1)!=(*s2)) || strcmp(s1,s2)) //saves about 2-6 out of 120 - expansion of idea from fastqcc
#define STRNCMP(s1,s2,l) (((*s1)!=(*s2)) || strncmp(s1+1,s2+1,l)) //pathetic saving here. #define STRNCMP(s1,s2,l) (((*s1)!=(*s2)) || strncmp(s1,s2,l)) //pathetic saving here.
extern char *compilingfile; extern char *compilingfile;

View file

@ -8,7 +8,7 @@
#define MEMBERFIELDNAME "__m%s" #define MEMBERFIELDNAME "__m%s"
#define STRCMP(s1,s2) (((*s1)!=(*s2)) || strcmp(s1+1,s2+1)) //saves about 2-6 out of 120 - expansion of idea from fastqcc #define STRCMP(s1,s2) (((*s1)!=(*s2)) || strcmp(s1,s2)) //saves about 2-6 out of 120 - expansion of idea from fastqcc
void QCC_PR_PreProcessor_Define(pbool append); void QCC_PR_PreProcessor_Define(pbool append);
pbool QCC_PR_UndefineName(char *name); pbool QCC_PR_UndefineName(char *name);
@ -2291,7 +2291,7 @@ void QCC_PR_LexName (void)
} }
c = *pr_file_p; c = *pr_file_p;
} while ( (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_' } while ( (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_'
|| (c >= '0' && c <= '9') || c & 0x80); || (c >= '0' && c <= '9') || (c & 0x80));
pr_token[len] = 0; pr_token[len] = 0;
pr_token_type = tt_name; pr_token_type = tt_name;

View file

@ -450,7 +450,7 @@ void QCC_EnumerateFilesResult(const char *name, const void *compdata, size_t com
LoadFile LoadFile
============== ==============
*/ */
void *QCC_ReadFile(const char *fname, unsigned char *(*buf_get)(void *ctx, size_t len), void *buf_ctx, size_t *out_size) static void *QCC_ReadFile(const char *fname, unsigned char *(*buf_get)(void *ctx, size_t len), void *buf_ctx, size_t *out_size)
//unsigned char *PDECL QCC_ReadFile (const char *fname, void *buffer, int len, size_t *sz) //unsigned char *PDECL QCC_ReadFile (const char *fname, void *buffer, int len, size_t *sz)
{ {
size_t len; size_t len;
@ -3374,8 +3374,8 @@ void *GUIReadFile(const char *fname, unsigned char *(*buf_get)(void *ctx, size_t
free(deflist); free(deflist);
blen = SendMessage(e->editpane, SCI_GETLENGTH, 0, 0); blen = SendMessage(e->editpane, SCI_GETLENGTH, 0, 0);
buffer = buf_get(buf_ctx, blen); buffer = buf_get(buf_ctx, blen+1);
blen = SendMessage(e->editpane, SCI_GETTEXT, blen, (LPARAM)buffer); blen = SendMessage(e->editpane, SCI_GETTEXT, blen+1, (LPARAM)buffer);
} }
else if (e->savefmt == UTF_ANSI) else if (e->savefmt == UTF_ANSI)
{ {

View file

@ -8,7 +8,7 @@
LoadFile LoadFile
============== ==============
*/ */
void *QCC_ReadFile(const char *fname, unsigned char *(*buf_get)(void *ctx, size_t len), void *buf_ctx, size_t *out_size, pbool issourcefile) static void *QCC_ReadFile(const char *fname, unsigned char *(*buf_get)(void *ctx, size_t len), void *buf_ctx, size_t *out_size, pbool issourcefile)
//unsigned char *PDECL QCC_ReadFile (const char *fname, void *buffer, int len, size_t *sz) //unsigned char *PDECL QCC_ReadFile (const char *fname, void *buffer, int len, size_t *sz)
{ {
size_t len; size_t len;
@ -43,7 +43,7 @@ void *QCC_ReadFile(const char *fname, unsigned char *(*buf_get)(void *ctx, size_
*out_size = len; *out_size = len;
return buffer; return buffer;
} }
int PDECL QCC_FileSize (const char *fname) static int PDECL QCC_FileSize (const char *fname)
{ {
long length; long length;
FILE *f; FILE *f;
@ -57,7 +57,7 @@ int PDECL QCC_FileSize (const char *fname)
return length; return length;
} }
pbool PDECL QCC_WriteFile (const char *name, void *data, int len) static pbool PDECL QCC_WriteFile (const char *name, void *data, int len)
{ {
long length; long length;
FILE *f; FILE *f;
@ -76,7 +76,7 @@ pbool PDECL QCC_WriteFile (const char *name, void *data, int len)
#undef printf #undef printf
#undef Sys_Error #undef Sys_Error
void PDECL Sys_Error(const char *text, ...) static void PDECL Sys_Error(const char *text, ...)
{ {
va_list argptr; va_list argptr;
static char msg[2048]; static char msg[2048];
@ -89,8 +89,8 @@ void PDECL Sys_Error(const char *text, ...)
} }
FILE *logfile; static FILE *logfile;
int logprintf(const char *format, ...) static int logprintf(const char *format, ...)
{ {
va_list argptr; va_list argptr;
static char string[1024]; static char string[1024];