-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start to work on diff saving capabilities.
- Loading branch information
Showing
5 changed files
with
91 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* See Licensing and Copyright notice in naev.h | ||
*/ | ||
/** | ||
* @file dev_diff.c | ||
* | ||
* @brief Handles saving unidiffs. | ||
*/ | ||
|
||
#include "dev_diff.h" | ||
|
||
#include "array.h" | ||
#include "nxml.h" | ||
|
||
int ddiff_save( UniHunk_t *diffs, const char *filename ) | ||
{ | ||
xmlDocPtr doc; | ||
xmlTextWriterPtr writer; | ||
int ret = 0; | ||
|
||
/* Create the writer. */ | ||
writer = xmlNewTextWriterDoc( &doc, 0 ); | ||
if ( writer == NULL ) { | ||
WARN( _( "testXmlwriterDoc: Error creating the xml writer" ) ); | ||
return -1; | ||
} | ||
|
||
/* Set the writer parameters. */ | ||
xmlw_setParams( writer ); | ||
|
||
/* Start writer. */ | ||
xmlw_start( writer ); | ||
xmlw_startElem( writer, "unidiff" ); | ||
|
||
/* Write the bulk of the diff. */ | ||
for ( int i = 0; i < array_size( diffs ); i++ ) { | ||
} | ||
|
||
xmlw_endElem( writer ); /* "unidiff" */ | ||
xmlw_done( writer ); | ||
|
||
/* No need for writer anymore. */ | ||
xmlFreeTextWriter( writer ); | ||
|
||
/* Write data. */ | ||
if ( xmlSaveFileEnc( filename, doc, "UTF-8" ) < 0 ) { | ||
WARN( "Failed to write '%s'!", filename ); | ||
ret = -1; | ||
} | ||
|
||
/* Clean up. */ | ||
xmlFreeDoc( doc ); | ||
|
||
return ret; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* | ||
* See Licensing and Copyright notice in naev.h | ||
*/ | ||
#pragma once | ||
|
||
#include "unidiff.h" | ||
|
||
int ddiff_save( UniHunk_t *diffs, const char *filename ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters