#include "common.h"#include "sqlNum.h"Include dependency graph for sqlNum.c:

Go to the source code of this file.
Functions | |
| unsigned | sqlUnsigned (char *s) |
| unsigned long | sqlUnsignedLong (char *s) |
| int | sqlSigned (char *s) |
| long long | sqlLongLong (char *s) |
| float | sqlFloat (char *s) |
| double | sqlDouble (char *s) |
Variables | |
| static char const | rcsid [] = "$Id: sqlNum.c,v 1.16 2005/12/09 22:39:36 hiram Exp $" |
| double sqlDouble | ( | char * | s | ) |
Definition at line 116 of file sqlNum.c.
References errAbort().
00119 { 00120 char* end; 00121 double val = strtod(s, &end); 00122 00123 if ((end == s) || (*end != '\0')) 00124 errAbort("invalid double: %s", s); 00125 return val; 00126 }
Here is the call graph for this function:

| float sqlFloat | ( | char * | s | ) |
Definition at line 100 of file sqlNum.c.
References errAbort().
00103 { 00104 char* end; 00105 /* used to have an ifdef here to use strtof() but that doesn't 00106 * actually exist on all systems and since strtod() does, may as 00107 * well use it since it will do the job here. 00108 */ 00109 float val = (float) strtod(s, &end); 00110 00111 if ((end == s) || (*end != '\0')) 00112 errAbort("invalid float: %s", s); 00113 return val; 00114 }
Here is the call graph for this function:

| long long sqlLongLong | ( | char * | s | ) |
Definition at line 75 of file sqlNum.c.
References errAbort().
Referenced by sqlLongLongArray(), sqlLongLongComma(), and sqlLongLongStaticArray().
00078 { 00079 long long res = 0; 00080 char *p, *p0 = s; 00081 00082 if (*p0 == '-') 00083 p0++; 00084 p = p0; 00085 while ((*p >= '0') && (*p <= '9')) 00086 { 00087 res *= 10; 00088 res += *p - '0'; 00089 p++; 00090 } 00091 /* test for invalid character, empty, or just a minus */ 00092 if ((*p != '\0') || (p == p0)) 00093 errAbort("invalid signed number: \"%s\"", s); 00094 if (*s == '-') 00095 return -res; 00096 else 00097 return res; 00098 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int sqlSigned | ( | char * | s | ) |
Definition at line 50 of file sqlNum.c.
References errAbort().
Referenced by pslLoad(), pslLoadLm(), repeatMaskOutLoad(), repeatMaskOutStaticLoad(), sqlByteArray(), sqlByteStaticArray(), sqlShortArray(), sqlShortStaticArray(), sqlSignedArray(), sqlSignedComma(), sqlSignedStaticArray(), and xAliLoad().
00053 { 00054 int res = 0; 00055 char *p, *p0 = s; 00056 00057 if (*p0 == '-') 00058 p0++; 00059 p = p0; 00060 while ((*p >= '0') && (*p <= '9')) 00061 { 00062 res *= 10; 00063 res += *p - '0'; 00064 p++; 00065 } 00066 /* test for invalid character, empty, or just a minus */ 00067 if ((*p != '\0') || (p == p0)) 00068 errAbort("invalid signed number: \"%s\"", s); 00069 if (*s == '-') 00070 return -res; 00071 else 00072 return res; 00073 }
Here is the call graph for this function:

Here is the caller graph for this function:

| unsigned sqlUnsigned | ( | char * | s | ) |
Definition at line 12 of file sqlNum.c.
References errAbort().
Referenced by getHitsFromServer(), gfQuerySeqTrans(), gfQuerySeqTransTrans(), pslLoad(), pslLoadLm(), repeatMaskOutLoad(), repeatMaskOutStaticLoad(), spacedColumnFromSizeCommaList(), sqlUbyteArray(), sqlUbyteStaticArray(), sqlUnsignedArray(), sqlUnsignedComma(), sqlUnsignedStaticArray(), sqlUshortArray(), sqlUshortStaticArray(), trixParseHitList(), and xAliLoad().
00016 { 00017 unsigned res = 0; 00018 char *p = s; 00019 char c; 00020 00021 while (((c = *(p++)) >= '0') && (c <= '9')) 00022 { 00023 res *= 10; 00024 res += c - '0'; 00025 } 00026 if (c != '\0') 00027 errAbort("invalid unsigned number: \"%s\"", s); 00028 return res; 00029 }
Here is the call graph for this function:

Here is the caller graph for this function:

| unsigned long sqlUnsignedLong | ( | char * | s | ) |
Definition at line 31 of file sqlNum.c.
References errAbort().
00035 { 00036 unsigned long res = 0; 00037 char *p = s; 00038 char c; 00039 00040 while (((c = *(p++)) >= '0') && (c <= '9')) 00041 { 00042 res *= 10; 00043 res += c - '0'; 00044 } 00045 if (c != '\0') 00046 errAbort("invalid unsigned number: \"%s\"", s); 00047 return res; 00048 }
Here is the call graph for this function:

char const rcsid[] = "$Id: sqlNum.c,v 1.16 2005/12/09 22:39:36 hiram Exp $" [static] |
1.5.2