diff --git a/configure/os/CONFIG_SITE.Common.darwin-x86 b/configure/os/CONFIG_SITE.Common.darwin-x86 index dc0e0206a..bd1564a2b 100644 --- a/configure/os/CONFIG_SITE.Common.darwin-x86 +++ b/configure/os/CONFIG_SITE.Common.darwin-x86 @@ -10,13 +10,15 @@ # i386 # x86_64 - Needs MacOS 10.4 with the Universal SDK, or 10.5 and later -ARCH_CLASS = i386 -#ARCH_CLASS = x86_64 +#ARCH_CLASS = i386 +ARCH_CLASS = x86_64 #ARCH_CLASS = i386 x86_64 -# Uncomment the followings lines to build with CLANG instead of GCC. # -#GNU = NO -#CMPLR_CLASS = clang -#CC = clang -#CCC = clang++ +# Comment out the following lines to build with GCC instead of CLANG. +# +CMPLR_CLASS = clang +CC = clang +CCC = clang++ +GNU = NO + diff --git a/src/ca/client/tools/caput.c b/src/ca/client/tools/caput.c index b97a0ff26..fbd4ef79e 100644 --- a/src/ca/client/tools/caput.c +++ b/src/ca/client/tools/caput.c @@ -494,12 +494,12 @@ int main (int argc, char *argv[]) if (charArrAsStr) { count = len; dbrType = DBR_CHAR; - ebuf = calloc(strlen(cbuf), sizeof(char)); + ebuf = calloc(strlen(cbuf)+1, sizeof(char)); if(!ebuf) { fprintf(stderr, "Memory allocation failed\n"); return 1; } - epicsStrnRawFromEscaped(ebuf, strlen(cbuf), cbuf, strlen(cbuf)); + epicsStrnRawFromEscaped(ebuf, strlen(cbuf)+1, cbuf, strlen(cbuf)); } else { for (i = 0; i < count; ++i) { epicsStrnRawFromEscaped(sbuf[i], sizeof(EpicsStr), *(argv+optind+i), sizeof(EpicsStr)); diff --git a/src/ca/client/tools/tool_lib.c b/src/ca/client/tools/tool_lib.c index 13d6330cf..ddead1115 100644 --- a/src/ca/client/tools/tool_lib.c +++ b/src/ca/client/tools/tool_lib.c @@ -445,10 +445,15 @@ char *dbr2str (const void *value, unsigned type) \ if (charArrAsStr && dbr_type_is_CHAR(TYPE_ENUM) && (reqElems || pv->nElems > 1)) { \ dbr_char_t *s = (dbr_char_t*) dbr_value_ptr(pv->value, pv->dbrType); \ - int dlen = epicsStrnEscapedFromRawSize((char*)s, strlen((char*)s)); \ - char *d = calloc(dlen+1, sizeof(char)); \ + size_t len = strlen((char*)s); \ + unsigned long elems = reqElems && (reqElems < pv->nElems) ? reqElems : pv->nElems; \ + int dlen; \ + char *d; \ + if (len < elems) elems = len; \ + dlen = epicsStrnEscapedFromRawSize((char*)s, elems); \ + d = calloc(dlen+1, sizeof(char)); \ if(d) { \ - epicsStrnEscapedFromRaw(d, dlen+1, (char*)s, strlen((char*)s));\ + epicsStrnEscapedFromRaw(d, dlen+1, (char*)s, elems); \ printf("%c%s", fieldSeparator, d); \ free(d); \ } else { \ diff --git a/src/ioc/as/asDbLib.c b/src/ioc/as/asDbLib.c index 330796d6b..4c295018c 100644 --- a/src/ioc/as/asDbLib.c +++ b/src/ioc/as/asDbLib.c @@ -1,12 +1,10 @@ -/* share/src/as/asDbLib.c */ /*************************************************************************\ -* Copyright (c) 2002 The University of Chicago, as Operator of Argonne +* Copyright (c) 2012 UChicago Argonne LLC, as Operator of Argonne * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* Author: Marty Kraimer Date: 02-11-94*/ @@ -69,18 +67,23 @@ static long asDbAddRecords(void) int asSetFilename(const char *acf) { - if(pacf) free ((void *)pacf); - if(acf) { - pacf = calloc(1,strlen(acf)+1); - if(!pacf) { - errMessage(0,"asSetFilename calloc failure"); - } else { - strcpy(pacf,acf); - } + if (pacf) + free (pacf); + if (acf) { + pacf = calloc(1, strlen(acf)+1); + if (!pacf) { + errMessage(0, "asSetFilename calloc failure"); + } else { + strcpy(pacf, acf); + if (*pacf != '/' && !strchr(pacf, ':')) { + printf("asSetFilename: Warning - relative paths won't usually " + "work\n"); + } + } } else { - pacf = NULL; + pacf = NULL; } - return(0); + return 0; } int asSetSubstitutions(const char *substitutions) diff --git a/src/libCom/osi/os/WIN32/osdStdio.c b/src/libCom/osi/os/WIN32/osdStdio.c index 602651f8b..8a2d58ea9 100644 --- a/src/libCom/osi/os/WIN32/osdStdio.c +++ b/src/libCom/osi/os/WIN32/osdStdio.c @@ -11,6 +11,11 @@ #include #include +#ifndef _MSC_VER +/* Older versions of MinGW omitted this prototype from stdio.h */ +_CRTIMP int __cdecl __MINGW_NOTHROW _vscprintf (const char*, va_list); +#endif + #define epicsExportSharedSymbols #include "epicsStdio.h" @@ -18,26 +23,12 @@ int epicsShareAPI epicsVsnprintf(char *str, size_t len, const char *fmt, va_list ap) { int retval = _vsnprintf(str, len, fmt, ap); - -#ifdef _MSC_VER int needed = _vscprintf(fmt, ap); if ((int) len < needed + 1) { str[len - 1] = 0; return needed; } -#else - /* Unfortunately MINGW doesn't provide _vscprintf and their - * _vsnprintf follows MS' broken return value semantics. - */ - if (retval == -1) { - if (len) - str[len - 1] = 0; - return len; - } else if (retval == (int) len) { - str[--retval] = 0; - } -#endif return retval; } diff --git a/src/libCom/osi/os/default/epicsReadline.c b/src/libCom/osi/os/default/epicsReadline.c index 20d5e0b79..6c442e376 100644 --- a/src/libCom/osi/os/default/epicsReadline.c +++ b/src/libCom/osi/os/default/epicsReadline.c @@ -189,8 +189,12 @@ epicsReadlineEnd (void *context) #include #define LEDLIB_LINESIZE 1000 +#ifndef _WRS_VXWORKS_MAJOR +typedef int LED_ID; +#endif + struct readlineContext { - int ledId; + LED_ID ledId; char line[LEDLIB_LINESIZE]; FILE *in; }; @@ -205,7 +209,7 @@ epicsReadlineBegin(FILE *in) readlineContext = malloc(sizeof *readlineContext); if (readlineContext != NULL) { - readlineContext->ledId = ERROR; + readlineContext->ledId = (LED_ID) ERROR; readlineContext->in = in; if (in == NULL) { long i = 50; @@ -213,7 +217,7 @@ epicsReadlineBegin(FILE *in) envGetLongConfigParam(&IOCSH_HISTSIZE, &i); if (i < 1) i = 1; readlineContext->ledId = ledOpen(fileno(stdin), fileno(stdout), i); - if (readlineContext->ledId == ERROR) { + if (readlineContext->ledId == (LED_ID) ERROR) { readlineContext->in = stdin; printf("Warning -- Unabled to allocate space for command-line history.\n"); printf("Warning -- Command-line editting disabled.\n"); @@ -236,7 +240,7 @@ epicsReadline (const char *prompt, void *context) fputs(prompt, stdout); fflush(stdout); } - if (readlineContext->ledId != ERROR) { + if (readlineContext->ledId != (LED_ID) ERROR) { i = ledRead(readlineContext->ledId, readlineContext->line, LEDLIB_LINESIZE-1); if (i < 0) return NULL; @@ -262,7 +266,7 @@ epicsReadlineEnd (void *context) struct readlineContext *readlineContext = context; if (readlineContext) { - if (readlineContext->ledId != ERROR) + if (readlineContext->ledId != (LED_ID) ERROR) ledClose(readlineContext->ledId); free(readlineContext); } diff --git a/src/template/ext/top/configure/os/CONFIG_SITE.darwin-x86.darwin-x86 b/src/template/ext/top/configure/os/CONFIG_SITE.darwin-x86.darwin-x86 index fe8cd431e..522510666 100644 --- a/src/template/ext/top/configure/os/CONFIG_SITE.darwin-x86.darwin-x86 +++ b/src/template/ext/top/configure/os/CONFIG_SITE.darwin-x86.darwin-x86 @@ -28,9 +28,9 @@ PYTHON_INCLUDE=/System/Library/Frameworks/Python.framework/Versions/2.3/include/ # XDarwin # X11_LIB=/usr/X11R6/lib -X11_INC=/usr/X11R6/include/X11 +X11_INC=/usr/X11R6/include XPM_LIB=/usr/X11R6/lib -XPM_INC=/usr/X11R6/include/X11 +XPM_INC=/usr/X11R6/include # # Fink OpenMotif diff --git a/src/tools/EPICS/Path.pm b/src/tools/EPICS/Path.pm index ba6ad4a9b..83a91efb3 100644 --- a/src/tools/EPICS/Path.pm +++ b/src/tools/EPICS/Path.pm @@ -123,6 +123,7 @@ sub AbsPath { # Now calculate the absolute path my $abs = File::Spec->rel2abs($path, abs_path($cwd)); + $abs = abs_path($abs) if -e $abs; return LocalPath($abs); }