diff --git a/readme.md b/readme.md index 240e2d1..64e4c84 100644 --- a/readme.md +++ b/readme.md @@ -113,13 +113,13 @@ seems to be based on an older release of Pawn. [build_win]: https://ci.appveyor.com/project/Southclaws/compiler/branch/master [build_status_win]: https://ci.appveyor.com/api/projects/status/k112tbr1afrkif0n?svg=true -[team]: https://github.com/pawn-lang/compiler/graphs/contributors +[team]: https://github.com/openmultiplayer/compiler/graphs/contributors [original_readme]: - https://github.com/pawn-lang/compiler/tree/master/readme_compuphase.txt -[issues]: https://github.com/pawn-lang/compiler/issues + https://github.com/openmultiplayer/compiler/tree/master/readme_compuphase.txt +[issues]: https://github.com/openmultiplayer/compiler/issues [bugs]: https://github.com/pawn-lang/compiler/wiki/Known-compiler-bugs [new]: https://github.com/pawn-lang/compiler/wiki/What's-new -[releases]: https://github.com/pawn-lang/compiler/releases +[releases]: https://github.com/openmultiplayer/compiler/releases [artifacts]: https://ci.appveyor.com/project/Southclaws/compiler/branch/master/artifacts [compat]: https://github.com/pawn-lang/compiler/wiki/Compatibility-mode diff --git a/source/amx/amx.c b/source/amx/amx.c index 9bfd1d4..6f5ddb8 100644 --- a/source/amx/amx.c +++ b/source/amx/amx.c @@ -793,6 +793,7 @@ static int amx_BrowseRelocate(AMX *amx) #else assert(sysreq_flg==0 || sysreq_flg==0x01 || sysreq_flg==0x02 || sysreq_flg==0x03); #endif + #if defined JIT amx->code_size = getMaxCodeSize()*opcode_count + hdr->cod + (hdr->stp - hdr->dat); @@ -1047,7 +1048,7 @@ int AMXAPI amx_Init(AMX *amx,void *program) hdr=(AMX_HEADER *)amx->base; numlibraries=NUMENTRIES(hdr,libraries,pubvars); for (i=0; ivalue==params[3] && strlen(name)==0) { amx_GetAddr(amx,params[4],&cstr); - amx_SetString(cstr,item->name,1,0, UNLIMITED); + amx_SetString(cstr,item->name,1,0,UNLIMITED); } /* if */ free(name); return (item!=NULL) ? item->value : 0; diff --git a/source/amx/amxfile.c b/source/amx/amxfile.c index 5b49ba7..9fd0275 100644 --- a/source/amx/amxfile.c +++ b/source/amx/amxfile.c @@ -975,7 +975,7 @@ static cell AMX_NATIVE_CALL n_flength(AMX *amx, const cell *params) } long l,c; - int fn = fileno(f); + int fn=fileno(f); if (params[1]&FILE_WRITEABLE_BIT) { /* writable, flush */ fflush(f); @@ -983,7 +983,7 @@ static cell AMX_NATIVE_CALL n_flength(AMX *amx, const cell *params) _commit(fn); #endif } - c=lseek(fn,0,SEEK_CUR); + c=lseek(fn,0,SEEK_CUR); /* save the current position */ l=lseek(fn,0,SEEK_END); /* return the file position at its end */ fseek(f,c,SEEK_SET); /* restore the file pointer */ (void)amx; @@ -1073,7 +1073,7 @@ static cell AMX_NATIVE_CALL n_fexist(AMX *amx, const cell *params) (void)amx; amx_StrParam(amx,params[1],name); if (name!=NULL && completename(fullname,name,sizearray(fullname))!=NULL) - r = !access(fullname, 0); + r = !access(fullname, 0); return r; } diff --git a/source/amx/amxfloat.c b/source/amx/amxfloat.c index 1571dcf..fe512a5 100644 --- a/source/amx/amxfloat.c +++ b/source/amx/amxfloat.c @@ -150,7 +150,6 @@ static cell AMX_NATIVE_CALL n_floatfract(AMX *amx,const cell *params) * params[0] = number of bytes * params[1] = float operand */ - REAL fA = amx_ctof(params[1]); if (fA >= 0.0) diff --git a/source/amx/amxstring.c b/source/amx/amxstring.c index d7d50b8..19a9d91 100644 --- a/source/amx/amxstring.c +++ b/source/amx/amxstring.c @@ -515,102 +515,103 @@ static cell AMX_NATIVE_CALL n_strdel(AMX *amx,const cell *params) */ static cell AMX_NATIVE_CALL n_strins(AMX* amx, const cell* params) { - cell *cstr, *csub; - int index, lenstr, lensub, maxlen, count; - unsigned char* ptr; - cell c; + cell *cstr, *csub; + int index, lenstr, lensub, maxlen, count; + unsigned char* ptr; + cell c; - /* calculate number of cells needed for (packed) destination */ + /* calculate number of cells needed for (packed) destination */ - amx_GetAddr(amx, params[1],&cstr); - amx_GetAddr(amx, params[2],&csub); + amx_GetAddr(amx, params[1],&cstr); + amx_GetAddr(amx, params[2],&csub); - amx_StrLen(cstr, &lenstr); - amx_StrLen(csub, &lensub); + amx_StrLen(cstr, &lenstr); + amx_StrLen(csub, &lensub); - index = (int)params[3]; - maxlen = (int)params[4]; + index = (int)params[3]; + maxlen = (int)params[4]; - if ((ucell)*cstr > UNPACKEDMAX) - maxlen *= sizeof(cell); + if ((ucell)*cstr > UNPACKEDMAX) + maxlen *= sizeof(cell); - maxlen -= 1; + maxlen -= 1; - if (index < 0) - index = 0; + if (index < 0) + index = 0; - if (index > lenstr || index > maxlen) - return amx_RaiseError(amx, AMX_ERR_NATIVE); + if (index > lenstr || index > maxlen) + return amx_RaiseError(amx, AMX_ERR_NATIVE); + if (lenstr == 0) { /* current string is empty (and the insertion point is zero), just make a copy */ - if (lenstr == 0) { - assert(index == 0); + assert(index == 0); - if (lensub > maxlen) - lensub = maxlen; + if (lensub > maxlen) + lensub = maxlen; - if ((ucell)*csub > UNPACKEDMAX) - amx_StrPack(cstr, csub, lensub, 0); - else - amx_StrUnpack(cstr, csub, lensub); - return 1; - } - - if (lenstr + lensub >= maxlen && index + lensub >= maxlen) { - int max_substr = maxlen - index; - - if ((ucell)*cstr > UNPACKEDMAX) { - for (count = 0; count < max_substr; count++) { - c = extractchar(csub, count, 0); - ptr = packedptr(cstr, index + count); - *ptr = (unsigned char)c; - } - *(packedptr(cstr, maxlen)) = 0; - } else { - for (count = 0; count < max_substr; count++) { - c = extractchar(csub, count, 0); - cstr[index + count] = c; - } - cstr[maxlen] = 0; - } - - return 1; - } - - int final_len = lenstr + lensub; /* length after insertion */ - - if (final_len >= maxlen) - final_len = maxlen - 1; + if ((ucell)*csub > UNPACKEDMAX) + amx_StrPack(cstr, csub, lensub, 0); + else + amx_StrUnpack(cstr, csub, lensub); + return 1; + } /* if */ + + if (lenstr + lensub >= maxlen && index + lensub >= maxlen) { + int max_substr = maxlen - index; if ((ucell)*cstr > UNPACKEDMAX) { - /* make room for the new characters */ - for (count = final_len; count > index; count--) { - ptr = packedptr(cstr, count - lensub); - c = *ptr; - ptr = packedptr(cstr, count); - *ptr = (unsigned char)c; - } - - /* copy in the new characters */ - for (count = 0; count < lensub; count++) { - c = extractchar(csub, count, 0); - ptr = packedptr(cstr, index + count); - *ptr = (unsigned char)c; - } - *(packedptr(cstr, maxlen)) = 0; + for (count = 0; count < max_substr; count++) { + c = extractchar(csub, count, 0); + ptr = packedptr(cstr, index + count); + *ptr = (unsigned char)c; + } /* for */ + *(packedptr(cstr, maxlen)) = 0; } else { - /* make room for the new characters */ - for (count = final_len; count > index; count--) - cstr[count] = cstr[count - lensub]; - - /* copy in the new characters */ - for (count = 0; count < lensub; count++) { - c = extractchar(csub, count, 0); - cstr[index + count] = c; - } - cstr[maxlen] = 0; - } + for (count = 0; count < max_substr; count++) { + c = extractchar(csub, count, 0); + cstr[index + count] = c; + } /* for */ + cstr[maxlen] = 0; + } /* if */ + return 1; + } /* if */ + + int final_len = lenstr + lensub; /* length after insertion */ + + if (final_len >= maxlen) + final_len = maxlen - 1; + + if ((ucell)*cstr > UNPACKEDMAX) { + /* make room for the new characters */ + for (count = final_len; count > index; count--) { + ptr = packedptr(cstr, count - lensub); + c = *ptr; + ptr = packedptr(cstr, count); + *ptr = (unsigned char)c; + } /* for */ + + /* copy in the new characters */ + for (count = 0; count < lensub; count++) { + c = extractchar(csub, count, 0); + ptr = packedptr(cstr, index + count); + *ptr = (unsigned char)c; + } /* for */ + *(packedptr(cstr, maxlen)) = 0; + } else { + /* make room for the new characters */ + for (count = final_len; count > index; count--) + cstr[count] = cstr[count - lensub]; + + /* copy in the new characters */ + for (count = 0; count < lensub; count++) { + c = extractchar(csub, count, 0); + cstr[index + count] = c; + } /* for */ + cstr[maxlen] = 0; + } /* if */ + + return 1; } /* strval(const string[], index=0) @@ -997,8 +998,8 @@ static cell AMX_NATIVE_CALL n_memcpy(AMX *amx,const cell *params) return 0; amx_GetAddr(amx,params[1],&cdest); amx_GetAddr(amx,params[2],&csrc); - pdest=(unsigned char*)cdest; - psrc=(unsigned char*)csrc+params[3]; + pdest=(unsigned char*)cdest+params[3]; + psrc=(unsigned char*)csrc; memmove(pdest,psrc,params[4]); return 1; }