aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ports
diff options
context:
space:
mode:
Diffstat (limited to 'src/ports')
-rw-r--r--src/ports/SkOSFile_stdio.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/ports/SkOSFile_stdio.cpp b/src/ports/SkOSFile_stdio.cpp
index 9100f6d122..e7f65cd499 100644
--- a/src/ports/SkOSFile_stdio.cpp
+++ b/src/ports/SkOSFile_stdio.cpp
@@ -41,6 +41,23 @@ SkFILE* sk_fopen(const char path[], SkFILE_Flags flags)
return f;
}
+ptrdiff_t sk_getline(char **lineptr, size_t *n, SkFILE *f) {
+ bool make_private_copy = (NULL == *lineptr);
+
+ ptrdiff_t ret = ::getline(lineptr, n, (FILE *) f);
+ if (make_private_copy) {
+ char *local_copy = (char *) sk_malloc_throw(strlen(*lineptr) + 1);
+ ::memcpy(local_copy, *lineptr, strlen(*lineptr));
+ ::free(*lineptr);
+ *lineptr = local_copy;
+ }
+ return ret;
+}
+
+int sk_feof(SkFILE *f) {
+ return ::feof((FILE *)f);
+}
+
size_t sk_fgetsize(SkFILE* f)
{
SkASSERT(f);