Fix pymapistore.c warning
authorJulien Kerihuel <j.kerihuel@openchange.org>
Wed, 14 Mar 2012 16:39:27 +0000 (16:39 +0000)
committerJulien Kerihuel <j.kerihuel@openchange.org>
Wed, 14 Mar 2012 16:39:27 +0000 (16:39 +0000)
Remove strict-aliasing requirement for python bindings

Makefile
pyopenchange/mapistore/pymapistore.c

index 6c48a787b23808f69cc3cbfd2147c369eeb139d9..ac1c2a32c9c0333ca85d314595b2f524e8f774e8 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1497,7 +1497,7 @@ $(pythonscriptdir)/openchange/mapi.$(SHLIBEXT):   pyopenchange/pymapi.c                           \
                                                pyopenchange/pymapi_properties.c                \
                                                libmapi.$(SHLIBEXT).$(PACKAGE_VERSION)
        @echo "Linking $@"
-       @$(CC) $(CFLAGS) $(DSOOPT) $(LDFLAGS) -o $@ $^ $(PYTHON_CFLAGS) $(PYTHON_LIBS) $(LIBS) 
+       @$(CC) $(CFLAGS) -fno-strict-aliasing $(DSOOPT) $(LDFLAGS) -o $@ $^ $(PYTHON_CFLAGS) $(PYTHON_LIBS) $(LIBS) 
 
 # $(pythonscriptdir)/openchange/ocpf.$(SHLIBEXT):      pyopenchange/pyocpf.c                           \
 #                                              libocpf.$(SHLIBEXT).$(PACKAGE_VERSION)          \
@@ -1513,7 +1513,7 @@ $(pythonscriptdir)/openchange/mapistore.$(SHLIBEXT):      pyopenchange/mapistore/pym
                                                        mapiproxy/libmapistore.$(SHLIBEXT).$(PACKAGE_VERSION)   \
                                                        mapiproxy/libmapiproxy.$(SHLIBEXT).$(PACKAGE_VERSION)
        @echo "Linking $@"
-       @$(CC) $(CFLAGS) $(DSOOPT) $(LDFLAGS) -o $@ $^ $(PYTHON_CFLAGS) $(PYTHON_LIBS) $(LIBS)
+       @$(CC) $(CFLAGS) -fno-strict-aliasing $(DSOOPT) $(LDFLAGS) -o $@ $^ $(PYTHON_CFLAGS) $(PYTHON_LIBS) $(LIBS)
 
 
 pyopenchange/pymapi_properties.c:              \
index 38e94df047f48e62b9641b390c7e89cb18a88ca2..f16104c58c0f0c0898ac747dfd3c05f9263a80bc 100644 (file)
@@ -27,7 +27,7 @@
 
 void initmapistore(void);
 
-static struct ldb_context      *sam_ldb_ctx = NULL;
+/* static struct ldb_context   *sam_ldb_ctx = NULL; */
 static struct ldb_context      *openchange_ldb_ctx = NULL;
 
 void PyErr_SetMAPIStoreError(uint32_t retval)
@@ -36,53 +36,53 @@ void PyErr_SetMAPIStoreError(uint32_t retval)
                        Py_BuildValue("(i, s)", retval, mapistore_errstr(retval)));
 }
 
