Skip to content

Commit 5904ab8

Browse files
authored
Merge pull request #13 from NexiusTailer/master
Fixes and corrections
2 parents f93172e + fb324a4 commit 5904ab8

File tree

10 files changed

+118
-103
lines changed

10 files changed

+118
-103
lines changed

include/file.inc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ native File: fopen(const name[], filemode: mode = io_readwrite);
3030
native bool: fclose(File: handle);
3131
native File: ftemp();
3232
native bool: fremove(const name[]);
33+
native bool: fcopy(const source[], const target[]);
34+
native bool: frename(const oldname[], const newname[]);
35+
native bool: fcreatedir(const name[]);
3336

3437
native fwrite(File: handle, const string[]);
3538
native fread(File: handle, string[], size = sizeof string, bool: pack = false);
@@ -42,3 +45,12 @@ native fseek(File: handle, position = 0, seek_whence: whence = seek_start)
4245
native flength(File: handle);
4346
native fexist(const pattern[]);
4447
native bool: fmatch(name[], const pattern[], index = 0, size = sizeof name);
48+
native bool: fstat(name[], &size = 0, &timestamp = 0, &mode = 0, &inode = 0);
49+
native bool: fattrib(const name[], timestamp=0, attrib=0x0f);
50+
native filecrc(const name[]);
51+
52+
native readcfg(const filename[]="", const section[]="", const key[], value[], size=sizeof value, const defvalue[]="", bool:pack=false);
53+
native readcfgvalue(const filename[]="", const section[]="", const key[], defvalue=0);
54+
native bool: writecfg(const filename[]="", const section[]="", const key[], const value[]);
55+
native bool: writecfgvalue(const filename[]="", const section[]="", const key[], value);
56+
native bool: deletecfg(const filename[]="", const section[]="", const key[]="");

include/string.inc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
native strlen(const string[]);
1313
native strpack(dest[], const source[], maxlength=sizeof dest);
1414
native strunpack(dest[], const source[], maxlength=sizeof dest);
15+
native strcopy(dest[], const source[], maxlength=sizeof dest);
1516
native strcat(dest[], const source[], maxlength=sizeof dest);
1617

1718
native strmid(dest[], const source[], start=0, end=cellmax, maxlength=sizeof dest);
@@ -32,4 +33,4 @@ native uuencode(dest[], const source[], numbytes, maxlength=sizeof dest);
3233
native memcpy(dest[], const source[], index=0, numbytes, maxlength=sizeof dest);
3334

3435
stock bool: strequal(const string1[], const string2[], bool:ignorecase=false, length=cellmax)
35-
return strcmp(string1, string2, ignorecase, length) == 0
36+
return strcmp(string1, string2, ignorecase, length) == 0;

include/time.inc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ native gettime(&hour=0, &minute=0, &second=0);
1313
native settime(hour=cellmin, minute=cellmin, second=cellmin);
1414
native getdate(&year=0, &month=0, &day=0);
1515
native setdate(year=cellmin, month=cellmin, day=cellmin);
16+
1617
native settimestamp(seconds1970);
18+
native cvttimestamp(seconds1970, &year=0, &month=0, &day=0, &hour=0, &minute=0, &second=0);
1719

1820
native settimer(milliseconds, bool: singleshot=false);
1921
native tickcount(&granularity=0);

readme.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,13 @@ seems to be based on an older release of Pawn.
113113
[build_win]: https://ci.appveyor.com/project/Southclaws/compiler/branch/master
114114
[build_status_win]:
115115
https://ci.appveyor.com/api/projects/status/k112tbr1afrkif0n?svg=true
116-
[team]: https://github.com/pawn-lang/compiler/graphs/contributors
116+
[team]: https://github.com/openmultiplayer/compiler/graphs/contributors
117117
[original_readme]:
118-
https://github.com/pawn-lang/compiler/tree/master/readme_compuphase.txt
119-
[issues]: https://github.com/pawn-lang/compiler/issues
118+
https://github.com/openmultiplayer/compiler/tree/master/readme_compuphase.txt
119+
[issues]: https://github.com/openmultiplayer/compiler/issues
120120
[bugs]: https://github.com/pawn-lang/compiler/wiki/Known-compiler-bugs
121121
[new]: https://github.com/pawn-lang/compiler/wiki/What's-new
122-
[releases]: https://github.com/pawn-lang/compiler/releases
122+
[releases]: https://github.com/openmultiplayer/compiler/releases
123123
[artifacts]:
124124
https://ci.appveyor.com/project/Southclaws/compiler/branch/master/artifacts
125125
[compat]: https://github.com/pawn-lang/compiler/wiki/Compatibility-mode

