osip_port.c (libosip2-5.0.0) | : | osip_port.c (libosip2-5.1.0) | ||
---|---|---|---|---|
skipping to change at line 85 | skipping to change at line 85 | |||
# include <sys/time.h> | # include <sys/time.h> | |||
# include <SysThread.h> | # include <SysThread.h> | |||
# endif | # endif | |||
#elif (!defined(WIN32) && !defined(_WIN32_WCE)) | #elif (!defined(WIN32) && !defined(_WIN32_WCE)) | |||
#include <sys/time.h> | #include <sys/time.h> | |||
#elif defined(WIN32) | #elif defined(WIN32) | |||
#include <windows.h> | #include <windows.h> | |||
#if (_MSC_VER >= 1700) && !defined(_USING_V110_SDK71_) | #if (_MSC_VER >= 1700) && !defined(_USING_V110_SDK71_) | |||
#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) | #if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) | |||
#include <winsock2.h> | #include <winsock2.h> | |||
#elif defined(WINAPI_FAMILY) && WINAPI_FAMILY_ONE_PARTITION( WINAPI_FAMILY, WINA | #elif defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PC_APP) | |||
PI_PARTITION_APP ) | ||||
#else | ||||
#ifdef WIN32_USE_CRYPTO | ||||
#include <Wincrypt.h> | ||||
#endif | #endif | |||
#endif | #endif | |||
#else | ||||
#ifdef WIN32_USE_CRYPTO | #ifdef WIN32_USE_CRYPTO | |||
#include <Wincrypt.h> | #include <Wincrypt.h> | |||
#endif | #endif | |||
#endif | #endif | |||
#endif | ||||
#if defined (__rtems__) | #if defined (__rtems__) | |||
#include <rtems.h> | #include <rtems.h> | |||
#endif | #endif | |||
#if defined (HAVE_SYS_UNISTD_H) | #if defined (HAVE_SYS_UNISTD_H) | |||
#include <sys/unistd.h> | #include <sys/unistd.h> | |||
#endif | #endif | |||
#if defined (HAVE_UNISTD_H) | #if defined (HAVE_UNISTD_H) | |||
#include <unistd.h> | #include <unistd.h> | |||
skipping to change at line 365 | skipping to change at line 360 | |||
return NULL; | return NULL; | |||
osip_strncpy (copy, ch, length); | osip_strncpy (copy, ch, length); | |||
return copy; | return copy; | |||
} | } | |||
#ifndef MINISIZE | #ifndef MINISIZE | |||
int | int | |||
osip_atoi (const char *number) | osip_atoi (const char *number) | |||
{ | { | |||
#if defined(__linux) || defined(HAVE_STRTOL) | #if defined(__linux) || defined(HAVE_STRTOL) | |||
int i; | long int i; | |||
if (number == NULL) | if (number == NULL) | |||
return OSIP_UNDEFINED_ERROR; | return OSIP_UNDEFINED_ERROR; | |||
i = strtol (number, (char **) NULL, 10); | i = strtol (number, (char **) NULL, 10); | |||
if (i == LONG_MIN || i == LONG_MAX) | if (i == LONG_MIN || i == LONG_MAX) | |||
return OSIP_UNDEFINED_ERROR; | return OSIP_UNDEFINED_ERROR; | |||
return i; | return i; | |||
#endif | #endif | |||
return atoi (number); | return atoi (number); | |||
} | } | |||
#endif | #endif | |||
#if (_MSC_VER >= 1700) && !defined(_USING_V110_SDK71_) | #if (_MSC_VER >= 1700) && !defined(_USING_V110_SDK71_) | |||
#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) | #if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) | |||
#define HAVE_WINDOWSPHONE_API | #define HAVE_WINDOWSPHONE_API | |||
#elif defined(WINAPI_FAMILY) && WINAPI_FAMILY_ONE_PARTITION( WINAPI_FAMILY, WINA PI_PARTITION_APP ) | #elif defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PC_APP) | |||
#define HAVE_WINAPPSTORE_API | #define HAVE_WINAPPSTORE_API | |||
#endif | #endif | |||
#endif | #endif | |||
void | void | |||
osip_usleep (int useconds) | osip_usleep (int useconds) | |||
{ | { | |||
#if defined(__PALMOS__) && (__PALMOS__ >= 0x06000000) | #if defined(__PALMOS__) && (__PALMOS__ >= 0x06000000) | |||
/* This bit will work for the Protein API, but not the Palm 68K API */ | /* This bit will work for the Protein API, but not the Palm 68K API */ | |||
nsecs_t nanoseconds = useconds * 1000; | nsecs_t nanoseconds = useconds * 1000; | |||
skipping to change at line 562 | skipping to change at line 557 | |||
char *pend; | char *pend; | |||
size_t len; | size_t len; | |||
if (word == NULL) | if (word == NULL) | |||
return OSIP_UNDEFINED_ERROR; | return OSIP_UNDEFINED_ERROR; | |||
if (*word == '\0') | if (*word == '\0') | |||
return OSIP_SUCCESS; | return OSIP_SUCCESS; | |||
len = strlen (word); | len = strlen (word); | |||
pbeg = word; | pbeg = word; | |||
while ((' ' == *pbeg) || ('\r' == *pbeg) || ('\n' == *pbeg) || ('\t' == *pbeg) | pbeg += strspn (pbeg, " \r\n\t"); | |||
) | ||||
pbeg++; | ||||
pend = word + len - 1; | pend = word + len - 1; | |||
while ((' ' == *pend) || ('\r' == *pend) || ('\n' == *pend) || ('\t' == *pend) ) { | while ((' ' == *pend) || ('\r' == *pend) || ('\n' == *pend) || ('\t' == *pend) ) { | |||
pend--; | pend--; | |||
if (pend < pbeg) { | if (pend < pbeg) { | |||
*word = '\0'; | *word = '\0'; | |||
return OSIP_SUCCESS; | return OSIP_SUCCESS; | |||
} | } | |||
} | } | |||
skipping to change at line 965 | skipping to change at line 959 | |||
#if (defined(WIN32) && !defined(_WIN32_WCE)) || defined(__linux) || defined(__A PPLE__) | #if (defined(WIN32) && !defined(_WIN32_WCE)) || defined(__linux) || defined(__A PPLE__) | |||
static struct timeval start = { 0, 0 }; | static struct timeval start = { 0, 0 }; | |||
struct timeval now; | struct timeval now; | |||
if (start.tv_sec == 0 && start.tv_usec == 0) { | if (start.tv_sec == 0 && start.tv_usec == 0) { | |||
__osip_port_gettimeofday (&start, NULL); | __osip_port_gettimeofday (&start, NULL); | |||
} | } | |||
__osip_port_gettimeofday (&now, NULL); | __osip_port_gettimeofday (&now, NULL); | |||
relative_time = (int)(1000 * (now.tv_sec - start.tv_sec)); | relative_time = (int) (1000 * (now.tv_sec - start.tv_sec)); | |||
if (now.tv_usec - start.tv_usec > 0) | if (now.tv_usec - start.tv_usec > 0) | |||
relative_time = relative_time + ((now.tv_usec - start.tv_usec) / 1000); | relative_time = relative_time + ((now.tv_usec - start.tv_usec) / 1000); | |||
else | else | |||
relative_time = relative_time - ((start.tv_usec - now.tv_usec) / 1000); | relative_time = relative_time - ((start.tv_usec - now.tv_usec) / 1000); | |||
#endif | #endif | |||
if (filename_long != NULL) { | if (filename_long != NULL) { | |||
fi = strrchr (filename_long, '/'); | fi = strrchr (filename_long, '/'); | |||
if (fi == NULL) | if (fi == NULL) | |||
fi = strrchr (filename_long, '\\'); | fi = strrchr (filename_long, '\\'); | |||
skipping to change at line 1469 | skipping to change at line 1463 | |||
char *p; | char *p; | |||
size_t spaceless_length; | size_t spaceless_length; | |||
if (src == NULL || len == 0) { | if (src == NULL || len == 0) { | |||
*dst = '\0'; | *dst = '\0'; | |||
return NULL; | return NULL; | |||
} | } | |||
/* find the start of relevant text */ | /* find the start of relevant text */ | |||
pbeg = src; | pbeg = src; | |||
while ((' ' == *pbeg) || ('\r' == *pbeg) || ('\n' == *pbeg) || ('\t' == *pbeg) | pbeg += strspn (pbeg, " \r\n\t"); | |||
) | ||||
pbeg++; | ||||
/* find the end of relevant text */ | /* find the end of relevant text */ | |||
pend = src + len - 1; | pend = src + len - 1; | |||
while ((' ' == *pend) || ('\r' == *pend) || ('\n' == *pend) || ('\t' == *pend) ) { | while ((' ' == *pend) || ('\r' == *pend) || ('\n' == *pend) || ('\t' == *pend) ) { | |||
pend--; | pend--; | |||
if (pend < pbeg) { | if (pend < pbeg) { | |||
*dst = '\0'; | *dst = '\0'; | |||
return dst; | return dst; | |||
} | } | |||
} | } | |||
End of changes. 8 change blocks. | ||||
17 lines changed or deleted | 7 lines changed or added |