Changeset 62389
- Timestamp:
- Oct 26, 2014, 1:23:32 PM (10 years ago)
- File:
-
- 1 edited
-
grass/trunk/lib/vector/Vlib/legal_vname.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
grass/trunk/lib/vector/Vlib/legal_vname.c
r62023 r62389 19 19 \brief Check if output is legal vector name. 20 20 21 Rule: [A-Za-z][A-Za-z0-9_ @]*21 Rule: [A-Za-z][A-Za-z0-9_]* 22 22 23 23 Check also for SQL keywords. … … 26 26 27 27 \return 1 OK 28 \return -1 if name does not start with letter A..Za..z or if name does not continue with A..Za..z0..9_ @28 \return -1 if name does not start with letter A..Za..z or if name does not continue with A..Za..z0..9_ 29 29 */ 30 30 … … 55 55 for (s++; *s; s++) 56 56 if (!((*s >= 'A' && *s <= 'Z') || (*s >= 'a' && *s <= 'z') || 57 (*s >= '0' && *s <= '9') || *s == '_') || *s == '@') {57 (*s >= '0' && *s <= '9') || *s == '_')) { 58 58 G_warning(_("Illegal vector map name <%s>. Character '%c' not allowed."), 59 59 buf, *s); … … 91 91 { 92 92 const char *mapset; 93 char nm[GNAME_MAX], ms[GMAPSET_MAX]; 93 char inm[GNAME_MAX], ims[GMAPSET_MAX]; 94 char onm[GNAME_MAX], oms[GMAPSET_MAX]; 95 96 /* check for fully-qualified map name */ 97 if (G_name_is_fully_qualified(output, onm, oms)) { 98 if (strcmp(oms, G_mapset()) != 0) { 99 if (error == G_FATAL_EXIT) { 100 G_fatal_error(_("Output vector map name <%s> is not in the current mapset (%s)"), 101 output, G_mapset()); 102 } 103 else if (error == G_FATAL_PRINT) { 104 G_warning(_("Output vector map name <%s> is not in the current mapset (%s)"), 105 output, G_mapset()); 106 return 1; 107 } 108 else { /* GV_FATAL_RETURN */ 109 return 1; 110 } 111 } 112 output = onm; 113 } 94 114 95 115 if (Vect_legal_filename(output) == -1) { 96 116 if (error == G_FATAL_EXIT) { 97 G_fatal_error(_("Output vector map name <%s> is not valid map name"),117 G_fatal_error(_("Output vector map name <%s> is not SQL compliant"), 98 118 output); 99 119 } 100 120 else if (error == G_FATAL_PRINT) { 101 G_warning(_("Output vector map name <%s> is not valid map name"),121 G_warning(_("Output vector map name <%s> is not SQL compliant"), 102 122 output); 103 123 return 1; … … 108 128 } 109 129 110 if (G_name_is_fully_qualified(input, nm,ms)) {111 if (strcasecmp( ms, "ogr") != 0)130 if (G_name_is_fully_qualified(input, inm, ims)) { 131 if (strcasecmp(ims, "ogr") != 0) 112 132 mapset = G_find_vector2(input, ""); 113 133 else 114 mapset = ms;134 mapset = ims; 115 135 } 116 136 else … … 131 151 132 152 if (strcmp(mapset, G_mapset()) == 0) { 133 const char *in; 134 135 if (G_name_is_fully_qualified(input, nm, ms)) { 136 in = nm; 137 } 138 else { 139 in = input; 153 if (G_name_is_fully_qualified(input, inm, ims)) { 154 input = inm; 140 155 } 141 156 142 if (strcmp(in , output) == 0) {157 if (strcmp(input, output) == 0) { 143 158 if (error == G_FATAL_EXIT) { 144 159 G_fatal_error(_("Output vector map <%s> is used as input"),
Note:
See TracChangeset
for help on using the changeset viewer.
