summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2010-03-05 14:34:03 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2010-03-05 14:34:03 (GMT)
commitb501910778714de837dc4367698256e996737e9b (patch)
treef2dc6d4861ea238a538f41c4306249dad1ac3ea5 /macosx
parentf7a64b3a111891d5f7f79ce94bbb37abedd30176 (diff)
downloadtcl-b501910778714de837dc4367698256e996737e9b.zip
tcl-b501910778714de837dc4367698256e996737e9b.tar.gz
tcl-b501910778714de837dc4367698256e996737e9b.tar.bz2
Code Audit results:
* use do { ... } while (0) in macros * avoid shadowing one local variable with another * use clearer 'foo.bar++;' instead of '++foo.bar;' where result not required (i.e., semantically equivalent) * follow Engineering Manual rules on spacing and declarations
Diffstat (limited to 'macosx')
-rw-r--r--macosx/tclMacOSXFCmd.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/macosx/tclMacOSXFCmd.c b/macosx/tclMacOSXFCmd.c
index 9d4e1a1..7b80a9d 100644
--- a/macosx/tclMacOSXFCmd.c
+++ b/macosx/tclMacOSXFCmd.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclMacOSXFCmd.c,v 1.17 2009/02/03 23:10:57 nijtmans Exp $
+ * RCS: @(#) $Id: tclMacOSXFCmd.c,v 1.18 2010/03/05 14:34:04 dkf Exp $
*/
#include "tclInt.h"
@@ -89,7 +89,7 @@ enum {
kIsInvisible = 0x4000,
};
-#define kFinfoIsInvisible (OSSwapHostToBigConstInt16(kIsInvisible))
+#define kFinfoIsInvisible (OSSwapHostToBigConstInt16(kIsInvisible))
typedef struct finderinfo {
u_int32_t type;
@@ -568,7 +568,7 @@ GetOSTypeFromObj(
if (objPtr->typePtr != &tclOSTypeType) {
result = tclOSTypeType.setFromAnyProc(interp, objPtr);
- };
+ }
*osTypePtr = (OSType) objPtr->internalRep.longValue;
return result;
}
@@ -635,16 +635,17 @@ SetOSTypeFromAny(
if (Tcl_DStringLength(&ds) > 4) {
Tcl_AppendResult(interp, "expected Macintosh OS type but got \"",
string, "\": ", NULL);
+ Tcl_SetErrorCode(interp, "TCL", "VALUE", "MAC_OSTYPE", NULL);
result = TCL_ERROR;
} else {
OSType osType;
- char string[4] = {'\0','\0','\0','\0'};
+ char bytes[4] = {'\0','\0','\0','\0'};
- memcpy(string, Tcl_DStringValue(&ds), (size_t)Tcl_DStringLength(&ds));
- osType = (OSType) string[0] << 24 |
- (OSType) string[1] << 16 |
- (OSType) string[2] << 8 |
- (OSType) string[3];
+ memcpy(bytes, Tcl_DStringValue(&ds), (size_t)Tcl_DStringLength(&ds));
+ osType = (OSType) bytes[0] << 24 |
+ (OSType) bytes[1] << 16 |
+ (OSType) bytes[2] << 8 |
+ (OSType) bytes[3];
TclFreeIntRep(objPtr);
objPtr->internalRep.longValue = (long) osType;
objPtr->typePtr = &tclOSTypeType;