diff options
author | David Wragg <david@rabbitmq.com> | 2010-10-21 17:49:04 +0100 |
---|---|---|
committer | David Wragg <david@rabbitmq.com> | 2010-10-21 17:49:04 +0100 |
commit | c72bba9de479902e864e3a6802c934cf7fb45e39 (patch) | |
tree | 175f75a729d02b9f5c1b48c17951395cdd7f2531 /librabbitmq | |
parent | 51345a3ded6ecd073921b7e83ec06bbd8988c345 (diff) | |
download | rabbitmq-c-github-ask-c72bba9de479902e864e3a6802c934cf7fb45e39.tar.gz |
Make the examples compile and work under Windows
Diffstat (limited to 'librabbitmq')
-rw-r--r-- | librabbitmq/Makefile.am | 2 | ||||
-rw-r--r-- | librabbitmq/amqp_debug.c | 133 | ||||
-rw-r--r-- | librabbitmq/amqp_private.h | 6 | ||||
-rw-r--r-- | librabbitmq/codegen.py | 2 |
4 files changed, 2 insertions, 141 deletions
diff --git a/librabbitmq/Makefile.am b/librabbitmq/Makefile.am index 238c781..a0f8987 100644 --- a/librabbitmq/Makefile.am +++ b/librabbitmq/Makefile.am @@ -13,7 +13,7 @@ if USE_MSINTTYPES AM_CFLAGS += -I$(top_srcdir)/msinttypes endif -librabbitmq_la_SOURCES = amqp_mem.c amqp_table.c amqp_connection.c amqp_socket.c amqp_debug.c amqp_api.c $(PLATFORM_DIR)/socket.c +librabbitmq_la_SOURCES = amqp_mem.c amqp_table.c amqp_connection.c amqp_socket.c amqp_api.c $(PLATFORM_DIR)/socket.c librabbitmq_la_LDFLAGS = -no-undefined librabbitmq_la_LIBADD = $(EXTRA_LIBS) nodist_librabbitmq_la_SOURCES = amqp_framing.c diff --git a/librabbitmq/amqp_debug.c b/librabbitmq/amqp_debug.c deleted file mode 100644 index 7258696..0000000 --- a/librabbitmq/amqp_debug.c +++ /dev/null @@ -1,133 +0,0 @@ -/* - * ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0 - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" - * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - * the License for the specific language governing rights and - * limitations under the License. - * - * The Original Code is librabbitmq. - * - * The Initial Developers of the Original Code are LShift Ltd, Cohesive - * Financial Technologies LLC, and Rabbit Technologies Ltd. Portions - * created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, Cohesive - * Financial Technologies LLC, or Rabbit Technologies Ltd are Copyright - * (C) 2007-2008 LShift Ltd, Cohesive Financial Technologies LLC, and - * Rabbit Technologies Ltd. - * - * Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift - * Ltd. Portions created by Cohesive Financial Technologies LLC are - * Copyright (C) 2007-2009 Cohesive Financial Technologies - * LLC. Portions created by Rabbit Technologies Ltd are Copyright (C) - * 2007-2009 Rabbit Technologies Ltd. - * - * Portions created by Tony Garnock-Jones are Copyright (C) 2009-2010 - * LShift Ltd and Tony Garnock-Jones. - * - * All Rights Reserved. - * - * Contributor(s): ______________________________________. - * - * Alternatively, the contents of this file may be used under the terms - * of the GNU General Public License Version 2 or later (the "GPL"), in - * which case the provisions of the GPL are applicable instead of those - * above. If you wish to allow use of your version of this file only - * under the terms of the GPL, and not to allow others to use your - * version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the - * notice and other provisions required by the GPL. If you do not - * delete the provisions above, a recipient may use your version of - * this file under the terms of any one of the MPL or the GPL. - * - * ***** END LICENSE BLOCK ***** - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include <ctype.h> - -static void dump_row(long count, int numinrow, int *chs) { - int i; - - printf("%08lX:", count - numinrow); - - if (numinrow > 0) { - for (i = 0; i < numinrow; i++) { - if (i == 8) - printf(" :"); - printf(" %02X", chs[i]); - } - for (i = numinrow; i < 16; i++) { - if (i == 8) - printf(" :"); - printf(" "); - } - printf(" "); - for (i = 0; i < numinrow; i++) { - if (isprint(chs[i])) - printf("%c", chs[i]); - else - printf("."); - } - } - printf("\n"); -} - -static int rows_eq(int *a, int *b) { - int i; - - for (i=0; i<16; i++) - if (a[i] != b[i]) - return 0; - - return 1; -} - -void amqp_dump(void const *buffer, size_t len) { - unsigned char *buf = (unsigned char *) buffer; - long count = 0; - int numinrow = 0; - int chs[16]; - int oldchs[16]; - int showed_dots = 0; - int i; - - for (i = 0; i < len; i++) { - int ch = buf[i]; - - if (numinrow == 16) { - int i; - - if (rows_eq(oldchs, chs)) { - if (!showed_dots) { - showed_dots = 1; - printf(" .. .. .. .. .. .. .. .. : .. .. .. .. .. .. .. ..\n"); - } - } else { - showed_dots = 0; - dump_row(count, numinrow, chs); - } - - for (i=0; i<16; i++) - oldchs[i] = chs[i]; - - numinrow = 0; - } - - count++; - chs[numinrow++] = ch; - } - - dump_row(count, numinrow, chs); - - if (numinrow != 0) - printf("%08lX:\n", count); -} diff --git a/librabbitmq/amqp_private.h b/librabbitmq/amqp_private.h index 2e2a7a2..eaf6b2c 100644 --- a/librabbitmq/amqp_private.h +++ b/librabbitmq/amqp_private.h @@ -248,10 +248,4 @@ static inline int amqp_decode_bytes(amqp_bytes_t encoded, size_t *offset, extern void amqp_abort(const char *fmt, ...); -#ifndef NDEBUG -extern void amqp_dump(void const *buffer, size_t len); -#else -#define amqp_dump(buffer, len) ((void) 0) -#endif - #endif diff --git a/librabbitmq/codegen.py b/librabbitmq/codegen.py index a496b9f..6fd149e 100644 --- a/librabbitmq/codegen.py +++ b/librabbitmq/codegen.py @@ -467,7 +467,7 @@ extern "C" { print """/* Function prototypes. */ extern char const *amqp_constant_name(int constantNumber); extern amqp_boolean_t amqp_constant_is_hard_error(int constantNumber); -extern char const *amqp_method_name(amqp_method_number_t methodNumber); +RABBITMQ_EXPORT char const *amqp_method_name(amqp_method_number_t methodNumber); extern amqp_boolean_t amqp_method_has_content(amqp_method_number_t methodNumber); extern int amqp_decode_method(amqp_method_number_t methodNumber, amqp_pool_t *pool, |