From: John Hodge (sonata) Date: Sat, 19 Jan 2013 16:32:19 +0000 (+0800) Subject: Fixing clang compilation errors X-Git-Tag: rel0.15~598^2~33 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=bbf01510accedc5e224e7b8bd7dc087932bb6233;p=tpg%2Facess2.git Fixing clang compilation errors --- diff --git a/Usermode/Applications/axwin3_src/WM/renderers/framebuffer.c b/Usermode/Applications/axwin3_src/WM/renderers/framebuffer.c index fc838cb0..68a3f8cc 100644 --- a/Usermode/Applications/axwin3_src/WM/renderers/framebuffer.c +++ b/Usermode/Applications/axwin3_src/WM/renderers/framebuffer.c @@ -16,7 +16,6 @@ typedef struct { short W, H; void *Data; - char _data[]; } tFBBuffer; typedef struct { @@ -162,7 +161,7 @@ int _Handle_CreateBuf(tWindow *Target, size_t Len, const void *Data) buf = malloc(sizeof(tFBBuffer) + msg->W * msg->H * 4); buf->W = msg->W; buf->H = msg->H; - buf->Data = buf->_data; + buf->Data = buf + 1; info->Buffers[msg->Buffer] = buf; diff --git a/Usermode/Applications/dhcpclient_src/main.c b/Usermode/Applications/dhcpclient_src/main.c index b9b28149..73e85d8e 100644 --- a/Usermode/Applications/dhcpclient_src/main.c +++ b/Usermode/Applications/dhcpclient_src/main.c @@ -528,7 +528,7 @@ void SetAddress(tInterface *Iface, void *Addr, void *Mask, void *Router) _SysIOCtl(Iface->IfaceFD, 6, Addr); _SysIOCtl(Iface->IfaceFD, 7, &mask_bits); - if( Router ); + if( Router ) { uint8_t *addr = Router; _SysDebug("Router %i.%i.%i.%i", addr[0], addr[1], addr[2], addr[3]); diff --git a/Usermode/Applications/irc_src/main.c b/Usermode/Applications/irc_src/main.c index 9e5a0757..16eee395 100644 --- a/Usermode/Applications/irc_src/main.c +++ b/Usermode/Applications/irc_src/main.c @@ -78,7 +78,7 @@ char *gsNickname = "acess"; tServer *gpServers; tWindow gWindow_Status = { NULL, NULL, NULL, // No next, empty list, no server - 0, "" // No activity, empty name (rendered as status) + 0, {""} // No activity, empty name (rendered as status) }; tWindow *gpWindows = &gWindow_Status; tWindow *gpCurrentWindow = &gWindow_Status; diff --git a/Usermode/Applications/telnetd_src/main.c b/Usermode/Applications/telnetd_src/main.c index a4f5e0da..bf6de999 100644 --- a/Usermode/Applications/telnetd_src/main.c +++ b/Usermode/Applications/telnetd_src/main.c @@ -55,17 +55,17 @@ int main(int argc, char *argv[]) return 0; } +static void FD_SET_MAX(fd_set *set, int fd, int *maxfd) +{ + FD_SET(fd, set); + if(*maxfd < fd) *maxfd = fd; +} + void EventLoop(void) { fd_set fds; int maxfd; - void FD_SET_MAX(fd_set *set, int fd, int *maxfd) - { - FD_SET(fd, set); - if(*maxfd < fd) *maxfd = fd; - } - for( ;; ) { FD_ZERO(&fds); diff --git a/Usermode/Libraries/libc.so_src/stdio.c b/Usermode/Libraries/libc.so_src/stdio.c index 17bdf49e..e25a6b60 100644 --- a/Usermode/Libraries/libc.so_src/stdio.c +++ b/Usermode/Libraries/libc.so_src/stdio.c @@ -458,7 +458,7 @@ EXPORT int vsprintf(char * __s, const char *__format, va_list __args) return vsnprintf(__s, 0x7FFFFFFF, __format, __args); } -//sprintfv + /** * \fn EXPORT void vsnprintf(char *buf, const char *format, va_list args) * \brief Prints a formatted string to a buffer @@ -476,11 +476,11 @@ EXPORT int vsnprintf(char *buf, size_t __maxlen, const char *format, va_list arg uint64_t arg; int bLongLong, bPadLeft; - void _addchar(char ch) - { - if(buf && pos < __maxlen) buf[pos] = ch; - pos ++; - } + #define _addchar(ch) do { \ + if(buf && pos < __maxlen) buf[pos] = (ch); \ + else (void)(ch); \ + pos ++; \ + } while(0) tmp[32] = '\0'; @@ -643,6 +643,7 @@ EXPORT int vsnprintf(char *buf, size_t __maxlen, const char *format, va_list arg } _addchar('\0'); pos --; + #undef _addchar //_SysDebug("vsnprintf: buf = '%s'", buf);