Changeset 15282 for trunk/FACT++
- Timestamp:
- 04/08/13 15:07:07 (12 years ago)
- Location:
- trunk/FACT++/dim
- Files:
-
- 34 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/dim/README_v20.txt
r14936 r15282 1 1 2 DIM version 20r 5Release Notes2 DIM version 20r7 Release Notes 3 3 4 4 Notes 1 and 2 for Unix Users only … … 17 17 Dns </dev/null >& dns.log & 18 18 19 NOTE 3: The Version Number service provided by servers is now set to 2005. 20 19 NOTE 3: The Version Number service provided by servers is now set to 2007. 20 21 05/04/2013 22 Changes for version 2007: 23 - DIM servers were allocating a lot of (possibly) unnecessary memory at startup - fixed. 24 - Tried to fix "Invalid Service ID" messages when creating services/commands in a server. 25 (By protecting the service/command creation in C++) 26 - Fixed many compilation warnings when adding gcc flag -Wconvertion 27 - DIM releases are now: 28 - Windows: 29 - Compiled on Windows 7 Visual Studio 10 30 - Distributed in /bin32 for 32 bits and /bin for 64 bits 31 - Linux: 32 - Compiled on SLC6 with gcc 4.4 33 - Distributed in /linux for 64 bits 34 35 36 17/01/2013 37 Changes for version 2006: 38 - Changes only affecting the Linux version of DIM: 39 - v20r5 changes related to removing the masking of signals could cause problems in single thread 40 applications, like smiGUI. The masking/unmasking of signals is now conditional, implemented by a 41 global variable in the DIM shareable library. 42 - Changed the DID makefile in order to make sure the correct libdim.so in used when linking. 43 - Changes in DID: 44 - When the list of nodes was long, the list was very slow to display - fixed. 45 - If it was really very long, it crashed - fixed. 46 - In nodes were reported by IPAdress, show servers by node didn't work - fixed. 47 48 21 49 21/12/2012 22 50 Changes for version 2005: 23 51 - Moved the WebDID sources to the src directory and the VS settings to the Visual directory 24 52 - In the Multithreaded (the default) version of DIM, signals are not touched anymore. 25 Before they were masked/unmasked at every dim lock/unlock occurence .53 Before they were masked/unmasked at every dim lock/unlock occurence (Linux only). 26 54 - Fixes in WebDID: 27 55 - Now DIM nodes defined by an IP Address are shown properly (by IP Name) -
trunk/FACT++/dim/dim/dic.hxx
r13995 r15282 57 57 { subscribe((char *)name, time, &nolink, sizeof(short), 0); }; 58 58 DimInfo(const char *name, char *nolink) 59 { subscribe((char *)name, 0, nolink, strlen(nolink)+1, 0); };59 { subscribe((char *)name, 0, nolink, (int)strlen(nolink)+1, 0); }; 60 60 DimInfo(const char *name, int time, char *nolink) 61 { subscribe((char *)name, time, nolink, strlen(nolink)+1, 0); };61 { subscribe((char *)name, time, nolink, (int)strlen(nolink)+1, 0); }; 62 62 DimInfo(const char *name, void *nolink, int nolinksize) 63 63 { subscribe((char *)name, 0, nolink, nolinksize, 0); }; … … 86 86 { subscribe((char *)name, time, &nolink, sizeof(short), handler); }; 87 87 DimInfo(const char *name, char *nolink, DimInfoHandler *handler) 88 { subscribe((char *)name, 0, nolink, strlen(nolink)+1, handler); };88 { subscribe((char *)name, 0, nolink, (int)strlen(nolink)+1, handler); }; 89 89 DimInfo(const char *name, int time, char *nolink, DimInfoHandler *handler) 90 { subscribe((char *)name, time, nolink, strlen(nolink)+1, handler); };90 { subscribe((char *)name, time, nolink, (int)strlen(nolink)+1, handler); }; 91 91 DimInfo(const char *name, void *nolink, int nolinksize, DimInfoHandler *handler) 92 92 { subscribe((char *)name, 0, nolink, nolinksize, handler); }; … … 158 158 { subscribe((char *)name, time, &nolink, sizeof(short), 0); }; 159 159 DimStampedInfo(const char *name, char *nolink) 160 { subscribe((char *)name, 0, nolink, strlen(nolink)+1, 0); };160 { subscribe((char *)name, 0, nolink, (int)strlen(nolink)+1, 0); }; 161 161 DimStampedInfo(const char *name, int time, char *nolink) 162 { subscribe((char *)name, time, nolink, strlen(nolink)+1, 0); };162 { subscribe((char *)name, time, nolink, (int)strlen(nolink)+1, 0); }; 163 163 DimStampedInfo(const char *name, void *nolink, int nolinksize) 164 164 { subscribe((char *)name, 0, nolink, nolinksize, 0); }; … … 187 187 { subscribe((char *)name, time, &nolink, sizeof(short), handler); }; 188 188 DimStampedInfo(const char *name, char *nolink, DimInfoHandler *handler) 189 { subscribe((char *)name, 0, nolink, strlen(nolink)+1, handler); };189 { subscribe((char *)name, 0, nolink, (int)strlen(nolink)+1, handler); }; 190 190 DimStampedInfo(const char *name, int time, char *nolink, DimInfoHandler *handler) 191 { subscribe((char *)name, time, nolink, strlen(nolink)+1, handler); };191 { subscribe((char *)name, time, nolink, (int)strlen(nolink)+1, handler); }; 192 192 DimStampedInfo(const char *name, void *nolink, int nolinksize, DimInfoHandler *handler) 193 193 { subscribe((char *)name, 0, nolink, nolinksize, handler); }; … … 230 230 { subscribe((char *)name, time, &nolink, sizeof(short), 0); }; 231 231 DimUpdatedInfo(const char *name, char *nolink) 232 { subscribe((char *)name, 0, nolink, strlen(nolink)+1, 0); };232 { subscribe((char *)name, 0, nolink, (int)strlen(nolink)+1, 0); }; 233 233 DimUpdatedInfo(const char *name, int time, char *nolink) 234 { subscribe((char *)name, time, nolink, strlen(nolink)+1, 0); };234 { subscribe((char *)name, time, nolink, (int)strlen(nolink)+1, 0); }; 235 235 DimUpdatedInfo(const char *name, void *nolink, int nolinksize) 236 236 { subscribe((char *)name, 0, nolink, nolinksize, 0); }; … … 259 259 { subscribe((char *)name, time, &nolink, sizeof(short), handler); }; 260 260 DimUpdatedInfo(const char *name, char *nolink, DimInfoHandler *handler) 261 { subscribe((char *)name, 0, nolink, strlen(nolink)+1, handler); };261 { subscribe((char *)name, 0, nolink, (int)strlen(nolink)+1, handler); }; 262 262 DimUpdatedInfo(const char *name, int time, char *nolink, DimInfoHandler *handler) 263 { subscribe((char *)name, time, nolink, strlen(nolink)+1, handler); };263 { subscribe((char *)name, time, nolink, (int)strlen(nolink)+1, handler); }; 264 264 DimUpdatedInfo(const char *name, void *nolink, int nolinksize, DimInfoHandler *handler) 265 265 { subscribe((char *)name, 0, nolink, nolinksize, handler); }; … … 310 310 subscribe((char *)name, 0, &nolink, sizeof(short)); }; 311 311 DimCurrentInfo(const char *name, char *nolink) { 312 subscribe((char *)name, 0, nolink, strlen(nolink)+1); };312 subscribe((char *)name, 0, nolink, (int)strlen(nolink)+1); }; 313 313 DimCurrentInfo(const char *name, void *nolink, int nolinksize) { 314 314 subscribe((char *)name, 0, nolink, nolinksize); }; … … 324 324 subscribe((char *)name, time, &nolink, sizeof(short)); }; 325 325 DimCurrentInfo(const char *name, int time, char *nolink) { 326 subscribe((char *)name, time, nolink, strlen(nolink)+1); };326 subscribe((char *)name, time, nolink, (int)strlen(nolink)+1); }; 327 327 DimCurrentInfo(const char *name, int time, void *nolink, int nolinksize) { 328 328 subscribe((char *)name, time, nolink, nolinksize); }; … … 377 377 subscribe((char *)name, 0, 0, &nolink, sizeof(short), 0); }; 378 378 DimRpcInfo(const char *name, char *nolink) { 379 subscribe((char *)name, 0, 0, nolink, strlen(nolink)+1, 0); };379 subscribe((char *)name, 0, 0, nolink, (int)strlen(nolink)+1, 0); }; 380 380 DimRpcInfo(const char *name, void *nolink, int nolinksize) { 381 381 subscribe((char *)name, 0, 0, nolink, nolinksize, 0); }; … … 392 392 subscribe((char *)name, 0, 0, &nolink, sizeof(short), time); }; 393 393 DimRpcInfo(const char *name, int time, char *nolink) { 394 subscribe((char *)name, 0, 0, nolink, strlen(nolink)+1, time); };394 subscribe((char *)name, 0, 0, nolink, (int)strlen(nolink)+1, time); }; 395 395 DimRpcInfo(const char *name, int time, void *nolink, int nolinksize) { 396 396 subscribe((char *)name, 0, 0, nolink, nolinksize, time); }; … … 417 417 void setData(longlong &data) { doIt(&data, sizeof(longlong)); } ; 418 418 void setData(short &data) { doIt(&data, sizeof(short)); } ; 419 void setData(char *data) { doIt(data, strlen(data)+1); } ;419 void setData(char *data) { doIt(data, (int)strlen(data)+1); } ; 420 420 421 421 private : -
trunk/FACT++/dim/dim/dim.h
r14936 r15282 14 14 #include "dim_common.h" 15 15 16 #define DIM_VERSION_NUMBER 200 516 #define DIM_VERSION_NUMBER 2007 17 17 18 18 -
trunk/FACT++/dim/dim/dim_common.h
r14936 r15282 124 124 #include <unistd.h> 125 125 126 extern int DIM_Threads_OFF; 127 128 #define DISABLE_SIG sigset_t set, oset; if (DIM_Threads_OFF) {\ 129 sigemptyset(&set);\ 130 sigaddset(&set,SIGIO);\ 131 sigaddset(&set,SIGALRM);\ 132 sigprocmask(SIG_BLOCK,&set,&oset);} 133 #define ENABLE_SIG if (DIM_Threads_OFF) {\ 134 sigprocmask(SIG_SETMASK,&oset,0);} 135 136 /* 126 137 #define DISABLE_SIG sigset_t set, oset; sigemptyset(&set);\ 127 138 sigaddset(&set,SIGIO);\ … … 129 140 sigprocmask(SIG_BLOCK,&set,&oset); 130 141 #define ENABLE_SIG sigprocmask(SIG_SETMASK,&oset,0); 131 132 #ifdef VxWorks 142 */ 143 133 144 #define DISABLE_AST DISABLE_SIG DIM_LOCK 134 145 #define ENABLE_AST DIM_UNLOCK ENABLE_SIG 146 147 #ifdef VxWorks 135 148 #define DIM_LOCK taskLock(); 136 149 #define DIM_UNLOCK taskUnlock(); … … 145 158 _DIM_PROTOE( void dim_signal_cond, () ); 146 159 147 #define DISABLE_AST DIM_LOCK148 #define ENABLE_AST DIM_UNLOCK149 160 #define DIM_LOCK dim_lock(); 150 161 #define DIM_UNLOCK dim_unlock(); … … 152 163 #else 153 164 #include <time.h> 154 #define DISABLE_AST DISABLE_SIG DIM_LOCK155 #define ENABLE_AST DIM_UNLOCK ENABLE_SIG156 165 #define DIM_LOCK 157 166 #define DIM_UNLOCK -
trunk/FACT++/dim/src/conn_handler.c
r13995 r15282 57 57 case SRC_DIC : 58 58 Dic_conns = (DIC_CONNECTION *) 59 calloc( Curr_N_Conns, sizeof(DIC_CONNECTION) );59 calloc( (size_t)Curr_N_Conns, sizeof(DIC_CONNECTION) ); 60 60 My_type = type; 61 61 break; 62 62 case SRC_DNS : 63 63 Dns_conns = (DNS_CONNECTION *) 64 calloc( Curr_N_Conns, sizeof(DNS_CONNECTION) );64 calloc( (size_t)Curr_N_Conns, sizeof(DNS_CONNECTION) ); 65 65 My_type = type; 66 66 break; 67 67 case SRC_DNA : 68 68 Dna_conns = (DNA_CONNECTION *) 69 calloc( Curr_N_Conns, sizeof(DNA_CONNECTION) );69 calloc( (size_t)Curr_N_Conns, sizeof(DNA_CONNECTION) ); 70 70 Net_conns = (NET_CONNECTION *) 71 calloc( Curr_N_Conns, sizeof(NET_CONNECTION) );71 calloc( (size_t)Curr_N_Conns, sizeof(NET_CONNECTION) ); 72 72 break; 73 73 default: … … 128 128 register char *new_ptr; 129 129 130 new_ptr = realloc( conn_ptr, conn_size * n_conns);131 memset( new_ptr + conn_size * Curr_N_Conns, 0, conn_size * CONN_BLOCK);130 new_ptr = realloc( conn_ptr, (size_t)(conn_size * n_conns) ); 131 memset( new_ptr + conn_size * Curr_N_Conns, 0, (size_t)(conn_size * CONN_BLOCK) ); 132 132 return(new_ptr); 133 133 } … … 137 137 138 138 Curr_N_Ids = ID_BLOCK; 139 Id_arr = (void *) calloc( Curr_N_Ids, sizeof(ID_ITEM));139 Id_arr = (void *) calloc( (size_t)Curr_N_Ids, sizeof(ID_ITEM)); 140 140 } 141 141 … … 145 145 register char *new_ptr; 146 146 147 new_ptr = realloc( id_ptr, id_size * n_ids);148 memset( new_ptr + id_size * Curr_N_Ids, 0, id_size * ID_BLOCK);147 new_ptr = realloc( id_ptr, (size_t)(id_size * n_ids) ); 148 memset( new_ptr + id_size * Curr_N_Ids, 0, (size_t)(id_size * ID_BLOCK) ); 149 149 return(new_ptr); 150 150 } -
trunk/FACT++/dim/src/copy_swap.c
r11071 r15282 176 176 if(!format_data->par_bytes) { 177 177 if(buff_in != buff_out) 178 memcpy( buff_out, buff_in, size );178 memcpy( buff_out, buff_in, (size_t)size ); 179 179 return(size); 180 180 } … … 196 196 size - curr_size, SIZEOF_CHAR); 197 197 198 memcpy( buff_out, buff_in, num);198 memcpy( buff_out, buff_in, (size_t)num); 199 199 inc_pter( buff_in, num); 200 200 inc_pter( buff_out, num); … … 213 213 } 214 214 } 215 memcpy( buff_out, buff_in, num);215 memcpy( buff_out, buff_in, (size_t)num); 216 216 inc_pter( buff_in, num); 217 217 inc_pter( buff_out, num); … … 230 230 } 231 231 } 232 memcpy( buff_out, buff_in, num);232 memcpy( buff_out, buff_in, (size_t)num); 233 233 inc_pter( buff_in, num); 234 234 inc_pter( buff_out, num); … … 251 251 } 252 252 } 253 memcpy( buff_out, buff_in, num);253 memcpy( buff_out, buff_in, (size_t)num); 254 254 inc_pter( buff_in, num); 255 255 inc_pter( buff_out, num); … … 276 276 if(!format_data->par_bytes) { 277 277 if(buff_in != buff_out) 278 memcpy( buff_out, buff_in, size );278 memcpy( buff_out, buff_in, (size_t)size ); 279 279 return(size); 280 280 } … … 322 322 323 323 if(buff_in != buff_out) 324 memcpy( buff_out, buff_in, num);324 memcpy( buff_out, buff_in, (size_t)num); 325 325 inc_pter( buff_in, num); 326 326 inc_pter( buff_out, num); -
trunk/FACT++/dim/src/dic.c
r14580 r15282 224 224 { 225 225 servp->pending = WAITING_DNS_UP; 226 dic_release_service( servp->serv_id );226 dic_release_service( (unsigned)servp->serv_id ); 227 227 } 228 228 servp = auxp; … … 237 237 break; 238 238 service_id = vtohl(packet->service_id); 239 if( service_id & 0x80000000) /* Service removed by server */239 if((unsigned)service_id & 0x80000000) /* Service removed by server */ 240 240 { 241 241 service_id &= 0x7fffffff; … … 288 288 { 289 289 servp->pending = WAITING_DNS_UP; 290 dic_release_service( servp->serv_id );290 dic_release_service( (unsigned)servp->serv_id ); 291 291 } 292 292 servp = auxp; … … 337 337 { 338 338 servp->pending = WAITING_DNS_UP; 339 dic_release_service( servp->serv_id );339 dic_release_service( (unsigned)servp->serv_id ); 340 340 } 341 341 else … … 390 390 { 391 391 for(formatp = format_data_cp; formatp->par_bytes; formatp++) 392 formatp->flags &= 0xFFF0; /* NOSWAP */392 formatp->flags &= (short)0xFFF0; /* NOSWAP */ 393 393 } 394 394 if( servp->stamped) … … 397 397 header_size = DIS_STAMPED_HEADER; 398 398 servp->time_stamp[0] = vtohl(((DIS_STAMPED_PACKET *)packet)->time_stamp[0]); 399 if(( servp->time_stamp[0] & 0xFFFF0000) == 0xc0de0000)399 if(((unsigned)servp->time_stamp[0] & 0xFFFF0000) == 0xc0de0000) 400 400 { 401 401 /* … … 442 442 if(!buffer_size) 443 443 { 444 buffer = (int *)malloc( add_size);444 buffer = (int *)malloc((size_t)add_size); 445 445 buffer_size = add_size; 446 446 } … … 450 450 { 451 451 free(buffer); 452 buffer = (int *)malloc( add_size);452 buffer = (int *)malloc((size_t)add_size); 453 453 buffer_size = add_size; 454 454 } … … 550 550 (servp->user_routine)( &servp->tag, &size ); 551 551 } 552 dic_release_service( servp->serv_id );552 dic_release_service( (unsigned)servp->serv_id ); 553 553 Curr_conn_id = 0; 554 554 return; … … 567 567 if( size > servp->serv_size ) 568 568 size = servp->serv_size; 569 memcpy(servp->serv_address, servp->fill_address, size);569 memcpy(servp->serv_address, servp->fill_address, (size_t)size); 570 570 if( servp->user_routine ) 571 571 (servp->user_routine)( &servp->tag, servp->serv_address, &size); … … 579 579 if( once_only ) 580 580 { 581 dic_release_service( servp->serv_id );581 dic_release_service( (unsigned)servp->serv_id ); 582 582 } 583 583 Curr_conn_id = 0; … … 760 760 if(serv_size > 0) 761 761 { 762 fillp = (int *)malloc( serv_size);763 memcpy( (char *)fillp, (char *)serv_address, serv_size );762 fillp = (int *)malloc((size_t)serv_size); 763 memcpy( (char *)fillp, (char *)serv_address, (size_t)serv_size ); 764 764 } 765 765 servp->fill_address = fillp; … … 807 807 newp = (DIC_SERVICE *) malloc(sizeof(DIC_SERVICE)); 808 808 newp->pending = 0; 809 strncpy( newp->serv_name, name, MAX_NAME );809 strncpy( newp->serv_name, name, (size_t)MAX_NAME ); 810 810 newp->type = type; 811 811 newp->timeout = timeout; … … 817 817 if(fill_size > 0) 818 818 { 819 fillp = (int *)malloc( fill_size);820 memcpy( (char *) fillp, (char *) fill_addr, fill_size );819 fillp = (int *)malloc((size_t)fill_size); 820 memcpy( (char *) fillp, (char *) fill_addr, (size_t)fill_size ); 821 821 } 822 822 newp->fill_address = fillp; … … 888 888 if(fill_size > 0) 889 889 { 890 fillp = (int *)malloc( fill_size);891 memcpy( (char *) fillp, (char *) fill_addr, fill_size );890 fillp = (int *)malloc((size_t)fill_size); 891 memcpy( (char *) fillp, (char *) fill_addr, (size_t)fill_size ); 892 892 } 893 893 servp->fill_address = fillp; … … 993 993 { 994 994 *secs = servp->time_stamp[1]; 995 if(( servp->time_stamp[0] & 0xFFFF0000) == 0xc0de0000)995 if(((unsigned)servp->time_stamp[0] & 0xFFFF0000) == 0xc0de0000) 996 996 *milisecs = servp->time_stamp[0] & 0x0000FFFF; 997 997 else … … 1022 1022 DISABLE_AST 1023 1023 if( !packet_size ) { 1024 dic_packet = (DIC_PACKET *)malloc( DIC_HEADER);1024 dic_packet = (DIC_PACKET *)malloc((size_t)DIC_HEADER); 1025 1025 packet_size = DIC_HEADER; 1026 1026 } … … 1046 1046 case NOT_PENDING : 1047 1047 conn_id = servp->conn_id; 1048 strncpy(dic_packet->service_name, servp->serv_name, MAX_NAME);1048 strncpy(dic_packet->service_name, servp->serv_name, (size_t)MAX_NAME); 1049 1049 dic_packet->type = htovl(DIM_DELETE); 1050 dic_packet->service_id = htovl(service_id);1050 dic_packet->service_id = (int)htovl(service_id); 1051 1051 dic_packet->size = htovl(DIC_HEADER); 1052 1052 dna_write_nowait( conn_id, dic_packet, DIC_HEADER ); … … 1064 1064 serv_reqp = &dic_dns_p->service; 1065 1065 strcpy( serv_reqp->service_name, servp->serv_name ); 1066 serv_reqp->service_id = htovl(servp->serv_id | 0x80000000);1066 serv_reqp->service_id = (int)htovl((unsigned)servp->serv_id | 0x80000000); 1067 1067 dna_write( Dns_dic_conn_id, dic_dns_p, 1068 1068 sizeof(DIC_DNS_PACKET) ); … … 1193 1193 return((DIC_SERVICE *)0); 1194 1194 if( (servp = (DIC_SERVICE *) dll_search( (DLL *) Cmnd_head, serv_name, 1195 strlen(serv_name)+1)) )1195 (int)strlen(serv_name)+1)) ) 1196 1196 return(servp); 1197 1197 return((DIC_SERVICE *)0); … … 1205 1205 return((DIC_SERVICE *)0); 1206 1206 if( (servp = (DIC_SERVICE *) dll_search( (DLL *) Service_pend_head, serv_name, 1207 strlen(serv_name)+1)) )1207 (int)strlen(serv_name)+1)) ) 1208 1208 return(servp); 1209 1209 return((DIC_SERVICE *)0); … … 1372 1372 strcpy(node_info,node_name); 1373 1373 for(i = 0; i < 4; i ++) 1374 node_info[ strlen(node_name)+i+1] = packet->node_addr[i];1374 node_info[(int)strlen(node_name)+i+1] = packet->node_addr[i]; 1375 1375 port = vtohl(packet->port); 1376 1376 pid = vtohl(packet->pid); … … 1386 1386 serv_reqp = &dic_dns_p->service; 1387 1387 strcpy( serv_reqp->service_name, servp->serv_name ); 1388 serv_reqp->service_id = htovl(servp->serv_id | 0x80000000);1388 serv_reqp->service_id = (int)htovl((unsigned)servp->serv_id | 0x80000000); 1389 1389 dna_write( Dns_dic_conn_id, dic_dns_p, 1390 1390 sizeof(DIC_DNS_PACKET) ); … … 1405 1405 serv_reqp = &dic_dns_p->service; 1406 1406 strcpy( serv_reqp->service_name, servp->serv_name ); 1407 serv_reqp->service_id = htovl(servp->serv_id | 0x80000000);1407 serv_reqp->service_id = (int)htovl((unsigned)servp->serv_id | 0x80000000); 1408 1408 dna_write( Dns_dic_conn_id, dic_dns_p, 1409 1409 sizeof(DIC_DNS_PACKET) ); … … 1456 1456 dic_connp = &Dic_conns[conn_id]; 1457 1457 strncpy( dic_connp->node_name, node_name, 1458 MAX_NODE_NAME);1458 (size_t)MAX_NODE_NAME); 1459 1459 strncpy( dic_connp->task_name, task_name, 1460 MAX_TASK_NAME);1460 (size_t)MAX_TASK_NAME); 1461 1461 dic_connp->port = port; 1462 1462 dic_connp->pid = pid; … … 1508 1508 bad_connp->n_retries++; 1509 1509 bad_connp->retrying = 0; 1510 strncpy( bad_connp->conn.node_name, node_name, MAX_NODE_NAME);1511 strncpy( bad_connp->conn.task_name, task_name, MAX_TASK_NAME);1510 strncpy( bad_connp->conn.node_name, node_name, (size_t)MAX_NODE_NAME); 1511 strncpy( bad_connp->conn.task_name, task_name, (size_t)MAX_TASK_NAME); 1512 1512 bad_connp->conn.port = port; 1513 1513 tmout = BAD_CONN_TIMEOUT * (bad_connp->n_retries - 1); … … 1804 1804 { 1805 1805 servp->pending = WAITING_DNS_UP; 1806 dic_release_service( servp->serv_id );1806 dic_release_service( (unsigned)servp->serv_id ); 1807 1807 } 1808 1808 else … … 1818 1818 { 1819 1819 servp->pending = WAITING_DNS_UP; 1820 dic_release_service( servp->serv_id );1820 dic_release_service( (unsigned)servp->serv_id ); 1821 1821 } 1822 1822 } … … 1859 1859 { 1860 1860 servp->pending = WAITING_DNS_UP; 1861 dic_release_service( servp->serv_id );1861 dic_release_service( (unsigned)servp->serv_id ); 1862 1862 } 1863 1863 else … … 1882 1882 1883 1883 if( !serv_packet_size ) { 1884 dic_packet = (DIC_PACKET *)malloc( DIC_HEADER);1884 dic_packet = (DIC_PACKET *)malloc((size_t)DIC_HEADER); 1885 1885 serv_packet_size = DIC_HEADER; 1886 1886 } 1887 1887 1888 strncpy( dic_packet->service_name, servp->serv_name, MAX_NAME );1888 strncpy( dic_packet->service_name, servp->serv_name, (size_t)MAX_NAME ); 1889 1889 type = servp->type; 1890 1890 if(servp->stamped) … … 1954 1954 1955 1955 if( !cmnd_packet_size ) { 1956 dic_packet = (DIC_PACKET *)malloc( DIC_HEADER + size);1956 dic_packet = (DIC_PACKET *)malloc((size_t)(DIC_HEADER + size)); 1957 1957 cmnd_packet_size = DIC_HEADER + size; 1958 1958 } … … 1961 1961 if( DIC_HEADER + size > cmnd_packet_size ) { 1962 1962 free( dic_packet ); 1963 dic_packet = (DIC_PACKET *)malloc( DIC_HEADER + size);1963 dic_packet = (DIC_PACKET *)malloc((size_t)(DIC_HEADER + size)); 1964 1964 cmnd_packet_size = DIC_HEADER + size; 1965 1965 } 1966 1966 } 1967 1967 1968 strncpy(dic_packet->service_name, servp->serv_name, MAX_NAME);1968 strncpy(dic_packet->service_name, servp->serv_name, (size_t)MAX_NAME); 1969 1969 dic_packet->type = htovl(COMMAND); 1970 1970 dic_packet->timeout = htovl(0); … … 2000 2000 { 2001 2001 servp->pending = WAITING_DNS_UP; 2002 dic_release_service( servp->serv_id );2002 dic_release_service( (unsigned)servp->serv_id ); 2003 2003 } 2004 2004 */ … … 2008 2008 { 2009 2009 servp->pending = WAITING_DNS_UP; 2010 dic_release_service( servp->serv_id );2010 dic_release_service( (unsigned)servp->serv_id ); 2011 2011 } 2012 2012 else … … 2052 2052 get_proc_name(name); 2053 2053 strcat(name,"@"); 2054 get_node_name(&name[ strlen(name)]);2054 get_node_name(&name[(int)strlen(name)]); 2055 2055 return(1); 2056 2056 } … … 2077 2077 { 2078 2078 auxp = servp->prev; 2079 dic_release_service( servp->serv_id );2079 dic_release_service( (unsigned)servp->serv_id ); 2080 2080 servp = auxp; 2081 2081 if(!dic_connp->service_head) … … 2157 2157 { 2158 2158 servp->pending = WAITING_DNS_UP; 2159 dic_release_service( servp->serv_id );2159 dic_release_service( (unsigned)servp->serv_id ); 2160 2160 } 2161 2161 servp = auxp; … … 2249 2249 if(!curr_allocated_size) 2250 2250 { 2251 service_info_buffer = (char *)malloc( max_size);2251 service_info_buffer = (char *)malloc((size_t)max_size); 2252 2252 curr_allocated_size = max_size; 2253 2253 } … … 2255 2255 { 2256 2256 free(service_info_buffer); 2257 service_info_buffer = (char *)malloc( max_size);2257 service_info_buffer = (char *)malloc((size_t)max_size); 2258 2258 curr_allocated_size = max_size; 2259 2259 } … … 2268 2268 strcat(buff_ptr, servp->serv_name); 2269 2269 strcat(buff_ptr, "\n"); 2270 buff_ptr += strlen(buff_ptr);2270 buff_ptr += (int)strlen(buff_ptr); 2271 2271 } 2272 2272 } -
trunk/FACT++/dim/src/diccpp.cxx
r14580 r15282 33 33 t->itsDataSize = *size; 34 34 } 35 memcpy(t->itsData, buf, *size);35 memcpy(t->itsData, buf, (size_t)*size); 36 36 } 37 37 else if (*size == 0) … … 83 83 itsDataSize = itsSize; 84 84 } 85 memcpy(itsData, data, itsSize);85 memcpy(itsData, data, (size_t)itsSize); 86 86 } 87 87 } … … 125 125 if(itsFormat) 126 126 { 127 len = strlen(itsFormat)+1;127 len = (int)strlen(itsFormat)+1; 128 128 if(len > 1) 129 129 return itsFormat; 130 130 } 131 131 def = dic_get_format(itsId); 132 new_len = strlen(def)+1;132 new_len = (int)strlen(def)+1; 133 133 if(new_len > len) 134 134 { 135 135 if(itsFormat) 136 136 delete[] itsFormat; 137 itsFormat = new char[ strlen(def)+1];137 itsFormat = new char[(int)strlen(def)+1]; 138 138 } 139 139 strcpy(itsFormat, def); … … 166 166 return; 167 167 } 168 itsName = new char[ strlen(name)+1];168 itsName = new char[(int)strlen(name)+1]; 169 169 strcpy(itsName,name); 170 170 itsNolinkBuf = nolink; … … 174 174 itsNolinkBuf = new char[nolinksize]; 175 175 itsNolinkSize = nolinksize; 176 memcpy(itsNolinkBuf, nolink, nolinksize);176 memcpy(itsNolinkBuf, nolink, (size_t)nolinksize); 177 177 } 178 178 if(!time) … … 253 253 return; 254 254 } 255 itsName = new char[ strlen(name)+1];255 itsName = new char[(int)strlen(name)+1]; 256 256 strcpy(itsName,name); 257 257 itsNolinkBuf = nolink; … … 261 261 itsNolinkBuf = new char[nolinksize]; 262 262 itsNolinkSize = nolinksize; 263 memcpy(itsNolinkBuf, nolink, nolinksize);263 memcpy(itsNolinkBuf, nolink, (size_t)nolinksize); 264 264 } 265 265 if(!time) … … 313 313 return; 314 314 } 315 itsName = new char[ strlen(name)+1];315 itsName = new char[(int)strlen(name)+1]; 316 316 strcpy(itsName,name); 317 317 itsNolinkBuf = nolink; … … 321 321 itsNolinkBuf = new char[nolinksize]; 322 322 itsNolinkSize = nolinksize; 323 memcpy(itsNolinkBuf, nolink, nolinksize);323 memcpy(itsNolinkBuf, nolink, (size_t)nolinksize); 324 324 } 325 325 if(!time) … … 363 363 t->itsDataSize = *size; 364 364 } 365 memcpy(t->itsData, buf, *size);365 memcpy(t->itsData, buf, (size_t)*size); 366 366 } 367 367 else if (*size == 0) … … 404 404 return; 405 405 } 406 itsName = new char[ strlen(name)+1];406 itsName = new char[(int)strlen(name)+1]; 407 407 strcpy(itsName,name); 408 408 itsNolinkBuf = nolink; … … 412 412 itsNolinkBuf = new char[nolinksize]; 413 413 itsNolinkSize = nolinksize; 414 memcpy(itsNolinkBuf, nolink, nolinksize);414 memcpy(itsNolinkBuf, nolink, (size_t)nolinksize); 415 415 } 416 416 if(!time) … … 570 570 { 571 571 if(size > 0) 572 memcpy(t->itsData, buf, size);572 memcpy(t->itsData, buf, (size_t)size); 573 573 else 574 574 t->itsData = buf; … … 633 633 { 634 634 if(size > 0) 635 memcpy(itsData, buf, size);635 memcpy(itsData, buf, (size_t)size); 636 636 else 637 637 itsData = buf; … … 676 676 itsDataSize = itsSize; 677 677 } 678 memcpy(itsData, data, itsSize);678 memcpy(itsData, data, (size_t)itsSize); 679 679 } 680 680 } … … 688 688 itsInit = 0; 689 689 itsWaiting = 0; 690 itsName = new char[ strlen(name)+1];690 itsName = new char[(int)strlen(name)+1]; 691 691 strcpy(itsName,name); 692 692 itsHandler = this; … … 701 701 itsNolinkBuf = new char[nolinksize]; 702 702 itsNolinkSize = nolinksize; 703 memcpy(itsNolinkBuf, nolink, nolinksize);704 } 705 itsNameOut = new char[ strlen(name)+1+10];703 memcpy(itsNolinkBuf, nolink, (size_t)nolinksize); 704 } 705 itsNameOut = new char[(int)strlen(name)+1+10]; 706 706 strcpy(itsNameOut,name); 707 707 strcat(itsNameOut,(char *)"/RpcIn"); 708 itsNameIn = new char[ strlen(name)+1+10];708 itsNameIn = new char[(int)strlen(name)+1+10]; 709 709 strcpy(itsNameIn,name); 710 710 strcat(itsNameIn,(char *)"/RpcOut"); … … 752 752 itsDataOutSize = size; 753 753 } 754 memcpy(itsDataOut, data, size);754 memcpy(itsDataOut, data, (size_t)size); 755 755 } 756 756 else … … 883 883 DimCurrentInfo srv((char *)"DIS_DNS/SERVER_LIST", timeout, (char *)"\0"); 884 884 str = srv.getString(); 885 size = strlen(str)+1;885 size = (int)strlen(str)+1; 886 886 totsize = srv.getSize(); 887 887 … … 894 894 if(totsize > size) 895 895 { 896 pid_str = str + strlen(str) + 1;896 pid_str = str + (int)strlen(str) + 1; 897 897 if(itsData[4]) 898 898 delete itsData[4]; … … 910 910 { 911 911 char *str; 912 char *name = new char[ strlen(serverName) + 20];912 char *name = new char[(int)strlen(serverName) + 20]; 913 913 strcpy(name,(char *)serverName); 914 914 strcat(name,(char *)"/SERVICE_LIST"); … … 933 933 { 934 934 char *str; 935 char *name = new char[ strlen(serverName) + 20];935 char *name = new char[(int)strlen(serverName) + 20]; 936 936 strcpy(name,(char *)serverName); 937 937 strcat(name,(char *)"/CLIENT_LIST"); … … 1129 1129 { 1130 1130 DimCmnd a; 1131 return a.send((char *)name, (char *)data, strlen(data)+1);1131 return a.send((char *)name, (char *)data, (int)strlen(data)+1); 1132 1132 } 1133 1133 … … 1171 1171 { 1172 1172 DimCmnd a; 1173 a.sendNB((char *)name, data, strlen(data)+1);1173 a.sendNB((char *)name, data, (int)strlen(data)+1); 1174 1174 } 1175 1175 … … 1184 1184 DimCmnd a; 1185 1185 int ret, tag = 1; 1186 char *name = new char[ strlen(srvName) + 20];1186 char *name = new char[(int)strlen(srvName) + 20]; 1187 1187 strcpy(name,(char *)srvName); 1188 1188 strcat(name,"/SET_EXIT_HANDLER"); … … 1196 1196 DimCmnd a; 1197 1197 int ret, tag = 1; 1198 char *name = new char[ strlen(srvName) + 20];1198 char *name = new char[(int)strlen(srvName) + 20]; 1199 1199 strcpy(name,(char *)srvName); 1200 1200 strcat(name,"/EXIT"); -
trunk/FACT++/dim/src/did/did.c
r14698 r15282 129 129 XtSetArg(arglist[n], XmNadjustLast, False); n++; 130 130 sprintf(w_name,"matrix_row"); 131 row_col_id = XmCreateRowColumn(top_id,w_name,arglist, n);131 row_col_id = XmCreateRowColumn(top_id,w_name,arglist,(Cardinal)n); 132 132 XtManageChild(row_col_id); 133 133 Matrix_id[Curr_matrix] = row_col_id; … … 302 302 XtSetArg ( ar[n], XmNscrollingPolicy, XmAUTOMATIC); n++; 303 303 304 sl = XmCreateScrolledWindow ( f, "ScrollWin", ar, n );304 sl = XmCreateScrolledWindow ( f, "ScrollWin", ar, (Cardinal)n ); 305 305 /* 306 306 XtVaSetValues ( sl, … … 363 363 364 364 w = XmCreateSeparator(parent_id, "separator", 365 arglist, n);365 arglist,(Cardinal)n); 366 366 XtManageChild(w); 367 367 return(w); … … 758 758 XtSetArg ( arglist[n], XmNtraversalOn,True); n++; 759 759 return XtAppCreateShell(argv[0], NULL, applicationShellWidgetClass, 760 display, arglist, n);760 display, arglist, (Cardinal)n); 761 761 762 762 } … … 860 860 } 861 861 for(i = 0;*ptr; ptr++, i++) 862 Curr_view_opt_par[i] = toupper(*ptr);862 Curr_view_opt_par[i] = (char)toupper((int)*ptr); 863 863 Curr_view_opt_par[i] = '\0'; 864 864 } … … 1033 1033 Widget id,sel_id; 1034 1034 int i, j, n_nodes, curr_index = 0; 1035 char nodes_str[MAX_NODE_NAME*MAX_CONNS ], max_str[MAX_NODE_NAME];1036 char *ptr, *nodeptrs[MAX_CONNS ], *curr_str, *sptr;1035 char nodes_str[MAX_NODE_NAME*MAX_CONNS*2], max_str[MAX_NODE_NAME]; 1036 char *ptr, *nodeptrs[MAX_CONNS*2], *curr_str, *sptr; 1037 1037 int get_nodes(); 1038 1038 … … 1052 1052 sptr = ptr; 1053 1053 ptr = strchr(ptr,'\n'); 1054 *ptr++ = '\0'; 1054 1055 for(j = 0; j < (int)strlen(sptr); j++) 1055 sptr[j] = tolower(sptr[j]); 1056 *ptr++ = '\0'; 1056 sptr[j] = (char)tolower((int)sptr[j]); 1057 1057 } 1058 1058 strcpy(max_str,"zzzzzzzzzzzzzzzzzzzzzzzzzzzz"); … … 1169 1169 ptr1 = strchr(ptr,'|'); 1170 1170 } 1171 strncpy(Curr_service_format,ptr,( int)(ptr1 - ptr));1171 strncpy(Curr_service_format,ptr,(size_t)(ptr1 - ptr)); 1172 1172 Curr_service_format[(int)(ptr1-ptr)] = '\0'; 1173 1173 } … … 1183 1183 1184 1184 if(tag){} 1185 Service_content_str = malloc( 1024 + (*size)*16);1186 Service_buffer = malloc( *size);1187 memcpy(Service_buffer, (char *)buffer, *size);1185 Service_content_str = malloc((size_t)(1024 + (*size)*16)); 1186 Service_buffer = malloc((size_t)*size); 1187 memcpy(Service_buffer, (char *)buffer, (size_t)*size); 1188 1188 Service_size = *size; 1189 1189 get_service_format(); … … 1303 1303 strcat(Service_content_str," L"); 1304 1304 if(!num) 1305 size = ssize/ sizeof(int);1305 size = ssize/(int)sizeof(int); 1306 1306 else 1307 1307 size = num; 1308 psize = size * sizeof(int);1308 psize = size * (int)sizeof(int); 1309 1309 print_service_standard(ptr, size); 1310 1310 break; … … 1313 1313 strcat(Service_content_str," I"); 1314 1314 if(!num) 1315 size = ssize/ sizeof(int);1315 size = ssize/(int)sizeof(int); 1316 1316 else 1317 1317 size = num; 1318 psize = size * sizeof(int);1318 psize = size * (int)sizeof(int); 1319 1319 print_service_standard(ptr, size); 1320 1320 break; … … 1323 1323 strcat(Service_content_str," S"); 1324 1324 if(!num) 1325 size = ssize/ sizeof(short);1325 size = ssize/(int)sizeof(short); 1326 1326 else 1327 1327 size = num; 1328 psize = size * sizeof(short);1328 psize = size * (int)sizeof(short); 1329 1329 print_service_short(ptr, size); 1330 1330 break; … … 1333 1333 strcat(Service_content_str," F"); 1334 1334 if(!num) 1335 size = ssize/ sizeof(float);1335 size = ssize/(int)sizeof(float); 1336 1336 else 1337 1337 size = num; 1338 psize = size * sizeof(float);1338 psize = size * (int)sizeof(float); 1339 1339 print_service_float(ptr, size); 1340 1340 break; … … 1343 1343 strcat(Service_content_str," D"); 1344 1344 if(!num) 1345 size = ssize/ sizeof(double);1345 size = ssize/(int)sizeof(double); 1346 1346 else 1347 1347 size = num; 1348 psize = size * sizeof(double);1348 psize = size * (int)sizeof(double); 1349 1349 print_service_double(ptr, size); 1350 1350 break; … … 1353 1353 strcat(Service_content_str," X"); 1354 1354 if(!num) 1355 size = ssize/ sizeof(longlong);1355 size = ssize/(int)sizeof(longlong); 1356 1356 else 1357 1357 size = num; 1358 psize = size * sizeof(longlong);1358 psize = size * (int)sizeof(longlong); 1359 1359 print_service_standard(ptr, size*2); 1360 1360 break; … … 1997 1997 if(last_size) 1998 1998 free(last_buffer); 1999 last_buffer = malloc( full_size);1999 last_buffer = malloc((size_t)full_size); 2000 2000 last_size = full_size; 2001 2001 } … … 2143 2143 strp++; 2144 2144 } 2145 num = strlen(strp)+1;2146 strncpy((char *)ptr,strp, num);2145 num = (int)strlen(strp)+1; 2146 strncpy((char *)ptr,strp,(size_t)num); 2147 2147 if( (ptr1 = (char *)strchr((char *)ptr,'\"')) ) 2148 2148 { … … 2198 2198 Curr_service_id = 0; 2199 2199 } 2200 Curr_service_id = dic_info_service_stamped(Curr_service_name,2200 Curr_service_id = (int)dic_info_service_stamped(Curr_service_name, 2201 2201 MONITORED,10,0,0, 2202 2202 recv_service_info,0, … … 2218 2218 Curr_service_id = 0; 2219 2219 } 2220 Curr_service_id = dic_info_service_stamped(Curr_service_name,2220 Curr_service_id = (int)dic_info_service_stamped(Curr_service_name, 2221 2221 MONITORED,0,0,0, 2222 2222 recv_service_info,0, … … 2404 2404 if(n_services != -1) 2405 2405 { 2406 service_size = n_services* sizeof(DNS_SERVICE_INFO);2407 servp->service_ptr = (DNS_SERVICE_INFO *)malloc( service_size);2408 memcpy(servp->service_ptr, buffer->services, service_size);2406 service_size = n_services*(int)sizeof(DNS_SERVICE_INFO); 2407 servp->service_ptr = (DNS_SERVICE_INFO *)malloc((size_t)service_size); 2408 memcpy(servp->service_ptr, buffer->services, (size_t)service_size); 2409 2409 N_services += n_services; 2410 2410 } … … 2539 2539 strcpy(node, server_ptr->node); 2540 2540 strcpy(par, Curr_view_opt_par); 2541 ptr = strchr(node, '.'); 2542 if(ptr) 2543 *ptr = '\0'; 2544 ptr = strchr(par,'.'); 2545 if(ptr) 2546 *ptr = '\0'; 2541 if(!isdigit(node[0])) 2542 { 2543 ptr = strchr(node, '.'); 2544 if(ptr) 2545 *ptr = '\0'; 2546 ptr = strchr(par,'.'); 2547 if(ptr) 2548 *ptr = '\0'; 2549 } 2547 2550 ptr = node; 2548 2551 for(i = 0; i < (int)strlen(ptr); i++) 2549 ptr[i] = tolower(ptr[i]);2552 ptr[i] = (char)tolower((int)ptr[i]); 2550 2553 ptr = par; 2551 2554 for(i = 0; i < (int)strlen(ptr); i++) 2552 ptr[i] = tolower(ptr[i]);2555 ptr[i] = (char)tolower((int)ptr[i]); 2553 2556 if(!strcmp(/*server_ptr->*/node, /*Curr_view_opt_*/par)) 2554 2557 { … … 2661 2664 w_id = w = XmCreateMenuBar(Matrix_id[Curr_matrix], 2662 2665 (String)XmStringCreateLtoR ( w_name,XmSTRING_DEFAULT_CHARSET), 2663 arglist, n);2666 arglist,(Cardinal)n); 2664 2667 /* 2665 2668 if(n_services == -1) … … 2675 2678 w = XmCreateCascadeButton(w, 2676 2679 (String)XmStringCreateLtoR ( w_name,XmSTRING_DEFAULT_CHARSET), 2677 arglist, n);2680 arglist,(Cardinal)n); 2678 2681 set_something(w,XmNlabelString,name); 2679 2682 set_something(w,XmNalignment,XmALIGNMENT_CENTER); … … 2689 2692 ww = XmCreatePulldownMenu(w_id, 2690 2693 (String)XmStringCreateLtoR ( w_name,XmSTRING_DEFAULT_CHARSET), 2691 arglist, n);2694 arglist,(Cardinal)n); 2692 2695 set_something(w,XmNsubMenuId,ww); 2693 2696 XtManageChild(w); … … 2697 2700 w = XmCreatePushButton(ww, 2698 2701 (String)XmStringCreateLtoR ( w_name,XmSTRING_DEFAULT_CHARSET), 2699 arglist, n);2702 arglist,(Cardinal)n); 2700 2703 2701 2704 set_something(w,XmNlabelString,"Services"); … … 2709 2712 w = XmCreatePushButton(ww, 2710 2713 (String)XmStringCreateLtoR ( w_name,XmSTRING_DEFAULT_CHARSET), 2711 arglist, n);2714 arglist,(Cardinal)n); 2712 2715 2713 2716 set_something(w,XmNlabelString,"Clients"); … … 2857 2860 2858 2861 service_ptr = servp->service_ptr; 2859 service_list = (DID_SLOT *)malloc( ptr->n_services * MAX_NAME);2862 service_list = (DID_SLOT *)malloc((size_t)(ptr->n_services * MAX_NAME)); 2860 2863 n_services = ptr->n_services; 2861 2864 … … 3300 3303 XtSetArg(ar[n],XmNselectionLabelString, xmSelection); n++; 3301 3304 } 3302 sd = XmCreateSelectionDialog ( toplevel_widget, "Selection", ar, n );3305 sd = XmCreateSelectionDialog ( toplevel_widget, "Selection", ar, (Cardinal)n ); 3303 3306 XmStringFree(xmList); 3304 3307 XmStringFree(xmOk); … … 3338 3341 XtSetArg(ar[n],XmNwidth, 500); n++; 3339 3342 XtSetArg(ar[n],XmNdirMask, xm1); n++; 3340 sd = XmCreateFileSelectionDialog ( toplevel_widget, "FileSelection", ar, n );3343 sd = XmCreateFileSelectionDialog ( toplevel_widget, "FileSelection", ar, (Cardinal)n ); 3341 3344 3342 3345 XmStringFree(xm1); … … 3367 3370 */ 3368 3371 XtSetArg(ar[n],XmNselectionLabelString, xm1); n++; 3369 sd = XmCreatePromptDialog ( toplevel_widget, "Prompt", ar, n );3372 sd = XmCreatePromptDialog ( toplevel_widget, "Prompt", ar, (Cardinal)n ); 3370 3373 3371 3374 XmStringFree(xm1); … … 3396 3399 */ 3397 3400 XtSetArg(ar[n],XmNmessageString, xm1); n++; 3398 sd = XmCreateQuestionDialog ( toplevel_widget, "Question", ar, n );3401 sd = XmCreateQuestionDialog ( toplevel_widget, "Question", ar, (Cardinal)n ); 3399 3402 3400 3403 XmStringFree(xm1); … … 3419 3422 XtSetArg(ar[n],XmNborderWidth, 1); n++; 3420 3423 XtSetArg(ar[n],XmNresizePolicy, XmRESIZE_ANY); n++; 3421 fd = XmCreateFormDialog ( toplevel_widget, "Form", ar, n );3424 fd = XmCreateFormDialog ( toplevel_widget, "Form", ar, (Cardinal)n ); 3422 3425 XtManageChild(fd); 3423 3426 … … 3434 3437 XtSetArg(ar[n],XmNleftAttachment, XmATTACH_FORM); n++; 3435 3438 XtSetArg(ar[n],XmNleftOffset, 0); n++; 3436 rc = XmCreateRowColumn ( fd, "rowcol", ar, n );3439 rc = XmCreateRowColumn ( fd, "rowcol", ar, (Cardinal)n ); 3437 3440 XtManageChild(rc); 3438 3441 … … 3444 3447 XtSetArg ( ar[n], XmNscrollingPolicy, XmAUTOMATIC); n++; 3445 3448 3446 sw = XmCreateScrolledWindow ( rc, "ScrollWin", ar, n );3449 sw = XmCreateScrolledWindow ( rc, "ScrollWin", ar, (Cardinal)n ); 3447 3450 XtManageChild ( sw ); 3448 3451 … … 3453 3456 XtSetArg(ar[n],XmNlabelString, xm1); n++; 3454 3457 XtSetArg(ar[n],XmNalignment, XmALIGNMENT_BEGINNING); n++; 3455 lb = XmCreateLabel ( sw, "label", ar, n );3458 lb = XmCreateLabel ( sw, "label", ar, (Cardinal)n ); 3456 3459 XtManageChild(lb); 3457 3460 XmStringFree(xm1); … … 3467 3470 XtSetArg(ar[n],XmNnumColumns, 3); n++; 3468 3471 XtSetArg(ar[n],XmNpacking, XmPACK_COLUMN); n++; 3469 rc1 = XmCreateRowColumn ( rc, "buttons", ar, n );3472 rc1 = XmCreateRowColumn ( rc, "buttons", ar, (Cardinal)n ); 3470 3473 XtManageChild(rc1); 3471 3474 /* … … 3496 3499 XtSetArg(ar[n],XmNfontList, did_default_font); n++; 3497 3500 XtSetArg(ar[n],XmNlabelString, xm1); n++; 3498 b = XmCreatePushButton ( parent, "button", ar, n );3501 b = XmCreatePushButton ( parent, "button", ar, (Cardinal)n ); 3499 3502 3500 3503 XtManageChild(b); … … 3506 3509 } 3507 3510 3508 3509 3510 -
trunk/FACT++/dim/src/dim_jni.c
r14575 r15282 620 620 DBG(dim_Dbg_SEND_NATIVE) send_data_format = "String"; 621 621 if(This){} 622 ret = send_data(env, name, theCompletionHandler, mode, timeout, (void*) data, strlen(data)+1);622 ret = send_data(env, name, theCompletionHandler, mode, timeout, (void*) data, (int)strlen(data)+1); 623 623 624 624 (*env)->ReleaseStringUTFChars(env,sdata, data); … … 640 640 641 641 nativeDataArray = (*env)->GetBooleanArrayElements(env,dataArray,0); 642 length = ( *env)->GetArrayLength(env,dataArray) *sizeof(*nativeDataArray);642 length = (jint)(*env)->GetArrayLength(env,dataArray) * (jint)sizeof(*nativeDataArray); 643 643 644 644 DBG(dim_Dbg_SEND_NATIVE) send_data_format = "boolean[]"; … … 664 664 665 665 nativeDataArray = (*env)->GetCharArrayElements(env,dataArray,0); 666 length = ( *env)->GetArrayLength(env,dataArray) *sizeof(*nativeDataArray);666 length = (jint)(*env)->GetArrayLength(env,dataArray) * (jint)sizeof(*nativeDataArray); 667 667 668 668 DBG(dim_Dbg_SEND_NATIVE) send_data_format = "jchar[]"; … … 688 688 689 689 nativeDataArray = (*env)->GetByteArrayElements(env,dataArray,0); 690 length = ( *env)->GetArrayLength(env,dataArray) *sizeof(*nativeDataArray);690 length = (jint)(*env)->GetArrayLength(env,dataArray) * (jint)sizeof(*nativeDataArray); 691 691 692 692 DBG(dim_Dbg_SEND_NATIVE) send_data_format = "jbyte[]"; … … 712 712 713 713 nativeDataArray = (*env)->GetShortArrayElements(env,dataArray,0); 714 length = ( *env)->GetArrayLength(env,dataArray) *sizeof(*nativeDataArray);714 length = (jint)(*env)->GetArrayLength(env,dataArray) * (jint)sizeof(*nativeDataArray); 715 715 716 716 DBG(dim_Dbg_SEND_NATIVE) send_data_format = "jshort[]"; … … 736 736 737 737 nativeDataArray = (*env)->GetIntArrayElements(env,dataArray,0); 738 length = ( *env)->GetArrayLength(env,dataArray) *sizeof(*nativeDataArray);738 length = (jint)(*env)->GetArrayLength(env,dataArray) * (jint)sizeof(*nativeDataArray); 739 739 740 740 DBG(dim_Dbg_SEND_NATIVE) send_data_format = "jint[]"; … … 760 760 761 761 nativeDataArray = (*env)->GetLongArrayElements(env,dataArray,0); 762 length = ( *env)->GetArrayLength(env,dataArray) *sizeof(*nativeDataArray);762 length = (jint)(*env)->GetArrayLength(env,dataArray) * (jint)sizeof(*nativeDataArray); 763 763 764 764 DBG(dim_Dbg_SEND_NATIVE) send_data_format = "jlong[]"; … … 784 784 785 785 nativeDataArray = (*env)->GetFloatArrayElements(env,dataArray,0); 786 length = ( *env)->GetArrayLength(env,dataArray) *sizeof(*nativeDataArray);786 length = (jint)(*env)->GetArrayLength(env,dataArray) * (jint)sizeof(*nativeDataArray); 787 787 788 788 DBG(dim_Dbg_SEND_NATIVE) send_data_format = "jfloat[]"; … … 808 808 809 809 nativeDataArray = (*env)->GetDoubleArrayElements(env,dataArray,0); 810 length = ( *env)->GetArrayLength(env,dataArray) *sizeof(*nativeDataArray);810 length = (jint)(*env)->GetArrayLength(env,dataArray) * (jint)sizeof(*nativeDataArray); 811 811 812 812 DBG(dim_Dbg_SEND_NATIVE) send_data_format = "jdouble[]"; … … 1009 1009 1010 1010 1011 ret = request_service((char *)info, service_type, timeout, 0, 0, callback_function, (dim_long)callback_param, &no_link, 0, stamped);1011 ret = (jint)request_service((char *)info, service_type, timeout, 0, 0, callback_function, (dim_long)callback_param, &no_link, 0, stamped); 1012 1012 DBGx(dim_Dbg_INFO_SERVICE) printf("DimJNI: client infoService(%s, DataDecoder@0x%08lx, mode=%d, timeout=%d ) returns %d\n", info, (dim_long)theNativeDataDecoder, mode, timeout, ret); 1013 1013 (*env)->ReleaseStringUTFChars(env, name, info); … … 1407 1407 if(This){} 1408 1408 dataEncoder = (*env)->NewGlobalRef(env, dataEncoder); 1409 sid = dis_add_service(serviceNameUTF, serviceTypeUTF, 0, 0, server_getInfo_callback, dataEncoder);1409 sid = (jint)dis_add_service(serviceNameUTF, serviceTypeUTF, 0, 0, server_getInfo_callback, dataEncoder); 1410 1410 1411 1411 DBGx(dim_Dbg_ADD_SERVICE) printf("DimJNI: Server.addService(%s,%s, @%08lx)=%d\n",serviceNameUTF, serviceTypeUTF, (dim_long)dataEncoder, sid); … … 1441 1441 if(This){} 1442 1442 dataDecoder = (*env)->NewGlobalRef(env, dataDecoder); 1443 sid = dis_add_cmnd(serviceNameUTF, serviceTypeUTF, server_cmnd_callback, dataDecoder);1443 sid = (jint)dis_add_cmnd(serviceNameUTF, serviceTypeUTF, server_cmnd_callback, dataDecoder); 1444 1444 1445 1445 DBGx(dim_Dbg_ADD_CMND) printf("DimJNI: Server.addCmnd(%s,%s, @%08lx) = %d\n",serviceNameUTF, serviceTypeUTF, (dim_long) dataDecoder, sid); … … 1467 1467 1468 1468 DBGe(dim_Dbg_UPDATE_SERVICE) printf("DimJNI: Server.updateService %d\n", sid); 1469 do_update_service( sid,clientArray);1469 do_update_service((unsigned int)sid, (int *)clientArray); 1470 1470 1471 1471 if(clientArray!=NULL) (*env)->ReleaseIntArrayElements(env,clients,clientArray,JNI_ABORT); … … 1787 1787 { 1788 1788 int* data = (int*) internalDataAddress; 1789 int leng = internalDataSize/sizeof(int);1789 int leng = (int)internalDataSize/(int)sizeof(int); 1790 1790 int i; 1791 1791 … … 2063 2063 if(nativeClass){} 2064 2064 // DBGe(dim_Dbg_MEMORY_ALLOCATE) ; /* report only */ 2065 address = (jlong) malloc( size);2065 address = (jlong) malloc((size_t)size); 2066 2066 DBGx(dim_Dbg_MEMORY_ALLOCATE) printf("DimJNI: MutableMemory.allocateNativeDataBlock of %d bytes at 0x%08lx\n", size, address); 2067 2067 return address; … … 2337 2337 if(nativeClass){} 2338 2338 DBGe(dim_Dbg_MUTABLE_MEMORY) printf("DimJNI: MutableMemory.copyNativeDataBlock\n"); 2339 memcpy((void *)destinationDataAddress, (void *)sourceDataAddress,length);2339 memcpy((void *)destinationDataAddress, (void *)sourceDataAddress, (size_t)length); 2340 2340 return ; 2341 2341 } … … 2391 2391 if(maxEntries==0) maxEntries = 10; 2392 2392 descriptor = (objectDescriptor_type*) malloc(sizeof(objectDescriptor_type)); 2393 descriptor->entry = (objectDescriptorEntry_type*) malloc( maxEntries * sizeof(objectDescriptorEntry_type));2393 descriptor->entry = (objectDescriptorEntry_type*) malloc((size_t)(maxEntries * (jint)sizeof(objectDescriptorEntry_type))); 2394 2394 descriptor->objectClass = (*env)->NewGlobalRef(env, objectClass); 2395 2395 descriptor->entries = 0; … … 2404 2404 if(descriptor->entries == descriptor->maxEntries) 2405 2405 { 2406 objectDescriptorEntry_type* entry = realloc(descriptor->entry, descriptor->maxEntries+10);2406 objectDescriptorEntry_type* entry = realloc(descriptor->entry, (size_t)(descriptor->maxEntries+10)); 2407 2407 //printf("realloc descriptor\n"); 2408 2408 if(entry==NULL) return NULL; -
trunk/FACT++/dim/src/dim_thr.c
r14936 r15282 121 121 #endif 122 122 */ 123 if(DIM_Threads_OFF) 124 { 125 dim_no_threads(); 126 return; 127 } 123 128 if(!DIM_THR_init_done) 124 129 { … … 136 141 137 142 #ifndef darwin 138 sem_init(&DIM_INIT_Sema, 0, INIT_count);143 sem_init(&DIM_INIT_Sema, 0, (unsigned int)INIT_count); 139 144 /* 140 145 sem_init(&DIM_WAIT_Sema, 0, WAIT_count); … … 710 715 HANDLE hProc; 711 716 int ret; 712 DWORD p ;717 DWORD p = 0; 713 718 714 719 #ifndef PXI … … 778 783 int dim_set_priority(int threadId, int prio) 779 784 { 780 HANDLE id ;781 int ret, p ;785 HANDLE id = 0; 786 int ret, p = 0; 782 787 783 788 #ifndef PXI … … 815 820 int dim_get_priority(int threadId, int *prio) 816 821 { 817 HANDLE id ;818 int ret, p ;822 HANDLE id = 0; 823 int ret, p = 0; 819 824 820 825 #ifndef PXI -
trunk/FACT++/dim/src/dimcpp.cxx
r10614 r15282 94 94 if(!itsId) 95 95 { 96 itsId = dim_start_thread(thread_user_routine, this);96 itsId = (long)dim_start_thread(thread_user_routine, this); 97 97 return 1; 98 98 } -
trunk/FACT++/dim/src/dis.c
r14575 r15282 201 201 if(Dis_packet_size) 202 202 free(Dis_packet); 203 Dis_packet = (DIS_STAMPED_PACKET *)malloc( DIS_STAMPED_HEADER + size);203 Dis_packet = (DIS_STAMPED_PACKET *)malloc((size_t)(DIS_STAMPED_HEADER + size)); 204 204 if(Dis_packet) 205 205 { … … 213 213 static int check_service_name(char *name) 214 214 { 215 if( strlen(name) > (MAX_NAME - 1))215 if((int)strlen(name) > (MAX_NAME - 1)) 216 216 return(0); 217 217 return(1); 218 218 } 219 219 220 staticvoid dis_init()220 void dis_init() 221 221 { 222 222 int dis_hash_service_init(); … … 266 266 } 267 267 new_serv = (SERVICE *)malloc( sizeof(SERVICE) ); 268 strncpy( new_serv->name, name, MAX_NAME );268 strncpy( new_serv->name, name, (size_t)MAX_NAME ); 269 269 if(type != (char *)0) 270 270 { 271 if ( strlen(type) >= MAX_NAME)271 if ((int)strlen(type) >= MAX_NAME) 272 272 { 273 273 strcpy(str,"Format String Too Long: "); … … 441 441 } 442 442 new_serv = (SERVICE *)malloc(sizeof(SERVICE)); 443 strncpy(new_serv->name, name, MAX_NAME);443 strncpy(new_serv->name, name, (size_t)MAX_NAME); 444 444 if(type != (char *)0) 445 445 { … … 783 783 dis_dns_p->n_services = htovl(n_services); 784 784 dis_dns_p->size = htovl(DIS_DNS_HEADER + 785 n_services * sizeof(SERVICE_REG));785 n_services * (int)sizeof(SERVICE_REG)); 786 786 serv_regp = dis_dns_p->services; 787 787 strcpy( serv_regp->service_name, "DUMMY_UPDATE_PACKET" ); … … 796 796 } 797 797 if( !dna_write(dnsp->dns_dis_conn_id, &(dnsp->dis_dns_packet), 798 DIS_DNS_HEADER + n_services * sizeof(SERVICE_REG)))798 DIS_DNS_HEADER + n_services * (int)sizeof(SERVICE_REG))) 799 799 { 800 800 release_conn(dnsp->dns_dis_conn_id, 0, 1); … … 826 826 */ 827 827 strncpy( dis_dns_p->task_name, dnsp->task_name, 828 MAX_TASK_NAME-4);828 (size_t)(MAX_TASK_NAME-4) ); 829 829 dis_dns_p->task_name[MAX_TASK_NAME-4-1] = '\0'; 830 830 get_node_addr( dis_dns_p->node_addr ); … … 852 852 dis_dns_p->n_services = htovl(n_services); 853 853 dis_dns_p->size = htovl( DIS_DNS_HEADER + 854 (n_services* sizeof(SERVICE_REG)));854 (n_services*(int)sizeof(SERVICE_REG))); 855 855 if(dnsp->dns_dis_conn_id > 0) 856 856 { … … 863 863 } 864 864 if(!dna_write(dnsp->dns_dis_conn_id, &(dnsp->dis_dns_packet), 865 DIS_DNS_HEADER + n_services* sizeof(SERVICE_REG)))865 DIS_DNS_HEADER + n_services*(int)sizeof(SERVICE_REG))) 866 866 { 867 867 release_conn(dnsp->dns_dis_conn_id, 0, 1); … … 917 917 { 918 918 dis_dns_p->n_services = htovl(n_services); 919 dis_dns_p->size = htovl(DIS_DNS_HEADER +920 n_services * sizeof(SERVICE_REG));919 dis_dns_p->size = (int)htovl(DIS_DNS_HEADER + 920 n_services * (int)sizeof(SERVICE_REG)); 921 921 if(dnsp->dns_dis_conn_id > 0) 922 922 { … … 931 931 &(dnsp->dis_dns_packet), 932 932 DIS_DNS_HEADER + n_services * 933 sizeof(SERVICE_REG)) )933 (int)sizeof(SERVICE_REG)) ) 934 934 { 935 935 release_conn(dnsp->dns_dis_conn_id, 0, 1); … … 946 946 dis_dns_p->n_services = htovl(n_services); 947 947 dis_dns_p->size = htovl(DIS_DNS_HEADER + 948 n_services * sizeof(SERVICE_REG));948 n_services * (int)sizeof(SERVICE_REG)); 949 949 if(dnsp->dns_dis_conn_id > 0) 950 950 { … … 957 957 } 958 958 if( !dna_write(dnsp->dns_dis_conn_id, &(dnsp->dis_dns_packet), 959 DIS_DNS_HEADER + n_services * sizeof(SERVICE_REG)))959 DIS_DNS_HEADER + n_services * (int)sizeof(SERVICE_REG))) 960 960 { 961 961 release_conn(dnsp->dns_dis_conn_id, 0, 1); … … 990 990 */ 991 991 strncpy( dis_dns_p->task_name, dnsp->task_name, 992 MAX_TASK_NAME-4);992 (size_t)(MAX_TASK_NAME-4) ); 993 993 dis_dns_p->task_name[MAX_TASK_NAME-4-1] = '\0'; 994 994 get_node_addr( dis_dns_p->node_addr ); … … 1001 1001 strcpy( serv_regp->service_name, servp->name ); 1002 1002 strcpy( serv_regp->service_def, servp->def ); 1003 serv_regp->service_id = htovl(servp->id | 0x80000000);1003 serv_regp->service_id = (int)htovl( (unsigned)servp->id | 0x80000000); 1004 1004 serv_regp++; 1005 1005 n_services = 1; … … 1007 1007 dis_dns_p->n_services = htovl(n_services); 1008 1008 dis_dns_p->size = htovl(DIS_DNS_HEADER + 1009 n_services * sizeof(SERVICE_REG));1009 n_services * (int)sizeof(SERVICE_REG)); 1010 1010 1011 1011 if(Debug_on) … … 1017 1017 } 1018 1018 if( !dna_write(dnsp->dns_dis_conn_id, &(dnsp->dis_dns_packet), 1019 DIS_DNS_HEADER + n_services * sizeof(SERVICE_REG)) )1019 DIS_DNS_HEADER + n_services * (int)sizeof(SERVICE_REG)) ) 1020 1020 { 1021 1021 release_conn(dnsp->dns_dis_conn_id, 0, 1); … … 1098 1098 extern DIS_DNS_CONN *dis_find_dns(dim_long); 1099 1099 DIS_DNS_CONN *dnsp; 1100 int more_ids[10] = {0};1100 unsigned int more_ids[10] = {0}; 1101 1101 1102 1102 dis_init(); … … 1132 1132 if(Dis_first_time) 1133 1133 { 1134 strncpy( task_name_aux, task, MAX_TASK_NAME );1134 strncpy( task_name_aux, task, (size_t)MAX_TASK_NAME ); 1135 1135 task_name_aux[MAX_TASK_NAME-1] = '\0'; 1136 1136 Port_number = SEEK_PORT; … … 1159 1159 1160 1160 more_ids[0] = do_dis_add_service_dns( str0, "L", &Version_number, 1161 1161 sizeof(Version_number), 0, 0, dnsid ); 1162 1162 1163 1163 more_ids[1] = do_dis_add_service_dns( str1, "C", 0, 0, client_info, (dim_long)dnsp, dnsid ); … … 1464 1464 if( Dis_packet_size ) 1465 1465 free( Dis_packet ); 1466 Dis_packet = (DIS_STAMPED_PACKET *)malloc( DIS_STAMPED_HEADER + size);1466 Dis_packet = (DIS_STAMPED_PACKET *)malloc((size_t)(DIS_STAMPED_HEADER + size)); 1467 1467 if(!Dis_packet) 1468 1468 { … … 1487 1487 tz = 0; 1488 1488 gettimeofday(&tv, tz); 1489 aux = tv.tv_usec / 1000;1489 aux = (int)tv.tv_usec / 1000; 1490 1490 Dis_packet->time_stamp[0] = htovl(aux); 1491 Dis_packet->time_stamp[1] = htovl( tv.tv_sec);1491 Dis_packet->time_stamp[1] = htovl((int)tv.tv_sec); 1492 1492 #endif 1493 1493 } … … 1498 1498 Dis_packet->time_stamp[1] = htovl(servp->user_secs); 1499 1499 } 1500 Dis_packet->reserved[0] = htovl(0xc0dec0de);1500 Dis_packet->reserved[0] = (int)htovl(0xc0dec0de); 1501 1501 Dis_packet->quality = htovl(servp->quality); 1502 1502 } … … 1566 1566 return; 1567 1567 if( !packet_size ) { 1568 dis_packet = (DIS_PACKET *)malloc( DIS_HEADER);1568 dis_packet = (DIS_PACKET *)malloc((size_t)DIS_HEADER); 1569 1569 packet_size = DIS_HEADER; 1570 1570 } 1571 service_id = ( reqp->service_id | 0x80000000);1571 service_id = (int)((unsigned)reqp->service_id | 0x80000000); 1572 1572 dis_packet->service_id = htovl(service_id); 1573 1573 dis_packet->size = htovl(DIS_HEADER); … … 1599 1599 if(!buffer_size) 1600 1600 { 1601 buffer = (int *)malloc( add_size);1601 buffer = (int *)malloc((size_t)add_size); 1602 1602 buffer_size = add_size; 1603 1603 } … … 1607 1607 { 1608 1608 free(buffer); 1609 buffer = (int *)malloc( add_size);1609 buffer = (int *)malloc((size_t)add_size); 1610 1610 buffer_size = add_size; 1611 1611 } … … 1622 1622 { 1623 1623 if(formatp->flags & IT_IS_FLOAT) 1624 formatp->flags |= ( format &0xf0);1625 formatp->flags &= 0xFFF0; /* NOSWAP */1624 formatp->flags |= ((short)format & (short)0xf0); 1625 formatp->flags &= (short)0xFFF0; /* NOSWAP */ 1626 1626 } 1627 1627 } … … 1631 1631 { 1632 1632 if(formatp->flags & IT_IS_FLOAT) 1633 formatp->flags |= ( format &0xf0);1633 formatp->flags |= ((short)format & (short)0xf0); 1634 1634 } 1635 1635 } … … 1992 1992 tz = 0; 1993 1993 gettimeofday(&tv, tz); 1994 servp->user_secs = tv.tv_sec;1995 servp->user_millisecs = tv.tv_usec / 1000;1994 servp->user_secs = (int)tv.tv_sec; 1995 servp->user_millisecs = (int)tv.tv_usec / 1000; 1996 1996 #endif 1997 1997 } … … 2074 2074 if(!packet_size) 2075 2075 { 2076 dis_packet = (DIS_PACKET *)malloc( DIS_HEADER+size);2076 dis_packet = (DIS_PACKET *)malloc((size_t)(DIS_HEADER+size)); 2077 2077 packet_size = DIS_HEADER + size; 2078 2078 } … … 2082 2082 { 2083 2083 free(dis_packet); 2084 dis_packet = (DIS_PACKET *)malloc( DIS_HEADER+size);2084 dis_packet = (DIS_PACKET *)malloc((size_t)(DIS_HEADER+size)); 2085 2085 packet_size = DIS_HEADER+size; 2086 2086 } … … 2091 2091 { 2092 2092 dis_packet->service_id = htovl(reqp->service_id); 2093 memcpy(dis_packet->buffer, buffer, size);2093 memcpy(dis_packet->buffer, buffer, (size_t)size); 2094 2094 dis_packet->size = htovl(DIS_HEADER + size); 2095 2095 … … 2263 2263 { 2264 2264 ENABLE_AST 2265 dis_remove_service( servp->id);2265 dis_remove_service((unsigned)servp->id); 2266 2266 { 2267 2267 DISABLE_AST … … 2371 2371 { 2372 2372 ENABLE_AST 2373 dis_remove_service( servp->id);2373 dis_remove_service((unsigned)servp->id); 2374 2374 { 2375 2375 DISABLE_AST … … 2467 2467 int found = 0; 2468 2468 int release_request(); 2469 DIS_DNS_CONN *dnsp ;2469 DIS_DNS_CONN *dnsp = 0; 2470 2470 2471 2471 DISABLE_AST; … … 2568 2568 if(!curr_allocated_size) 2569 2569 { 2570 service_info_buffer = (char *)malloc( max_size);2570 service_info_buffer = (char *)malloc((size_t)max_size); 2571 2571 curr_allocated_size = max_size; 2572 2572 } … … 2574 2574 { 2575 2575 free(service_info_buffer); 2576 service_info_buffer = (char *)malloc( max_size);2576 service_info_buffer = (char *)malloc((size_t)max_size); 2577 2577 curr_allocated_size = max_size; 2578 2578 } … … 2587 2587 strcat(buff_ptr, servp->name); 2588 2588 strcat(buff_ptr, "\n"); 2589 buff_ptr += strlen(buff_ptr);2589 buff_ptr += (int)strlen(buff_ptr); 2590 2590 } 2591 2591 } … … 2743 2743 sll_init((SLL *) Cmnds_head); 2744 2744 } 2745 new_cmnd = (DIS_CMND *)malloc(( *size)+12);2745 new_cmnd = (DIS_CMND *)malloc((size_t)((*size)+12)); 2746 2746 new_cmnd->next = 0; 2747 2747 new_cmnd->tag = *tag; 2748 2748 new_cmnd->size = *size; 2749 memcpy(new_cmnd->buffer, cmnd_buff, *size);2749 memcpy(new_cmnd->buffer, cmnd_buff, (size_t)*size); 2750 2750 sll_insert_queue((SLL *) Cmnds_head, (SLL *) new_cmnd); 2751 2751 } … … 2782 2782 ret_val = 1; 2783 2783 } 2784 memcpy(buffer, cmndp->buffer, *size);2784 memcpy(buffer, cmndp->buffer, (size_t)*size); 2785 2785 *tag = cmndp->tag; 2786 2786 free(cmndp); … … 2824 2824 2825 2825 strcpy(for_str->dsc$a_pointer, c_str); 2826 for(i = strlen(c_str); i< for_str->dsc$w_length; i++)2826 for(i = (int)strlen(c_str); i< for_str->dsc$w_length; i++) 2827 2827 for_str->dsc$a_pointer[i] = ' '; 2828 2828 } … … 2843 2843 if(!curr_allocated_size) 2844 2844 { 2845 dns_info_buffer = malloc( max_size);2845 dns_info_buffer = malloc((size_t)max_size); 2846 2846 curr_allocated_size = max_size; 2847 2847 } … … 2859 2859 curr_conns[index++] = clip->conn_id; 2860 2860 } 2861 max_size = (index+1)* sizeof(DNS_CLIENT_INFO);2861 max_size = (index+1)*(int)sizeof(DNS_CLIENT_INFO); 2862 2862 if (max_size > curr_allocated_size) 2863 2863 { 2864 2864 free(dns_info_buffer); 2865 dns_info_buffer = malloc( max_size);2865 dns_info_buffer = malloc((size_t)max_size); 2866 2866 curr_allocated_size = max_size; 2867 2867 } … … 2892 2892 } 2893 2893 if(index) 2894 dns_client_info[ strlen(dns_client_info)-1] = '\0';2894 dns_client_info[(int)strlen(dns_client_info)-1] = '\0'; 2895 2895 *bufp = (int *)dns_info_buffer; 2896 *size = strlen(dns_info_buffer)+1;2896 *size = (int)strlen(dns_info_buffer)+1; 2897 2897 } 2898 2898 … … 2967 2967 if(!curr_allocated_size) 2968 2968 { 2969 service_info_buffer = (char *)malloc( max_size);2969 service_info_buffer = (char *)malloc((size_t)max_size); 2970 2970 curr_allocated_size = max_size; 2971 2971 } … … 2973 2973 { 2974 2974 free(service_info_buffer); 2975 service_info_buffer = (char *)malloc( max_size);2975 service_info_buffer = (char *)malloc((size_t)max_size); 2976 2976 curr_allocated_size = max_size; 2977 2977 } … … 2996 2996 servp->registered = Last_n_clients+1; 2997 2997 append_service(buff_ptr, servp); 2998 buff_ptr += strlen(buff_ptr);2998 buff_ptr += (int)strlen(buff_ptr); 2999 2999 } 3000 3000 } … … 3012 3012 { 3013 3013 strcat(buff_ptr, "-"); 3014 buff_ptr += strlen(buff_ptr);3014 buff_ptr += (int)strlen(buff_ptr); 3015 3015 append_service(buff_ptr, servp); 3016 buff_ptr += strlen(buff_ptr);3016 buff_ptr += (int)strlen(buff_ptr); 3017 3017 } 3018 3018 else if(servp->registered < (Last_n_clients+1)) … … 3021 3021 { 3022 3022 strcat(buff_ptr, "+"); 3023 buff_ptr += strlen(buff_ptr);3023 buff_ptr += (int)strlen(buff_ptr); 3024 3024 done = 1; 3025 3025 } 3026 3026 append_service(buff_ptr, servp); 3027 buff_ptr += strlen(buff_ptr);3027 buff_ptr += (int)strlen(buff_ptr); 3028 3028 /* 3029 3029 servp->registered = 2; … … 3034 3034 } 3035 3035 *bufp = (int *)service_info_buffer; 3036 *size = buff_ptr - service_info_buffer+1;3036 *size = (int)(buff_ptr - service_info_buffer+1); 3037 3037 if(*size == 1) 3038 3038 *size = -1; … … 3235 3235 int dis_hash_service_init() 3236 3236 { 3237 3237 3238 int i; 3238 3239 static int done = 0; … … 3242 3243 for( i = 0; i < MAX_HASH_ENTRIES; i++ ) 3243 3244 { 3245 /* 3244 3246 Service_hash_table[i] = (SERVICE *) malloc(sizeof(SERVICE)); 3245 3247 dll_init((DLL *) Service_hash_table[i]); 3248 */ 3249 Service_hash_table[i] = 0; 3246 3250 Service_new_entries[i] = 0; 3247 3251 } 3248 3252 done = 1; 3249 3253 } 3254 3250 3255 return(1); 3251 3256 } … … 3255 3260 int index; 3256 3261 index = HashFunction(servp->name, MAX_HASH_ENTRIES); 3262 if(!Service_hash_table[index]) 3263 { 3264 Service_hash_table[index] = (SERVICE *) malloc(sizeof(SERVICE)); 3265 dll_init((DLL *) Service_hash_table[index]); 3266 } 3257 3267 Service_new_entries[index]++; 3258 3268 dll_insert_queue((DLL *) Service_hash_table[index], … … 3272 3282 int dis_hash_service_remove(SERVICE *servp) 3273 3283 { 3284 int index; 3285 index = HashFunction(servp->name, MAX_HASH_ENTRIES); 3286 if(!Service_hash_table[index]) 3287 { 3288 return(0); 3289 } 3274 3290 dll_remove( (DLL *) servp ); 3275 3291 return(1); … … 3283 3299 3284 3300 index = HashFunction(name, MAX_HASH_ENTRIES); 3301 if(!Service_hash_table[index]) 3302 { 3303 return((SERVICE *)0); 3304 } 3285 3305 if( (servp = (SERVICE *) dll_search( 3286 3306 (DLL *) Service_hash_table[index], 3287 name, strlen(name)+1)) )3307 name, (int)strlen(name)+1)) ) 3288 3308 { 3289 3309 return(servp); … … 3314 3334 do 3315 3335 { 3316 if((!new_entries) || (Service_new_entries[index] > 0)) 3317 { 3318 servp = (SERVICE *) dll_get_next( 3336 if(prevp) 3337 { 3338 if((!new_entries) || (Service_new_entries[index] > 0)) 3339 { 3340 servp = (SERVICE *) dll_get_next( 3319 3341 (DLL *) Service_hash_table[index], 3320 3342 (DLL *) prevp); 3321 if(servp) 3322 break; 3343 if(servp) 3344 break; 3345 } 3323 3346 } 3324 3347 index++; -
trunk/FACT++/dim/src/discpp.cxx
r14575 r15282 17 17 18 18 extern "C" { 19 extern void dis_init(); 20 19 21 static void user_routine( void *tagp, void **buf, int *size, int *first_time) 20 22 { … … 39 41 } 40 42 if( t->itsType == DisSTRING) 41 t->itsSize = strlen((char *)t->itsData)+1;43 t->itsSize = (int)strlen((char *)t->itsData)+1; 42 44 *buf = t->itsData; 43 45 *size = t->itsSize; … … 49 51 // itsTagId = 0; 50 52 itsDns = dns; 51 itsName = new char[ strlen(name)+1];53 itsName = new char[(int)strlen(name)+1]; 52 54 itsDataSize = 0; 53 55 strcpy( itsName, name); … … 57 59 itsServiceHandler = 0; 58 60 // itsTagId = id_get((void *)this, SRC_DIS); 61 dis_init(); 59 62 if(itsDns == 0) 60 63 { 64 DISABLE_AST 61 65 itsId = dis_add_service( name, format, NULL, 0, 62 66 // user_routine, itsTagId); 63 67 user_routine, (dim_long)this); 68 ENABLE_AST 64 69 DimServer::start(); 65 70 } 66 71 else 67 72 { 73 DISABLE_AST 68 74 itsId = dis_add_service_dns( itsDns->getDnsId(), name, format, NULL, 0, 69 75 // user_routine, itsTagId); 70 76 user_routine, (dim_long)this); 77 ENABLE_AST 71 78 // itsDns->addServiceId(itsId); 72 79 DimServer::start(itsDns); … … 88 95 itsDataSize = size; 89 96 } 90 memcpy(itsData, data, size);97 memcpy(itsData, data, (size_t)size); 91 98 itsSize = size; 92 99 } … … 125 132 // itsTagId = 0; 126 133 itsDns = dns; 127 itsName = new char[ strlen(name)+1];134 itsName = new char[(int)strlen(name)+1]; 128 135 strcpy( itsName, name); 129 itsFormat = new char[ strlen(format)+1];136 itsFormat = new char[(int)strlen(format)+1]; 130 137 strcpy( itsFormat, format); 131 138 currCmnd = 0; … … 135 142 itsCommandHandler = 0; 136 143 // itsTagId = id_get((void *)this, SRC_DIS); 144 dis_init(); 137 145 if(!itsDns) 138 146 { 147 DISABLE_AST 139 148 itsId = dis_add_cmnd( name, format, command_routine, 140 149 // itsTagId); 141 150 (dim_long)this); 151 ENABLE_AST 142 152 DimServer::start(); 143 153 } 144 154 else 145 155 { 156 DISABLE_AST 146 157 itsId = dis_add_cmnd_dns( itsDns->getDnsId(), name, format, command_routine, 147 158 // itsTagId); 148 159 (dim_long)this); 160 ENABLE_AST 149 161 // itsDns->addServiceId(itsId); 150 162 DimServer::start(itsDns); … … 230 242 // itsTagId = 0; 231 243 itsDns = dns; 232 itsName = new char[ strlen(name)+1];244 itsName = new char[(int)strlen(name)+1]; 233 245 strcpy( itsName, name); 234 itsNameIn = new char[ strlen(name)+1+10];246 itsNameIn = new char[(int)strlen(name)+1+10]; 235 247 strcpy( itsNameIn, name); 236 248 strcat(itsNameIn,(char *)"/RpcIn"); 237 itsNameOut = new char[ strlen(name)+1+10];249 itsNameOut = new char[(int)strlen(name)+1+10]; 238 250 strcpy( itsNameOut, name); 239 251 strcat(itsNameOut,(char *)"/RpcOut"); … … 244 256 245 257 // itsTagId = id_get((void *)this, SRC_DIS); 258 dis_init(); 246 259 if(!itsDns) 247 260 { 261 DISABLE_AST 248 262 itsIdIn = dis_add_cmnd( itsNameIn, formatin, 249 263 // rpcin_routine, itsTagId); … … 252 266 // rpcout_routine, itsTagId); 253 267 rpcout_routine, (dim_long)this); 268 ENABLE_AST 254 269 DimServer::start(); 255 270 } 256 271 else 257 272 { 273 DISABLE_AST 258 274 itsIdIn = dis_add_cmnd_dns( itsDns->getDnsId(), itsNameIn, formatin, 259 275 // rpcin_routine, itsTagId); … … 262 278 // rpcout_routine, itsTagId); 263 279 rpcout_routine, (dim_long)this); 280 ENABLE_AST 264 281 // itsDns->addServiceId(itsIdIn); 265 282 // itsDns->addServiceId(itsIdOut); … … 282 299 itsDataOutSize = size; 283 300 } 284 memcpy(itsDataOut, data, size);301 memcpy(itsDataOut, data, (size_t)size); 285 302 itsSizeOut = size; 286 303 } … … 314 331 // if(!itsNode) 315 332 // { 316 itsNode = new char[ strlen(node)+1];333 itsNode = new char[(int)strlen(node)+1]; 317 334 strcpy(itsNode,node); 318 335 // } … … 335 352 { 336 353 tmp = new int[itsServiceIdListSize + DisDnsIdBlock]; 337 memcpy(tmp, itsServiceIdList, itsServiceIdListSize*sizeof(int));354 memcpy(tmp, itsServiceIdList, (size_t)itsServiceIdListSize*sizeof(int)); 338 355 delete itsServiceIdList; 339 356 itsServiceIdList = tmp; … … 378 395 if(!itsName) 379 396 { 380 itsName = new char[ strlen(name)+1];397 itsName = new char[(int)strlen(name)+1]; 381 398 strcpy(itsName,name); 382 399 } … … 437 454 if(!itsName) 438 455 { 439 itsName = new char[ strlen(name)+1];456 itsName = new char[(int)strlen(name)+1]; 440 457 strcpy(itsName,name); 441 458 } … … 447 464 dim_long dnsid; 448 465 466 dis_init(); 467 { 449 468 DISABLE_AST 450 469 dns->setName(name); … … 452 471 dis_start_serving_dns(dnsid, (char *)name /*, dns->getServiceIdList()*/); 453 472 ENABLE_AST 473 } 454 474 } 455 475 /* … … 491 511 int isAuto; 492 512 513 dis_init(); 514 { 493 515 DISABLE_AST 494 516 // dns->itsNServices++; … … 503 525 } 504 526 ENABLE_AST 527 } 505 528 } 506 529 … … 798 821 { 799 822 itsData = string; 800 itsSize = strlen(string)+1;823 itsSize = (int)strlen(string)+1; 801 824 itsType = DisSTRING; 802 825 declareIt((char *)name, (char *)"C", 0, 0); … … 880 903 { 881 904 itsData = string; 882 itsSize = strlen(string)+1;905 itsSize = (int)strlen(string)+1; 883 906 itsType = DisSTRING; 884 907 declareIt((char *)name, (char *)"C", 0, dns); … … 987 1010 { 988 1011 itsData = string; 989 itsSize = strlen(string)+1;1012 itsSize = (int)strlen(string)+1; 990 1013 return dis_update_service( itsId ); 991 1014 } … … 1106 1129 { 1107 1130 itsData = string; 1108 itsSize = strlen(string)+1;1131 itsSize = (int)strlen(string)+1; 1109 1132 if( cids == 0) 1110 1133 { … … 1179 1202 void DimService::setData(char *data) 1180 1203 { 1181 storeIt(data, strlen(data)+1);1204 storeIt(data, (int)strlen(data)+1); 1182 1205 } 1183 1206 … … 1204 1227 secs = tsecs; 1205 1228 millisecs = tmillisecs; 1206 memcpy(itsData, data, datasize);1229 memcpy(itsData, data, (size_t)datasize); 1207 1230 } 1208 1231 … … 1465 1488 void DimRpc::setData(char *data) 1466 1489 { 1467 storeIt(data, strlen(data)+1);1490 storeIt(data,(int)strlen(data)+1); 1468 1491 } 1469 1492 -
trunk/FACT++/dim/src/dll.c
r11071 r15282 53 53 DISABLE_AST 54 54 while( auxp!= head ) { 55 if( !memcmp(auxp->user_info, data, size) ) {55 if( !memcmp(auxp->user_info, data, (size_t)size) ) { 56 56 ENABLE_AST 57 57 return(auxp); … … 117 117 DISABLE_AST 118 118 while( auxp!= head ) { 119 if( !memcmp(&(auxp->user_info[offset]), data, size) ) {119 if( !memcmp(&(auxp->user_info[offset]), data, (size_t)size) ) { 120 120 retp = auxp; 121 121 } -
trunk/FACT++/dim/src/dna.c
r13135 r15282 248 248 { 249 249 dna_connp->buffer = 250 (int *) realloc(dna_connp->buffer, size);250 (int *) realloc(dna_connp->buffer, (size_t)size); 251 251 dna_connp->buffer_size = size; 252 252 } … … 428 428 header_p->header_size = htovl(READ_HEADER_SIZE); 429 429 header_p->data_size = htovl(size); 430 header_p->header_magic = htovl(HDR_MAGIC);430 header_p->header_magic = (int)htovl(HDR_MAGIC); 431 431 tcpip_code = dna_write_bytes(conn_id, &header_pkt, READ_HEADER_SIZE, 1); 432 432 if(tcpip_failure(tcpip_code)) … … 462 462 DISABLE_AST 463 463 464 pktp = malloc( READ_HEADER_SIZE+size);464 pktp = malloc((size_t)(READ_HEADER_SIZE+size)); 465 465 headerp = &(pktp->header); 466 466 headerp->header_size = htovl(READ_HEADER_SIZE); 467 467 headerp->data_size = htovl(size); 468 headerp->header_magic = htovl(HDR_MAGIC);469 470 memcpy(pktp->data, (char *)buffer, size);468 headerp->header_magic = (int)htovl(HDR_MAGIC); 469 470 memcpy(pktp->data, (char *)buffer, (size_t)size); 471 471 472 472 newp = malloc(sizeof(WRITE_ITEM)); … … 505 505 } else { 506 506 dna_connp->state = RD_HDR; 507 dna_connp->buffer = (int *)malloc( TCP_RCV_BUF_SIZE);507 dna_connp->buffer = (int *)malloc((size_t)TCP_RCV_BUF_SIZE); 508 508 /* 509 509 if(!dna_connp->buffer) … … 623 623 register int i, size; 624 624 time_t oldest; 625 int oldesti; 625 int oldesti = 0; 626 extern time_t time(); 626 627 627 628 if(type == 0) … … 803 804 dna_connp->state = RD_HDR; 804 805 dna_connp->writing = FALSE; 805 dna_connp->buffer = (int *)malloc( TCP_RCV_BUF_SIZE);806 dna_connp->buffer = (int *)malloc((size_t)TCP_RCV_BUF_SIZE); 806 807 /* 807 808 if(!dna_connp->buffer) … … 815 816 dna_connp->saw_init = TRUE; /* we send it! */ 816 817 dna_start_read(conn_id, READ_HEADER_SIZE); 817 local_buffer.code = htovl(OPN_MAGIC);818 local_buffer.code = (int)htovl(OPN_MAGIC); 818 819 get_node_name(local_buffer.node); 819 820 get_proc_name(local_buffer.task); -
trunk/FACT++/dim/src/dns.c
r14698 r15282 198 198 int rem_only = 0; 199 199 200 Dns_conns[conn_id].validity = time(NULL);200 Dns_conns[conn_id].validity = (int)time(NULL); 201 201 if( !Dns_conns[conn_id].service_head ) 202 202 { … … 205 205 { 206 206 service_id = vtohl(packet->services[0].service_id); 207 if( service_id & 0x80000000)207 if((unsigned)service_id & 0x80000000) 208 208 rem_only = 1; 209 209 } … … 233 233 Dns_conns[conn_id].protocol = vtohl(packet->protocol); 234 234 strncpy( Dns_conns[conn_id].node_name, packet->node_name, 235 MAX_NODE_NAME );235 (size_t)MAX_NODE_NAME ); 236 236 strncpy( Dns_conns[conn_id].task_name, packet->task_name, 237 MAX_TASK_NAME-4);237 (size_t)(MAX_TASK_NAME-4) ); 238 238 strcpy(Dns_conns[conn_id].long_task_name, packet->task_name); 239 239 Dns_conns[conn_id].task_name[MAX_TASK_NAME-4-1] = '\0'; … … 277 277 { 278 278 ptr1 = ptr; 279 ptr1 += strlen(ptr);279 ptr1 += (int)strlen(ptr); 280 280 } 281 281 if(strstr(Dns_conns[conn_id].node_name,ptr)) … … 339 339 } 340 340 n_services = vtohl(packet->n_services); 341 if( strlen(Dns_conns[conn_id].task_name) == MAX_TASK_NAME-4-1)341 if((int)strlen(Dns_conns[conn_id].task_name) == MAX_TASK_NAME-4-1) 342 342 name_too_long = 1; 343 343 for( i = 0; i < n_services; i++ ) … … 452 452 /*there are interested clients waiting*/ 453 453 strncpy( servp->serv_def, 454 packet->services[i].service_def, MAX_NAME );454 packet->services[i].service_def,(size_t)MAX_NAME ); 455 455 servp->conn_id = conn_id; 456 456 servp->state = 1; … … 475 475 /* test if Service is to be removed */ 476 476 service_id = vtohl(packet->services[i].service_id); 477 if( service_id & 0x80000000)477 if((unsigned)service_id & 0x80000000) 478 478 { 479 479 dll_remove((DLL *) servp); … … 525 525 { 526 526 strncpy(Dns_conns[conn_id].long_task_name, packet->services[i].service_name, 527 MAX_NAME);527 (size_t)MAX_NAME); 528 528 ptrt = strstr(Dns_conns[conn_id].long_task_name,"/CLIENT_LIST"); 529 529 *ptrt = '\0'; … … 532 532 strncpy( servp->serv_name, 533 533 packet->services[i].service_name, 534 MAX_NAME );534 (size_t)MAX_NAME ); 535 535 strncpy( servp->serv_def, 536 536 packet->services[i].service_def, 537 MAX_NAME );537 (size_t)MAX_NAME ); 538 538 servp->state = 1; 539 539 servp->conn_id = conn_id; … … 628 628 */ 629 629 } 630 time_diff = time(NULL) - Dns_conns[conn_id].validity;630 time_diff = (int)time(NULL) - Dns_conns[conn_id].validity; 631 631 if(time_diff > (int)(WATCHDOG_TMOUT_MAX*1.2)) 632 632 { … … 700 700 { 701 701 ptr1 = ptr; 702 ptr1 += strlen(ptr);702 ptr1 += (int)strlen(ptr); 703 703 } 704 704 if(strstr(Net_conns[conn_id].node,ptr)) … … 777 777 return(0); 778 778 } 779 if( service_id & 0x80000000 ) /* remove service */779 if( (unsigned)service_id & 0x80000000 ) /* remove service */ 780 780 { 781 781 service_id &= 0x7fffffff; … … 843 843 } 844 844 servp = (DNS_SERVICE *) malloc(sizeof(DNS_SERVICE)); 845 strncpy( servp->serv_name, serv_regp->service_name, MAX_NAME );845 strncpy( servp->serv_name, serv_regp->service_name, (size_t)MAX_NAME ); 846 846 servp->serv_def[0] = '\0'; 847 847 servp->state = 0; … … 1254 1254 if(n_services == -1) 1255 1255 n_services = 0; 1256 max_size = sizeof(DNS_SERVER_INFO) +1257 n_services * sizeof(DNS_SERVICE_INFO);1256 max_size = (int)sizeof(DNS_SERVER_INFO) + 1257 n_services * (int)sizeof(DNS_SERVICE_INFO); 1258 1258 if(!curr_allocated_size) 1259 1259 { 1260 dns_info_buffer = (DNS_DID *)malloc( max_size);1260 dns_info_buffer = (DNS_DID *)malloc((size_t)max_size); 1261 1261 curr_allocated_size = max_size; 1262 1262 } … … 1264 1264 { 1265 1265 free(dns_info_buffer); 1266 dns_info_buffer = (DNS_DID *)malloc( max_size);1266 dns_info_buffer = (DNS_DID *)malloc((size_t)max_size); 1267 1267 curr_allocated_size = max_size; 1268 1268 } 1269 1269 dns_server_info = &dns_info_buffer->server; 1270 1270 dns_service_info = dns_info_buffer->services; 1271 strncpy(dns_server_info->task, connp->task_name, MAX_TASK_NAME-4);1272 strncpy(dns_server_info->node, connp->node_name, MAX_NODE_NAME);1271 strncpy(dns_server_info->task, connp->task_name, (size_t)(MAX_TASK_NAME-4)); 1272 strncpy(dns_server_info->node, connp->node_name, (size_t)MAX_NODE_NAME); 1273 1273 dns_server_info->pid = htovl(connp->pid); 1274 1274 dns_server_info->n_services = htovl(connp->n_services); … … 1277 1277 (DLL *) servp)) ) 1278 1278 { 1279 strncpy(dns_service_info->name, servp->serv_name, MAX_NAME);1279 strncpy(dns_service_info->name, servp->serv_name, (size_t)MAX_NAME); 1280 1280 dns_service_info->status = htovl(1); 1281 1281 if(servp->serv_id & 0x10000000) … … 1314 1314 } 1315 1315 } 1316 max_size = ( sizeof(DNS_SERVER_INFO) + MAX_TASK_NAME) * n_server;1317 max_pid_size = sizeof(int) * n_server;1316 max_size = ((int)sizeof(DNS_SERVER_INFO) + MAX_TASK_NAME) * n_server; 1317 max_pid_size = (int)sizeof(int) * n_server; 1318 1318 if(!curr_allocated_size) 1319 1319 { 1320 info_buffer = (char *)malloc( max_size);1320 info_buffer = (char *)malloc((size_t)max_size); 1321 1321 curr_allocated_size = max_size; 1322 pid_buffer = (int *)malloc( max_pid_size);1322 pid_buffer = (int *)malloc((size_t)max_pid_size); 1323 1323 } 1324 1324 else if (max_size > curr_allocated_size) 1325 1325 { 1326 1326 free(info_buffer); 1327 info_buffer = (char *)malloc( max_size);1327 info_buffer = (char *)malloc((size_t)max_size); 1328 1328 curr_allocated_size = max_size; 1329 1329 free(pid_buffer); 1330 pid_buffer = (int *)malloc( max_pid_size);1330 pid_buffer = (int *)malloc((size_t)max_pid_size); 1331 1331 } 1332 1332 info_buffer[0] = '\0'; … … 1342 1342 connp = &Dns_conns[i]; 1343 1343 /* 1344 if( strlen(connp->task_name) == MAX_TASK_NAME-4-1)1344 if((int)strlen(connp->task_name) == MAX_TASK_NAME-4-1) 1345 1345 { 1346 1346 strcpy(aux,connp->task_name); … … 1373 1373 strcat(server,"|"); 1374 1374 strcpy(info_buffer_ptr, server); 1375 info_buffer_ptr += strlen(server);1375 info_buffer_ptr += (int)strlen(server); 1376 1376 pid_buffer[pid_index] = connp->pid; 1377 1377 pid_index++; … … 1395 1395 pid_index++; 1396 1396 } 1397 info_buffer[ strlen(info_buffer) - 1] = '\0';1398 info_buffer_ptr = &info_buffer[ strlen(info_buffer)+1];1397 info_buffer[(int)strlen(info_buffer) - 1] = '\0'; 1398 info_buffer_ptr = &info_buffer[(int)strlen(info_buffer)+1]; 1399 1399 pid_size = 0; 1400 1400 for(i = 0; i < pid_index; i++) … … 1405 1405 sprintf(server, "%d",pid_buffer[i]); 1406 1406 strcpy(info_buffer_ptr, server); 1407 info_buffer_ptr += strlen(server);1408 pid_size += strlen(server);1407 info_buffer_ptr += (int)strlen(server); 1408 pid_size += (int)strlen(server); 1409 1409 } 1410 1410 *bufp = (int *)info_buffer; 1411 *size = strlen(info_buffer)+1+pid_size+1;1411 *size = (int)strlen(info_buffer)+1+pid_size+1; 1412 1412 ENABLE_AST 1413 1413 } … … 1444 1444 fflush(stdout); 1445 1445 1446 Server_new_info_id = dis_add_service( "DIS_DNS/SERVER_LIST", "C", 0, 0,1446 Server_new_info_id =(int) dis_add_service( "DIS_DNS/SERVER_LIST", "C", 0, 0, 1447 1447 get_new_dns_server_info, 0 ); 1448 Server_info_id = dis_add_service( "DIS_DNS/SERVER_INFO", 0, 0, 0,1448 Server_info_id = (int)dis_add_service( "DIS_DNS/SERVER_INFO", 0, 0, 0, 1449 1449 get_dns_server_info, 0 ); 1450 1450 dis_add_cmnd( "DIS_DNS/PRINT_STATS", 0, print_stats, 0 ); … … 1454 1454 dis_add_cmnd( "DIS_DNS/PRINT_HASH_TABLE", 0, print_hash_table, 0 ); 1455 1455 dis_add_cmnd( "DIS_DNS/SERVICE_INFO/RpcIn", "C", set_rpc_info, 0 ); 1456 Rpc_id = dis_add_service( "DIS_DNS/SERVICE_INFO/RpcOut", "C", 0, 0,1456 Rpc_id = (int)dis_add_service( "DIS_DNS/SERVICE_INFO/RpcOut", "C", 0, 0, 1457 1457 get_rpc_info, 0 ); 1458 1458 dns_port = get_dns_port_number(); … … 1586 1586 { 1587 1587 type = DNS_DIS_SOFT_EXIT; 1588 type |= (soft_code << 16) &0xFFFF0000;1588 type |= (soft_code << (int)16) & (int)0xFFFF0000; 1589 1589 dim_print_date_time(); 1590 1590 printf(" Killing server %s@%s with exit code %d\n", … … 1649 1649 if( (servp = (RED_DNS_SERVICE *) dll_search( 1650 1650 (DLL *) Service_hash_table[index], 1651 name, strlen(name)+1)) )1651 name, (int)strlen(name)+1)) ) 1652 1652 { 1653 1653 ptr = (char *)servp - (2 * sizeof(void *)); … … 1719 1719 1720 1720 Service_info_list = (DNS_SERVICE **) 1721 malloc( Curr_n_services*sizeof(DNS_SERVICE *));1721 malloc((size_t)(Curr_n_services*(int)sizeof(DNS_SERVICE *))); 1722 1722 1723 1723 if(!strchr(wild_name, '*')) … … 1768 1768 break; 1769 1769 } 1770 dptr1 += strlen(tmp);1770 dptr1 += (int)strlen(tmp); 1771 1771 ptr = ptr1; 1772 1772 dptr = dptr1; … … 1784 1784 if(!strncmp(dptr, tmp, strlen(tmp))) 1785 1785 { 1786 dptr += strlen(tmp);1786 dptr += (int)strlen(tmp); 1787 1787 ptr = ptr1; 1788 1788 } … … 1839 1839 if(!Rpc_info_size) 1840 1840 { 1841 Rpc_info = malloc( MAX_NAME*(n+1)*2);1841 Rpc_info = malloc((size_t)(MAX_NAME*(n+1)*2)); 1842 1842 Rpc_info_size = MAX_NAME*(n+1)*2; 1843 1843 } … … 1845 1845 { 1846 1846 free(Rpc_info); 1847 Rpc_info = malloc( MAX_NAME*(n+1)*2);1847 Rpc_info = malloc((size_t)(MAX_NAME*(n+1)*2)); 1848 1848 Rpc_info_size = MAX_NAME*(n+1)*2; 1849 1849 } … … 1863 1863 if( (ptr = strstr(Rpc_info, aux)) ) 1864 1864 { 1865 ptr += strlen(aux);1865 ptr += (int)strlen(aux); 1866 1866 if(*ptr == '|') 1867 1867 rpc = 2; … … 1874 1874 if( (ptr = strstr(Rpc_info, aux)) ) 1875 1875 { 1876 ptr += strlen(aux);1876 ptr += (int)strlen(aux); 1877 1877 if(*ptr == '|') 1878 1878 rpc = 2; … … 1896 1896 strcat(rpcaux,"|RPC\n"); 1897 1897 strcpy(rpcptr, rpcaux); 1898 rpcptr += strlen(rpcaux);1898 rpcptr += (int)strlen(rpcaux); 1899 1899 } 1900 1900 } … … 1911 1911 strcat(rpcaux,"|\n"); 1912 1912 strcpy(rpcptr, rpcaux); 1913 rpcptr += strlen(rpcaux);1913 rpcptr += (int)strlen(rpcaux); 1914 1914 } 1915 1915 } … … 1926 1926 if(tag){} 1927 1927 *buffer = Rpc_info; 1928 *size = strlen(Rpc_info)+1;1929 } 1930 1928 *size = (int)strlen(Rpc_info)+1; 1929 } 1930 -
trunk/FACT++/dim/src/dtq.c
r14936 r15282 10 10 11 11 /* include files */ 12 #ifndef WIN32 13 #ifndef NOTHREADS 14 int DIM_Threads_OFF = 0; 15 #else 16 int DIM_Threads_OFF = 1; 17 #endif 18 #endif 12 19 #include <signal.h> 13 20 #include <stdio.h> … … 76 83 extern void dis_no_threads(); 77 84 85 DIM_Threads_OFF = 1; 78 86 Threads_off = 1; 79 87 dic_no_threads(); … … 231 239 tz = 0; 232 240 gettimeofday(&tv, tz); 233 secs = tv.tv_sec;234 *millies = tv.tv_usec / 1000;241 secs = (int)tv.tv_sec; 242 *millies = (int)tv.tv_usec / 1000; 235 243 #endif 236 244 return secs; … … 266 274 else 267 275 { 268 return( alarm(secs));276 return((int)alarm((unsigned int)secs)); 269 277 } 270 278 } -
trunk/FACT++/dim/src/examples/demo_client.c
r11071 r15282 30 30 scanf("%s",cmnd); 31 31 printf("Sending Command: %s\n",cmnd); 32 dic_cmnd_service(aux,cmnd, strlen(cmnd)+1);32 dic_cmnd_service(aux,cmnd,(int)strlen(cmnd)+1); 33 33 } 34 34 } -
trunk/FACT++/dim/src/examples/pvss_dim_server.cxx
r11071 r15282 227 227 // simpleService.updateService(); 228 228 229 if( strlen(cData.str) < 16)229 if((int)strlen(cData.str) < 16) 230 230 strcat(cData.str," abc"); 231 231 cTestService.updateService(); -
trunk/FACT++/dim/src/examples/rpc_server.cxx
r11071 r15282 72 72 pout.c1 = pin->c1; 73 73 strcpy(pout.str,pin->str); 74 setData(&pout, strlen(pout.str)+1+5);74 setData(&pout, (int)strlen(pout.str)+1+5); 75 75 } 76 76 public: -
trunk/FACT++/dim/src/examples/test_client.c
r14575 r15282 83 83 printf("DNS node = %s\n",node); 84 84 printf("size = %d\n",*size); 85 memcpy(&t, buf, *size);85 memcpy(&t, buf, (size_t)*size); 86 86 printf("t.i = %d, t.d = %2.2f, t.s = %d, t.c = %c, t.f = %2.2f, t.str = %s\n", 87 87 t.i,t.d,t.s,t.c,t.f,t.str); … … 89 89 tsecs = secs; 90 90 my_ctime(&tsecs, str, 128); 91 str[ strlen(str)-1] = '\0';91 str[(int)strlen(str)-1] = '\0'; 92 92 printf("timestamp = %s.%d\n",str,millis); 93 93 -
trunk/FACT++/dim/src/examples/test_server.c
r14936 r15282 110 110 { 111 111 sprintf(str[i],"%s/Service_%03d",argv[1],i); 112 dis_add_service( str[i], "C", str[i], strlen(str[i])+1,112 dis_add_service( str[i], "C", str[i], (int)strlen(str[i])+1, 113 113 (void *)0, 0 ); 114 114 } … … 195 195 sprintf(more_str[curr_more_index],"%s/More_Service_%03d",argv[1],curr_more_index); 196 196 more_ids[curr_more_index] = dis_add_service( more_str[curr_more_index], "C", 197 more_str[curr_more_index], strlen(more_str[curr_more_index])+1,197 more_str[curr_more_index], (int)strlen(more_str[curr_more_index])+1, 198 198 (void *)0, 0 ); 199 199 printf("Adding service %s\n",more_str[curr_more_index]); -
trunk/FACT++/dim/src/examples/test_server.cxx
r14698 r15282 168 168 if(testServ){} 169 169 170 // farr[0] = 1.2;170 // farr[0] = 1.2; 171 171 // farr[1] = 2.3; 172 172 // farrp = new DimService("/PCITCO147/sensors/fan/input","F", farr, sizeof(farr)); … … 208 208 bool_serv[1]->updateService(); 209 209 210 int inCallback = DimServer::inCallback();211 cout << "main: In callback "<< inCallback << endl;210 // int inCallback = DimServer::inCallback(); 211 // cout << "main: In callback "<< inCallback << endl; 212 212 servint.updateService(); 213 213 if(extraDns) -
trunk/FACT++/dim/src/hash.c
r11071 r15282 28 28 int len; 29 29 30 len = strlen(name);30 len = (int)strlen(name); 31 31 32 32 for(i = 0; i < len; name++, i++) 33 33 { 34 hash = hash*a+( *name);34 hash = hash*a+(unsigned)(*name); 35 35 a = a*b; 36 36 } 37 37 38 return ( hash % max);38 return ((int)(hash % (unsigned)max)); 39 39 } -
trunk/FACT++/dim/src/open_dns.c
r14575 r15282 156 156 get_proc_name(pid_str); 157 157 sscanf(pid_str,"%d",&pid); 158 srand( ip+pid);158 srand((unsigned)(ip+pid)); 159 159 } 160 160 … … 345 345 strcpy(node_info,dns_node); 346 346 for(i = 0; i < 4; i ++) 347 node_info[ strlen(node_info)+i+1] = (char)0xff;347 node_info[(int)strlen(node_info)+i+1] = (char)0xff; 348 348 connp->conn_id = 0; 349 349 connp->connecting = 1; … … 359 359 if(!conn_id) 360 360 { 361 strncpy(connp->task_name, DNS_TASK, MAX_TASK_NAME);361 strncpy(connp->task_name, DNS_TASK, (size_t)MAX_TASK_NAME); 362 362 connp->recv_rout = recv_rout; 363 363 connp->error_rout = error_rout; … … 402 402 strcpy(node_info,dns_node); 403 403 for(i = 0; i < 4; i ++) 404 node_info[ strlen(node_info)+i+1] = (char)0xff;404 node_info[(int)strlen(node_info)+i+1] = (char)0xff; 405 405 connp->conn_id = 0; 406 406 connp->connecting = 1; -
trunk/FACT++/dim/src/sll.c
r11071 r15282 38 38 while( (head = head->next) ) 39 39 { 40 if( !memcmp(head->user_info, data, size) )40 if( !memcmp(head->user_info, data, (size_t)size) ) 41 41 { 42 42 break; … … 123 123 while( (auxp = item->next) ) 124 124 { 125 if( !memcmp(&(auxp->user_info[offset]), data, size) )125 if( !memcmp(&(auxp->user_info[offset]), data, (size_t)size) ) 126 126 { 127 127 item->next = auxp->next; -
trunk/FACT++/dim/src/tcpip.c
r13995 r15282 290 290 if(DIM_IO_path[0] == -1) 291 291 { 292 if( (DIM_IO_path[0] = socket(AF_INET, SOCK_STREAM, 0)) == -1 )292 if( (DIM_IO_path[0] = (int)socket(AF_INET, SOCK_STREAM, 0)) == -1 ) 293 293 { 294 294 perror("socket"); … … 369 369 closesock(DIM_IO_path[0]); 370 370 DIM_IO_path[0] = -1; 371 if( (DIM_IO_path[0] = socket(AF_INET, SOCK_STREAM, 0)) == -1 )371 if( (DIM_IO_path[0] = (int)socket(AF_INET, SOCK_STREAM, 0)) == -1 ) 372 372 { 373 373 perror("socket"); … … 568 568 static int get_bytes_to_read(int conn_id) 569 569 { 570 int i, ret, count ;570 int i, ret, count = 0; 571 571 572 572 for(i = 0; i < 3; i++) … … 616 616 would this be better? not sure afterwards... 617 617 nbytes = (size < count) ? size : count; 618 if( (len = readsock(Net_conns[conn_id].channel, p, nbytes, 0)) <= 0 )619 */ 620 if( (len = readsock(Net_conns[conn_id].channel, p,size, 0)) <= 0 )618 if( (len = readsock(Net_conns[conn_id].channel, p, (size_t)nbytes, 0)) <= 0 ) 619 */ 620 if( (len = (int)readsock(Net_conns[conn_id].channel, p, (size_t)size, 0)) <= 0 ) 621 621 { /* Connection closed by other side. */ 622 622 Net_conns[conn_id].read_rout( conn_id, -1, 0 ); … … 654 654 655 655 othersize = sizeof(other); 656 memset( (char *) &other, 0, othersize );657 Net_conns[conn_id].mbx_channel = accept( Net_conns[conn_id].channel,656 memset( (char *) &other, 0, (size_t)othersize ); 657 Net_conns[conn_id].mbx_channel = (int)accept( Net_conns[conn_id].channel, 658 658 (struct sockaddr*)&other, (unsigned int *)&othersize ); 659 659 if( Net_conns[conn_id].mbx_channel < 0 ) … … 842 842 int ret; 843 843 844 ptr = (unsigned char *)node+ strlen(node)+1;844 ptr = (unsigned char *)node+(int)strlen(node)+1; 845 845 ipaddr[0] = *ptr++; 846 846 ipaddr[1] = *ptr++; … … 900 900 { 901 901 sscanf(node,"%d.%d.%d.%d",&a, &b, &c, &d); 902 ipaddr[0] = a;903 ipaddr[1] = b;904 ipaddr[2] = c;905 ipaddr[3] = d;902 ipaddr[0] = (unsigned char)a; 903 ipaddr[1] = (unsigned char)b; 904 ipaddr[2] = (unsigned char)c; 905 ipaddr[3] = (unsigned char)d; 906 906 host_number = 1; 907 907 #ifndef VxWorks … … 928 928 host_number = 1; 929 929 /* 930 ptr = (unsigned char *)node+ strlen(node)+1;930 ptr = (unsigned char *)node+(int)strlen(node)+1; 931 931 ipaddr[0] = *ptr++; 932 932 ipaddr[1] = *ptr++; … … 961 961 #endif 962 962 963 if( (path = socket(AF_INET, SOCK_STREAM, 0)) == -1 )963 if( (path = (int)socket(AF_INET, SOCK_STREAM, 0)) == -1 ) 964 964 { 965 965 perror("socket"); … … 1053 1053 1054 1054 dim_tcpip_init(0); 1055 if( (path = socket(AF_INET, SOCK_STREAM, 0)) == -1 )1055 if( (path = (int)socket(AF_INET, SOCK_STREAM, 0)) == -1 ) 1056 1056 { 1057 1057 return(0); … … 1257 1257 int wrote; 1258 1258 1259 wrote = writesock( Net_conns[conn_id].channel, buffer,size, 0 );1259 wrote = (int)writesock( Net_conns[conn_id].channel, buffer, (size_t)size, 0 ); 1260 1260 if( wrote == -1 ) { 1261 1261 /* … … 1306 1306 1307 1307 set_non_blocking(Net_conns[conn_id].channel); 1308 wrote = writesock( Net_conns[conn_id].channel, buffer,size, 0 );1308 wrote = (int)writesock( Net_conns[conn_id].channel, buffer, (size_t)size, 0 ); 1309 1309 #ifndef WIN32 1310 1310 ret = errno; … … 1332 1332 if(selret > 0) 1333 1333 { 1334 wrote = writesock( Net_conns[conn_id].channel, buffer,size, 0 );1334 wrote = (int)writesock( Net_conns[conn_id].channel, buffer, (size_t)size, 0 ); 1335 1335 if( wrote == -1 ) 1336 1336 { -
trunk/FACT++/dim/src/tokenstring.cxx
r11071 r15282 4 4 TokenString::TokenString(char *str) 5 5 { 6 token_buff = new char[( strlen(str)+1)*2];6 token_buff = new char[((int)strlen(str)+1)*2]; 7 7 token_ptr = token_buff; 8 8 token_seps = 0; … … 14 14 TokenString::TokenString(char *str, char *seps) 15 15 { 16 token_buff = new char[( strlen(str)+1)*2];17 token_ptr = token_buff; 18 token_seps = new char[( strlen(seps)+1)];16 token_buff = new char[((int)strlen(str)+1)*2]; 17 token_ptr = token_buff; 18 token_seps = new char[((int)strlen(seps)+1)]; 19 19 strcpy(token_seps,seps); 20 20 store_str(str); … … 154 154 155 155 curr_token_ptr = token_ptr; 156 token_ptr += strlen(curr_token_ptr)+1;156 token_ptr += (int)strlen(curr_token_ptr)+1; 157 157 token = curr_token_ptr; 158 158 -
trunk/FACT++/dim/src/util/dim_send_command.c
r13995 r15282 61 61 } 62 62 } 63 dic_cmnd_callback(str,data, strlen(data)+1, rout, silent);63 dic_cmnd_callback(str,data,(int)strlen(data)+1, rout, silent); 64 64 while(!received) 65 65 dim_wait(); … … 135 135 else 136 136 { 137 dic_cmnd_callback(str,data, strlen(data)+1, rout, silent);137 dic_cmnd_callback(str,data,(int)strlen(data)+1, rout, silent); 138 138 } 139 139 while(!received) -
trunk/FACT++/dim/src/utilities.c
r12757 r15282 102 102 #endif 103 103 char node_name[MAX_NODE_NAME]; 104 unsignedchar *ptr;104 char *ptr; 105 105 106 106 #ifdef WIN32 … … 117 117 return(0); 118 118 } 119 ptr = ( unsignedchar *)host->h_addr;119 ptr = (char *)host->h_addr; 120 120 node_addr[0] = *ptr++; 121 121 node_addr[1] = *ptr++; … … 150 150 */ 151 151 my_ctime(&t, str, 128); 152 str[ strlen(str)-1] = '\0';152 str[(int)strlen(str)-1] = '\0'; 153 153 printf("PID %d - ",getpid()); 154 154 printf("%s - ",str ); … … 172 172 tz = 0; 173 173 gettimeofday(&tv, tz); 174 millies = tv.tv_usec / 1000;174 millies = (int)tv.tv_usec / 1000; 175 175 #endif 176 176 dim_print_date_time(); … … 233 233 return(0); 234 234 else { 235 tot = strlen(p)+1;235 tot = (int)strlen(p)+1; 236 236 if(value != 0) 237 237 { … … 239 239 if(sz > len) 240 240 sz = len; 241 strncpy(value, p, sz);241 strncpy(value, p, (size_t)sz); 242 242 if((sz == len) && (len > 0)) 243 243 value[sz-1] = '\0'; -
trunk/FACT++/dim/src/webDid/webDid.c
r14937 r15282 15 15 int match; 16 16 int busy; 17 int isSMI; 17 18 }SERVER; 18 19 … … 23 24 int match; 24 25 int busy; 26 int hasSMI; 25 27 }NODE; 26 28 NODE *Node_head = (NODE *)0; … … 319 321 buffer->services[j].n_clients = vtohl( 320 322 buffer->services[j].n_clients); 321 if( strlen(sname) == MAX_TASK_NAME-4-1)323 if((int)strlen(sname) == MAX_TASK_NAME-4-1) 322 324 { 323 325 strcpy(str,buffer->services[j].name); … … 337 339 nodep = (NODE *)malloc(sizeof(NODE)); 338 340 strcpy(nodep->name,buffer->server.node); 341 nodep->hasSMI = 0; 339 342 nodep->server_head = (SERVER *)malloc(sizeof(SERVER)); 340 343 sll_init((SLL *)nodep->server_head); … … 352 355 servp->server.n_services = 0; 353 356 servp->service_ptr = 0; 357 servp->isSMI = 0; 358 if(strstr(sname,"_SMI")) 359 { 360 servp->isSMI = 1; 361 nodep->hasSMI = 1; 362 } 354 363 sll_insert_queue((SLL *)nodep->server_head,(SLL *)servp); 355 364 } … … 373 382 if(n_services != -1) 374 383 { 375 service_size = n_services* sizeof(DNS_SERVICE_INFO);376 servp->service_ptr = (DNS_SERVICE_INFO *)malloc( service_size);377 memcpy(servp->service_ptr, buffer->services, service_size);384 service_size = n_services*(int)sizeof(DNS_SERVICE_INFO); 385 servp->service_ptr = (DNS_SERVICE_INFO *)malloc((size_t)service_size); 386 memcpy(servp->service_ptr, buffer->services, (size_t)service_size); 378 387 N_services += n_services; 379 388 } … … 391 400 servp->server.n_services = 0; 392 401 servp->busy = -1; 402 servp->isSMI = 0; 393 403 } 394 404 } … … 464 474 if(!rpc_flag) 465 475 { 466 ptr += strlen(str);476 ptr += (int)strlen(str); 467 477 ptr1 = strchr(ptr,'|'); 468 478 } 469 479 else if(rpc_flag == 1) 470 480 { 471 ptr += strlen(str);481 ptr += (int)strlen(str); 472 482 ptr1 = strchr(ptr,','); 473 483 } 474 484 else 475 485 { 476 ptr += strlen(str);486 ptr += (int)strlen(str); 477 487 ptr = strchr(ptr,','); 478 488 ptr++; … … 512 522 if(!rpc_flag) 513 523 { 514 ptr += strlen(str);524 ptr += (int)strlen(str); 515 525 ptr1 = strchr(ptr,'|'); 516 526 } 517 527 else if(rpc_flag == 1) 518 528 { 519 ptr += strlen(str);529 ptr += (int)strlen(str); 520 530 ptr1 = strchr(ptr,','); 521 531 } 522 532 else 523 533 { 524 ptr += strlen(str);534 ptr += (int)strlen(str); 525 535 ptr = strchr(ptr,','); 526 536 ptr++; 527 537 ptr1 = strchr(ptr,'|'); 528 538 } 529 strncpy(format,ptr,( int)(ptr1 - ptr));539 strncpy(format,ptr,(size_t)(ptr1 - ptr)); 530 540 format[(int)(ptr1-ptr)] = '\0'; 531 541 } … … 678 688 servicep->n_browsers = 0; 679 689 sll_insert_queue((SLL *)Curr_service_head,(SLL *)servicep); 680 servicep->sid = dic_info_service_stamped( service, MONITORED, subscribe, 0, 0,690 servicep->sid = (int)dic_info_service_stamped( service, MONITORED, subscribe, 0, 0, 681 691 recv_service_info, servicep, &no_link_int, 4); 682 692 } … … 792 802 if(servicep->buffer_size) 793 803 free(servicep->buffer); 794 servicep->buffer = malloc( *size);804 servicep->buffer = malloc((size_t)*size); 795 805 servicep->buffer_size = *size; 796 806 } 797 memcpy(servicep->buffer, (char *)buffer, *size);807 memcpy(servicep->buffer, (char *)buffer, (size_t)*size); 798 808 servicep->size = *size; 799 809 if (servicep->buffer_str_size < (1024 + (*size)*16)) … … 801 811 if(servicep->buffer_str_size) 802 812 free(servicep->buffer_str); 803 servicep->buffer_str = malloc( 1024 + (*size)*16);813 servicep->buffer_str = malloc((size_t)(1024 + (*size)*16)); 804 814 servicep->buffer_str_size = 1024 + (*size)*16; 805 815 } … … 855 865 sprintf(ptr,".%03d",mili); 856 866 strcat(timestr, aux); 857 timestr[ strlen(timestr)-1] = '\0';867 timestr[(int)strlen(timestr)-1] = '\0'; 858 868 859 869 sprintf(str," Timestamp: %s         Quality: %d    Size: %s<br /><br />", … … 906 916 strcat(Service_content_str," L"); 907 917 if(!num) 908 size = ssize/ sizeof(int);918 size = ssize/(int)sizeof(int); 909 919 else 910 920 size = num; 911 psize = size * sizeof(int);921 psize = size * (int)sizeof(int); 912 922 print_service_standard(ptr, size); 913 923 break; … … 916 926 strcat(Service_content_str," I"); 917 927 if(!num) 918 size = ssize/ sizeof(int);928 size = ssize/(int)sizeof(int); 919 929 else 920 930 size = num; 921 psize = size * sizeof(int);931 psize = size * (int)sizeof(int); 922 932 print_service_standard(ptr, size); 923 933 break; … … 926 936 strcat(Service_content_str," S"); 927 937 if(!num) 928 size = ssize/ sizeof(short);938 size = ssize/(int)sizeof(short); 929 939 else 930 940 size = num; 931 psize = size * sizeof(short);941 psize = size * (int)sizeof(short); 932 942 print_service_short(ptr, size); 933 943 break; … … 936 946 strcat(Service_content_str," F"); 937 947 if(!num) 938 size = ssize/ sizeof(float);948 size = ssize/(int)sizeof(float); 939 949 else 940 950 size = num; 941 psize = size * sizeof(float);951 psize = size * (int)sizeof(float); 942 952 print_service_float(ptr, size); 943 953 break; … … 946 956 strcat(Service_content_str," D"); 947 957 if(!num) 948 size = ssize/ sizeof(double);958 size = ssize/(int)sizeof(double); 949 959 else 950 960 size = num; 951 psize = size * sizeof(double);961 psize = size * (int)sizeof(double); 952 962 print_service_double(ptr, size); 953 963 break; … … 956 966 strcat(Service_content_str," X"); 957 967 if(!num) 958 size = ssize/ sizeof(longlong);968 size = ssize/(int)sizeof(longlong); 959 969 else 960 970 size = num; 961 psize = size * sizeof(longlong);971 psize = size * (int)sizeof(longlong); 962 972 print_service_standard(ptr, size*2); 963 973 break; … … 999 1009 1000 1010 ptr = Service_content_str; 1001 ptr += strlen(Service_content_str);1011 ptr += (int)strlen(Service_content_str); 1002 1012 for( i = 0; i < size; i++) 1003 1013 { … … 1030 1040 } 1031 1041 strcpy(ptr, tmp); 1032 ptr += strlen(tmp);1042 ptr += (int)strlen(tmp); 1033 1043 } 1034 1044 strcpy(tmp,"<br />"); … … 1043 1053 1044 1054 ptr = Service_content_str; 1045 ptr += strlen(Service_content_str);1055 ptr += (int)strlen(Service_content_str); 1046 1056 for( i = 0; i < size; i++) 1047 1057 { … … 1068 1078 if(j == 0) 1069 1079 strcat(tmp,"        D: "); 1070 sprintf_html(str, 12, last[j]);1080 sprintf_html(str, 12, (int)last[j]); 1071 1081 strcat(tmp,str); 1072 1082 } … … 1074 1084 } 1075 1085 strcpy(ptr, tmp); 1076 ptr += strlen(tmp);1086 ptr += (int)strlen(tmp); 1077 1087 } 1078 1088 strcpy(tmp,"<br />"); … … 1087 1097 1088 1098 ptr = Service_content_str; 1089 ptr += strlen(Service_content_str);1099 ptr += (int)strlen(Service_content_str); 1090 1100 for( i = 0; i < size; i++) 1091 1101 { … … 1118 1128 } 1119 1129 strcpy(ptr, tmp); 1120 ptr += strlen(tmp);1130 ptr += (int)strlen(tmp); 1121 1131 } 1122 1132 strcpy(tmp,"<br />"); … … 1131 1141 asc = (char *)buff; 1132 1142 ptr = Service_content_str; 1133 ptr += strlen(Service_content_str);1143 ptr += (int)strlen(Service_content_str); 1134 1144 for( i = 0; i < size; i++) 1135 1145 { … … 1150 1160 */ 1151 1161 strcat(tmp," "); 1152 strcat(tmp,&str[ strlen(str)-2]);1162 strcat(tmp,&str[(int)strlen(str)-2]); 1153 1163 /* 1154 1164 if(i%4 == 3) … … 1180 1190 } 1181 1191 strcpy(ptr, tmp); 1182 ptr += strlen(tmp);1192 ptr += (int)strlen(tmp); 1183 1193 } 1184 1194 strcpy(tmp,"<br />"); … … 1192 1202 1193 1203 ptr = Service_content_str; 1194 ptr += strlen(Service_content_str);1204 ptr += (int)strlen(Service_content_str); 1195 1205 for( i = 0; i < size; i++) 1196 1206 { … … 1212 1222 } 1213 1223 strcpy(ptr, tmp); 1214 ptr += strlen(tmp);1224 ptr += (int)strlen(tmp); 1215 1225 } 1216 1226 strcpy(tmp,"<br />"); 1217 1227 strcpy(ptr, tmp); 1218 ptr += strlen(tmp);1228 ptr += (int)strlen(tmp); 1219 1229 } 1220 1230 … … 1225 1235 1226 1236 ptr = Service_content_str; 1227 ptr += strlen(Service_content_str);1237 ptr += (int)strlen(Service_content_str); 1228 1238 for( i = 0; i < size; i++) 1229 1239 { … … 1245 1255 } 1246 1256 strcpy(ptr, tmp); 1247 ptr += strlen(tmp);1257 ptr += (int)strlen(tmp); 1248 1258 } 1249 1259 strcpy(tmp,"<br />"); 1250 1260 strcpy(ptr, tmp); 1251 ptr += strlen(tmp);1261 ptr += (int)strlen(tmp); 1252 1262 } 1253 1263 … … 1257 1267 1258 1268 strcat(ptr,"{\n"); 1259 ptro = ptr + strlen(ptr);1269 ptro = ptr + (int)strlen(ptr); 1260 1270 return ptro; 1261 1271 } … … 1266 1276 1267 1277 strcat(ptr,"}\n"); 1268 ptro = ptr + strlen(ptr);1278 ptro = ptr + (int)strlen(ptr); 1269 1279 return ptro; 1270 1280 } … … 1275 1285 1276 1286 sprintf(ptr,"%s: [\n", node); 1277 ptro = ptr + strlen(ptr);1287 ptro = ptr + (int)strlen(ptr); 1278 1288 return ptro; 1279 1289 } … … 1284 1294 1285 1295 strcat(ptr,"]\n"); 1286 ptro = ptr + strlen(ptr);1296 ptro = ptr + (int)strlen(ptr); 1287 1297 return ptro; 1288 1298 } … … 1296 1306 else 1297 1307 sprintf(ptr,"{ %s", child); 1298 ptro = ptr + strlen(ptr);1308 ptro = ptr + (int)strlen(ptr); 1299 1309 return ptro; 1300 1310 } … … 1308 1318 else 1309 1319 strcat(ptr," }\n"); 1310 ptro = ptr + strlen(ptr);1320 ptro = ptr + (int)strlen(ptr); 1311 1321 return ptro; 1312 1322 } … … 1352 1362 for(i = 0; i < ((int)strlen(label) + 1); i++) 1353 1363 { 1354 label[i] = tolower(label[i]);1364 label[i] = (char)tolower((int)label[i]); 1355 1365 if(label[i] == '.') 1356 1366 { … … 1384 1394 if(JSONBufferSize == 0) 1385 1395 { 1386 JSONBuffer = malloc( N_nodes*128+N_servers*128);1396 JSONBuffer = malloc((size_t)(N_nodes*128+N_servers*128)); 1387 1397 } 1388 1398 else if (JSONBufferSize < N_nodes*128+N_servers*128) 1389 1399 { 1390 1400 free(JSONBuffer); 1391 JSONBuffer = malloc( N_nodes*128+N_servers*128);1401 JSONBuffer = malloc((size_t)(N_nodes*128+N_servers*128)); 1392 1402 } 1393 1403 ptr = JSONBuffer; … … 1397 1407 if(browserp->JSONBufferSize == 0) 1398 1408 { 1399 browserp->JSONBuffer = malloc( N_nodes*128+N_servers*128);1409 browserp->JSONBuffer = malloc((size_t)(N_nodes*128+N_servers*128)); 1400 1410 } 1401 1411 else if (browserp->JSONBufferSize < N_nodes*128+N_servers*128) 1402 1412 { 1403 1413 free(browserp->JSONBuffer); 1404 browserp->JSONBuffer = malloc( N_nodes*128+N_servers*128);1414 browserp->JSONBuffer = malloc((size_t)(N_nodes*128+N_servers*128)); 1405 1415 } 1406 1416 ptr = browserp->JSONBuffer; … … 1556 1566 if(JSONServicesSize == 0) 1557 1567 { 1558 JSONServices = malloc( n_services*256);1568 JSONServices = malloc((size_t)(n_services*256)); 1559 1569 } 1560 1570 else if (JSONServicesSize < n_services*256) 1561 1571 { 1562 1572 free(JSONServices); 1563 JSONServices = malloc( n_services*256);1573 JSONServices = malloc((size_t)(n_services*256)); 1564 1574 } 1565 1575 if(browserp) … … 1704 1714 if(last_size) 1705 1715 free(last_buffer); 1706 last_buffer = malloc( full_size);1716 last_buffer = malloc((size_t)full_size); 1707 1717 last_size = full_size; 1708 1718 } 1709 memset(last_buffer, 0, last_size);1719 memset(last_buffer, 0, (size_t)last_size); 1710 1720 buffer_ptr = last_buffer; 1711 1721 ptr = format; … … 1864 1874 strp++; 1865 1875 } 1866 num = strlen(strp)+1;1867 strncpy((char *)ptr,strp, num);1876 num = (int)strlen(strp)+1; 1877 strncpy((char *)ptr,strp,(size_t)num); 1868 1878 if( (ptr1 = (char *)strchr((char *)ptr,'\"')) ) 1869 1879 { -
trunk/FACT++/dim/src/webDid/webServer.c
r14937 r15282 68 68 (void)sprintf(snd_buffer,"HTTP/1.1 200 OK\r\nDate: %s\r\nServer: DID/19.7\r\nContent-Length: %d\r\nContent-Type: %s\r\nConnection: close\r\n\r\n", 69 69 date_buffer, (int)strlen(logbuffer), "text/html"); 70 (void)web_write(conn_id,snd_buffer, strlen(snd_buffer));71 (void)web_write(conn_id,logbuffer, strlen(logbuffer));70 (void)web_write(conn_id,snd_buffer,(int)strlen(snd_buffer)); 71 (void)web_write(conn_id,logbuffer,(int)strlen(logbuffer)); 72 72 break; 73 73 case LOG: (void)printf("INFO: %s:%s:%d\n",s1, s2,conn_id); … … 98 98 if((ptr = strstr(buffer, parptr))) 99 99 { 100 ptrs[i] = ptr+ strlen(parptr);100 ptrs[i] = ptr+(int)strlen(parptr); 101 101 found++; 102 102 } … … 206 206 int code; 207 207 208 buffer_size = strlen(buffer) + 1;208 buffer_size = (int)strlen(buffer) + 1; 209 209 if(buffer_size > conv_buffer_size ) 210 210 { 211 211 if(conv_buffer_size) 212 212 free(conv_buffer); 213 conv_buffer = malloc( buffer_size);213 conv_buffer = malloc((size_t)buffer_size); 214 214 conv_buffer_size = buffer_size; 215 215 } … … 333 333 (void)sprintf(snd_buffer,"HTTP/1.1 200 OK\r\nDate: %s\r\nServer: DID/19.7\r\nContent-Length: %d\r\nContent-Type: %s\r\nConnection: close\r\n\r\n", 334 334 date_buffer, (int)strlen(ptr), datatype); 335 (void)web_write(conn_id,snd_buffer, strlen(snd_buffer));335 (void)web_write(conn_id,snd_buffer,(int)strlen(snd_buffer)); 336 336 if(WebDID_Debug) 337 337 printf("SENDING DATA to conn %d:\n%s\n",conn_id, snd_buffer); 338 (void)web_write(conn_id,ptr,strlen(ptr)); 338 (void)web_write(conn_id,ptr,(int)strlen(ptr)); 339 if(WebDID_Debug == 2) 340 printf("SENDING DATA to conn %d:\n%s\n",conn_id, ptr); 341 } 342 343 344 void sendSmiData(int conn_id, char *buffer, int type) 345 { 346 static char date_buffer[128]; 347 static char snd_buffer[BUFSIZE+1]; /* static so zero filled */ 348 static char snd_data_buffer[BUFSIZE+1]; /* static so zero filled */ 349 char *ptr = 0; 350 char node[128], server[256], service[256]; 351 int pid, ret, req, browser, force; 352 extern char *update_services(); 353 extern char *update_service_data(); 354 extern char *getJSONHeader(); 355 extern char *getJSONBuffer(); 356 char datatype[128]; 357 char *conv_buffer; 358 359 conv_buffer = buffer; 360 strcpy(datatype,"application/json"); 361 if(type == 0) 362 { 363 ptr = getJSONHeader(); 364 } 365 else if(type == 1) 366 { 367 ret = getNodeParameters(conv_buffer, node, &browser); 368 ptr = getJSONBuffer(node, browser); 369 } 370 else if(type == 2) 371 { 372 ret = getServerParameters(conv_buffer, node, server, &pid, &browser); 373 if(!ret) 374 { 375 strcpy(snd_data_buffer,"{}"); 376 ptr = snd_data_buffer; 377 } 378 else 379 { 380 ptr = update_services(node, server, pid, browser); 381 } 382 } 383 else if(type == 3) 384 { 385 ret = getServiceParameters(conv_buffer, service, &req, &browser, &force); 386 if(!ret) 387 { 388 strcpy(snd_data_buffer,"{}"); 389 ptr = snd_data_buffer; 390 } 391 else 392 { 393 update_service_data(service, conn_id, 0, req, browser, force); 394 return; 395 } 396 } 397 else if(type == 4) 398 { 399 ptr = conv_buffer; 400 if(WebDID_Debug) 401 printf("%s\n",ptr); 402 strcpy(datatype,"text/html"); 403 } 404 else if(type == 5) 405 { 406 ret = getServiceParameters(conv_buffer, service, &req, &browser, &force); 407 if(!ret) 408 { 409 strcpy(snd_data_buffer,"{}"); 410 ptr = snd_data_buffer; 411 } 412 else 413 { 414 check_browser_changes(service, conn_id, 0, req, browser, force); 415 return; 416 } 417 } 418 else if(type == 6) 419 { 420 ret = getServiceParameters(conv_buffer, service, &req, &browser, &force); 421 if(!ret) 422 { 423 strcpy(snd_data_buffer,"{}"); 424 ptr = snd_data_buffer; 425 } 426 else 427 { 428 find_services(service, conn_id, browser, force); 429 if(force == -1) 430 strcpy(snd_data_buffer,""); 431 else 432 strcpy(snd_data_buffer,"load"); 433 ptr = snd_data_buffer; 434 } 435 } 436 getTime(date_buffer); 437 (void)sprintf(snd_buffer,"HTTP/1.1 200 OK\r\nDate: %s\r\nServer: DID/19.7\r\nContent-Length: %d\r\nContent-Type: %s\r\nConnection: close\r\n\r\n", 438 date_buffer, (int)strlen(ptr), datatype); 439 (void)web_write(conn_id,snd_buffer,(int)strlen(snd_buffer)); 440 if(WebDID_Debug) 441 printf("SENDING DATA to conn %d:\n%s\n",conn_id, snd_buffer); 442 (void)web_write(conn_id,ptr,(int)strlen(ptr)); 339 443 if(WebDID_Debug == 2) 340 444 printf("SENDING DATA to conn %d:\n%s\n",conn_id, ptr); … … 356 460 else buffer[0]=0; 357 461 462 if(WebDID_Debug) 463 printf("Got %s\n", buffer); 358 464 if( strncmp(buffer,"GET ",4) && strncmp(buffer,"get ",4) ) 359 465 { … … 371 477 } 372 478 373 for(j=0;j<i-1;j++) /* check for illegal parent directory use .. */ 479 if(WebDID_Debug) 480 printf("Got 1 %s\n", buffer); 481 for(j=0;j<i-1;j++) /* check for illegal parent directory use .. */ 374 482 { 375 483 if(buffer[j] == '.' && buffer[j+1] == '.') … … 379 487 } 380 488 } 381 if( !strncmp(&buffer[0],"GET /\0",6) || !strncmp(&buffer[0],"get /\0",6) ) 489 if((int)strlen(buffer) == 5) 490 { 491 if( !strncmp(&buffer[0],"GET /",5) || !strncmp(&buffer[0],"get /",5) ) 382 492 /* convert no filename to index file */ 383 493 (void)strcpy(buffer,"GET /index.html"); 384 494 } 495 if((int)strlen(buffer) == 8) 496 { 497 if( !strncmp(&buffer[0],"GET /smi",8) || !strncmp(&buffer[0],"get /smi",8) ) 498 /* convert no filename to index file */ 499 (void)strcpy(buffer,"GET /smi/index.html"); 500 } 385 501 /* work out the file type and check we support it */ 386 buflen= strlen(buffer);502 buflen=(int)strlen(buffer); 387 503 fstr = (char *)0; 388 504 for(i=0;extensions[i].ext != 0;i++) 389 505 { 390 len = strlen(extensions[i].ext);391 if( !strncmp(&buffer[buflen-len], extensions[i].ext, len))506 len = (int)strlen(extensions[i].ext); 507 if( !strncmp(&buffer[buflen-len], extensions[i].ext, (size_t)len)) 392 508 { 393 509 fstr =extensions[i].filetype; … … 397 513 /* 398 514 (void)sprintf(snd_buffer,"HTTP/1.1 100 Continue\r\n\r\n"); 399 (void)web_write(conn_id,snd_buffer, strlen(snd_buffer));515 (void)web_write(conn_id,snd_buffer,(int)strlen(snd_buffer)); 400 516 printf("SENDING to conn %d:\n%s\n",conn_id, snd_buffer); 401 517 */ … … 432 548 { 433 549 sendData(conn_id, &buffer[5], 6); 550 return; 551 } 552 else if(!strncmp(&buffer[5],"smiObjects",11)) 553 { 554 sendSmiData(conn_id, &buffer[5], 2); 434 555 return; 435 556 } … … 441 562 *ptr = '\0'; 442 563 } 443 buflen= strlen(buffer);564 buflen=(int)strlen(buffer); 444 565 for(i=0;extensions[i].ext != 0;i++) 445 566 { 446 len = strlen(extensions[i].ext);567 len = (int)strlen(extensions[i].ext); 447 568 if( !strncmp(&buffer[buflen-len], extensions[i].ext, len)) 448 569 { … … 476 597 477 598 flen = 0; 478 while ( (ret = read(file_fd, snd_buffer, BUFSIZE)) > 0 )599 while ( (ret = (int)read(file_fd, snd_buffer, BUFSIZE)) > 0 ) 479 600 { 480 601 flen += ret; … … 491 612 (void)sprintf(snd_buffer,"HTTP/1.1 200 OK\r\nDate: %s\r\nServer: DID/19.7\r\nContent-Length: %d\r\nContent-Type: %s\r\nConnection: close\r\n\r\n", 492 613 date_buffer, flen, fstr); 493 (void)web_write(conn_id,snd_buffer, strlen(snd_buffer));614 (void)web_write(conn_id,snd_buffer,(int)strlen(snd_buffer)); 494 615 if(WebDID_Debug) 495 616 printf("SENDING to conn %d:\n%s\n",conn_id, snd_buffer); 496 617 497 618 /* send file in 8KB block - last block may be smaller */ 498 while ( (ret = read(file_fd, snd_buffer, BUFSIZE)) > 0 ) {619 while ( (ret = (int)read(file_fd, snd_buffer, BUFSIZE)) > 0 ) { 499 620 (void)web_write(conn_id,snd_buffer,ret); 500 621 if(WebDID_Debug == 2) -
trunk/FACT++/dim/src/webDid/webTcpip.c
r14937 r15282 163 163 { 164 164 dna_connp->buffer = 165 (int *) realloc(dna_connp->buffer, size);166 memset(dna_connp->buffer, 0, size);165 (int *) realloc(dna_connp->buffer, (size_t)size); 166 memset(dna_connp->buffer, 0, (size_t)size); 167 167 dna_connp->buffer_size = size; 168 168 } … … 288 288 { 289 289 sscanf(node,"%d.%d.%d.%d",&a, &b, &c, &d); 290 ipaddr[0] = a;291 ipaddr[1] = b;292 ipaddr[2] = c;293 ipaddr[3] = d;290 ipaddr[0] = (unsigned char)a; 291 ipaddr[1] = (unsigned char)b; 292 ipaddr[2] = (unsigned char)c; 293 ipaddr[3] = (unsigned char)d; 294 294 if( (host = gethostbyaddr(ipaddr, sizeof(ipaddr), AF_INET)) == (struct hostent *)0 ) 295 295 {
Note:
See TracChangeset
for help on using the changeset viewer.