Commit 5abfc83a authored by Matthias Klumpp's avatar Matthias Klumpp
Browse files

validator: Correctly read line numbers in long files

parent fe2894b8
......@@ -41,7 +41,7 @@ typedef struct
gchar *fname;
gchar *cid;
gint line;
glong line;
AsIssueKind kind; /* deprecated */
} AsValidatorIssuePrivate;
......@@ -306,7 +306,7 @@ as_validator_issue_set_cid (AsValidatorIssue *issue, const gchar *cid)
*
* Returns: the line number where this issue occured, or -1 if unknown.
**/
gint
glong
as_validator_issue_get_line (AsValidatorIssue *issue)
{
AsValidatorIssuePrivate *priv = GET_PRIVATE (issue);
......@@ -321,7 +321,7 @@ as_validator_issue_get_line (AsValidatorIssue *issue)
* Sets the line number where this issue was found.
**/
void
as_validator_issue_set_line (AsValidatorIssue *issue, gint line)
as_validator_issue_set_line (AsValidatorIssue *issue, glong line)
{
AsValidatorIssuePrivate *priv = GET_PRIVATE (issue);
priv->line = line;
......@@ -385,7 +385,7 @@ as_validator_issue_get_location (AsValidatorIssue *issue)
g_string_append_printf (location, ":%s", priv->cid);
if (priv->line >= 0) {
g_string_append_printf (location, ":%i", priv->line);
g_string_append_printf (location, ":%li", priv->line);
}
return g_string_free (location, FALSE);
......
......@@ -145,9 +145,9 @@ const gchar *as_validator_issue_get_filename (AsValidatorIssue *issue);
void as_validator_issue_set_filename (AsValidatorIssue *issue,
const gchar *fname);
gint as_validator_issue_get_line (AsValidatorIssue *issue);
glong as_validator_issue_get_line (AsValidatorIssue *issue);
void as_validator_issue_set_line (AsValidatorIssue *issue,
gint line);
glong line);
gchar *as_validator_issue_get_location (AsValidatorIssue *issue);
......
......@@ -168,7 +168,7 @@ as_validator_add_issue (AsValidator *validator, xmlNode *node, const gchar *tag,
as_validator_issue_set_cid (issue, as_component_get_id (priv->current_cpt));
if (node != NULL)
as_validator_issue_set_line (issue, node->line);
as_validator_issue_set_line (issue, xmlGetLineNo (node));
location = as_validator_issue_get_location (issue);
id_str = g_strdup_printf ("%s/%s/%s",
......
......@@ -337,7 +337,7 @@ as_xml_add_description_node_helper (AsContext *ctx, xmlNode *root, xmlNode **des
doc = xmlReadMemory (xmldata, strlen (xmldata),
NULL,
"utf-8",
XML_PARSE_NOBLANKS | XML_PARSE_NONET);
XML_PARSE_NOBLANKS | XML_PARSE_NONET | XML_PARSE_BIG_LINES);
if (doc == NULL) {
ret = FALSE;
goto out;
......
......@@ -38,17 +38,17 @@ create_issue_info_print_string (AsValidatorIssue *issue)
const AsIssueSeverity severity = as_validator_issue_get_severity (issue);
const gchar *tag = as_validator_issue_get_tag (issue);
const gchar *cid = as_validator_issue_get_cid (issue);
const gchar line = as_validator_issue_get_line (issue);
const gchar *hint = as_validator_issue_get_hint (issue);
glong line = as_validator_issue_get_line (issue);
if (cid == NULL) {
if (line >= 0)
location = g_strdup_printf ("~:%i", line);
location = g_strdup_printf ("~:%li", line);
else
location = g_strdup ("~:~");
} else {
if (line >= 0)
location = g_strdup_printf ("%s:%i", cid, line);
location = g_strdup_printf ("%s:%li", cid, line);
else
location = g_strdup_printf ("%s:~", cid);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment