Replace atoi() into atol().

This commit is contained in:
agibert 2005-06-26 23:06:22 +00:00
parent 193e13bc58
commit a71fd35b9e

View File

@ -10,7 +10,7 @@
#include <shmem.h> #include <shmem.h>
//VER_INFO_EXPORT (smadmin, "$Revision: 2.2 $", "$Name: $", __FILE__, "$Author: agibert $") //VER_INFO_EXPORT (smadmin, "$Revision: 2.3 $", "$Name: $", __FILE__, "$Author: agibert $")
#define USAGE "Usage : %s [ --help | --version [-v] | --create | --destroy ]\n" #define USAGE "Usage : %s [ --help | --version [-v] | --create | --destroy ]\n"
@ -145,7 +145,7 @@ int main (int argc, char ** argv)
fgets( tmp, NAME_SIZE, stdin); fgets( tmp, NAME_SIZE, stdin);
tmp[ strlen( tmp) - 1] = '\0'; tmp[ strlen( tmp) - 1] = '\0';
size = atoi (tmp); size = atol (tmp);
fprintf (stdout, "\nReturn code = %s\n", \ fprintf (stdout, "\nReturn code = %s\n", \
SM_Heap_Open (name, &Heap, size, \ SM_Heap_Open (name, &Heap, size, \
SMD_CREATE, &Locked) == SMS_OK ? "OK" : "NOK" ); SMD_CREATE, &Locked) == SMS_OK ? "OK" : "NOK" );
@ -246,13 +246,13 @@ int main (int argc, char ** argv)
fgets( tmp, TMP_SIZE, stdin); fgets( tmp, TMP_SIZE, stdin);
tmp[ strlen( tmp) - 1] = '\0'; tmp[ strlen( tmp) - 1] = '\0';
size = atoi (tmp); size = atol (tmp);
if (SM_Heap_Open (name, &Heap, 0, SMD_OPEN | SMD_WRITE, &Locked) == SMS_OK) if (SM_Heap_Open (name, &Heap, 0, SMD_OPEN | SMD_WRITE, &Locked) == SMS_OK)
{ {
SM_Chunk_Alloc (Heap, size, &ptr); SM_Chunk_Alloc (Heap, size, &ptr);
if (Locked == TRUE) SM_Heap_Unlock (Heap); if (Locked == TRUE) SM_Heap_Unlock (Heap);
} }
fprintf (stdout, "\nAddress = 0x%p (%d)\n", ptr, (unsigned int)ptr); fprintf (stdout, "\nAddress = 0x%p (%lu)\n", ptr, ptr);
break; break;
case WRITE_CHUNK: case WRITE_CHUNK:
@ -260,7 +260,7 @@ int main (int argc, char ** argv)
fgets( tmp, TMP_SIZE, stdin); fgets( tmp, TMP_SIZE, stdin);
tmp[ strlen( tmp) - 1] = '\0'; tmp[ strlen( tmp) - 1] = '\0';
ptr = (void *)atoi (tmp); ptr = (void *)atol (tmp);
fprintf (stdout, "\nString to put in ? "); fprintf (stdout, "\nString to put in ? ");
fgets( tmp, TMP_SIZE, stdin); fgets( tmp, TMP_SIZE, stdin);
tmp[ strlen( tmp) - 1] = '\0'; tmp[ strlen( tmp) - 1] = '\0';
@ -274,7 +274,7 @@ int main (int argc, char ** argv)
fgets( tmp, TMP_SIZE, stdin); fgets( tmp, TMP_SIZE, stdin);
tmp[ strlen( tmp) - 1] = '\0'; tmp[ strlen( tmp) - 1] = '\0';
ptr = (void *)atoi (tmp); ptr = (void *)atol (tmp);
fprintf (stdout, "\nValeur du pointeur = %s\n", (char *)ptr); fprintf (stdout, "\nValeur du pointeur = %s\n", (char *)ptr);
break; break;
@ -287,7 +287,7 @@ int main (int argc, char ** argv)
fgets( tmp, TMP_SIZE, stdin); fgets( tmp, TMP_SIZE, stdin);
tmp[ strlen( tmp) - 1] = '\0'; tmp[ strlen( tmp) - 1] = '\0';
ptr = (void *)atoi (tmp); ptr = (void *)atol (tmp);
if (SM_Heap_Open (name, &Heap, 0, SMD_OPEN | SMD_WRITE, &Locked) == SMS_OK) if (SM_Heap_Open (name, &Heap, 0, SMD_OPEN | SMD_WRITE, &Locked) == SMS_OK)
{ {
fprintf (stdout, "\nReturn code = %s\n", \ fprintf (stdout, "\nReturn code = %s\n", \