-static void *sam_ldb_init(TALLOC_CTX *mem_ctx, const char *syspath)
-{
-       char                    *ldb_path;
-       struct tevent_context   *ev;
-       int                     ret;
-       /* struct ldb_result    *res; */
-       /* struct ldb_dn                *tmp_dn = NULL; */
-       /* static const char    *attrs[] = { */
-       /*      "rootDomainNamingContext", */
-       /*      "defaultNamingContext", */
-       /*      NULL */
-       /* }; */
-
-       /* Sanity checks */
-       if (sam_ldb_ctx) return sam_ldb_ctx;
-
-       ev = tevent_context_init(talloc_autofree_context());
-       if (!ev) return NULL;
-
-       /* Step 1. Retrieve a LDB context pointer on sam.ldb database */
-       ldb_path = talloc_asprintf(mem_ctx, "%s/sam.ldb", syspath);
-       sam_ldb_ctx = ldb_init(mem_ctx, ev);
-       if (!sam_ldb_ctx) return NULL;
-
-       /* Step 2. Connect to the database */
-       ret = ldb_connect(sam_ldb_ctx, ldb_path, 0, NULL);
-       talloc_free(ldb_path);
-       if (ret != LDB_SUCCESS) return NULL;
-
-       /* /\* Step 3. Search for rootDSE record *\/ */
-       /* ret = ldb_search(sam_ldb_ctx, mem_ctx, &res, ldb_dn_new(mem_ctx, sam_ldb_ctx, "@ROOTDSE"), */
-       /*               LDB_SCOPE_BASE, attrs, NULL); */
-       /* if (ret != LDB_SUCCESS) return NULL; */
-       /* if (res->count != 1) return NULL; */
-
-       /* /\* Step 4. Set opaque naming *\/ */
-       /* tmp_dn = ldb_msg_find_attr_as_dn(sam_ldb_ctx, sam_ldb_ctx,  */
-       /*                               res->msgs[0], "rootDomainNamingContext"); */
-       /* ldb_set_opaque(sam_ldb_ctx, "rootDomainNamingContext", tmp_dn); */
+/* static void *sam_ldb_init(TALLOC_CTX *mem_ctx, const char *syspath) */
+/* { */
+/*     char                    *ldb_path; */
+/*     struct tevent_context   *ev; */
+/*     int                     ret; */
+/*     struct ldb_result       *res; */
+/*     struct ldb_dn           *tmp_dn = NULL; */
+/*     static const char       *attrs[] = { */
+/*             "rootDomainNamingContext", */
+/*             "defaultNamingContext", */
+/*             NULL */
+/*     }; */
+
+/*     /\* Sanity checks *\/ */
+/*     if (sam_ldb_ctx) return sam_ldb_ctx; */
+
+/*     ev = tevent_context_init(talloc_autofree_context()); */
+/*     if (!ev) return NULL; */
+
+/*     /\* Step 1. Retrieve a LDB context pointer on sam.ldb database *\/ */
+/*     ldb_path = talloc_asprintf(mem_ctx, "%s/sam.ldb", syspath); */
+/*     sam_ldb_ctx = ldb_init(mem_ctx, ev); */
+/*     if (!sam_ldb_ctx) return NULL; */
+
+/*     /\* Step 2. Connect to the database *\/ */
+/*     ret = ldb_connect(sam_ldb_ctx, ldb_path, 0, NULL); */
+/*     talloc_free(ldb_path); */
+/*     if (ret != LDB_SUCCESS) return NULL; */
+
+/*     /\* Step 3. Search for rootDSE record *\/ */
+/*     ret = ldb_search(sam_ldb_ctx, mem_ctx, &res, ldb_dn_new(mem_ctx, sam_ldb_ctx, "@ROOTDSE"), */
+/*                      LDB_SCOPE_BASE, attrs, NULL); */
+/*     if (ret != LDB_SUCCESS) return NULL; */
+/*     if (res->count != 1) return NULL; */
+
+/*     /\* Step 4. Set opaque naming *\/ */
+/*     tmp_dn = ldb_msg_find_attr_as_dn(sam_ldb_ctx, sam_ldb_ctx, */
+/*                                      res->msgs[0], "rootDomainNamingContext"); */
+/*     ldb_set_opaque(sam_ldb_ctx, "rootDomainNamingContext", tmp_dn); */
        
-       /* tmp_dn = ldb_msg_find_attr_as_dn(sam_ldb_ctx, sam_ldb_ctx, */
-       /*                               res->msgs[0], "defaultNamingContext"); */
-       /* ldb_set_opaque(sam_ldb_ctx, "defaultNamingContext", tmp_dn); */
+/*     tmp_dn = ldb_msg_find_attr_as_dn(sam_ldb_ctx, sam_ldb_ctx, */
+/*                                      res->msgs[0], "defaultNamingContext"); */
+/*     ldb_set_opaque(sam_ldb_ctx, "defaultNamingContext", tmp_dn); */
 
-       return sam_ldb_ctx;
+/*     return sam_ldb_ctx; */
 
-}
+/* } */
 
 static void *openchange_ldb_init(TALLOC_CTX *mem_ctx, const char *syspath)
 {