int main() { stringtype string; strcpy( string, "test" ); charptr_function( string ); string_function( string ); if( calls != 2 ) fail(__LINE__); _PASS; }
int main(void) { stringtype string; strcpy(string, "test"); charptr_function(string); #if __WATCOM_REVISION__ >= 8 string_function(string); #endif _PASS; }
static bool string_boolean( qli_nod* node) { /************************************** * * s t r i n g _ b o o l e a n * ************************************** * * Functional description * Perform one of the complex string functions CONTAINING, MATCHES, * or STARTS WITH. * **************************************/ const DSC *desc1, *desc2, *desc3; if (!(desc1 = EVAL_value(node->nod_arg[0])) || (desc1->dsc_missing & DSC_missing) || !(desc2 = EVAL_value(node->nod_arg[1])) || (desc2->dsc_missing & DSC_missing) || (node->nod_arg[2] && (!(desc3 = EVAL_value(node->nod_arg[2])) || (desc3->dsc_missing & DSC_missing)))) { return false; } if (node->nod_type == nod_sleuth) return sleuth(node, desc1, desc2, desc3); // Get address and length of strings const TEXT* p2; Firebird::VaryStr<TEMP_STR_LENGTH> temp2; SSHORT l2 = MOVQ_get_string(desc2, &p2, &temp2, TEMP_STR_LENGTH); // If source is not a blob, do a simple search if (desc1->dsc_dtype != dtype_blob) { Firebird::VaryStr<TEMP_STR_LENGTH> temp1; const TEXT* p1; SSHORT l1 = MOVQ_get_string(desc1, &p1, &temp1, TEMP_STR_LENGTH); return string_function(node, l1, p1, l2, p2); } // Source string is a blob, things get interesting bool result = false; FB_API_HANDLE blob = EXEC_open_blob(node->nod_arg[0]); TEXT fixed_buffer[512]; USHORT buffer_length = sizeof(fixed_buffer); TEXT* buffer = make_blob_buffer( blob, &buffer_length); if (!buffer) buffer = fixed_buffer; ISC_STATUS_ARRAY status_vector; SSHORT l3 = 0; while (!isc_get_segment(status_vector, &blob, (USHORT*) &l3, buffer_length, buffer)) { if (string_function(node, l3, buffer, l2, p2)) { result = true; break; } } if (buffer != fixed_buffer) gds__free(buffer); if (isc_close_blob(status_vector, &blob)) { qli_ctx* context = (qli_ctx*) node->nod_arg[e_fld_context]; qli_req* request = context->ctx_request; qli_dbb* database = request->req_database; ERRQ_database_error(database, status_vector); } return result; }