From: <ale...@us...> - 2012-03-23 14:06:25
|
Revision: 54230 http://firebird.svn.sourceforge.net/firebird/?rev=54230&view=rev Author: alexpeshkoff Date: 2012-03-23 14:06:14 +0000 (Fri, 23 Mar 2012) Log Message: ----------- MAC port. Also cleaned up one related place, where names of struct and variable were same (bstream) Modified Paths: -------------- firebird/trunk/configure.in firebird/trunk/src/gpre/boot/gpre_meta_boot.cpp firebird/trunk/src/jrd/ibase.h firebird/trunk/src/msgs/templates.sql firebird/trunk/src/yvalve/MasterImplementation.cpp firebird/trunk/src/yvalve/gds.cpp firebird/trunk/src/yvalve/utl.cpp Modified: firebird/trunk/configure.in =================================================================== --- firebird/trunk/configure.in 2012-03-23 10:38:12 UTC (rev 54229) +++ firebird/trunk/configure.in 2012-03-23 14:06:14 UTC (rev 54230) @@ -847,6 +847,11 @@ fi fi +dnl Some OS place iconv() support in separate library +if test "$ac_cv_header_iconv_h" = "yes"; then +AC_SEARCH_LIBS(iconv_open, iconv) +fi + dnl HPUX has a bug in .h files. To detect it we need C++ here. AC_LANG_PUSH(C++) AC_LINK_IFELSE( Modified: firebird/trunk/src/gpre/boot/gpre_meta_boot.cpp =================================================================== --- firebird/trunk/src/gpre/boot/gpre_meta_boot.cpp 2012-03-23 10:38:12 UTC (rev 54229) +++ firebird/trunk/src/gpre/boot/gpre_meta_boot.cpp 2012-03-23 14:06:14 UTC (rev 54230) @@ -757,7 +757,7 @@ { } -Firebird::IMaster* ISC_EXPORT fb_get_master_interface() +Firebird::IMaster* API_ROUTINE fb_get_master_interface() { static DummyMasterImpl dummyMaster; return &dummyMaster; Modified: firebird/trunk/src/jrd/ibase.h =================================================================== --- firebird/trunk/src/jrd/ibase.h 2012-03-23 10:38:12 UTC (rev 54229) +++ firebird/trunk/src/jrd/ibase.h 2012-03-23 14:06:14 UTC (rev 54230) @@ -154,7 +154,7 @@ short bstr_length; /* Length of buffer */ short bstr_cnt; /* Characters in buffer */ char bstr_mode; /* (mode) ? OUTPUT : INPUT */ -} BSTREAM; +} BSTREAM, * FB_BLOB_STREAM; /* Three ugly macros, one even using octal radix... sigh... */ #define getb(p) (--(p)->bstr_cnt >= 0 ? *(p)->bstr_ptr++ & 0377: BLOB_get (p)) @@ -997,16 +997,16 @@ /* Other Blob functions */ /******************************/ -BSTREAM* ISC_EXPORT BLOB_open(isc_blob_handle, - ISC_SCHAR*, - int); +FB_BLOB_STREAM ISC_EXPORT BLOB_open(isc_blob_handle, + ISC_SCHAR*, + int); int ISC_EXPORT BLOB_put(ISC_SCHAR, - BSTREAM*); + FB_BLOB_STREAM); -int ISC_EXPORT BLOB_close(BSTREAM*); +int ISC_EXPORT BLOB_close(FB_BLOB_STREAM); -int ISC_EXPORT BLOB_get(BSTREAM*); +int ISC_EXPORT BLOB_get(FB_BLOB_STREAM); int ISC_EXPORT BLOB_display(ISC_QUAD*, isc_db_handle, @@ -1038,10 +1038,10 @@ isc_tr_handle, const ISC_SCHAR*); -BSTREAM* ISC_EXPORT Bopen(ISC_QUAD*, - isc_db_handle, - isc_tr_handle, - const ISC_SCHAR*); +FB_BLOB_STREAM ISC_EXPORT Bopen(ISC_QUAD*, + isc_db_handle, + isc_tr_handle, + const ISC_SCHAR*); /******************************/ Modified: firebird/trunk/src/msgs/templates.sql =================================================================== --- firebird/trunk/src/msgs/templates.sql 2012-03-23 10:38:12 UTC (rev 54229) +++ firebird/trunk/src/msgs/templates.sql 2012-03-23 14:06:14 UTC (rev 54230) @@ -125,13 +125,13 @@ short bstr_length; /* Length of buffer */ short bstr_cnt; /* Characters in buffer */ char bstr_mode; /* (mode) ? OUTPUT : INPUT */ -} BSTREAM; +} BSTREAM, * FB_BLOB_STREAM; #define getb(p) (--(p)->bstr_cnt >= 0 ? *(p)->bstr_ptr++ & 0377: BLOB_get (p)) #define putb(x,p) ((x == '\n' || (!(--(p)->bstr_cnt))) ? BLOB_put (x,p) : ((int) (*(p)->bstr_ptr++ = (unsigned) (x)))) #define putbx(x,p) ((!(--(p)->bstr_cnt)) ? BLOB_put (x,p) : ((int) (*(p)->bstr_ptr++ = (unsigned) (x)))) -BSTREAM *Bopen(), *BLOB_open(); +FB_BLOB_STREAM Bopen(), BLOB_open(); /* Information call declarations */ @@ -454,13 +454,13 @@ short bstr_length; /* Length of buffer */ short bstr_cnt; /* Characters in buffer */ char bstr_mode; /* (mode) ? OUTPUT : INPUT */ -} BSTREAM; +} BSTREAM, * FB_BLOB_STREAM; #define getb(p) (--(p)->bstr_cnt >= 0 ? *(p)->bstr_ptr++ & 0377: BLOB_get (p)) #define putb(x,p) ((x == '\n' || (!(--(p)->bstr_cnt))) ? BLOB_put (x,p) : ((int) (*(p)->bstr_ptr++ = (unsigned) (x)))) #define putbx(x,p) ((!(--(p)->bstr_cnt)) ? BLOB_put (x,p) : ((int) (*(p)->bstr_ptr++ = (unsigned) (x)))) -BSTREAM *Bopen(), *BLOB_open(); +FB_BLOB_STREAM Bopen(), BLOB_open(); /* Information call declarations */ Modified: firebird/trunk/src/yvalve/MasterImplementation.cpp =================================================================== --- firebird/trunk/src/yvalve/MasterImplementation.cpp 2012-03-23 10:38:12 UTC (rev 54229) +++ firebird/trunk/src/yvalve/MasterImplementation.cpp 2012-03-23 14:06:14 UTC (rev 54230) @@ -624,7 +624,7 @@ // get master // -Firebird::IMaster* ISC_EXPORT fb_get_master_interface() +Firebird::IMaster* API_ROUTINE fb_get_master_interface() { static Static<Why::MasterImplementation> instance; return &instance; Modified: firebird/trunk/src/yvalve/gds.cpp =================================================================== --- firebird/trunk/src/yvalve/gds.cpp 2012-03-23 10:38:12 UTC (rev 54229) +++ firebird/trunk/src/yvalve/gds.cpp 2012-03-23 14:06:14 UTC (rev 54230) @@ -3716,7 +3716,7 @@ } -void gds__trace_printer(void* /*arg*/, SSHORT offset, const TEXT* line) +void API_ROUTINE gds__trace_printer(void* /*arg*/, SSHORT offset, const TEXT* line) { // Assume that line is not too long char buffer[PRETTY_BUFFER_SIZE + 10]; Modified: firebird/trunk/src/yvalve/utl.cpp =================================================================== --- firebird/trunk/src/yvalve/utl.cpp 2012-03-23 10:38:12 UTC (rev 54229) +++ firebird/trunk/src/yvalve/utl.cpp 2012-03-23 14:06:14 UTC (rev 54230) @@ -1197,7 +1197,7 @@ } -int API_ROUTINE BLOB_close(BSTREAM* bstream) +int API_ROUTINE BLOB_close(FB_BLOB_STREAM blobStream) { /************************************** * @@ -1211,27 +1211,27 @@ **************************************/ ISC_STATUS_ARRAY status_vector; - if (!bstream->bstr_blob) + if (!blobStream->bstr_blob) return FALSE; - if (bstream->bstr_mode & BSTR_output) + if (blobStream->bstr_mode & BSTR_output) { - const USHORT l = (bstream->bstr_ptr - bstream->bstr_buffer); + const USHORT l = (blobStream->bstr_ptr - blobStream->bstr_buffer); if (l > 0) { - if (isc_put_segment(status_vector, &bstream->bstr_blob, l, bstream->bstr_buffer)) + if (isc_put_segment(status_vector, &blobStream->bstr_blob, l, blobStream->bstr_buffer)) { return FALSE; } } } - isc_close_blob(status_vector, &bstream->bstr_blob); + isc_close_blob(status_vector, &blobStream->bstr_blob); - if (bstream->bstr_mode & BSTR_alloc) - gds__free(bstream->bstr_buffer); + if (blobStream->bstr_mode & BSTR_alloc) + gds__free(blobStream->bstr_buffer); - gds__free(bstream); + gds__free(blobStream); return TRUE; } @@ -1416,7 +1416,7 @@ } -int API_ROUTINE BLOB_get(BSTREAM* bstream) +int API_ROUTINE BLOB_get(FB_BLOB_STREAM blobStream) { /************************************** * @@ -1431,27 +1431,27 @@ **************************************/ ISC_STATUS_ARRAY status_vector; - if (!bstream->bstr_buffer) + if (!blobStream->bstr_buffer) return EOF; while (true) { - if (--bstream->bstr_cnt >= 0) - return *bstream->bstr_ptr++ & 0377; + if (--blobStream->bstr_cnt >= 0) + return *blobStream->bstr_ptr++ & 0377; - isc_get_segment(status_vector, &bstream->bstr_blob, + isc_get_segment(status_vector, &blobStream->bstr_blob, // safe - cast from short, alignment is OK - reinterpret_cast<USHORT*>(&bstream->bstr_cnt), - bstream->bstr_length, bstream->bstr_buffer); + reinterpret_cast<USHORT*>(&blobStream->bstr_cnt), + blobStream->bstr_length, blobStream->bstr_buffer); if (status_vector[1] && status_vector[1] != isc_segment) { - bstream->bstr_ptr = 0; - bstream->bstr_cnt = 0; + blobStream->bstr_ptr = 0; + blobStream->bstr_cnt = 0; if (status_vector[1] != isc_segstr_eof) isc_print_status(status_vector); return EOF; } - bstream->bstr_ptr = bstream->bstr_buffer; + blobStream->bstr_ptr = blobStream->bstr_buffer; } } @@ -1544,10 +1544,10 @@ } -BSTREAM* API_ROUTINE Bopen(ISC_QUAD* blob_id, - FB_API_HANDLE database, - FB_API_HANDLE transaction, - const SCHAR* mode) +FB_BLOB_STREAM API_ROUTINE Bopen(ISC_QUAD* blob_id, + FB_API_HANDLE database, + FB_API_HANDLE transaction, + const SCHAR* mode) { /************************************** * @@ -1588,26 +1588,26 @@ return NULL; } - BSTREAM* bstream = BLOB_open(blob, NULL, 0); + FB_BLOB_STREAM blobStream = BLOB_open(blob, NULL, 0); if (*mode == 'w' || *mode == 'W') { - bstream->bstr_mode |= BSTR_output; - bstream->bstr_cnt = bstream->bstr_length; - bstream->bstr_ptr = bstream->bstr_buffer; + blobStream->bstr_mode |= BSTR_output; + blobStream->bstr_cnt = blobStream->bstr_length; + blobStream->bstr_ptr = blobStream->bstr_buffer; } else { - bstream->bstr_cnt = 0; - bstream->bstr_mode |= BSTR_input; + blobStream->bstr_cnt = 0; + blobStream->bstr_mode |= BSTR_input; } - return bstream; + return blobStream; } // CVC: This routine doesn't open a blob really! -BSTREAM* API_ROUTINE BLOB_open(FB_API_HANDLE blob, SCHAR* buffer, int length) +FB_BLOB_STREAM API_ROUTINE BLOB_open(FB_API_HANDLE blob, SCHAR* buffer, int length) { /************************************** * @@ -1622,47 +1622,47 @@ if (!blob) return NULL; - BSTREAM* bstream = (BSTREAM*) gds__alloc((SLONG) sizeof(BSTREAM)); + FB_BLOB_STREAM blobStream = (FB_BLOB_STREAM) gds__alloc((SLONG) sizeof(struct bstream)); // FREE: This structure is freed by BLOB_close - if (!bstream) // NOMEM: + if (!blobStream) // NOMEM: return NULL; #ifdef DEBUG_gds__alloc // This structure is handed to the user process, we depend on the client // to call BLOB_close() for it to be freed. - gds_alloc_flag_unfreed((void*) bstream); + gds_alloc_flag_unfreed((void*) blobStream); #endif - bstream->bstr_blob = blob; - bstream->bstr_length = length ? length : 512; - bstream->bstr_mode = 0; - bstream->bstr_cnt = 0; - bstream->bstr_ptr = 0; + blobStream->bstr_blob = blob; + blobStream->bstr_length = length ? length : 512; + blobStream->bstr_mode = 0; + blobStream->bstr_cnt = 0; + blobStream->bstr_ptr = 0; - if (!(bstream->bstr_buffer = buffer)) + if (!(blobStream->bstr_buffer = buffer)) { - bstream->bstr_buffer = (SCHAR*) gds__alloc((SLONG) (sizeof(SCHAR) * bstream->bstr_length)); + blobStream->bstr_buffer = (SCHAR*) gds__alloc((SLONG) (sizeof(SCHAR) * blobStream->bstr_length)); // FREE: This structure is freed in BLOB_close() - if (!bstream->bstr_buffer) + if (!blobStream->bstr_buffer) { // NOMEM: - gds__free(bstream); + gds__free(blobStream); return NULL; } #ifdef DEBUG_gds__alloc // This structure is handed to the user process, we depend on the client // to call BLOB_close() for it to be freed. - gds_alloc_flag_unfreed((void*) bstream->bstr_buffer); + gds_alloc_flag_unfreed((void*) blobStream->bstr_buffer); #endif - bstream->bstr_mode |= BSTR_alloc; + blobStream->bstr_mode |= BSTR_alloc; } - return bstream; + return blobStream; } -int API_ROUTINE BLOB_put(SCHAR x, BSTREAM* bstream) +int API_ROUTINE BLOB_put(SCHAR x, FB_BLOB_STREAM blobStream) { /************************************** * @@ -1678,22 +1678,52 @@ * block and retun TRUE if all is well. * **************************************/ - if (!bstream->bstr_buffer) + if (!blobStream->bstr_buffer) return FALSE; - *bstream->bstr_ptr++ = (x & 0377); - const USHORT l = (bstream->bstr_ptr - bstream->bstr_buffer); + *blobStream->bstr_ptr++ = (x & 0377); + const USHORT l = (blobStream->bstr_ptr - blobStream->bstr_buffer); ISC_STATUS_ARRAY status_vector; - if (isc_put_segment(status_vector, &bstream->bstr_blob, l, bstream->bstr_buffer)) + if (isc_put_segment(status_vector, &blobStream->bstr_blob, l, blobStream->bstr_buffer)) { return FALSE; } - bstream->bstr_cnt = bstream->bstr_length; - bstream->bstr_ptr = bstream->bstr_buffer; + blobStream->bstr_cnt = blobStream->bstr_length; + blobStream->bstr_ptr = blobStream->bstr_buffer; return TRUE; } + +int API_ROUTINE gds__thread_start(FPTR_INT_VOID_PTR* entrypoint, + void* arg, + int priority, + int /*flags*/, + void* thd_id) +{ +/************************************** + * + * g d s _ _ t h r e a d _ s t a r t + * + ************************************** + * + * Functional description + * Start a thread. + * + **************************************/ + + int rc = 0; + try + { + Thread::start((ThreadEntryPoint*) entrypoint, arg, priority, (Thread::Handle*) thd_id); + } + catch (const Firebird::status_exception& status) + { + rc = status.value()[1]; + } + return rc; +} + #if (defined SOLARIS ) || (defined __cplusplus) } //extern "C" { #endif @@ -2113,35 +2143,7 @@ return TRUE; } -int API_ROUTINE gds__thread_start(FPTR_INT_VOID_PTR entrypoint, - void* arg, - int priority, - int /*flags*/, - void* thd_id) -{ -/************************************** - * - * g d s _ _ t h r e a d _ s t a r t - * - ************************************** - * - * Functional description - * Start a thread. - * - **************************************/ - int rc = 0; - try - { - Thread::start((ThreadEntryPoint*) entrypoint, arg, priority, (Thread::Handle*) thd_id); - } - catch (const Firebird::status_exception& status) - { - rc = status.value()[1]; - } - return rc; -} - // new utl static inline void setTag(Firebird::ClumpletWriter& dpb, UCHAR tag, Firebird::string& value, bool utf8) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |