You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by ab...@apache.org on 2012/12/05 11:53:41 UTC
svn commit: r1417350 - in /incubator/celix/trunk:
examples/osgi-in-action/chapter04-paint-example/circle/private/src/
examples/osgi-in-action/chapter04-paint-example/paint/
examples/osgi-in-action/chapter04-paint-example/paint/private/src/
examples/osg...
Author: abroekhuis
Date: Wed Dec 5 10:53:39 2012
New Revision: 1417350
URL: http://svn.apache.org/viewvc?rev=1417350&view=rev
Log:
CELIX-41: Fixed some errors on Windows introduced by CELIX-41
Modified:
incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/circle/private/src/activator.c
incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/circle/private/src/circle_shape.c
incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/CMakeLists.txt
incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/activator.c
incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/default_shape.c
incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/paint_frame.c
incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/shape_component.c
incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/square/private/src/square_shape.c
incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/triangle/private/src/triangle_shape.c
incubator/celix/trunk/framework/private/src/framework.c
Modified: incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/circle/private/src/activator.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/circle/private/src/activator.c?rev=1417350&r1=1417349&r2=1417350&view=diff
==============================================================================
--- incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/circle/private/src/activator.c (original)
+++ incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/circle/private/src/activator.c Wed Dec 5 10:53:39 2012
@@ -59,8 +59,10 @@ celix_status_t bundleActivator_start(voi
struct activator * act = (struct activator *) userData;
celix_status_t status = CELIX_SUCCESS;
SIMPLE_SHAPE es = NULL;
+ properties_t props = NULL;
+
circleShape_create(ctx, &es);
- properties_t props = properties_create();
+ props = properties_create();
properties_set(props, "name", "circle");
status = bundleContext_registerService(ctx, SIMPLE_SHAPE_SERVICE_NAME, es, props, &act->reg);
return status;
Modified: incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/circle/private/src/circle_shape.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/circle/private/src/circle_shape.c?rev=1417350&r1=1417349&r2=1417350&view=diff
==============================================================================
--- incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/circle/private/src/circle_shape.c (original)
+++ incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/circle/private/src/circle_shape.c Wed Dec 5 10:53:39 2012
@@ -25,7 +25,7 @@
*/
#include <stdio.h>
#include <string.h>
-#include <stdbool.h>
+#include <celixbool.h>
#include <stdlib.h>
#include <glib.h>
#include <gtk/gtk.h>
@@ -57,9 +57,10 @@ celix_status_t circleShape_create(bundle
if (!*shape) {
status = CELIX_ENOMEM;
} else {
+ celix_status_t status = CELIX_SUCCESS;
(*shape)->name = "Circle";
(*shape)->icon_path = NULL;
- celix_status_t status = bundle_getEntry(bundle, CIRCLE_FILE, pool, &(*shape)->icon_path);
+ status = bundle_getEntry(bundle, CIRCLE_FILE, pool, &(*shape)->icon_path);
if (status == CELIX_SUCCESS) {
(*shape)->simpleShape_draw = circleShape_draw;
} else {
Modified: incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/CMakeLists.txt?rev=1417350&r1=1417349&r2=1417350&view=diff
==============================================================================
--- incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/CMakeLists.txt (original)
+++ incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/CMakeLists.txt Wed Dec 5 10:53:39 2012
@@ -25,6 +25,7 @@ include_directories(
../simple/public/include
)
+message(GTK: ${GLIB_INCLUDE_DIRS})
include_directories(${GTK_INCLUDE_DIRS})
include_directories(${GLIB_INCLUDE_DIRS})
include_directories(${GTHR_INCLUDE_DIRS})
Modified: incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/activator.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/activator.c?rev=1417350&r1=1417349&r2=1417350&view=diff
==============================================================================
--- incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/activator.c (original)
+++ incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/activator.c Wed Dec 5 10:53:39 2012
@@ -53,11 +53,12 @@ celix_status_t removedServ(void * handle
typedef struct paintFrameActivatorData *GREETING_ACTIVATOR;
celix_status_t bundleActivator_create(bundle_context_t context, void **userData) {
+ celix_status_t status = CELIX_SUCCESS;
apr_pool_t *pool;
GREETING_ACTIVATOR activator;
service_tracker_customizer_t cust = NULL;
printf("Paint_frame create\n");
- celix_status_t status = bundleContext_getMemoryPool(context, &pool);
+ status = bundleContext_getMemoryPool(context, &pool);
if (status == CELIX_SUCCESS) {
*userData = apr_palloc(pool, sizeof(struct paintFrameActivatorData));
activator = *userData;
@@ -65,6 +66,7 @@ celix_status_t bundleActivator_create(bu
activator->pool = pool;
activator->context = context;
activator->paint_frame = NULL;
+ activator->tracker = NULL;
status = paintFrame_create(context, pool, &activator->paint_frame);
serviceTrackerCustomizer_create(pool, activator, addingServ,
@@ -105,9 +107,10 @@ celix_status_t addedServ(void * handle,
struct paintFrameActivatorData * data = (struct paintFrameActivatorData *) handle;
service_registration_t reg = NULL;
properties_t props = NULL;
+ char * serviceName = NULL;
serviceReference_getServiceRegistration(ref, ®);
serviceRegistration_getProperties(reg, &props);
- char * serviceName = properties_get(props, "name");
+ serviceName = properties_get(props, "name");
paintFrame_addShape(data->paint_frame, data->context, service);
return CELIX_SUCCESS;
}
@@ -116,9 +119,10 @@ celix_status_t modifiedServ(void * handl
struct paintFrameActivatorData * data = (struct paintFrameActivatorData *) handle;
service_registration_t reg = NULL;
properties_t props = NULL;
+ char * serviceName = NULL;
serviceReference_getServiceRegistration(ref, ®);
serviceRegistration_getProperties(reg, &props);
- char * serviceName = properties_get(props, "name");
+ serviceName = properties_get(props, "name");
return CELIX_SUCCESS;
}
@@ -126,9 +130,10 @@ celix_status_t removedServ(void * handle
struct paintFrameActivatorData * data = (struct paintFrameActivatorData *) handle;
service_registration_t reg = NULL;
properties_t props = NULL;
+ char * serviceName = NULL;
serviceReference_getServiceRegistration(ref, ®);
serviceRegistration_getProperties(reg, &props);
- char * serviceName = properties_get(props, "name");
+ serviceName = properties_get(props, "name");
paintFrame_removeShape(data->paint_frame, service);
return CELIX_SUCCESS;
}
Modified: incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/default_shape.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/default_shape.c?rev=1417350&r1=1417349&r2=1417350&view=diff
==============================================================================
--- incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/default_shape.c (original)
+++ incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/default_shape.c Wed Dec 5 10:53:39 2012
@@ -27,7 +27,7 @@
#include <stdio.h>
#include <string.h>
-#include <stdbool.h>
+#include <celixbool.h>
#include <stdlib.h>
#include <glib.h>
#include <gtk/gtk.h>
@@ -42,13 +42,14 @@
void defaultShape_draw(SIMPLE_SHAPE shape, GdkPixmap *pixMap, GtkWidget *widget, gdouble x, gdouble y);
SIMPLE_SHAPE defaultShape_create(bundle_context_t context) {
+ celix_status_t status = CELIX_SUCCESS;
bundle_t bundle;
apr_pool_t *pool;
SIMPLE_SHAPE shape = (SIMPLE_SHAPE) malloc(sizeof(*shape));
bundleContext_getBundle(context, &bundle);
bundleContext_getMemoryPool(context, &pool);
shape->icon_path = NULL;
- celix_status_t status = bundle_getEntry(bundle, DEFAULT_FILE, pool, &shape->icon_path);
+ status = bundle_getEntry(bundle, DEFAULT_FILE, pool, &shape->icon_path);
shape->simpleShape_draw = defaultShape_draw;
if (status == CELIX_SUCCESS){
// no error
Modified: incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/paint_frame.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/paint_frame.c?rev=1417350&r1=1417349&r2=1417350&view=diff
==============================================================================
--- incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/paint_frame.c (original)
+++ incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/paint_frame.c Wed Dec 5 10:53:39 2012
@@ -37,7 +37,7 @@
#include <stdlib.h>
#include <gtk/gtk.h>
#include <string.h>
-#include <stdbool.h>
+#include <celixbool.h>
#include <glib.h>
#include <gdk/gdk.h>
#include "bundle_context.h"
@@ -83,10 +83,11 @@ celix_status_t paintFrame_create(bundle_
this = NULL;
status = CELIX_ENOMEM;
} else {
- *frame = this;
char *builderFile;
bundle_t bundle;
GError *error = NULL;
+ *frame = this;
+
(*frame)->showing = false;
(*frame)->pool = mypool;
@@ -108,8 +109,8 @@ celix_status_t paintFrame_create(bundle_
gtk_init(NULL, NULL);
if( g_thread_supported()) {
- (*frame)->main = g_thread_new("main", paintFrame_gtkmain, (*frame));
- // (*frame)->main = g_thread_create(paintFrame_gtkmain, (*frame), TRUE, &error);
+ // (*frame)->main = g_thread_new("main", paintFrame_gtkmain, (*frame));
+ (*frame)->main = g_thread_create(paintFrame_gtkmain, (*frame), TRUE, &error);
if ((*frame)->main == NULL){
g_printerr ("Failed to create thread: %s\n", error->message);
status = CELIX_BUNDLE_EXCEPTION;
@@ -164,12 +165,15 @@ static celix_status_t paintFrame_show(PA
**/
celix_status_t paintFrame_addShape(PAINT_FRAME frame, bundle_context_t context, SIMPLE_SHAPE shape) {
celix_status_t status = CELIX_SUCCESS;
+ GError *gerror = NULL;
+ GtkWidget *button = NULL;
+ GtkWidget *im = NULL;
gdk_threads_enter();
- GError *gerror = NULL;
- GtkWidget *button = gtk_button_new();
+
+ button = gtk_button_new();
gtk_widget_set_name((GtkWidget *) button, shape->name);
- GtkWidget *im = gtk_image_new_from_file(shape->icon_path);
+ im = gtk_image_new_from_file(shape->icon_path);
gtk_button_set_image((GtkButton *) button, im);
gtk_toolbar_append_widget((GtkToolbar *) frame->toolbar, (GtkWidget *) button, "", "");
g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (paintFrame_buttonClicked), frame);
@@ -193,8 +197,9 @@ celix_status_t paintFrame_addShape(PAINT
**/
celix_status_t paintFrame_removeShape(PAINT_FRAME frame, SIMPLE_SHAPE sshape) {
celix_status_t status = CELIX_SUCCESS;
+ shape_info_t shape = NULL;
gdk_threads_enter();
- shape_info_t shape = (shape_info_t) hashMap_remove(this->m_shapes, sshape->name);
+ shape = (shape_info_t) hashMap_remove(this->m_shapes, sshape->name);
if (shape != NULL) {
this->m_selected = NULL;
gtk_widget_destroy(GTK_WIDGET(shape->button));
@@ -302,6 +307,7 @@ static celix_status_t paintFrame_redraw(
if (frame->pixMap != NULL && frame->showing) {
GdkRectangle update_rect;
GtkAllocation allocation;
+ linked_list_iterator_t it = NULL;
update_rect.x = 0;
update_rect.y = 0;
@@ -314,7 +320,7 @@ static celix_status_t paintFrame_redraw(
update_rect.x, update_rect.y,
update_rect.width, update_rect.height);
gtk_widget_draw(frame->drawingArea, &update_rect);
- linked_list_iterator_t it = linkedListIterator_create(this->m_shapeComponents, 0);
+ it = linkedListIterator_create(this->m_shapeComponents, 0);
while (linkedListIterator_hasNext(it)) {
SHAPE_COMPONENT sc = linkedListIterator_next(it);
(*sc->shapeComponent_paintComponent)(sc, this, this->pixMap, frame->drawingArea);
Modified: incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/shape_component.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/shape_component.c?rev=1417350&r1=1417349&r2=1417350&view=diff
==============================================================================
--- incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/shape_component.c (original)
+++ incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/shape_component.c Wed Dec 5 10:53:39 2012
@@ -26,7 +26,7 @@
#include <stdio.h>
#include <stdio.h>
#include <string.h>
-#include <stdbool.h>
+#include <celixbool.h>
#include <stdlib.h>
#include <glib.h>
#include <gtk/gtk.h>
Modified: incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/square/private/src/square_shape.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/square/private/src/square_shape.c?rev=1417350&r1=1417349&r2=1417350&view=diff
==============================================================================
--- incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/square/private/src/square_shape.c (original)
+++ incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/square/private/src/square_shape.c Wed Dec 5 10:53:39 2012
@@ -25,7 +25,7 @@
*/
#include <stdio.h>
#include <string.h>
-#include <stdbool.h>
+#include <celixbool.h>
#include <stdlib.h>
#include <glib.h>
#include <gtk/gtk.h>
@@ -43,11 +43,12 @@ SIMPLE_SHAPE squareShape_create(bundle_c
bundle_t bundle;
apr_pool_t *pool;
SIMPLE_SHAPE shape = (SIMPLE_SHAPE) malloc(sizeof(*shape));
+ celix_status_t status = CELIX_SUCCESS;
bundleContext_getBundle(context, &bundle);
bundleContext_getMemoryPool(context, &pool);
shape->name = "Square";
shape->icon_path = NULL;
- celix_status_t status = bundle_getEntry(bundle, SQUARE_FILE, pool, &shape->icon_path);
+ status = bundle_getEntry(bundle, SQUARE_FILE, pool, &shape->icon_path);
shape->simpleShape_draw = squareShape_draw;
if (status == CELIX_SUCCESS) {
// no error
Modified: incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/triangle/private/src/triangle_shape.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/triangle/private/src/triangle_shape.c?rev=1417350&r1=1417349&r2=1417350&view=diff
==============================================================================
--- incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/triangle/private/src/triangle_shape.c (original)
+++ incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/triangle/private/src/triangle_shape.c Wed Dec 5 10:53:39 2012
@@ -27,7 +27,7 @@
#include <stdio.h>
#include <string.h>
-#include <stdbool.h>
+#include <celixbool.h>
#include <stdlib.h>
#include <glib.h>
#include <gtk/gtk.h>
@@ -45,11 +45,12 @@ SIMPLE_SHAPE triangleShape_create(bundle
bundle_t bundle;
apr_pool_t *pool;
SIMPLE_SHAPE shape = (SIMPLE_SHAPE) malloc(sizeof(*shape));
+ celix_status_t status = CELIX_SUCCESS;
bundleContext_getBundle(context, &bundle);
bundleContext_getMemoryPool(context, &pool);
shape->name = "Triangle";
shape->icon_path = NULL;
- celix_status_t status = bundle_getEntry(bundle, TRIANGLE_FILE, pool, &shape->icon_path);
+ status = bundle_getEntry(bundle, TRIANGLE_FILE, pool, &shape->icon_path);
shape->simpleShape_draw = triangleShape_draw;
if (status == CELIX_SUCCESS){
// no error
Modified: incubator/celix/trunk/framework/private/src/framework.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/framework.c?rev=1417350&r1=1417349&r2=1417350&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/framework.c (original)
+++ incubator/celix/trunk/framework/private/src/framework.c Wed Dec 5 10:53:39 2012
@@ -374,7 +374,7 @@ celix_status_t fw_init(framework_t frame
return status;
} else {
#ifdef _WIN32
- Hmodule_t this_process;
+ HMODULE this_process;
#endif
unsigned int arcIdx;
void * handle;
@@ -435,10 +435,10 @@ celix_status_t fw_init(framework_t frame
bundle_context_t context = NULL;
void * userData = NULL;
#ifdef _WIN32
- create_function_t create = (create_function_t) GetProcAddress((Hmodule_t) bundle_getHandle(framework->bundle), BUNDLE_ACTIVATOR_CREATE);
- start_function_t start = (start_function_t) GetProcAddress((Hmodule_t) bundle_getHandle(framework->bundle), BUNDLE_ACTIVATOR_START);
- stop_function_t stop = (stop_function_t) GetProcAddress((Hmodule_t) bundle_getHandle(framework->bundle), BUNDLE_ACTIVATOR_STOP);
- destroy_function_t destroy = (destroy_function_t) GetProcAddress((Hmodule_t) bundle_getHandle(framework->bundle), BUNDLE_ACTIVATOR_DESTROY);
+ create_function_t create = (create_function_t) GetProcAddress((HMODULE) bundle_getHandle(framework->bundle), BUNDLE_ACTIVATOR_CREATE);
+ start_function_t start = (start_function_t) GetProcAddress((HMODULE) bundle_getHandle(framework->bundle), BUNDLE_ACTIVATOR_START);
+ stop_function_t stop = (stop_function_t) GetProcAddress((HMODULE) bundle_getHandle(framework->bundle), BUNDLE_ACTIVATOR_STOP);
+ destroy_function_t destroy = (destroy_function_t) GetProcAddress((HMODULE) bundle_getHandle(framework->bundle), BUNDLE_ACTIVATOR_DESTROY);
#else
create_function_t create = dlsym(bundle_getHandle(framework->bundle), BUNDLE_ACTIVATOR_CREATE);
start_function_t start = dlsym(bundle_getHandle(framework->bundle), BUNDLE_ACTIVATOR_START);
@@ -745,10 +745,10 @@ celix_status_t fw_startBundle(framework_
bundle_context_t context;
#ifdef _WIN32
- create_function_t create = (create_function_t) GetProcAddress((Hmodule_t) bundle_getHandle(bundle), BUNDLE_ACTIVATOR_CREATE);
- start_function_t start = (start_function_t) GetProcAddress((Hmodule_t) bundle_getHandle(bundle), BUNDLE_ACTIVATOR_START);
- stop_function_t stop = (stop_function_t) GetProcAddress((Hmodule_t) bundle_getHandle(bundle), BUNDLE_ACTIVATOR_STOP);
- destroy_function_t destroy = (destroy_function_t) GetProcAddress((Hmodule_t) bundle_getHandle(bundle), BUNDLE_ACTIVATOR_DESTROY);
+ create_function_t create = (create_function_t) GetProcAddress((HMODULE) bundle_getHandle(bundle), BUNDLE_ACTIVATOR_CREATE);
+ start_function_t start = (start_function_t) GetProcAddress((HMODULE) bundle_getHandle(bundle), BUNDLE_ACTIVATOR_START);
+ stop_function_t stop = (stop_function_t) GetProcAddress((HMODULE) bundle_getHandle(bundle), BUNDLE_ACTIVATOR_STOP);
+ destroy_function_t destroy = (destroy_function_t) GetProcAddress((HMODULE) bundle_getHandle(bundle), BUNDLE_ACTIVATOR_DESTROY);
#else
create_function_t create = dlsym(bundle_getHandle(bundle), BUNDLE_ACTIVATOR_CREATE);
start_function_t start = dlsym(bundle_getHandle(bundle), BUNDLE_ACTIVATOR_START);