projects
/
xscreensaver
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
From http://www.jwz.org/xscreensaver/xscreensaver-5.27.tar.gz
[xscreensaver]
/
OSX
/
iostextclient.m
diff --git
a/OSX/iostextclient.m
b/OSX/iostextclient.m
index 646436c323fcbcb1bb026353b0225e0ca4558291..3cbddea0a9b68bcc071c8900e41b5c214a677224 100644
(file)
--- a/
OSX/iostextclient.m
+++ b/
OSX/iostextclient.m
@@
-38,15
+38,6
@@
struct text_data {
};
};
-void
-textclient_reshape (text_data *d,
- int pix_w, int pix_h,
- int char_w, int char_h)
-{
- d->columns = char_w;
-}
-
-
text_data *
textclient_open (Display *dpy)
{
text_data *
textclient_open (Display *dpy)
{
@@
-289,7
+280,7
@@
copy_rss_field (const char *s)
s += 9;
char *e = strstr (s, "]]");
if (e) *e = 0;
s += 9;
char *e = strstr (s, "]]");
if (e) *e = 0;
-
int
L = strlen (s);
+
unsigned long
L = strlen (s);
char *s2 = (char *) malloc (L+1);
memcpy (s2, s, L+1);
return s2;
char *s2 = (char *) malloc (L+1);
memcpy (s2, s, L+1);
return s2;
@@
-316,10
+307,10
@@
pick_rss_field (const char *a, const char *b, const char *c, const char *d)
char *b2 = copy_rss_field (b);
char *c2 = copy_rss_field (c);
char *d2 = copy_rss_field (d);
char *b2 = copy_rss_field (b);
char *c2 = copy_rss_field (c);
char *d2 = copy_rss_field (d);
-
int
al = a2 ? strlen(a2) : 0;
-
int
bl = b2 ? strlen(b2) : 0;
-
int
cl = c2 ? strlen(c2) : 0;
-
int
dl = d2 ? strlen(d2) : 0;
+
unsigned long
al = a2 ? strlen(a2) : 0;
+
unsigned long
bl = b2 ? strlen(b2) : 0;
+
unsigned long
cl = c2 ? strlen(c2) : 0;
+
unsigned long
dl = d2 ? strlen(d2) : 0;
char *ret = 0;
if (al > bl && al > cl && al > dl) ret = a2;
char *ret = 0;
if (al > bl && al > cl && al > dl) ret = a2;
@@
-405,6
+396,7
@@
wrap_text (char *body, int columns)
{
int col = 0, last_col = 0;
char *last_space = 0;
{
int col = 0, last_col = 0;
char *last_space = 0;
+ if (! body) return;
for (char *p = body; *p; p++) {
if (*p == '\r' || *p == '\n' || *p == ' ' || *p == '\t') {
if (col > columns && last_space) {
for (char *p = body; *p; p++) {
if (*p == '\r' || *p == '\n' || *p == ' ' || *p == '\t') {
if (col > columns && last_space) {
@@
-425,6
+417,23
@@
wrap_text (char *body, int columns)
}
}
+static void
+rewrap_text (char *body, int columns)
+{
+ if (! body) return;
+ for (char *p = body; *p; p++) {
+ if (*p == '\n') {
+ if (p[1] == '\n')
+ p++;
+ else
+ *p = ' ';
+ }
+ }
+ wrap_text (body, columns);
+}
+
+
+
static void
strip_backslashes (char *s)
{
static void
strip_backslashes (char *s)
{
@@
-462,7
+471,7
@@
url_string (const char *url)
// Only search the first 1/2 K of the document while determining type.
// Only search the first 1/2 K of the document while determining type.
-
int
L = [body length];
+
unsigned long
L = [body length];
if (L > 512) L = 512;
NSString *head = [[[body substringToIndex: L]
stringByTrimmingCharactersInSet:
if (L > 512) L = 512;
NSString *head = [[[body substringToIndex: L]
stringByTrimmingCharactersInSet:
@@
-553,4
+562,14
@@
textclient_putc (text_data *d, XKeyEvent *k)
return False;
}
return False;
}
+
+void
+textclient_reshape (text_data *d,
+ int pix_w, int pix_h,
+ int char_w, int char_h)
+{
+ d->columns = char_w;
+ rewrap_text (d->buf, d->columns);
+}
+
#endif /* USE_IPHONE -- whole file */
#endif /* USE_IPHONE -- whole file */