2014-12-18 11:04 GMT+03:00 Alexey Pavlov <[email protected]>:
>
>
>
> 2014-12-18 10:53 GMT+03:00 Dmitry Yemanov <[email protected]>:
>>
>> 18.12.2014 10:47, Alexey Pavlov wrote:
>>
>> > -*(ISC_ULONG *)arg_vector[-1].a_address = (ISC_ULONG)p;
>> > -
>> > +*(uintptr_t *)arg_vector[-1].a_address = (uintptr_t)p;
>>
>> So far our practice is to favor FB-specific typedefs instead of system
>> ones. U_IPTR should be used here instead of uintptr_t.
>>
>> Strange but it give me error with U_IPTR
>
> C:/git/mingw/mingw-w64-firebird-git/src/firebird/src/gpre/languages/fbrmclib.cpp:
> In function 'int rmc_status_address(char*, int, argument_entry*, int)':
>
> C:/git/mingw/mingw-w64-firebird-git/src/firebird/src/gpre/languages/fbrmclib.cpp:1398:49:
> error: cast from 'ISC_STATUS* {aka long long int*}' to 'ISC_ULONG {aka long
> unsigned int}' loses precision [-fpermissive]
>
>    *(U_IPTR *)arg_vector[-1].a_address = (U_IPTR)p;
>
> Fixed patch:

>From 3b306b8bb47647333f8e1701de13247584eb62cf Mon Sep 17 00:00:00 2001
From: Alexpux <[email protected]>
Date: Thu, 18 Dec 2014 11:15:17 +0300
Subject: [PATCH] Cobol interface: fix warnings and cast error.

---
 src/gpre/languages/fbrmclib.cpp | 23 +++++++++--------------
 1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/src/gpre/languages/fbrmclib.cpp
b/src/gpre/languages/fbrmclib.cpp
index 9a21278..89cedd7 100644
--- a/src/gpre/languages/fbrmclib.cpp
+++ b/src/gpre/languages/fbrmclib.cpp
@@ -45,10 +45,6 @@
 #include "../jrd/ibase.h"


-#ifndef U_IPTR
-#define U_IPTR ISC_ULONG
-#endif
-
 // Firebird transaction existence block (as defined in why.cpp)
 struct ISC_TEB
 {
@@ -72,9 +68,9 @@ struct argument_entry

 struct entry_table
 {
- char *EntryPointCobolName;
- int (*EntryPointAddress)(char *, int, argument_entry *, int);
- char *EntryPointName;
+ const char *EntryPointCobolName;
+ int (*EntryPointAddress)(char *, int, argument_entry *, int);
+ const char *EntryPointName;
 };

 struct date_fmt
@@ -1392,8 +1388,7 @@ EXPORT RM_ENTRY(rmc_status_address)

  CobolToStatus(stat, &arg_vector[0]);
  ISC_STATUS *p = stat;
- *(ISC_ULONG *)arg_vector[-1].a_address = (ISC_ULONG)p;
-
+ *(U_IPTR *)arg_vector[-1].a_address = (U_IPTR)p;

  return (0);
 }
@@ -1664,24 +1659,24 @@ EXPORT RM_ENTRY(rmc_ctos)
  return (0);
 }

-static char* banner = "Firebird Embedded SQL Interface";
+static const char* banner = "Firebird Embedded SQL Interface";

 #ifdef __cplusplus
 extern "C" {
 #endif
-char* RM_AddOnBanner();
-char* RM_AddOnLoadMessage();
+const char* RM_AddOnBanner();
+const char* RM_AddOnLoadMessage();
 #ifdef __cplusplus
 }
 #endif

 // Return additional banner message for this module
-char* RM_AddOnBanner()
+const char* RM_AddOnBanner()
 {
  return (banner);
 }

-char* RM_AddOnLoadMessage()
+const char* RM_AddOnLoadMessage()
 {
  return (banner);
 }
-- 
2.2.0



>
>
>>
>> Dmitry
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
>> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
>> with Interactivity, Sharing, Native Excel Exports, App Integration & more
>> Get technology previously reserved for billion-dollar corporations, FREE
>>
>> http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
>> Firebird-Devel
>> <http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrkFirebird-Devel>
>> mailing list, web interface at
>> https://lists.sourceforge.net/lists/listinfo/firebird-devel
>>
>
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to