Skip to content

Commit

Permalink
Merge pull request #293 from akgrant43/FileAttributesPlugin200
Browse files Browse the repository at this point in the history
FileAttributesPlugin 2.0.2: free faPath
  • Loading branch information
akgrant43 authored Oct 7, 2018
2 parents 5bf7fc6 + 4c3c6cd commit 127f38f
Showing 1 changed file with 29 additions and 9 deletions.
38 changes: 29 additions & 9 deletions src/plugins/FileAttributesPlugin/FileAttributesPlugin.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* Automatically generated by
VMPluginCodeGenerator VMMaker.oscog-eem.2445 uuid: ecf80f10-9e24-4ff5-8a41-d65cb2690c94
from
FileAttributesPlugin * FileAttributesPlugin.oscog-AlistairGrant.38 uuid: f0fcdb0f-e642-4f87-8a9f-d35ffa0d05ff
FileAttributesPlugin FileAttributesPlugin.oscog-AlistairGrant.40 uuid: 2d975e6c-81fb-4b6d-9dab-35be5e978e22
*/
static char __buildInfo[] = "FileAttributesPlugin * FileAttributesPlugin.oscog-AlistairGrant.38 uuid: f0fcdb0f-e642-4f87-8a9f-d35ffa0d05ff " __DATE__ ;
static char __buildInfo[] = "FileAttributesPlugin FileAttributesPlugin.oscog-AlistairGrant.40 uuid: 2d975e6c-81fb-4b6d-9dab-35be5e978e22 " __DATE__ ;



Expand Down Expand Up @@ -176,9 +176,9 @@ extern
struct VirtualMachine* interpreterProxy;
static const char *moduleName =
#ifdef SQUEAK_BUILTIN_PLUGIN
"FileAttributesPlugin * FileAttributesPlugin.oscog-AlistairGrant.38 (i)"
"FileAttributesPlugin FileAttributesPlugin.oscog-AlistairGrant.40 (i)"
#else
"FileAttributesPlugin * FileAttributesPlugin.oscog-AlistairGrant.38 (e)"
"FileAttributesPlugin FileAttributesPlugin.oscog-AlistairGrant.40 (e)"
#endif
;
static void * sCLPfn;
Expand Down Expand Up @@ -486,9 +486,11 @@ primitiveChangeMode(void)
}
faSetStPathOop(faPath, fileNameOop);
if (failed()) {
free(faPath);
return primitiveFailureCode();
}
status = chmod(faGetPlatPath(faPath), newMode);
free(faPath);
if (status != 0) {
return primitiveFailForOSError(errno);
}
Expand Down Expand Up @@ -525,9 +527,11 @@ primitiveChangeOwner(void)
}
faSetStPathOop(faPath, fileNameOop);
if (failed()) {
free(faPath);
return primitiveFailureCode();
}
status = chown(faGetPlatPath(faPath), ownerId, groupId);
free(faPath);
if (status != 0) {
return primitiveFailForOSError(errno);
}
Expand Down Expand Up @@ -600,9 +604,11 @@ primitiveFileAttribute(void)
}
faSetStPathOop(faPath, fileName);
if (failed()) {
free(faPath);
return primitiveFailureCode();
}
resultOop = faFileAttribute(faPath, attributeNumber);
free(faPath);
if (failed()) {
return primitiveFailureCode();
}
Expand All @@ -612,7 +618,7 @@ primitiveFileAttribute(void)
primitiveFailForOSError(-14 /* unexpectedError */);
}
else {
popthenPush(3, resultOop);
methodReturnValue(resultOop);
}
return 0;
}
Expand Down Expand Up @@ -652,14 +658,16 @@ primitiveFileAttributes(void)
}
faSetStPathOop(faPath, fileName);
if (failed()) {
free(faPath);
return primitiveFailureCode();
}
status = fileToAttributeArraymaskarray(faPath, attributeMask, (&attributeArray));
free(faPath);
if (status != 0) {
primitiveFailForOSError(status);
}
else {
popthenPush(3, attributeArray);
methodReturnValue(attributeArray);
}
return 0;
}
Expand All @@ -673,6 +681,7 @@ primitiveFileExists(void)
{
fapath *faPath;
sqInt fileNameOop;
sqInt resultOop;

fileNameOop = stackObjectValue(0);
if (!(isBytes(fileNameOop))) {
Expand All @@ -686,7 +695,9 @@ primitiveFileExists(void)
if (failed()) {
return primitiveFailureCode();
}
return methodReturnValue(faExists(faPath));
resultOop = faExists(faPath);
free(faPath);
return methodReturnValue(resultOop);
}


Expand Down Expand Up @@ -781,6 +792,7 @@ primitiveOpendir(void)
}
status = faOpenDirectory(faPath);
if (status == 1 /* noMoreData */) {
free(faPath);
return popthenPush(2, nilObject());
}
if (status < 0) {
Expand All @@ -803,7 +815,7 @@ primitiveOpendir(void)
#endif /* SPURVM */
;
return (storePointerofObjectwithValue(2, resultOop, dirOop),
popthenPush(2, resultOop));
methodReturnValue(resultOop));
}


Expand Down Expand Up @@ -841,14 +853,17 @@ primitivePlatToStPath(void)
}
faSetPlatPathOop(faPath, fileName);
if (failed()) {
free(faPath);
return primitiveFailureCode();
}
resultOop = instantiateClassindexableSize(classByteArray(), faGetStPathLen(faPath));
if (!(resultOop)) {
free(faPath);
return primitiveFailFor(PrimErrNoMemory);
}
byteArrayPtr = arrayValueOf(resultOop);
memcpy(byteArrayPtr, faGetStPath(faPath), faGetStPathLen(faPath));
free(faPath);
return methodReturnValue(resultOop);
}

Expand Down Expand Up @@ -940,14 +955,17 @@ primitiveStToPlatPath(void)
}
faSetStPathOop(faPath, fileName);
if (failed()) {
free(faPath);
return primitiveFailureCode();
}
resultOop = instantiateClassindexableSize(classByteArray(), faGetPlatPathByteCount(faPath));
if (!(resultOop)) {
free(faPath);
return primitiveFailFor(PrimErrNoMemory);
}
byteArrayPtr = arrayValueOf(resultOop);
memcpy(byteArrayPtr, faGetPlatPath(faPath), faGetPlatPathByteCount(faPath));
free(faPath);
return methodReturnValue(resultOop);
}

Expand Down Expand Up @@ -979,9 +997,11 @@ primitiveSymlinkChangeOwner(void)
}
faSetStPathOop(faPath, fileNameOop);
if (failed()) {
free(faPath);
return primitiveFailureCode();
}
status = lchown(faGetPlatPath(faPath), ownerId, groupId);
free(faPath);
if (status != 0) {
return primitiveFailForOSError(errno);
}
Expand All @@ -997,7 +1017,7 @@ primitiveSymlinkChangeOwner(void)
EXPORT(sqInt)
primitiveVersionString(void)
{
popthenPush(1, stringFromCString("2.0.1"));
popthenPush(1, stringFromCString("2.0.2"));
return 0;
}

Expand Down

0 comments on commit 127f38f

Please sign in to comment.