source/amx/amx.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -793,6 +793,7 @@ static int amx_BrowseRelocate(AMX *amx)
793793
#else
794794
assert(sysreq_flg==0 || sysreq_flg==0x01 || sysreq_flg==0x02 || sysreq_flg==0x03);
795795
#endif
796+
796797
#if defined JIT
797798
amx->code_size = getMaxCodeSize()*opcode_count + hdr->cod
798799
+ (hdr->stp - hdr->dat);
@@ -1047,7 +1048,7 @@ int AMXAPI amx_Init(AMX *amx,void *program)
10471048
hdr=(AMX_HEADER *)amx->base;
10481049
numlibraries=NUMENTRIES(hdr,libraries,pubvars);
10491050
for (i=0; i<numlibraries; i++) {
1050-
lib=(AMX_FUNCWIDE*)GETENTRY(hdr, libraries, i);
1051+
lib=(AMX_FUNCWIDE*)GETENTRY(hdr,libraries,i);
10511052
libname[0]='\0';
10521053
#if defined LINUX || defined __FreeBSD__ || defined __OpenBSD__
10531054
if (root!=NULL && *root!='\0') {
@@ -1404,7 +1405,7 @@ int AMXAPI amx_FindNative(AMX* amx, const char* name, int* index)
14041405
}
14051406

14061407
/* not found, set to an invalid index, so amx_Exec() will fail */
1407-
*index = INT_MAX;
1408+
*index=INT_MAX;
14081409
return AMX_ERR_NOTFOUND;
14091410
}
14101411
#endif /* AMX_XXXNATIVES */
@@ -1774,7 +1775,7 @@ int AMXAPI amx_PushString(AMX *amx, cell *amx_addr, cell **phys_addr, const char
17741775
assert(string!=NULL);
17751776

17761777
#if defined AMX_ANSIONLY
1777-
length = strlen(string) + 1;
1778+
length = strlen(string);
17781779
#else
17791780
length = (use_wchar ? wcslen((const wchar_t*)string) : strlen(string));
17801781
#endif

source/amx/amx.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ extern "C" {
203203

204204
#if !defined PAWN_CELL_SIZE
205205
#if defined __64BIT__
206-
#define PAWN_CELL_SIZE 64 /* by default, use 32-bit cells */
206+
#define PAWN_CELL_SIZE 64 /* use 64-bit cells for 64-bit systems */
207207
#else
208208
#define PAWN_CELL_SIZE 32 /* by default, use 32-bit cells */
209209
#endif
@@ -244,9 +244,8 @@ typedef int (AMXAPI *AMX_IDLE)(struct tagAMX *amx, int AMXAPI Exec(struct tagAMX
244244
#endif
245245

246246
#if defined _MSC_VER
247-
#pragma warning(disable:4103) /* disable warning message 4103 that complains
248-
* about pragma pack in a header file */
249247
#pragma warning(disable:4100) /* "'%$S' : unreferenced formal parameter" */
248+
#pragma warning(disable:4103) /* disable warning message 4103 that complains about pragma pack in a header file */
250249
#pragma warning(disable:4127) /* "conditional expression is constant" (needed for static_assert) */
251250
#pragma warning(disable:4996) /* POSIX name is deprecated */
252251
#elif defined __GNUC__

source/amx/amxcore.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ static cell AMX_NATIVE_CALL core_tolower(AMX *amx,const cell *params)
283283
#endif
284284
}
285285

286-
static cell AMX_NATIVE_CALL core_toupper(AMX *amx, const cell *params)
286+
static cell AMX_NATIVE_CALL core_toupper(AMX *amx,const cell *params)
287287
{
288288
(void)amx;
289289
#if (defined __WIN32__ || defined _WIN32 || defined WIN32) && !defined _WIN64
@@ -347,7 +347,7 @@ static cell AMX_NATIVE_CALL getproperty(AMX *amx,const cell *params)
347347
/* if list_finditem() found the value, store the name */
348348
if (item!=NULL && item->value==params[3] && strlen(name)==0) {
349349
amx_GetAddr(amx,params[4],&cstr);
350-
amx_SetString(cstr,item->name,1,0, UNLIMITED);
350+
amx_SetString(cstr,item->name,1,0,UNLIMITED);
351351
} /* if */
352352
free(name);
353353
return (item!=NULL) ? item->value : 0;

source/amx/amxfile.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ static cell AMX_NATIVE_CALL n_fwrite(AMX *amx, const cell *params)
664664
if ((ucell)*cptr>UNPACKEDMAX) {
665665
/* the string is packed, write it as an ASCII/ANSI string */
666666
if ((str=(char*)alloca(len + 1))!=NULL) {
667-
amx_GetString(str,cptr,0,len);
667+
amx_GetString(str,cptr,0,len+1);
668668
r=fputs(str,f);
669669
} /* if */
670670
} else {
@@ -975,15 +975,15 @@ static cell AMX_NATIVE_CALL n_flength(AMX *amx, const cell *params)
975975
}
976976

977977
long l,c;
978-
int fn = fileno(f);
978+
int fn=fileno(f);
979979
if (params[1]&FILE_WRITEABLE_BIT) {
980980
/* writable, flush */
981981
fflush(f);
982982
#if defined __WIN32__
983983
_commit(fn);
984984
#endif
985985
}
986-
c=lseek(fn,0,SEEK_CUR);
986+
c=lseek(fn,0,SEEK_CUR); /* save the current position */
987987
l=lseek(fn,0,SEEK_END); /* return the file position at its end */
988988
fseek(f,c,SEEK_SET); /* restore the file pointer */
989989
(void)amx;
@@ -1073,7 +1073,7 @@ static cell AMX_NATIVE_CALL n_fexist(AMX *amx, const cell *params)
10731073
(void)amx;
10741074
amx_StrParam(amx,params[1],name);
10751075
if (name!=NULL && completename(fullname,name,sizearray(fullname))!=NULL)
1076-
r = !access(fullname, 0);
1076+
r = !access(fullname, 0);
10771077
return r;
10781078
}
10791079

source/amx/amxfloat.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ static cell AMX_NATIVE_CALL n_floatfract(AMX *amx,const cell *params)
150150
* params[0] = number of bytes
151151
* params[1] = float operand
152152
*/
153-
154153
REAL fA = amx_ctof(params[1]);
155154

156155
if (fA >= 0.0)
@@ -290,7 +289,7 @@ static cell AMX_NATIVE_CALL n_floatsin(AMX *amx,const cell *params)
290289
*/
291290
REAL fA = amx_ctof(params[1]);
292291
fA = ToRadians(fA, params[2]);
293-
fA = (float)sin(fA);
292+
fA = (REAL)sin(fA);
294293
(void)amx;
295294
return amx_ftoc(fA);
296295
}
@@ -305,7 +304,7 @@ static cell AMX_NATIVE_CALL n_floatcos(AMX *amx,const cell *params)
305304
*/
306305
REAL fA = amx_ctof(params[1]);
307306
fA = ToRadians(fA, params[2]);
308-
fA = (float)cos(fA);
307+
fA = (REAL)cos(fA);
309308
(void)amx;
310309
return amx_ftoc(fA);
311310
}
@@ -320,7 +319,7 @@ static cell AMX_NATIVE_CALL n_floattan(AMX *amx,const cell *params)
320319
*/
321320
REAL fA = amx_ctof(params[1]);
322321
fA = ToRadians(fA, params[2]);
323-
fA = (float)tan(fA);
322+
fA = (REAL)tan(fA);
324323
(void)amx;
325324
return amx_ftoc(fA);
326325
}

0 commit comments

Comments
 (0)